glib2 1.1.9-x86-mingw32 → 1.2.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (517) hide show
  1. data/Rakefile +26 -4
  2. data/ext/glib2/glib2.def +3 -1
  3. data/ext/glib2/rbgcompat.h +0 -15
  4. data/ext/glib2/rbglib.h +11 -3
  5. data/ext/glib2/rbglib_source.c +6 -1
  6. data/ext/glib2/rbgobj_boxed.c +65 -48
  7. data/ext/glib2/rbgobj_convert.c +29 -14
  8. data/ext/glib2/rbgobj_value.c +42 -0
  9. data/ext/glib2/rbgobject.c +7 -4
  10. data/ext/glib2/rbgobject.h +15 -9
  11. data/lib/1.8/glib2.so +0 -0
  12. data/lib/1.9/glib2.so +0 -0
  13. data/lib/gnome2-raketask.rb +6 -1
  14. data/lib/gnome2-win32-binary-build-task.rb +40 -10
  15. data/vendor/local/bin/certtool.exe +0 -0
  16. data/vendor/local/bin/danetool.exe +0 -0
  17. data/vendor/local/bin/gdbus-codegen +1 -1
  18. data/vendor/local/bin/gdbus.exe +0 -0
  19. data/vendor/local/bin/gio-querymodules.exe +0 -0
  20. data/vendor/local/bin/glib-compile-resources.exe +0 -0
  21. data/vendor/local/bin/glib-compile-schemas.exe +0 -0
  22. data/vendor/local/bin/glib-genmarshal.exe +0 -0
  23. data/vendor/local/bin/glib-gettextize +1 -1
  24. data/vendor/local/bin/glib-mkenums +1 -1
  25. data/vendor/local/bin/gnutls-cli-debug.exe +0 -0
  26. data/vendor/local/bin/gnutls-cli.exe +0 -0
  27. data/vendor/local/bin/gnutls-serv.exe +0 -0
  28. data/vendor/local/bin/gobject-query.exe +0 -0
  29. data/vendor/local/bin/gresource.exe +0 -0
  30. data/vendor/local/bin/gsettings.exe +0 -0
  31. data/vendor/local/bin/gspawn-win32-helper-console.exe +0 -0
  32. data/vendor/local/bin/gspawn-win32-helper.exe +0 -0
  33. data/vendor/local/bin/libgio-2.0-0.dll +0 -0
  34. data/vendor/local/bin/libglib-2.0-0.dll +0 -0
  35. data/vendor/local/bin/libgmodule-2.0-0.dll +0 -0
  36. data/vendor/local/bin/libgmp-10.dll +0 -0
  37. data/vendor/local/bin/libgnutls-28.dll +0 -0
  38. data/vendor/local/bin/libgnutls-openssl-27.dll +0 -0
  39. data/vendor/local/bin/libgnutls-openssl-28.def +87 -93
  40. data/vendor/local/bin/libgnutlsxx-28.dll +0 -0
  41. data/vendor/local/bin/libgobject-2.0-0.dll +0 -0
  42. data/vendor/local/bin/libgthread-2.0-0.dll +0 -0
  43. data/vendor/local/bin/libhogweed-2-2.dll +0 -0
  44. data/vendor/local/bin/libnettle-4-4.dll +0 -0
  45. data/vendor/local/bin/nettle-hash.exe +0 -0
  46. data/vendor/local/bin/nettle-lfib-stream.exe +0 -0
  47. data/vendor/local/bin/ocsptool.exe +0 -0
  48. data/vendor/local/bin/pkcs1-conv.exe +0 -0
  49. data/vendor/local/bin/psktool.exe +0 -0
  50. data/vendor/local/bin/sexp-conv.exe +0 -0
  51. data/vendor/local/bin/srptool.exe +0 -0
  52. data/vendor/local/{lib/libffi-3.0.6/include → include}/ffi.h +0 -0
  53. data/vendor/local/{lib/libffi-3.0.6/include → include}/ffitarget.h +0 -0
  54. data/vendor/local/include/glib-2.0/gio/gactionmap.h +0 -4
  55. data/vendor/local/include/glib-2.0/gio/gappinfo.h +1 -3
  56. data/vendor/local/include/glib-2.0/gio/gapplication.h +0 -1
  57. data/vendor/local/include/glib-2.0/gio/gapplicationcommandline.h +0 -4
  58. data/vendor/local/include/glib-2.0/gio/gcontenttype.h +0 -1
  59. data/vendor/local/include/glib-2.0/gio/gdbusnamewatching.h +1 -6
  60. data/vendor/local/include/glib-2.0/gio/gfile.h +0 -3
  61. data/vendor/local/include/glib-2.0/gio/gfileenumerator.h +0 -3
  62. data/vendor/local/include/glib-2.0/gio/gfileinfo.h +0 -2
  63. data/vendor/local/include/glib-2.0/gio/ginetaddressmask.h +0 -6
  64. data/vendor/local/include/glib-2.0/gio/gio.h +0 -1
  65. data/vendor/local/include/glib-2.0/gio/gioenums.h +1 -3
  66. data/vendor/local/include/glib-2.0/gio/giomodule.h +0 -5
  67. data/vendor/local/include/glib-2.0/gio/gioscheduler.h +0 -4
  68. data/vendor/local/include/glib-2.0/gio/giotypes.h +0 -1
  69. data/vendor/local/include/glib-2.0/gio/gmemoryoutputstream.h +0 -2
  70. data/vendor/local/include/glib-2.0/gio/gmenu.h +0 -27
  71. data/vendor/local/include/glib-2.0/gio/gmenumodel.h +0 -19
  72. data/vendor/local/include/glib-2.0/gio/gresource.h +0 -2
  73. data/vendor/local/include/glib-2.0/gio/gsettingsschema.h +0 -4
  74. data/vendor/local/include/glib-2.0/gio/gsimpleaction.h +0 -1
  75. data/vendor/local/include/glib-2.0/gio/gsimpleactiongroup.h +0 -1
  76. data/vendor/local/include/glib-2.0/gio/gsocket.h +0 -13
  77. data/vendor/local/include/glib-2.0/glib/deprecated/gthread.h +0 -1
  78. data/vendor/local/include/glib-2.0/glib/gchecksum.h +1 -3
  79. data/vendor/local/include/glib-2.0/glib/gconvert.h +9 -24
  80. data/vendor/local/include/glib-2.0/glib/gdir.h +8 -10
  81. data/vendor/local/include/glib-2.0/glib/genviron.h +8 -12
  82. data/vendor/local/include/glib-2.0/glib/gfileutils.h +15 -20
  83. data/vendor/local/include/glib-2.0/glib/giochannel.h +4 -14
  84. data/vendor/local/include/glib-2.0/glib/gslice.h +0 -4
  85. data/vendor/local/include/glib-2.0/glib/gspawn.h +10 -46
  86. data/vendor/local/include/glib-2.0/glib/gtestutils.h +0 -1
  87. data/vendor/local/include/glib-2.0/glib/gunicode.h +5 -5
  88. data/vendor/local/include/glib-2.0/glib/gutils.h +14 -14
  89. data/vendor/local/include/glib-2.0/glib/gvariant.h +0 -8
  90. data/vendor/local/include/glib-2.0/glib/gversionmacros.h +0 -24
  91. data/vendor/local/include/glib-2.0/glib/gwin32.h +7 -14
  92. data/vendor/local/include/glib-2.0/gmodule.h +7 -11
  93. data/vendor/local/include/glib-2.0/gobject/glib-types.h +0 -33
  94. data/vendor/local/include/glib-2.0/gobject/gobject.h +7 -7
  95. data/vendor/local/include/glib-2.0/gobject/gtype.h +7 -13
  96. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/__init__.py +0 -0
  97. data/vendor/local/lib/gdbus-2.0/codegen/__init__.pyc +0 -0
  98. data/vendor/local/lib/gdbus-2.0/codegen/__init__.pyo +0 -0
  99. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen.py +0 -0
  100. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen.pyc +0 -0
  101. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen.pyo +0 -0
  102. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_docbook.py +0 -0
  103. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_docbook.pyc +0 -0
  104. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_docbook.pyo +0 -0
  105. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_main.py +0 -2
  106. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_main.pyc +0 -0
  107. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_main.pyo +0 -0
  108. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/config.py +1 -1
  109. data/vendor/local/lib/gdbus-2.0/codegen/config.pyc +0 -0
  110. data/vendor/local/lib/gdbus-2.0/codegen/config.pyo +0 -0
  111. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/dbustypes.py +0 -0
  112. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/dbustypes.pyc +0 -0
  113. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/dbustypes.pyo +0 -0
  114. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/parser.py +0 -0
  115. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/parser.pyc +0 -0
  116. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/parser.pyo +0 -0
  117. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/utils.py +0 -0
  118. data/vendor/local/lib/gdbus-2.0/codegen/utils.pyc +0 -0
  119. data/vendor/local/lib/gdbus-2.0/codegen/utils.pyo +0 -0
  120. data/vendor/local/lib/gio-2.0.def +2 -41
  121. data/vendor/local/lib/gio/modules/libgiognutls.a +0 -0
  122. data/vendor/local/lib/gio/modules/libgiognutls.dll +0 -0
  123. data/vendor/local/lib/gio/modules/libgiognutls.dll.a +0 -0
  124. data/vendor/local/lib/gio/modules/libgiognutls.la +1 -1
  125. data/vendor/local/lib/glib-2.0.def +0 -2
  126. data/vendor/local/lib/glib-2.0/include/glibconfig.h +1 -1
  127. data/vendor/local/lib/gobject-2.0.def +0 -4
  128. data/vendor/local/lib/libgio-2.0.dll.a +0 -0
  129. data/vendor/local/lib/libgio-2.0.la +4 -4
  130. data/vendor/local/lib/libglib-2.0.dll.a +0 -0
  131. data/vendor/local/lib/libglib-2.0.la +3 -3
  132. data/vendor/local/lib/libgmodule-2.0.dll.a +0 -0
  133. data/vendor/local/lib/libgmodule-2.0.la +3 -3
  134. data/vendor/local/lib/libgmp.dll.a +0 -0
  135. data/vendor/local/lib/libgnutls-openssl.a +0 -0
  136. data/vendor/local/lib/libgnutls-openssl.dll.a +0 -0
  137. data/vendor/local/lib/libgnutls.a +0 -0
  138. data/vendor/local/lib/libgnutls.dll.a +0 -0
  139. data/vendor/local/lib/libgnutlsxx.a +0 -0
  140. data/vendor/local/lib/libgnutlsxx.dll.a +0 -0
  141. data/vendor/local/lib/libgobject-2.0.dll.a +0 -0
  142. data/vendor/local/lib/libgobject-2.0.la +4 -4
  143. data/vendor/local/lib/libgthread-2.0.dll.a +0 -0
  144. data/vendor/local/lib/libgthread-2.0.la +3 -3
  145. data/vendor/local/lib/libhogweed.a +0 -0
  146. data/vendor/local/lib/libhogweed.dll.a +0 -0
  147. data/vendor/local/lib/libnettle.a +0 -0
  148. data/vendor/local/lib/libnettle.dll.a +0 -0
  149. data/vendor/local/lib/pkgconfig/gio-2.0.pc +1 -1
  150. data/vendor/local/lib/pkgconfig/gio-windows-2.0.pc +1 -1
  151. data/vendor/local/lib/pkgconfig/glib-2.0.pc +1 -1
  152. data/vendor/local/lib/pkgconfig/gmodule-2.0.pc +1 -1
  153. data/vendor/local/lib/pkgconfig/gmodule-export-2.0.pc +1 -1
  154. data/vendor/local/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
  155. data/vendor/local/lib/pkgconfig/gobject-2.0.pc +1 -1
  156. data/vendor/local/lib/pkgconfig/gthread-2.0.pc +1 -1
  157. data/vendor/local/share/gdb/auto-load/{libglib-2.0.so.0.3503.0-gdb.py → libglib-2.0.so.0.3400.3-gdb.py} +0 -0
  158. data/vendor/local/share/gdb/auto-load/{libgobject-2.0.so.0.3503.0-gdb.py → libgobject-2.0.so.0.3400.3-gdb.py} +0 -0
  159. data/vendor/local/share/glib-2.0/gdb/glib.py +4 -0
  160. data/vendor/local/share/glib-2.0/gettext/mkinstalldirs +2 -2
  161. data/vendor/local/share/glib-2.0/gettext/po/Makefile.in.in +17 -5
  162. data/vendor/local/share/gtk-doc/html/gio/GActionMap.html +1 -1
  163. data/vendor/local/share/gtk-doc/html/gio/GAppInfo.html +1 -27
  164. data/vendor/local/share/gtk-doc/html/gio/GApplication.html +15 -8
  165. data/vendor/local/share/gtk-doc/html/gio/GApplicationCommandLine.html +6 -47
  166. data/vendor/local/share/gtk-doc/html/gio/GAsyncInitable.html +37 -21
  167. data/vendor/local/share/gtk-doc/html/gio/GAsyncResult.html +4 -16
  168. data/vendor/local/share/gtk-doc/html/gio/GBufferedInputStream.html +1 -1
  169. data/vendor/local/share/gtk-doc/html/gio/GDBusAuthObserver.html +1 -1
  170. data/vendor/local/share/gtk-doc/html/gio/GDBusConnection.html +32 -16
  171. data/vendor/local/share/gtk-doc/html/gio/GDBusInterfaceSkeleton.html +1 -1
  172. data/vendor/local/share/gtk-doc/html/gio/GDBusMethodInvocation.html +1 -1
  173. data/vendor/local/share/gtk-doc/html/gio/GDBusObjectManagerClient.html +2 -4
  174. data/vendor/local/share/gtk-doc/html/gio/GDBusProxy.html +10 -6
  175. data/vendor/local/share/gtk-doc/html/gio/GDBusServer.html +7 -3
  176. data/vendor/local/share/gtk-doc/html/gio/GDataInputStream.html +3 -3
  177. data/vendor/local/share/gtk-doc/html/gio/GFile.html +17 -65
  178. data/vendor/local/share/gtk-doc/html/gio/GFileEnumerator.html +2 -59
  179. data/vendor/local/share/gtk-doc/html/gio/GFileInfo.html +1 -29
  180. data/vendor/local/share/gtk-doc/html/gio/GFileInputStream.html +1 -1
  181. data/vendor/local/share/gtk-doc/html/gio/GInputStream.html +4 -4
  182. data/vendor/local/share/gtk-doc/html/gio/GMemoryOutputStream.html +0 -13
  183. data/vendor/local/share/gtk-doc/html/gio/GMount.html +1 -1
  184. data/vendor/local/share/gtk-doc/html/gio/GProxyAddress.html +2 -2
  185. data/vendor/local/share/gtk-doc/html/gio/GSettings.html +5 -5
  186. data/vendor/local/share/gtk-doc/html/gio/GSimpleAction.html +1 -1
  187. data/vendor/local/share/gtk-doc/html/gio/GSimpleAsyncResult.html +4 -12
  188. data/vendor/local/share/gtk-doc/html/gio/GSocket.html +1 -137
  189. data/vendor/local/share/gtk-doc/html/gio/GTestDBus.html +2 -3
  190. data/vendor/local/share/gtk-doc/html/gio/GTlsConnection.html +1 -1
  191. data/vendor/local/share/gtk-doc/html/gio/GVolume.html +1 -1
  192. data/vendor/local/share/gtk-doc/html/gio/api-index-2-26.html +0 -4
  193. data/vendor/local/share/gtk-doc/html/gio/api-index-deprecated.html +0 -19
  194. data/vendor/local/share/gtk-doc/html/gio/api-index-full.html +0 -180
  195. data/vendor/local/share/gtk-doc/html/gio/async.html +0 -3
  196. data/vendor/local/share/gtk-doc/html/gio/ch01.html +1 -1
  197. data/vendor/local/share/gtk-doc/html/gio/ch02.html +3 -3
  198. data/vendor/local/share/gtk-doc/html/gio/ch03.html +1 -1
  199. data/vendor/local/share/gtk-doc/html/gio/ch29.html +1 -1
  200. data/vendor/local/share/gtk-doc/html/gio/ch30.html +4 -4
  201. data/vendor/local/share/gtk-doc/html/gio/ch30s02.html +2 -2
  202. data/vendor/local/share/gtk-doc/html/gio/ch30s03.html +3 -3
  203. data/vendor/local/share/gtk-doc/html/gio/ch31.html +3 -3
  204. data/vendor/local/share/gtk-doc/html/gio/ch31s02.html +1 -1
  205. data/vendor/local/share/gtk-doc/html/gio/ch31s03.html +1 -1
  206. data/vendor/local/share/gtk-doc/html/gio/ch31s04.html +1 -1
  207. data/vendor/local/share/gtk-doc/html/gio/ch31s05.html +1 -1
  208. data/vendor/local/share/gtk-doc/html/gio/ch31s06.html +2 -2
  209. data/vendor/local/share/gtk-doc/html/gio/ch31s07.html +1 -1
  210. data/vendor/local/share/gtk-doc/html/gio/ch32.html +3 -3
  211. data/vendor/local/share/gtk-doc/html/gio/ch32s02.html +1 -1
  212. data/vendor/local/share/gtk-doc/html/gio/ch32s03.html +1 -1
  213. data/vendor/local/share/gtk-doc/html/gio/ch32s04.html +1 -1
  214. data/vendor/local/share/gtk-doc/html/gio/ch32s05.html +17 -9
  215. data/vendor/local/share/gtk-doc/html/gio/gdbus-codegen.html +11 -11
  216. data/vendor/local/share/gtk-doc/html/gio/gdbus-org.gtk.GDBus.Example.ObjectManager.Animal.html +2 -2
  217. data/vendor/local/share/gtk-doc/html/gio/gdbus.html +6 -6
  218. data/vendor/local/share/gtk-doc/html/gio/gio-D-Bus-Introspection-Data.html +5 -5
  219. data/vendor/local/share/gtk-doc/html/gio/gio-D-Bus-Utilities.html +1 -1
  220. data/vendor/local/share/gtk-doc/html/gio/gio-Desktop-file-based-GAppInfo.html +0 -109
  221. data/vendor/local/share/gtk-doc/html/gio/gio-GDBusError.html +1 -1
  222. data/vendor/local/share/gtk-doc/html/gio/gio-GFileAttribute.html +2 -2
  223. data/vendor/local/share/gtk-doc/html/gio/gio-GIOError.html +1 -7
  224. data/vendor/local/share/gtk-doc/html/gio/gio-GIOScheduler.html +12 -29
  225. data/vendor/local/share/gtk-doc/html/gio/gio-GResource.html +1 -1
  226. data/vendor/local/share/gtk-doc/html/gio/gio-Owning-Bus-Names.html +7 -3
  227. data/vendor/local/share/gtk-doc/html/gio/gio-Watching-Bus-Names.html +8 -10
  228. data/vendor/local/share/gtk-doc/html/gio/gio-hierarchy.html +0 -1
  229. data/vendor/local/share/gtk-doc/html/gio/gio-querymodules.html +1 -1
  230. data/vendor/local/share/gtk-doc/html/gio/gio.devhelp2 +11 -64
  231. data/vendor/local/share/gtk-doc/html/gio/glib-compile-resources.html +3 -15
  232. data/vendor/local/share/gtk-doc/html/gio/glib-compile-schemas.html +2 -2
  233. data/vendor/local/share/gtk-doc/html/gio/gresource-tool.html +2 -2
  234. data/vendor/local/share/gtk-doc/html/gio/gsettings-tool.html +2 -2
  235. data/vendor/local/share/gtk-doc/html/gio/highlevel-socket.html +2 -2
  236. data/vendor/local/share/gtk-doc/html/gio/index.html +4 -10
  237. data/vendor/local/share/gtk-doc/html/gio/index.sgml +0 -59
  238. data/vendor/local/share/gtk-doc/html/gio/migrating.html +3 -3
  239. data/vendor/local/share/gtk-doc/html/gio/networking.html +0 -3
  240. data/vendor/local/share/gtk-doc/html/gio/pt01.html +1 -1
  241. data/vendor/local/share/gtk-doc/html/gio/pt02.html +1 -7
  242. data/vendor/local/share/gtk-doc/html/glib/api-index-2-34.html +0 -4
  243. data/vendor/local/share/gtk-doc/html/glib/api-index-full.html +1 -21
  244. data/vendor/local/share/gtk-doc/html/glib/glib-Arrays.html +2 -2
  245. data/vendor/local/share/gtk-doc/html/glib/glib-Byte-Arrays.html +1 -1
  246. data/vendor/local/share/gtk-doc/html/glib/glib-Data-Checksums.html +4 -13
  247. data/vendor/local/share/gtk-doc/html/glib/glib-Date-and-Time-Functions.html +2 -2
  248. data/vendor/local/share/gtk-doc/html/glib/glib-Deprecated-Thread-APIs.html +11 -7
  249. data/vendor/local/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html +2 -2
  250. data/vendor/local/share/gtk-doc/html/glib/glib-Dynamic-Loading-of-Modules.html +1 -1
  251. data/vendor/local/share/gtk-doc/html/glib/glib-GVariant.html +10 -86
  252. data/vendor/local/share/gtk-doc/html/glib/glib-Hash-Tables.html +46 -5
  253. data/vendor/local/share/gtk-doc/html/glib/glib-IO-Channels.html +7 -11
  254. data/vendor/local/share/gtk-doc/html/glib/glib-Keyed-Data-Lists.html +3 -3
  255. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Slices.html +4 -4
  256. data/vendor/local/share/gtk-doc/html/glib/glib-Message-Logging.html +3 -3
  257. data/vendor/local/share/gtk-doc/html/glib/glib-Miscellaneous-Utility-Functions.html +34 -27
  258. data/vendor/local/share/gtk-doc/html/glib/glib-Pointer-Arrays.html +1 -1
  259. data/vendor/local/share/gtk-doc/html/glib/glib-Singly-Linked-Lists.html +2 -2
  260. data/vendor/local/share/gtk-doc/html/glib/glib-Spawning-Processes.html +2 -2
  261. data/vendor/local/share/gtk-doc/html/glib/glib-Testing.html +2 -23
  262. data/vendor/local/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html +14 -14
  263. data/vendor/local/share/gtk-doc/html/glib/glib-Threads.html +6 -6
  264. data/vendor/local/share/gtk-doc/html/glib/glib-UNIX-specific-utilities-and-integration.html +7 -13
  265. data/vendor/local/share/gtk-doc/html/glib/glib-Unicode-Manipulation.html +5 -9
  266. data/vendor/local/share/gtk-doc/html/glib/glib-Version-Information.html +4 -28
  267. data/vendor/local/share/gtk-doc/html/glib/glib-Warnings-and-Assertions.html +2 -2
  268. data/vendor/local/share/gtk-doc/html/glib/glib-building.html +1 -1
  269. data/vendor/local/share/gtk-doc/html/glib/glib-changes.html +2 -2
  270. data/vendor/local/share/gtk-doc/html/glib/glib-compiling.html +1 -1
  271. data/vendor/local/share/gtk-doc/html/glib/glib-gettextize.html +3 -3
  272. data/vendor/local/share/gtk-doc/html/glib/glib-programming.html +3 -3
  273. data/vendor/local/share/gtk-doc/html/glib/glib-regex-syntax.html +45 -45
  274. data/vendor/local/share/gtk-doc/html/glib/glib-resources.html +3 -3
  275. data/vendor/local/share/gtk-doc/html/glib/glib-running.html +6 -6
  276. data/vendor/local/share/gtk-doc/html/glib/glib.devhelp2 +25 -32
  277. data/vendor/local/share/gtk-doc/html/glib/gtester-report.html +3 -3
  278. data/vendor/local/share/gtk-doc/html/glib/gtester.html +3 -3
  279. data/vendor/local/share/gtk-doc/html/glib/gvariant-format-strings.html +12 -12
  280. data/vendor/local/share/gtk-doc/html/glib/gvariant-text.html +2 -2
  281. data/vendor/local/share/gtk-doc/html/glib/index.html +1 -1
  282. data/vendor/local/share/gtk-doc/html/glib/index.sgml +0 -7
  283. data/vendor/local/share/gtk-doc/html/gobject/api-index-deprecated.html +0 -12
  284. data/vendor/local/share/gtk-doc/html/gobject/api-index-full.html +0 -12
  285. data/vendor/local/share/gtk-doc/html/gobject/ch01s02.html +4 -4
  286. data/vendor/local/share/gtk-doc/html/gobject/chapter-gtype.html +4 -4
  287. data/vendor/local/share/gtk-doc/html/gobject/chapter-intro.html +2 -2
  288. data/vendor/local/share/gtk-doc/html/gobject/chapter-signal.html +8 -8
  289. data/vendor/local/share/gtk-doc/html/gobject/glib-genmarshal.html +6 -6
  290. data/vendor/local/share/gtk-doc/html/gobject/glib-mkenums.html +5 -5
  291. data/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html +0 -22
  292. data/vendor/local/share/gtk-doc/html/gobject/gobject-Generic-values.html +5 -1
  293. data/vendor/local/share/gtk-doc/html/gobject/gobject-Signals.html +32 -6
  294. data/vendor/local/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html +6 -6
  295. data/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html +24 -51
  296. data/vendor/local/share/gtk-doc/html/gobject/gobject-properties.html +4 -4
  297. data/vendor/local/share/gtk-doc/html/gobject/gobject-query.html +3 -3
  298. data/vendor/local/share/gtk-doc/html/gobject/gobject.devhelp2 +8 -11
  299. data/vendor/local/share/gtk-doc/html/gobject/gtype-conventions.html +2 -2
  300. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-chainup.html +2 -2
  301. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-methods.html +3 -3
  302. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject.html +3 -3
  303. data/vendor/local/share/gtk-doc/html/gobject/howto-interface-properties.html +2 -2
  304. data/vendor/local/share/gtk-doc/html/gobject/howto-signals.html +2 -2
  305. data/vendor/local/share/gtk-doc/html/gobject/index.html +7 -7
  306. data/vendor/local/share/gtk-doc/html/gobject/index.sgml +0 -3
  307. data/vendor/local/share/gtk-doc/html/gobject/pr01.html +1 -1
  308. data/vendor/local/share/gtk-doc/html/gobject/pt01.html +4 -4
  309. data/vendor/local/share/gtk-doc/html/gobject/pt02.html +4 -4
  310. data/vendor/local/share/gtk-doc/html/gobject/pt03.html +1 -1
  311. data/vendor/local/share/gtk-doc/html/gobject/rn01.html +1 -1
  312. data/vendor/local/share/gtk-doc/html/gobject/rn02.html +1 -1
  313. data/vendor/local/share/gtk-doc/html/gobject/signal.html +4 -4
  314. data/vendor/local/share/locale/as/LC_MESSAGES/glib20.mo +0 -0
  315. data/vendor/local/share/locale/cs/LC_MESSAGES/glib-networking.mo +0 -0
  316. data/vendor/local/share/locale/da/LC_MESSAGES/glib20.mo +0 -0
  317. data/vendor/local/share/locale/es/LC_MESSAGES/glib-networking.mo +0 -0
  318. data/vendor/local/share/locale/es/LC_MESSAGES/glib20.mo +0 -0
  319. data/vendor/local/share/locale/gl/LC_MESSAGES/glib20.mo +0 -0
  320. data/vendor/local/share/locale/gu/LC_MESSAGES/glib20.mo +0 -0
  321. data/vendor/local/share/locale/he/LC_MESSAGES/glib-networking.mo +0 -0
  322. data/vendor/local/share/locale/he/LC_MESSAGES/glib20.mo +0 -0
  323. data/vendor/local/share/locale/kn/LC_MESSAGES/glib20.mo +0 -0
  324. data/vendor/local/share/locale/lt/LC_MESSAGES/glib-networking.mo +0 -0
  325. data/vendor/local/share/locale/lt/LC_MESSAGES/glib20.mo +0 -0
  326. data/vendor/local/share/locale/nb/LC_MESSAGES/glib20.mo +0 -0
  327. data/vendor/local/share/locale/or/LC_MESSAGES/glib20.mo +0 -0
  328. data/vendor/local/share/locale/pl/LC_MESSAGES/glib-networking.mo +0 -0
  329. data/vendor/local/share/locale/pl/LC_MESSAGES/glib20.mo +0 -0
  330. data/vendor/local/share/locale/sk/LC_MESSAGES/glib20.mo +0 -0
  331. data/vendor/local/share/locale/sl/LC_MESSAGES/glib20.mo +0 -0
  332. data/vendor/local/share/locale/sr/LC_MESSAGES/glib20.mo +0 -0
  333. data/vendor/local/share/locale/sr@latin/LC_MESSAGES/glib20.mo +0 -0
  334. data/vendor/local/share/man/man1/gdbus-codegen.1 +1 -1
  335. data/vendor/local/share/man/man1/gdbus.1 +1 -1
  336. data/vendor/local/share/man/man1/gio-querymodules.1 +1 -1
  337. data/vendor/local/share/man/man1/glib-compile-resources.1 +1 -13
  338. data/vendor/local/share/man/man1/glib-compile-schemas.1 +1 -1
  339. data/vendor/local/share/man/man1/glib-genmarshal.1 +1 -1
  340. data/vendor/local/share/man/man1/glib-gettextize.1 +1 -1
  341. data/vendor/local/share/man/man1/glib-mkenums.1 +1 -1
  342. data/vendor/local/share/man/man1/gobject-query.1 +1 -1
  343. data/vendor/local/share/man/man1/gresource.1 +1 -1
  344. data/vendor/local/share/man/man1/gsettings.1 +1 -1
  345. data/vendor/local/share/man/man1/gtester-report.1 +1 -1
  346. data/vendor/local/share/man/man1/gtester.1 +1 -1
  347. metadata +33 -197
  348. data/ext/glib2/rbgobj_fundamental.c +0 -43
  349. data/vendor/local/bin/asn1Coding.exe +0 -0
  350. data/vendor/local/bin/asn1Decoding.exe +0 -0
  351. data/vendor/local/bin/asn1Parser.exe +0 -0
  352. data/vendor/local/bin/dumpsexp.exe +0 -0
  353. data/vendor/local/bin/gpg-error.exe +0 -0
  354. data/vendor/local/bin/hmac256.exe +0 -0
  355. data/vendor/local/bin/libgcrypt-11.dll +0 -0
  356. data/vendor/local/bin/libgcrypt-config +0 -177
  357. data/vendor/local/bin/libgnutls-26.dll +0 -0
  358. data/vendor/local/bin/libgnutls-extra-26.dll +0 -0
  359. data/vendor/local/bin/libgnutls-openssl-26.dll +0 -0
  360. data/vendor/local/bin/libgpg-error-0.dll +0 -0
  361. data/vendor/local/bin/libtasn1-3.dll +0 -0
  362. data/vendor/local/etc/bash_completion.d/gdbus-bash-completion.sh +0 -33
  363. data/vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh +0 -67
  364. data/vendor/local/gnutls.README.txt +0 -6
  365. data/vendor/local/include/gcrypt-module.h +0 -226
  366. data/vendor/local/include/gcrypt.h +0 -1826
  367. data/vendor/local/include/glib-2.0/gio/gnetworking.h +0 -83
  368. data/vendor/local/include/glib-2.0/gio/gtask.h +0 -160
  369. data/vendor/local/include/glib-2.0/glib/gcache.h +0 -69
  370. data/vendor/local/include/glib-2.0/glib/gcompletion.h +0 -81
  371. data/vendor/local/include/glib-2.0/glib/grel.h +0 -101
  372. data/vendor/local/include/gnutls/extra.h +0 -137
  373. data/vendor/local/include/gpg-error.h +0 -651
  374. data/vendor/local/include/libtasn1.h +0 -246
  375. data/vendor/local/lib/gio-2.0.lib +0 -0
  376. data/vendor/local/lib/glib-2.0.lib +0 -0
  377. data/vendor/local/lib/gmodule-2.0.lib +0 -0
  378. data/vendor/local/lib/gobject-2.0.lib +0 -0
  379. data/vendor/local/lib/gthread-2.0.lib +0 -0
  380. data/vendor/local/lib/libgcrypt.def +0 -237
  381. data/vendor/local/lib/libgcrypt.dll.a +0 -0
  382. data/vendor/local/lib/libgnutls-extra.dll.a +0 -0
  383. data/vendor/local/lib/libgpg-error.dll.a +0 -0
  384. data/vendor/local/lib/libtasn1.dll.a +0 -0
  385. data/vendor/local/manifest/glib-dev_2.28.8-1_win32.mft +0 -619
  386. data/vendor/local/manifest/glib_2.28.8-1_win32.mft +0 -103
  387. data/vendor/local/manifest/gnutls-dev_2.4.2-1_win32.mft +0 -593
  388. data/vendor/local/manifest/gnutls_2.4.2-1_win32.mft +0 -8
  389. data/vendor/local/share/aclocal/gpg-error.m4 +0 -65
  390. data/vendor/local/share/aclocal/libgcrypt.m4 +0 -108
  391. data/vendor/local/share/aclocal/libgnutls-extra.m4 +0 -161
  392. data/vendor/local/share/aclocal/libgnutls.m4 +0 -160
  393. data/vendor/local/share/aclocal/libtasn1.m4 +0 -160
  394. data/vendor/local/share/common-lisp/source/gpg-error/gpg-error-codes.lisp +0 -417
  395. data/vendor/local/share/common-lisp/source/gpg-error/gpg-error-package.lisp +0 -64
  396. data/vendor/local/share/common-lisp/source/gpg-error/gpg-error.asd +0 -36
  397. data/vendor/local/share/common-lisp/source/gpg-error/gpg-error.lisp +0 -236
  398. data/vendor/local/share/doc/glib-2.28.8/COPYING +0 -482
  399. data/vendor/local/share/doc/glib-dev-2.28.8/COPYING +0 -482
  400. data/vendor/local/share/glib-2.0/codegen/__init__.pyc +0 -0
  401. data/vendor/local/share/glib-2.0/codegen/__init__.pyo +0 -0
  402. data/vendor/local/share/glib-2.0/codegen/config.pyc +0 -0
  403. data/vendor/local/share/glib-2.0/codegen/config.pyo +0 -0
  404. data/vendor/local/share/glib-2.0/codegen/utils.pyc +0 -0
  405. data/vendor/local/share/glib-2.0/codegen/utils.pyo +0 -0
  406. data/vendor/local/share/gtk-doc/html/gio/GDBusError.html +0 -879
  407. data/vendor/local/share/gtk-doc/html/gio/GTask.html +0 -2296
  408. data/vendor/local/share/gtk-doc/html/gio/ch26.html +0 -75
  409. data/vendor/local/share/gtk-doc/html/gio/ch27.html +0 -217
  410. data/vendor/local/share/gtk-doc/html/gio/ch27s02.html +0 -41
  411. data/vendor/local/share/gtk-doc/html/gio/ch27s03.html +0 -39
  412. data/vendor/local/share/gtk-doc/html/gio/ch28.html +0 -57
  413. data/vendor/local/share/gtk-doc/html/gio/ch28s02.html +0 -59
  414. data/vendor/local/share/gtk-doc/html/gio/ch28s03.html +0 -159
  415. data/vendor/local/share/gtk-doc/html/gio/ch28s04.html +0 -46
  416. data/vendor/local/share/gtk-doc/html/gio/ch28s05.html +0 -48
  417. data/vendor/local/share/gtk-doc/html/gio/ch28s06.html +0 -279
  418. data/vendor/local/share/gtk-doc/html/gio/ch28s07.html +0 -160
  419. data/vendor/local/share/gtk-doc/html/gio/ch29s02.html +0 -130
  420. data/vendor/local/share/gtk-doc/html/gio/ch29s03.html +0 -202
  421. data/vendor/local/share/gtk-doc/html/gio/ch29s04.html +0 -96
  422. data/vendor/local/share/gtk-doc/html/gio/ch29s05.html +0 -823
  423. data/vendor/local/share/gtk-doc/html/gio/ch29s06.html +0 -828
  424. data/vendor/local/share/gtk-doc/html/gio/gio-gnetworking.h.html +0 -91
  425. data/vendor/local/share/gtk-doc/html/gio/gio.devhelp +0 -1956
  426. data/vendor/local/share/gtk-doc/html/glib/glib-Limits-of-Basic-Types.html +0 -389
  427. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Allocators.html +0 -137
  428. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Chunks.html +0 -679
  429. data/vendor/local/share/gtk-doc/html/glib/glib.devhelp +0 -2218
  430. data/vendor/local/share/gtk-doc/html/gobject/ch06s03.html +0 -113
  431. data/vendor/local/share/gtk-doc/html/gobject/gobject.devhelp +0 -766
  432. data/vendor/local/share/info/gcrypt.info +0 -6243
  433. data/vendor/local/share/info/gnutls-certificate-user-use-case.png +0 -0
  434. data/vendor/local/share/info/gnutls-extensions_st.png +0 -0
  435. data/vendor/local/share/info/gnutls-mod_auth_st.png +0 -0
  436. data/vendor/local/share/info/gnutls-objects.png +0 -0
  437. data/vendor/local/share/info/libtasn1.info +0 -2993
  438. data/vendor/local/share/man/man1/asn1Coding.1 +0 -46
  439. data/vendor/local/share/man/man1/asn1Decoding.1 +0 -41
  440. data/vendor/local/share/man/man1/asn1Parser.1 +0 -49
  441. data/vendor/local/share/man/man3/asn1_array2tree.3 +0 -47
  442. data/vendor/local/share/man/man3/asn1_bit_der.3 +0 -39
  443. data/vendor/local/share/man/man3/asn1_check_version.3 +0 -39
  444. data/vendor/local/share/man/man3/asn1_copy_node.3 +0 -39
  445. data/vendor/local/share/man/man3/asn1_create_element.3 +0 -45
  446. data/vendor/local/share/man/man3/asn1_delete_element.3 +0 -39
  447. data/vendor/local/share/man/man3/asn1_delete_structure.3 +0 -37
  448. data/vendor/local/share/man/man3/asn1_der_coding.3 +0 -52
  449. data/vendor/local/share/man/man3/asn1_der_decoding.3 +0 -50
  450. data/vendor/local/share/man/man3/asn1_der_decoding_element.3 +0 -54
  451. data/vendor/local/share/man/man3/asn1_der_decoding_startEnd.3 +0 -58
  452. data/vendor/local/share/man/man3/asn1_expand_any_defined_by.3 +0 -45
  453. data/vendor/local/share/man/man3/asn1_expand_octet_string.3 +0 -51
  454. data/vendor/local/share/man/man3/asn1_find_node.3 +0 -38
  455. data/vendor/local/share/man/man3/asn1_find_structure_from_oid.3 +0 -37
  456. data/vendor/local/share/man/man3/asn1_get_bit_der.3 +0 -43
  457. data/vendor/local/share/man/man3/asn1_get_length_der.3 +0 -38
  458. data/vendor/local/share/man/man3/asn1_get_octet_der.3 +0 -43
  459. data/vendor/local/share/man/man3/asn1_get_tag_der.3 +0 -41
  460. data/vendor/local/share/man/man3/asn1_length_der.3 +0 -36
  461. data/vendor/local/share/man/man3/asn1_number_of_elements.3 +0 -43
  462. data/vendor/local/share/man/man3/asn1_octet_der.3 +0 -37
  463. data/vendor/local/share/man/man3/asn1_parser2array.3 +0 -58
  464. data/vendor/local/share/man/man3/asn1_parser2tree.3 +0 -55
  465. data/vendor/local/share/man/man3/asn1_print_structure.3 +0 -40
  466. data/vendor/local/share/man/man3/asn1_read_tag.3 +0 -46
  467. data/vendor/local/share/man/man3/asn1_read_value.3 +0 -92
  468. data/vendor/local/share/man/man3/asn1_write_value.3 +0 -136
  469. data/vendor/local/share/man/man3/gnutls_certificate_client_set_retrieve_function.3 +0 -58
  470. data/vendor/local/share/man/man3/gnutls_certificate_get_openpgp_keyring.3 +0 -37
  471. data/vendor/local/share/man/man3/gnutls_certificate_get_x509_cas.3 +0 -40
  472. data/vendor/local/share/man/man3/gnutls_certificate_get_x509_crls.3 +0 -40
  473. data/vendor/local/share/man/man3/gnutls_certificate_server_set_retrieve_function.3 +0 -47
  474. data/vendor/local/share/man/man3/gnutls_certificate_verify_peers.3 +0 -44
  475. data/vendor/local/share/man/man3/gnutls_crypto_cipher_register.3 +0 -45
  476. data/vendor/local/share/man/man3/gnutls_crypto_digest_register.3 +0 -45
  477. data/vendor/local/share/man/man3/gnutls_crypto_mac_register.3 +0 -45
  478. data/vendor/local/share/man/man3/gnutls_crypto_rnd_register.3 +0 -43
  479. data/vendor/local/share/man/man3/gnutls_extra_check_version.3 +0 -36
  480. data/vendor/local/share/man/man3/gnutls_free.3 +0 -34
  481. data/vendor/local/share/man/man3/gnutls_global_init_extra.3 +0 -38
  482. data/vendor/local/share/man/man3/gnutls_ia_allocate_client_credentials.3 +0 -42
  483. data/vendor/local/share/man/man3/gnutls_ia_allocate_server_credentials.3 +0 -42
  484. data/vendor/local/share/man/man3/gnutls_ia_enable.3 +0 -53
  485. data/vendor/local/share/man/man3/gnutls_ia_endphase_send.3 +0 -43
  486. data/vendor/local/share/man/man3/gnutls_ia_extract_inner_secret.3 +0 -44
  487. data/vendor/local/share/man/man3/gnutls_ia_free_client_credentials.3 +0 -34
  488. data/vendor/local/share/man/man3/gnutls_ia_free_server_credentials.3 +0 -34
  489. data/vendor/local/share/man/man3/gnutls_ia_generate_challenge.3 +0 -40
  490. data/vendor/local/share/man/man3/gnutls_ia_get_client_avp_ptr.3 +0 -36
  491. data/vendor/local/share/man/man3/gnutls_ia_get_server_avp_ptr.3 +0 -36
  492. data/vendor/local/share/man/man3/gnutls_ia_handshake.3 +0 -36
  493. data/vendor/local/share/man/man3/gnutls_ia_handshake_p.3 +0 -37
  494. data/vendor/local/share/man/man3/gnutls_ia_permute_inner_secret.3 +0 -43
  495. data/vendor/local/share/man/man3/gnutls_ia_recv.3 +0 -57
  496. data/vendor/local/share/man/man3/gnutls_ia_send.3 +0 -56
  497. data/vendor/local/share/man/man3/gnutls_ia_set_client_avp_function.3 +0 -61
  498. data/vendor/local/share/man/man3/gnutls_ia_set_client_avp_ptr.3 +0 -36
  499. data/vendor/local/share/man/man3/gnutls_ia_set_server_avp_function.3 +0 -68
  500. data/vendor/local/share/man/man3/gnutls_ia_set_server_avp_ptr.3 +0 -36
  501. data/vendor/local/share/man/man3/gnutls_ia_verify_endphase.3 +0 -45
  502. data/vendor/local/share/man/man3/gnutls_malloc.3 +0 -37
  503. data/vendor/local/share/man/man3/gnutls_openpgp_privkey_get_subkey_expiration_time.3 +0 -40
  504. data/vendor/local/share/man/man3/gnutls_oprfi_enable_client.3 +0 -42
  505. data/vendor/local/share/man/man3/gnutls_oprfi_enable_server.3 +0 -49
  506. data/vendor/local/share/man/man3/gnutls_psk_netconf_derive_key.3 +0 -44
  507. data/vendor/local/share/man/man3/gnutls_session_get_client_random.3 +0 -40
  508. data/vendor/local/share/man/man3/gnutls_session_get_master_secret.3 +0 -43
  509. data/vendor/local/share/man/man3/gnutls_session_get_server_random.3 +0 -40
  510. data/vendor/local/share/man/man3/gnutls_sign_algorithm_get_name.3 +0 -35
  511. data/vendor/local/share/man/man3/gnutls_transport_set_global_errno.3 +0 -47
  512. data/vendor/local/share/man/man3/gnutls_transport_set_lowat.3 +0 -40
  513. data/vendor/local/share/man/man3/gnutls_x509_privkey_verify_data.3 +0 -43
  514. data/vendor/local/share/man/man3/libtasn1_perror.3 +0 -32
  515. data/vendor/local/share/man/man3/libtasn1_strerror.3 +0 -35
  516. data/vendor/local/src/dieterv/packaging/glib_2.28.8-1_win32.log +0 -2919
  517. data/vendor/local/src/dieterv/packaging/glib_2.28.8-1_win32.sh +0 -157
@@ -1,1826 +0,0 @@
1
- /* gcrypt.h - GNU Cryptographic Library Interface -*- c -*-
2
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
3
- 2007, 2008 Free Software Foundation, Inc.
4
-
5
- This file is part of Libgcrypt.
6
-
7
- Libgcrypt is free software; you can redistribute it and/or modify
8
- it under the terms of the GNU Lesser General Public License as
9
- published by the Free Software Foundation; either version 2.1 of
10
- the License, or (at your option) any later version.
11
-
12
- Libgcrypt is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU Lesser General Public License for more details.
16
-
17
- You should have received a copy of the GNU Lesser General Public
18
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
19
-
20
- File: src/gcrypt.h. Generated from gcrypt.h.in by configure. */
21
-
22
- #ifndef _GCRYPT_H
23
- #define _GCRYPT_H
24
-
25
- #include <stdlib.h>
26
- #include <stdarg.h>
27
- #include <string.h>
28
-
29
- #include <gpg-error.h>
30
-
31
- #include <sys/types.h>
32
-
33
- #if defined _WIN32 || defined __WIN32__
34
- # include <winsock2.h>
35
- # include <ws2tcpip.h>
36
- #else
37
- # include <sys/socket.h>
38
- #endif /*!_WIN32*/
39
-
40
- typedef int gcry_socklen_t;
41
-
42
- #include <sys/time.h>
43
-
44
- /* This is required for error code compatibility. */
45
- #define _GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GCRYPT
46
-
47
- #ifdef __cplusplus
48
- extern "C" {
49
- #if 0 /* (Keep Emacsens' auto-indent happy.) */
50
- }
51
- #endif
52
- #endif
53
-
54
- /* The version of this header should match the one of the library. It
55
- should not be used by a program because gcry_check_version() should
56
- return the same version. The purpose of this macro is to let
57
- autoconf (using the AM_PATH_GCRYPT macro) check that this header
58
- matches the installed library. */
59
- #define GCRYPT_VERSION "1.4.2"
60
-
61
- /* Internal: We can't use the convenience macros for the multi
62
- precision integer functions when building this library. */
63
- #ifdef _GCRYPT_IN_LIBGCRYPT
64
- #ifndef GCRYPT_NO_MPI_MACROS
65
- #define GCRYPT_NO_MPI_MACROS 1
66
- #endif
67
- #endif
68
-
69
- /* We want to use gcc attributes when possible. Warning: Don't use
70
- these macros in your programs: As indicated by the leading
71
- underscore they are subject to change without notice. */
72
- #ifdef __GNUC__
73
-
74
- #define _GCRY_GCC_VERSION (__GNUC__ * 10000 \
75
- + __GNUC_MINOR__ * 100 \
76
- + __GNUC_PATCHLEVEL__)
77
-
78
- #if _GCRY_GCC_VERSION >= 30100
79
- #define _GCRY_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
80
- #endif
81
-
82
- #if _GCRY_GCC_VERSION >= 29600
83
- #define _GCRY_GCC_ATTR_PURE __attribute__ ((__pure__))
84
- #endif
85
-
86
- #if _GCRY_GCC_VERSION >= 30200
87
- #define _GCRY_GCC_ATTR_MALLOC __attribute__ ((__malloc__))
88
- #endif
89
-
90
- #endif /*__GNUC__*/
91
-
92
- #ifndef _GCRY_GCC_ATTR_DEPRECATED
93
- #define _GCRY_GCC_ATTR_DEPRECATED
94
- #endif
95
- #ifndef _GCRY_GCC_ATTR_PURE
96
- #define _GCRY_GCC_ATTR_PURE
97
- #endif
98
- #ifndef _GCRY_GCC_ATTR_MALLOC
99
- #define _GCRY_GCC_ATTR_MALLOC
100
- #endif
101
-
102
- /* Some members in a public type should only be used internally.
103
- There is no "internal" attribute, so we abuse the deprecated
104
- attribute to discourage external use. */
105
- #ifdef _GCRYPT_IN_LIBGCRYPT
106
- #define _GCRY_ATTR_INTERNAL
107
- #else
108
- #define _GCRY_ATTR_INTERNAL _GCRY_GCC_ATTR_DEPRECATED
109
- #endif
110
-
111
- /* Wrappers for the libgpg-error library. */
112
-
113
- typedef gpg_error_t gcry_error_t;
114
- typedef gpg_err_code_t gcry_err_code_t;
115
- typedef gpg_err_source_t gcry_err_source_t;
116
-
117
- static GPG_ERR_INLINE gcry_error_t
118
- gcry_err_make (gcry_err_source_t source, gcry_err_code_t code)
119
- {
120
- return gpg_err_make (source, code);
121
- }
122
-
123
- /* The user can define GPG_ERR_SOURCE_DEFAULT before including this
124
- file to specify a default source for gpg_error. */
125
- #ifndef GCRY_ERR_SOURCE_DEFAULT
126
- #define GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_USER_1
127
- #endif
128
-
129
- static GPG_ERR_INLINE gcry_error_t
130
- gcry_error (gcry_err_code_t code)
131
- {
132
- return gcry_err_make (GCRY_ERR_SOURCE_DEFAULT, code);
133
- }
134
-
135
- static GPG_ERR_INLINE gcry_err_code_t
136
- gcry_err_code (gcry_error_t err)
137
- {
138
- return gpg_err_code (err);
139
- }
140
-
141
-
142
- static GPG_ERR_INLINE gcry_err_source_t
143
- gcry_err_source (gcry_error_t err)
144
- {
145
- return gpg_err_source (err);
146
- }
147
-
148
- /* Return a pointer to a string containing a description of the error
149
- code in the error value ERR. */
150
- const char *gcry_strerror (gcry_error_t err);
151
-
152
- /* Return a pointer to a string containing a description of the error
153
- source in the error value ERR. */
154
- const char *gcry_strsource (gcry_error_t err);
155
-
156
- /* Retrieve the error code for the system error ERR. This returns
157
- GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
158
- this). */
159
- gcry_err_code_t gcry_err_code_from_errno (int err);
160
-
161
- /* Retrieve the system error for the error code CODE. This returns 0
162
- if CODE is not a system error code. */
163
- int gcry_err_code_to_errno (gcry_err_code_t code);
164
-
165
- /* Return an error value with the error source SOURCE and the system
166
- error ERR. */
167
- gcry_error_t gcry_err_make_from_errno (gcry_err_source_t source, int err);
168
-
169
- /* Return an error value with the system error ERR. */
170
- gcry_err_code_t gcry_error_from_errno (int err);
171
-
172
-
173
- /* This enum is deprecated; it is only declared for the sake of
174
- complete API compatibility. */
175
- enum gcry_thread_option
176
- {
177
- _GCRY_THREAD_OPTION_DUMMY
178
- } _GCRY_GCC_ATTR_DEPRECATED;
179
-
180
-
181
- /* Constants defining the thread model to use. Used with the OPTION
182
- field of the struct gcry_thread_cbs. */
183
- #define GCRY_THREAD_OPTION_DEFAULT 0
184
- #define GCRY_THREAD_OPTION_USER 1
185
- #define GCRY_THREAD_OPTION_PTH 2
186
- #define GCRY_THREAD_OPTION_PTHREAD 3
187
-
188
- /* The version number encoded in the OPTION field of the struct
189
- gcry_thread_cbs. */
190
- #define GCRY_THREAD_OPTION_VERSION 0
191
-
192
- /* Wrapper for struct ath_ops. */
193
- struct gcry_thread_cbs
194
- {
195
- /* The OPTION field encodes the thread model and the version number
196
- of this structure.
197
- Bits 7 - 0 are used for the thread model
198
- Bits 15 - 8 are used for the version number.
199
- */
200
- unsigned int option;
201
-
202
- int (*init) (void);
203
- int (*mutex_init) (void **priv);
204
- int (*mutex_destroy) (void **priv);
205
- int (*mutex_lock) (void **priv);
206
- int (*mutex_unlock) (void **priv);
207
- ssize_t (*read) (int fd, void *buf, size_t nbytes);
208
- ssize_t (*write) (int fd, const void *buf, size_t nbytes);
209
- #ifdef _WIN32
210
- ssize_t (*select) (int nfd, void *rset, void *wset, void *eset,
211
- struct timeval *timeout);
212
- ssize_t (*waitpid) (pid_t pid, int *status, int options);
213
- int (*accept) (int s, void *addr, int *length_ptr);
214
- int (*connect) (int s, void *addr, gcry_socklen_t length);
215
- int (*sendmsg) (int s, const void *msg, int flags);
216
- int (*recvmsg) (int s, void *msg, int flags);
217
- #else
218
- ssize_t (*select) (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
219
- struct timeval *timeout);
220
- ssize_t (*waitpid) (pid_t pid, int *status, int options);
221
- int (*accept) (int s, struct sockaddr *addr, gcry_socklen_t *length_ptr);
222
- int (*connect) (int s, struct sockaddr *addr, gcry_socklen_t length);
223
- int (*sendmsg) (int s, const struct msghdr *msg, int flags);
224
- int (*recvmsg) (int s, struct msghdr *msg, int flags);
225
- #endif
226
- };
227
-
228
- #ifdef _WIN32
229
- # define _GCRY_THREAD_OPTION_PTH_IMPL_NET \
230
- static ssize_t gcry_pth_select (int nfd, void *rset, void *wset, \
231
- void *eset, struct timeval *timeout) \
232
- { return pth_select (nfd, rset, wset, eset, timeout); } \
233
- static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \
234
- { return pth_waitpid (pid, status, options); } \
235
- static int gcry_pth_accept (int s, void *addr, \
236
- gcry_socklen_t *length_ptr) \
237
- { return pth_accept (s, addr, length_ptr); } \
238
- static int gcry_pth_connect (int s, void *addr, \
239
- gcry_socklen_t length) \
240
- { return pth_connect (s, addr, length); }
241
- #else /*!_WIN32*/
242
- # define _GCRY_THREAD_OPTION_PTH_IMPL_NET \
243
- static ssize_t gcry_pth_select (int nfd, fd_set *rset, fd_set *wset, \
244
- fd_set *eset, struct timeval *timeout) \
245
- { return pth_select (nfd, rset, wset, eset, timeout); } \
246
- static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \
247
- { return pth_waitpid (pid, status, options); } \
248
- static int gcry_pth_accept (int s, struct sockaddr *addr, \
249
- gcry_socklen_t *length_ptr) \
250
- { return pth_accept (s, addr, length_ptr); } \
251
- static int gcry_pth_connect (int s, struct sockaddr *addr, \
252
- gcry_socklen_t length) \
253
- { return pth_connect (s, addr, length); }
254
- #endif /*!_WIN32*/
255
-
256
-
257
-
258
- #define GCRY_THREAD_OPTION_PTH_IMPL \
259
- static int gcry_pth_init (void) \
260
- { return (pth_init () == FALSE) ? errno : 0; } \
261
- static int gcry_pth_mutex_init (void **priv) \
262
- { \
263
- int err = 0; \
264
- pth_mutex_t *lock = malloc (sizeof (pth_mutex_t)); \
265
- \
266
- if (!lock) \
267
- err = ENOMEM; \
268
- if (!err) \
269
- { \
270
- err = pth_mutex_init (lock); \
271
- if (err == FALSE) \
272
- err = errno; \
273
- else \
274
- err = 0; \
275
- if (err) \
276
- free (lock); \
277
- else \
278
- *priv = lock; \
279
- } \
280
- return err; \
281
- } \
282
- static int gcry_pth_mutex_destroy (void **lock) \
283
- { /* GNU Pth has no destructor function. */ free (*lock); return 0; } \
284
- static int gcry_pth_mutex_lock (void **lock) \
285
- { return ((pth_mutex_acquire (*lock, 0, NULL)) == FALSE) \
286
- ? errno : 0; } \
287
- static int gcry_pth_mutex_unlock (void **lock) \
288
- { return ((pth_mutex_release (*lock)) == FALSE) \
289
- ? errno : 0; } \
290
- static ssize_t gcry_pth_read (int fd, void *buf, size_t nbytes) \
291
- { return pth_read (fd, buf, nbytes); } \
292
- static ssize_t gcry_pth_write (int fd, const void *buf, size_t nbytes) \
293
- { return pth_write (fd, buf, nbytes); } \
294
- _GCRY_THREAD_OPTION_PTH_IMPL_NET \
295
- \
296
- /* Note: GNU Pth is missing pth_sendmsg and pth_recvmsg. */ \
297
- static struct gcry_thread_cbs gcry_threads_pth = { \
298
- (GCRY_THREAD_OPTION_PTH | (GCRY_THREAD_OPTION_VERSION << 8)), \
299
- gcry_pth_init, gcry_pth_mutex_init, gcry_pth_mutex_destroy, \
300
- gcry_pth_mutex_lock, gcry_pth_mutex_unlock, gcry_pth_read, gcry_pth_write, \
301
- gcry_pth_select, gcry_pth_waitpid, gcry_pth_accept, gcry_pth_connect, \
302
- NULL, NULL }
303
-
304
-
305
- #define GCRY_THREAD_OPTION_PTHREAD_IMPL \
306
- static int gcry_pthread_mutex_init (void **priv) \
307
- { \
308
- int err = 0; \
309
- pthread_mutex_t *lock = (pthread_mutex_t*)malloc (sizeof (pthread_mutex_t));\
310
- \
311
- if (!lock) \
312
- err = ENOMEM; \
313
- if (!err) \
314
- { \
315
- err = pthread_mutex_init (lock, NULL); \
316
- if (err) \
317
- free (lock); \
318
- else \
319
- *priv = lock; \
320
- } \
321
- return err; \
322
- } \
323
- static int gcry_pthread_mutex_destroy (void **lock) \
324
- { int err = pthread_mutex_destroy ((pthread_mutex_t*)*lock); \
325
- free (*lock); return err; } \
326
- static int gcry_pthread_mutex_lock (void **lock) \
327
- { return pthread_mutex_lock ((pthread_mutex_t*)*lock); } \
328
- static int gcry_pthread_mutex_unlock (void **lock) \
329
- { return pthread_mutex_unlock ((pthread_mutex_t*)*lock); } \
330
- \
331
- static struct gcry_thread_cbs gcry_threads_pthread = { \
332
- (GCRY_THREAD_OPTION_PTHREAD | (GCRY_THREAD_OPTION_VERSION << 8)), \
333
- NULL, gcry_pthread_mutex_init, gcry_pthread_mutex_destroy, \
334
- gcry_pthread_mutex_lock, gcry_pthread_mutex_unlock, \
335
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
336
-
337
-
338
- /* The data object used to hold a multi precision integer. */
339
- struct gcry_mpi;
340
- typedef struct gcry_mpi *gcry_mpi_t;
341
-
342
- #ifndef GCRYPT_NO_DEPRECATED
343
- typedef struct gcry_mpi *GCRY_MPI _GCRY_GCC_ATTR_DEPRECATED;
344
- typedef struct gcry_mpi *GcryMPI _GCRY_GCC_ATTR_DEPRECATED;
345
- #endif
346
-
347
-
348
-
349
- /* Check that the library fulfills the version requirement. */
350
- const char *gcry_check_version (const char *req_version);
351
-
352
- /* Codes for function dispatchers. */
353
-
354
- /* Codes used with the gcry_control function. */
355
- enum gcry_ctl_cmds
356
- {
357
- GCRYCTL_SET_KEY = 1,
358
- GCRYCTL_SET_IV = 2,
359
- GCRYCTL_CFB_SYNC = 3,
360
- GCRYCTL_RESET = 4, /* e.g. for MDs */
361
- GCRYCTL_FINALIZE = 5,
362
- GCRYCTL_GET_KEYLEN = 6,
363
- GCRYCTL_GET_BLKLEN = 7,
364
- GCRYCTL_TEST_ALGO = 8,
365
- GCRYCTL_IS_SECURE = 9,
366
- GCRYCTL_GET_ASNOID = 10,
367
- GCRYCTL_ENABLE_ALGO = 11,
368
- GCRYCTL_DISABLE_ALGO = 12,
369
- GCRYCTL_DUMP_RANDOM_STATS = 13,
370
- GCRYCTL_DUMP_SECMEM_STATS = 14,
371
- GCRYCTL_GET_ALGO_NPKEY = 15,
372
- GCRYCTL_GET_ALGO_NSKEY = 16,
373
- GCRYCTL_GET_ALGO_NSIGN = 17,
374
- GCRYCTL_GET_ALGO_NENCR = 18,
375
- GCRYCTL_SET_VERBOSITY = 19,
376
- GCRYCTL_SET_DEBUG_FLAGS = 20,
377
- GCRYCTL_CLEAR_DEBUG_FLAGS = 21,
378
- GCRYCTL_USE_SECURE_RNDPOOL= 22,
379
- GCRYCTL_DUMP_MEMORY_STATS = 23,
380
- GCRYCTL_INIT_SECMEM = 24,
381
- GCRYCTL_TERM_SECMEM = 25,
382
- GCRYCTL_DISABLE_SECMEM_WARN = 27,
383
- GCRYCTL_SUSPEND_SECMEM_WARN = 28,
384
- GCRYCTL_RESUME_SECMEM_WARN = 29,
385
- GCRYCTL_DROP_PRIVS = 30,
386
- GCRYCTL_ENABLE_M_GUARD = 31,
387
- GCRYCTL_START_DUMP = 32,
388
- GCRYCTL_STOP_DUMP = 33,
389
- GCRYCTL_GET_ALGO_USAGE = 34,
390
- GCRYCTL_IS_ALGO_ENABLED = 35,
391
- GCRYCTL_DISABLE_INTERNAL_LOCKING = 36,
392
- GCRYCTL_DISABLE_SECMEM = 37,
393
- GCRYCTL_INITIALIZATION_FINISHED = 38,
394
- GCRYCTL_INITIALIZATION_FINISHED_P = 39,
395
- GCRYCTL_ANY_INITIALIZATION_P = 40,
396
- GCRYCTL_SET_CBC_CTS = 41,
397
- GCRYCTL_SET_CBC_MAC = 42,
398
- GCRYCTL_SET_CTR = 43,
399
- GCRYCTL_ENABLE_QUICK_RANDOM = 44,
400
- GCRYCTL_SET_RANDOM_SEED_FILE = 45,
401
- GCRYCTL_UPDATE_RANDOM_SEED_FILE = 46,
402
- GCRYCTL_SET_THREAD_CBS = 47,
403
- GCRYCTL_FAST_POLL = 48,
404
- GCRYCTL_SET_RANDOM_DAEMON_SOCKET = 49,
405
- GCRYCTL_USE_RANDOM_DAEMON = 50,
406
- GCRYCTL_FAKED_RANDOM_P = 51,
407
- GCRYCTL_SET_RNDEGD_SOCKET = 52,
408
- GCRYCTL_PRINT_CONFIG = 53,
409
- GCRYCTL_OPERATIONAL_P = 54,
410
- GCRYCTL_FIPS_MODE_P = 55,
411
- GCRYCTL_FORCE_FIPS_MODE = 56,
412
- GCRYCTL_SELFTEST = 57
413
- };
414
-
415
- /* Perform various operations defined by CMD. */
416
- gcry_error_t gcry_control (enum gcry_ctl_cmds CMD, ...);
417
-
418
-
419
- /* S-expression management. */
420
-
421
- /* The object to represent an S-expression as used with the public key
422
- functions. */
423
- struct gcry_sexp;
424
- typedef struct gcry_sexp *gcry_sexp_t;
425
-
426
- #ifndef GCRYPT_NO_DEPRECATED
427
- typedef struct gcry_sexp *GCRY_SEXP _GCRY_GCC_ATTR_DEPRECATED;
428
- typedef struct gcry_sexp *GcrySexp _GCRY_GCC_ATTR_DEPRECATED;
429
- #endif
430
-
431
- /* The possible values for the S-expression format. */
432
- enum gcry_sexp_format
433
- {
434
- GCRYSEXP_FMT_DEFAULT = 0,
435
- GCRYSEXP_FMT_CANON = 1,
436
- GCRYSEXP_FMT_BASE64 = 2,
437
- GCRYSEXP_FMT_ADVANCED = 3
438
- };
439
-
440
- /* Create an new S-expression object from BUFFER of size LENGTH and
441
- return it in RETSEXP. With AUTODETECT set to 0 the data in BUFFER
442
- is expected to be in canonized format. */
443
- gcry_error_t gcry_sexp_new (gcry_sexp_t *retsexp,
444
- const void *buffer, size_t length,
445
- int autodetect);
446
-
447
- /* Same as gcry_sexp_new but allows to pass a FREEFNC which has the
448
- effect to transfer ownership of BUFFER to the created object. */
449
- gcry_error_t gcry_sexp_create (gcry_sexp_t *retsexp,
450
- void *buffer, size_t length,
451
- int autodetect, void (*freefnc) (void *));
452
-
453
- /* Scan BUFFER and return a new S-expression object in RETSEXP. This
454
- function expects a printf like string in BUFFER. */
455
- gcry_error_t gcry_sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
456
- const char *buffer, size_t length);
457
-
458
- /* Same as gcry_sexp_sscan but expects a string in FORMAT and can thus
459
- only be used for certain encodings. */
460
- gcry_error_t gcry_sexp_build (gcry_sexp_t *retsexp, size_t *erroff,
461
- const char *format, ...);
462
-
463
- /* Like gcry_sexp_build, but uses an array instead of variable
464
- function arguments. */
465
- gcry_error_t gcry_sexp_build_array (gcry_sexp_t *retsexp, size_t *erroff,
466
- const char *format, void **arg_list);
467
-
468
- /* Release the S-expression object SEXP */
469
- void gcry_sexp_release (gcry_sexp_t sexp);
470
-
471
- /* Calculate the length of an canonized S-expresion in BUFFER and
472
- check for a valid encoding. */
473
- size_t gcry_sexp_canon_len (const unsigned char *buffer, size_t length,
474
- size_t *erroff, gcry_error_t *errcode);
475
-
476
- /* Copies the S-expression object SEXP into BUFFER using the format
477
- specified in MODE. */
478
- size_t gcry_sexp_sprint (gcry_sexp_t sexp, int mode, void *buffer,
479
- size_t maxlength);
480
-
481
- /* Dumps the S-expression object A in a aformat suitable for debugging
482
- to Libgcrypt's logging stream. */
483
- void gcry_sexp_dump (const gcry_sexp_t a);
484
-
485
- gcry_sexp_t gcry_sexp_cons (const gcry_sexp_t a, const gcry_sexp_t b);
486
- gcry_sexp_t gcry_sexp_alist (const gcry_sexp_t *array);
487
- gcry_sexp_t gcry_sexp_vlist (const gcry_sexp_t a, ...);
488
- gcry_sexp_t gcry_sexp_append (const gcry_sexp_t a, const gcry_sexp_t n);
489
- gcry_sexp_t gcry_sexp_prepend (const gcry_sexp_t a, const gcry_sexp_t n);
490
-
491
- /* Scan the S-expression for a sublist with a type (the car of the
492
- list) matching the string TOKEN. If TOKLEN is not 0, the token is
493
- assumed to be raw memory of this length. The function returns a
494
- newly allocated S-expression consisting of the found sublist or
495
- `NULL' when not found. */
496
- gcry_sexp_t gcry_sexp_find_token (gcry_sexp_t list,
497
- const char *tok, size_t toklen);
498
- /* Return the length of the LIST. For a valid S-expression this
499
- should be at least 1. */
500
- int gcry_sexp_length (const gcry_sexp_t list);
501
-
502
- /* Create and return a new S-expression from the element with index
503
- NUMBER in LIST. Note that the first element has the index 0. If
504
- there is no such element, `NULL' is returned. */
505
- gcry_sexp_t gcry_sexp_nth (const gcry_sexp_t list, int number);
506
-
507
- /* Create and return a new S-expression from the first element in
508
- LIST; this called the "type" and should always exist and be a
509
- string. `NULL' is returned in case of a problem. */
510
- gcry_sexp_t gcry_sexp_car (const gcry_sexp_t list);
511
-
512
- /* Create and return a new list form all elements except for the first
513
- one. Note, that this function may return an invalid S-expression
514
- because it is not guaranteed, that the type exists and is a string.
515
- However, for parsing a complex S-expression it might be useful for
516
- intermediate lists. Returns `NULL' on error. */
517
- gcry_sexp_t gcry_sexp_cdr (const gcry_sexp_t list);
518
-
519
- gcry_sexp_t gcry_sexp_cadr (const gcry_sexp_t list);
520
-
521
-
522
- /* This function is used to get data from a LIST. A pointer to the
523
- actual data with index NUMBER is returned and the length of this
524
- data will be stored to DATALEN. If there is no data at the given
525
- index or the index represents another list, `NULL' is returned.
526
- *Note:* The returned pointer is valid as long as LIST is not
527
- modified or released. */
528
- const char *gcry_sexp_nth_data (const gcry_sexp_t list, int number,
529
- size_t *datalen);
530
-
531
- /* This function is used to get and convert data from a LIST. The
532
- data is assumed to be a Nul terminated string. The caller must
533
- release the returned value using `gcry_free'. If there is no data
534
- at the given index, the index represents a list or the value can't
535
- be converted to a string, `NULL' is returned. */
536
- char *gcry_sexp_nth_string (gcry_sexp_t list, int number);
537
-
538
- /* This function is used to get and convert data from a LIST. This
539
- data is assumed to be an MPI stored in the format described by
540
- MPIFMT and returned as a standard Libgcrypt MPI. The caller must
541
- release this returned value using `gcry_mpi_release'. If there is
542
- no data at the given index, the index represents a list or the
543
- value can't be converted to an MPI, `NULL' is returned. */
544
- gcry_mpi_t gcry_sexp_nth_mpi (gcry_sexp_t list, int number, int mpifmt);
545
-
546
-
547
-
548
- /*******************************************
549
- * *
550
- * Multi Precision Integer Functions *
551
- * *
552
- *******************************************/
553
-
554
- /* Different formats of external big integer representation. */
555
- enum gcry_mpi_format
556
- {
557
- GCRYMPI_FMT_NONE= 0,
558
- GCRYMPI_FMT_STD = 1, /* Twos complement stored without length. */
559
- GCRYMPI_FMT_PGP = 2, /* As used by OpenPGP (unsigned only). */
560
- GCRYMPI_FMT_SSH = 3, /* As used by SSH (like STD but with length). */
561
- GCRYMPI_FMT_HEX = 4, /* Hex format. */
562
- GCRYMPI_FMT_USG = 5 /* Like STD but unsigned. */
563
- };
564
-
565
- /* Flags used for creating big integers. */
566
- enum gcry_mpi_flag
567
- {
568
- GCRYMPI_FLAG_SECURE = 1, /* Allocate the number in "secure" memory. */
569
- GCRYMPI_FLAG_OPAQUE = 2 /* The number is not a real one but just
570
- a way to store some bytes. This is
571
- useful for encrypted big integers. */
572
- };
573
-
574
-
575
- /* Allocate a new big integer object, initialize it with 0 and
576
- initially allocate memory for a number of at least NBITS. */
577
- gcry_mpi_t gcry_mpi_new (unsigned int nbits);
578
-
579
- /* Same as gcry_mpi_new() but allocate in "secure" memory. */
580
- gcry_mpi_t gcry_mpi_snew (unsigned int nbits);
581
-
582
- /* Release the number A and free all associated resources. */
583
- void gcry_mpi_release (gcry_mpi_t a);
584
-
585
- /* Create a new number with the same value as A. */
586
- gcry_mpi_t gcry_mpi_copy (const gcry_mpi_t a);
587
-
588
- /* Store the big integer value U in W. */
589
- gcry_mpi_t gcry_mpi_set (gcry_mpi_t w, const gcry_mpi_t u);
590
-
591
- /* Store the unsigned integer value U in W. */
592
- gcry_mpi_t gcry_mpi_set_ui (gcry_mpi_t w, unsigned long u);
593
-
594
- /* Swap the values of A and B. */
595
- void gcry_mpi_swap (gcry_mpi_t a, gcry_mpi_t b);
596
-
597
- /* Compare the big integer number U and V returning 0 for equality, a
598
- positive value for U > V and a negative for U < V. */
599
- int gcry_mpi_cmp (const gcry_mpi_t u, const gcry_mpi_t v);
600
-
601
- /* Compare the big integer number U with the unsigned integer V
602
- returning 0 for equality, a positive value for U > V and a negative
603
- for U < V. */
604
- int gcry_mpi_cmp_ui (const gcry_mpi_t u, unsigned long v);
605
-
606
- /* Convert the external representation of an integer stored in BUFFER
607
- with a length of BUFLEN into a newly create MPI returned in
608
- RET_MPI. If NSCANNED is not NULL, it will receive the number of
609
- bytes actually scanned after a successful operation. */
610
- gcry_error_t gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format,
611
- const void *buffer, size_t buflen,
612
- size_t *nscanned);
613
-
614
- /* Convert the big integer A into the external representation
615
- described by FORMAT and store it in the provided BUFFER which has
616
- been allocated by the user with a size of BUFLEN bytes. NWRITTEN
617
- receives the actual length of the external representation unless it
618
- has been passed as NULL. */
619
- gcry_error_t gcry_mpi_print (enum gcry_mpi_format format,
620
- unsigned char *buffer, size_t buflen,
621
- size_t *nwritten,
622
- const gcry_mpi_t a);
623
-
624
- /* Convert the big integer A int the external representation described
625
- by FORMAT and store it in a newly allocated buffer which address
626
- will be put into BUFFER. NWRITTEN receives the actual lengths of the
627
- external representation. */
628
- gcry_error_t gcry_mpi_aprint (enum gcry_mpi_format format,
629
- unsigned char **buffer, size_t *nwritten,
630
- const gcry_mpi_t a);
631
-
632
- /* Dump the value of A in a format suitable for debugging to
633
- Libgcrypt's logging stream. Note that one leading space but no
634
- trailing space or linefeed will be printed. It is okay to pass
635
- NULL for A. */
636
- void gcry_mpi_dump (const gcry_mpi_t a);
637
-
638
-
639
- /* W = U + V. */
640
- void gcry_mpi_add (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
641
-
642
- /* W = U + V. V is an unsigned integer. */
643
- void gcry_mpi_add_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v);
644
-
645
- /* W = U + V mod M. */
646
- void gcry_mpi_addm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
647
-
648
- /* W = U - V. */
649
- void gcry_mpi_sub (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
650
-
651
- /* W = U - V. V is an unsigned integer. */
652
- void gcry_mpi_sub_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v );
653
-
654
- /* W = U - V mod M */
655
- void gcry_mpi_subm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
656
-
657
- /* W = U * V. */
658
- void gcry_mpi_mul (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
659
-
660
- /* W = U * V. V is an unsigned integer. */
661
- void gcry_mpi_mul_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v );
662
-
663
- /* W = U * V mod M. */
664
- void gcry_mpi_mulm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
665
-
666
- /* W = U * (2 ^ CNT). */
667
- void gcry_mpi_mul_2exp (gcry_mpi_t w, gcry_mpi_t u, unsigned long cnt);
668
-
669
- /* Q = DIVIDEND / DIVISOR, R = DIVIDEND % DIVISOR,
670
- Q or R may be passed as NULL. ROUND should be negative or 0. */
671
- void gcry_mpi_div (gcry_mpi_t q, gcry_mpi_t r,
672
- gcry_mpi_t dividend, gcry_mpi_t divisor, int round);
673
-
674
- /* R = DIVIDEND % DIVISOR */
675
- void gcry_mpi_mod (gcry_mpi_t r, gcry_mpi_t dividend, gcry_mpi_t divisor);
676
-
677
- /* W = B ^ E mod M. */
678
- void gcry_mpi_powm (gcry_mpi_t w,
679
- const gcry_mpi_t b, const gcry_mpi_t e,
680
- const gcry_mpi_t m);
681
-
682
- /* Set G to the greatest common divisor of A and B.
683
- Return true if the G is 1. */
684
- int gcry_mpi_gcd (gcry_mpi_t g, gcry_mpi_t a, gcry_mpi_t b);
685
-
686
- /* Set X to the multiplicative inverse of A mod M.
687
- Return true if the value exists. */
688
- int gcry_mpi_invm (gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t m);
689
-
690
-
691
- /* Return the number of bits required to represent A. */
692
- unsigned int gcry_mpi_get_nbits (gcry_mpi_t a);
693
-
694
- /* Return true when bit number N (counting from 0) is set in A. */
695
- int gcry_mpi_test_bit (gcry_mpi_t a, unsigned int n);
696
-
697
- /* Set bit number N in A. */
698
- void gcry_mpi_set_bit (gcry_mpi_t a, unsigned int n);
699
-
700
- /* Clear bit number N in A. */
701
- void gcry_mpi_clear_bit (gcry_mpi_t a, unsigned int n);
702
-
703
- /* Set bit number N in A and clear all bits greater than N. */
704
- void gcry_mpi_set_highbit (gcry_mpi_t a, unsigned int n);
705
-
706
- /* Clear bit number N in A and all bits greater than N. */
707
- void gcry_mpi_clear_highbit (gcry_mpi_t a, unsigned int n);
708
-
709
- /* Shift the value of A by N bits to the right and store the result in X. */
710
- void gcry_mpi_rshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
711
-
712
- /* Shift the value of A by N bits to the left and store the result in X. */
713
- void gcry_mpi_lshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
714
-
715
- /* Store NBITS of the value P points to in A and mark A as an opaque
716
- value. WARNING: Never use an opaque MPI for anything thing else then
717
- gcry_mpi_release, gcry_mpi_get_opaque. */
718
- gcry_mpi_t gcry_mpi_set_opaque (gcry_mpi_t a, void *p, unsigned int nbits);
719
-
720
- /* Return a pointer to an opaque value stored in A and return its size
721
- in NBITS. Note that the returned pointer is still owned by A and
722
- that the function should never be used for an non-opaque MPI. */
723
- void *gcry_mpi_get_opaque (gcry_mpi_t a, unsigned int *nbits);
724
-
725
- /* Set the FLAG for the big integer A. Currently only the flag
726
- GCRYMPI_FLAG_SECURE is allowed to convert A into an big intger
727
- stored in "secure" memory. */
728
- void gcry_mpi_set_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
729
-
730
- /* Clear FLAG for the big integer A. Note that this function is
731
- currently useless as no flags are allowed. */
732
- void gcry_mpi_clear_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
733
-
734
- /* Return true when the FLAG is set for A. */
735
- int gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
736
-
737
- /* Unless the GCRYPT_NO_MPI_MACROS is used, provide a couple of
738
- convenience macros for the big integer functions. */
739
- #ifndef GCRYPT_NO_MPI_MACROS
740
- #define mpi_new(n) gcry_mpi_new( (n) )
741
- #define mpi_secure_new( n ) gcry_mpi_snew( (n) )
742
- #define mpi_release(a) \
743
- do \
744
- { \
745
- gcry_mpi_release ((a)); \
746
- (a) = NULL; \
747
- } \
748
- while (0)
749
-
750
- #define mpi_copy( a ) gcry_mpi_copy( (a) )
751
- #define mpi_set( w, u) gcry_mpi_set( (w), (u) )
752
- #define mpi_set_ui( w, u) gcry_mpi_set_ui( (w), (u) )
753
- #define mpi_cmp( u, v ) gcry_mpi_cmp( (u), (v) )
754
- #define mpi_cmp_ui( u, v ) gcry_mpi_cmp_ui( (u), (v) )
755
-
756
- #define mpi_add_ui(w,u,v) gcry_mpi_add_ui((w),(u),(v))
757
- #define mpi_add(w,u,v) gcry_mpi_add ((w),(u),(v))
758
- #define mpi_addm(w,u,v,m) gcry_mpi_addm ((w),(u),(v),(m))
759
- #define mpi_sub_ui(w,u,v) gcry_mpi_sub_ui ((w),(u),(v))
760
- #define mpi_sub(w,u,v) gcry_mpi_sub ((w),(u),(v))
761
- #define mpi_subm(w,u,v,m) gcry_mpi_subm ((w),(u),(v),(m))
762
- #define mpi_mul_ui(w,u,v) gcry_mpi_mul_ui ((w),(u),(v))
763
- #define mpi_mul_2exp(w,u,v) gcry_mpi_mul_2exp ((w),(u),(v))
764
- #define mpi_mul(w,u,v) gcry_mpi_mul ((w),(u),(v))
765
- #define mpi_mulm(w,u,v,m) gcry_mpi_mulm ((w),(u),(v),(m))
766
- #define mpi_powm(w,b,e,m) gcry_mpi_powm ( (w), (b), (e), (m) )
767
- #define mpi_tdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), 0)
768
- #define mpi_fdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), -1)
769
- #define mpi_mod(r,a,m) gcry_mpi_mod ((r), (a), (m))
770
- #define mpi_gcd(g,a,b) gcry_mpi_gcd ( (g), (a), (b) )
771
- #define mpi_invm(g,a,b) gcry_mpi_invm ( (g), (a), (b) )
772
-
773
- #define mpi_get_nbits(a) gcry_mpi_get_nbits ((a))
774
- #define mpi_test_bit(a,b) gcry_mpi_test_bit ((a),(b))
775
- #define mpi_set_bit(a,b) gcry_mpi_set_bit ((a),(b))
776
- #define mpi_set_highbit(a,b) gcry_mpi_set_highbit ((a),(b))
777
- #define mpi_clear_bit(a,b) gcry_mpi_clear_bit ((a),(b))
778
- #define mpi_clear_highbit(a,b) gcry_mpi_clear_highbit ((a),(b))
779
- #define mpi_rshift(a,b,c) gcry_mpi_rshift ((a),(b),(c))
780
- #define mpi_lshift(a,b,c) gcry_mpi_lshift ((a),(b),(c))
781
-
782
- #define mpi_set_opaque(a,b,c) gcry_mpi_set_opaque( (a), (b), (c) )
783
- #define mpi_get_opaque(a,b) gcry_mpi_get_opaque( (a), (b) )
784
- #endif /* GCRYPT_NO_MPI_MACROS */
785
-
786
-
787
-
788
- /************************************
789
- * *
790
- * Symmetric Cipher Functions *
791
- * *
792
- ************************************/
793
-
794
- /* The data object used to hold a handle to an encryption object. */
795
- struct gcry_cipher_handle;
796
- typedef struct gcry_cipher_handle *gcry_cipher_hd_t;
797
-
798
- #ifndef GCRYPT_NO_DEPRECATED
799
- typedef struct gcry_cipher_handle *GCRY_CIPHER_HD _GCRY_GCC_ATTR_DEPRECATED;
800
- typedef struct gcry_cipher_handle *GcryCipherHd _GCRY_GCC_ATTR_DEPRECATED;
801
- #endif
802
-
803
- /* All symmetric encryption algorithms are identified by their IDs.
804
- More IDs may be registered at runtime. */
805
- enum gcry_cipher_algos
806
- {
807
- GCRY_CIPHER_NONE = 0,
808
- GCRY_CIPHER_IDEA = 1,
809
- GCRY_CIPHER_3DES = 2,
810
- GCRY_CIPHER_CAST5 = 3,
811
- GCRY_CIPHER_BLOWFISH = 4,
812
- GCRY_CIPHER_SAFER_SK128 = 5,
813
- GCRY_CIPHER_DES_SK = 6,
814
- GCRY_CIPHER_AES = 7,
815
- GCRY_CIPHER_AES192 = 8,
816
- GCRY_CIPHER_AES256 = 9,
817
- GCRY_CIPHER_TWOFISH = 10,
818
-
819
- /* Other cipher numbers are above 300 for OpenPGP reasons. */
820
- GCRY_CIPHER_ARCFOUR = 301, /* Fully compatible with RSA's RC4 (tm). */
821
- GCRY_CIPHER_DES = 302, /* Yes, this is single key 56 bit DES. */
822
- GCRY_CIPHER_TWOFISH128 = 303,
823
- GCRY_CIPHER_SERPENT128 = 304,
824
- GCRY_CIPHER_SERPENT192 = 305,
825
- GCRY_CIPHER_SERPENT256 = 306,
826
- GCRY_CIPHER_RFC2268_40 = 307, /* Ron's Cipher 2 (40 bit). */
827
- GCRY_CIPHER_RFC2268_128 = 308, /* Ron's Cipher 2 (128 bit). */
828
- GCRY_CIPHER_SEED = 309, /* 128 bit cipher described in RFC4269. */
829
- GCRY_CIPHER_CAMELLIA128 = 310,
830
- GCRY_CIPHER_CAMELLIA192 = 311,
831
- GCRY_CIPHER_CAMELLIA256 = 312
832
- };
833
-
834
- /* The Rijndael algorithm is basically AES, so provide some macros. */
835
- #define GCRY_CIPHER_AES128 GCRY_CIPHER_AES
836
- #define GCRY_CIPHER_RIJNDAEL GCRY_CIPHER_AES
837
- #define GCRY_CIPHER_RIJNDAEL128 GCRY_CIPHER_AES128
838
- #define GCRY_CIPHER_RIJNDAEL192 GCRY_CIPHER_AES192
839
- #define GCRY_CIPHER_RIJNDAEL256 GCRY_CIPHER_AES256
840
-
841
- /* The supported encryption modes. Note that not all of them are
842
- supported for each algorithm. */
843
- enum gcry_cipher_modes
844
- {
845
- GCRY_CIPHER_MODE_NONE = 0, /* Not yet specified. */
846
- GCRY_CIPHER_MODE_ECB = 1, /* Electronic codebook. */
847
- GCRY_CIPHER_MODE_CFB = 2, /* Cipher feedback. */
848
- GCRY_CIPHER_MODE_CBC = 3, /* Cipher block chaining. */
849
- GCRY_CIPHER_MODE_STREAM = 4, /* Used with stream ciphers. */
850
- GCRY_CIPHER_MODE_OFB = 5, /* Outer feedback. */
851
- GCRY_CIPHER_MODE_CTR = 6 /* Counter. */
852
- };
853
-
854
- /* Flags used with the open function. */
855
- enum gcry_cipher_flags
856
- {
857
- GCRY_CIPHER_SECURE = 1, /* Allocate in secure memory. */
858
- GCRY_CIPHER_ENABLE_SYNC = 2, /* Enable CFB sync mode. */
859
- GCRY_CIPHER_CBC_CTS = 4, /* Enable CBC cipher text stealing (CTS). */
860
- GCRY_CIPHER_CBC_MAC = 8 /* Enable CBC message auth. code (MAC). */
861
- };
862
-
863
-
864
- /* Create a handle for algorithm ALGO to be used in MODE. FLAGS may
865
- be given as an bitwise OR of the gcry_cipher_flags values. */
866
- gcry_error_t gcry_cipher_open (gcry_cipher_hd_t *handle,
867
- int algo, int mode, unsigned int flags);
868
-
869
- /* Close the cioher handle H and release all resource. */
870
- void gcry_cipher_close (gcry_cipher_hd_t h);
871
-
872
- /* Perform various operations on the cipher object H. */
873
- gcry_error_t gcry_cipher_ctl (gcry_cipher_hd_t h, int cmd, void *buffer,
874
- size_t buflen);
875
-
876
- /* Retrieve various information about the cipher object H. */
877
- gcry_error_t gcry_cipher_info (gcry_cipher_hd_t h, int what, void *buffer,
878
- size_t *nbytes);
879
-
880
- /* Retrieve various information about the cipher algorithm ALGO. */
881
- gcry_error_t gcry_cipher_algo_info (int algo, int what, void *buffer,
882
- size_t *nbytes);
883
-
884
- /* Map the cipher algorithm whose ID is contained in ALGORITHM to a
885
- string representation of the algorithm name. For unknown algorithm
886
- IDs this function returns "?". */
887
- const char *gcry_cipher_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
888
-
889
- /* Map the algorithm name NAME to an cipher algorithm ID. Return 0 if
890
- the algorithm name is not known. */
891
- int gcry_cipher_map_name (const char *name) _GCRY_GCC_ATTR_PURE;
892
-
893
- /* Given an ASN.1 object identifier in standard IETF dotted decimal
894
- format in STRING, return the encryption mode associated with that
895
- OID or 0 if not known or applicable. */
896
- int gcry_cipher_mode_from_oid (const char *string) _GCRY_GCC_ATTR_PURE;
897
-
898
- /* Encrypt the plaintext of size INLEN in IN using the cipher handle H
899
- into the buffer OUT which has an allocated length of OUTSIZE. For
900
- most algorithms it is possible to pass NULL for in and 0 for INLEN
901
- and do a in-place decryption of the data provided in OUT. */
902
- gcry_error_t gcry_cipher_encrypt (gcry_cipher_hd_t h,
903
- void *out, size_t outsize,
904
- const void *in, size_t inlen);
905
-
906
- /* The counterpart to gcry_cipher_encrypt. */
907
- gcry_error_t gcry_cipher_decrypt (gcry_cipher_hd_t h,
908
- void *out, size_t outsize,
909
- const void *in, size_t inlen);
910
-
911
- /* Set KEY of length KEYLEN for the cipher handle HD. */
912
- gcry_error_t gcry_cipher_setkey (gcry_cipher_hd_t hd,
913
- const void *key, size_t keylen);
914
-
915
-
916
- /* Set initialization vector IV of length IVLEN for the cipher handle HD. */
917
- gcry_error_t gcry_cipher_setiv (gcry_cipher_hd_t hd,
918
- const void *iv, size_t ivlen);
919
-
920
-
921
- /* Reset the handle to the state after open. */
922
- #define gcry_cipher_reset(h) gcry_cipher_ctl ((h), GCRYCTL_RESET, NULL, 0)
923
-
924
- /* Perform the OpenPGP sync operation if this is enabled for the
925
- cipher handle H. */
926
- #define gcry_cipher_sync(h) gcry_cipher_ctl( (h), GCRYCTL_CFB_SYNC, NULL, 0)
927
-
928
- /* Enable or disable CTS in future calls to gcry_encrypt(). CBC mode only. */
929
- #define gcry_cipher_cts(h,on) gcry_cipher_ctl( (h), GCRYCTL_SET_CBC_CTS, \
930
- NULL, on )
931
-
932
- /* Set counter for CTR mode. (CTR,CTRLEN) must denote a buffer of
933
- block size length, or (NULL,0) to set the CTR to the all-zero block. */
934
- gpg_error_t gcry_cipher_setctr (gcry_cipher_hd_t hd,
935
- const void *ctr, size_t ctrlen);
936
-
937
- /* Retrieved the key length used with algorithm A. */
938
- size_t gcry_cipher_get_algo_keylen (int algo);
939
-
940
- /* Retrieve the block length used with algorithm A. */
941
- size_t gcry_cipher_get_algo_blklen (int algo);
942
-
943
- /* Return 0 if the algorithm A is available for use. */
944
- #define gcry_cipher_test_algo(a) \
945
- gcry_cipher_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
946
-
947
- /* Get a list consisting of the IDs of the loaded cipher modules. If
948
- LIST is zero, write the number of loaded cipher modules to
949
- LIST_LENGTH and return. If LIST is non-zero, the first
950
- *LIST_LENGTH algorithm IDs are stored in LIST, which must be of
951
- according size. In case there are less cipher modules than
952
- *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */
953
- gcry_error_t gcry_cipher_list (int *list, int *list_length);
954
-
955
-
956
- /************************************
957
- * *
958
- * Asymmetric Cipher Functions *
959
- * *
960
- ************************************/
961
-
962
- /* The algorithms and their IDs we support. */
963
- enum gcry_pk_algos
964
- {
965
- GCRY_PK_RSA = 1,
966
- GCRY_PK_RSA_E = 2, /* (deprecated) */
967
- GCRY_PK_RSA_S = 3, /* (deprecated) */
968
- GCRY_PK_ELG_E = 16,
969
- GCRY_PK_DSA = 17,
970
- GCRY_PK_ELG = 20,
971
- GCRY_PK_ECDSA = 301
972
- };
973
-
974
- /* Flags describing usage capabilities of a PK algorithm. */
975
- #define GCRY_PK_USAGE_SIGN 1 /* Good for signatures. */
976
- #define GCRY_PK_USAGE_ENCR 2 /* Good for encryption. */
977
- #define GCRY_PK_USAGE_CERT 4 /* Good to certify other keys. */
978
- #define GCRY_PK_USAGE_AUTH 8 /* Good for authentication. */
979
- #define GCRY_PK_USAGE_UNKN 128 /* Unknown usage flag. */
980
-
981
- /* Encrypt the DATA using the public key PKEY and store the result as
982
- a newly created S-expression at RESULT. */
983
- gcry_error_t gcry_pk_encrypt (gcry_sexp_t *result,
984
- gcry_sexp_t data, gcry_sexp_t pkey);
985
-
986
- /* Decrypt the DATA using the private key SKEY and store the result as
987
- a newly created S-expression at RESULT. */
988
- gcry_error_t gcry_pk_decrypt (gcry_sexp_t *result,
989
- gcry_sexp_t data, gcry_sexp_t skey);
990
-
991
- /* Sign the DATA using the private key SKEY and store the result as
992
- a newly created S-expression at RESULT. */
993
- gcry_error_t gcry_pk_sign (gcry_sexp_t *result,
994
- gcry_sexp_t data, gcry_sexp_t skey);
995
-
996
- /* Check the signature SIGVAL on DATA using the public key PKEY. */
997
- gcry_error_t gcry_pk_verify (gcry_sexp_t sigval,
998
- gcry_sexp_t data, gcry_sexp_t pkey);
999
-
1000
- /* Check that private KEY is sane. */
1001
- gcry_error_t gcry_pk_testkey (gcry_sexp_t key);
1002
-
1003
- /* Generate a new key pair according to the parameters given in
1004
- S_PARMS. The new key pair is returned in as an S-expression in
1005
- R_KEY. */
1006
- gcry_error_t gcry_pk_genkey (gcry_sexp_t *r_key, gcry_sexp_t s_parms);
1007
-
1008
- /* Catch all function for miscellaneous operations. */
1009
- gcry_error_t gcry_pk_ctl (int cmd, void *buffer, size_t buflen);
1010
-
1011
- /* Retrieve information about the public key algorithm ALGO. */
1012
- gcry_error_t gcry_pk_algo_info (int algo, int what,
1013
- void *buffer, size_t *nbytes);
1014
-
1015
- /* Map the public key algorithm whose ID is contained in ALGORITHM to
1016
- a string representation of the algorithm name. For unknown
1017
- algorithm IDs this functions returns "?". */
1018
- const char *gcry_pk_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
1019
-
1020
- /* Map the algorithm NAME to a public key algorithm Id. Return 0 if
1021
- the algorithm name is not known. */
1022
- int gcry_pk_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
1023
-
1024
- /* Return what is commonly referred as the key length for the given
1025
- public or private KEY. */
1026
- unsigned int gcry_pk_get_nbits (gcry_sexp_t key) _GCRY_GCC_ATTR_PURE;
1027
-
1028
- /* Please note that keygrip is still experimental and should not be
1029
- used without contacting the author. */
1030
- unsigned char *gcry_pk_get_keygrip (gcry_sexp_t key, unsigned char *array);
1031
-
1032
- /* Return 0 if the public key algorithm A is available for use. */
1033
- #define gcry_pk_test_algo(a) \
1034
- gcry_pk_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
1035
-
1036
- /* Get a list consisting of the IDs of the loaded pubkey modules. If
1037
- LIST is zero, write the number of loaded pubkey modules to
1038
- LIST_LENGTH and return. If LIST is non-zero, the first
1039
- *LIST_LENGTH algorithm IDs are stored in LIST, which must be of
1040
- according size. In case there are less pubkey modules than
1041
- *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */
1042
- gcry_error_t gcry_pk_list (int *list, int *list_length);
1043
-
1044
-
1045
-
1046
- /************************************
1047
- * *
1048
- * Cryptograhic Hash Functions *
1049
- * *
1050
- ************************************/
1051
-
1052
- /* Algorithm IDs for the hash functions we know about. Not all of them
1053
- are implemnted. */
1054
- enum gcry_md_algos
1055
- {
1056
- GCRY_MD_NONE = 0,
1057
- GCRY_MD_MD5 = 1,
1058
- GCRY_MD_SHA1 = 2,
1059
- GCRY_MD_RMD160 = 3,
1060
- GCRY_MD_MD2 = 5,
1061
- GCRY_MD_TIGER = 6, /* TIGER/192. */
1062
- GCRY_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */
1063
- GCRY_MD_SHA256 = 8,
1064
- GCRY_MD_SHA384 = 9,
1065
- GCRY_MD_SHA512 = 10,
1066
- GCRY_MD_SHA224 = 11,
1067
- GCRY_MD_MD4 = 301,
1068
- GCRY_MD_CRC32 = 302,
1069
- GCRY_MD_CRC32_RFC1510 = 303,
1070
- GCRY_MD_CRC24_RFC2440 = 304,
1071
- GCRY_MD_WHIRLPOOL = 305
1072
- };
1073
-
1074
- /* Flags used with the open function. */
1075
- enum gcry_md_flags
1076
- {
1077
- GCRY_MD_FLAG_SECURE = 1, /* Allocate all buffers in "secure" memory. */
1078
- GCRY_MD_FLAG_HMAC = 2 /* Make an HMAC out of this algorithm. */
1079
- };
1080
-
1081
- /* (Forward declaration.) */
1082
- struct gcry_md_context;
1083
-
1084
- /* This object is used to hold a handle to a message digest object.
1085
- This structure is private - only to be used by the public gcry_md_*
1086
- macros. */
1087
- typedef struct gcry_md_handle
1088
- {
1089
- /* Actual context. */
1090
- struct gcry_md_context *ctx;
1091
-
1092
- /* Buffer management. */
1093
- int bufpos;
1094
- int bufsize;
1095
- unsigned char buf[1];
1096
- } *gcry_md_hd_t;
1097
-
1098
- /* Compatibility types, do not use them. */
1099
- #ifndef GCRYPT_NO_DEPRECATED
1100
- typedef struct gcry_md_handle *GCRY_MD_HD _GCRY_GCC_ATTR_DEPRECATED;
1101
- typedef struct gcry_md_handle *GcryMDHd _GCRY_GCC_ATTR_DEPRECATED;
1102
- #endif
1103
-
1104
- /* Create a message digest object for algorithm ALGO. FLAGS may be
1105
- given as an bitwise OR of the gcry_md_flags values. ALGO may be
1106
- given as 0 if the algorithms to be used are later set using
1107
- gcry_md_enable. */
1108
- gcry_error_t gcry_md_open (gcry_md_hd_t *h, int algo, unsigned int flags);
1109
-
1110
- /* Release the message digest object HD. */
1111
- void gcry_md_close (gcry_md_hd_t hd);
1112
-
1113
- /* Add the message digest algorithm ALGO to the digest object HD. */
1114
- gcry_error_t gcry_md_enable (gcry_md_hd_t hd, int algo);
1115
-
1116
- /* Create a new digest object as an exact copy of the object HD. */
1117
- gcry_error_t gcry_md_copy (gcry_md_hd_t *bhd, gcry_md_hd_t ahd);
1118
-
1119
- /* Reset the digest object HD to its initial state. */
1120
- void gcry_md_reset (gcry_md_hd_t hd);
1121
-
1122
- /* Perform various operations on the digest object HD. */
1123
- gcry_error_t gcry_md_ctl (gcry_md_hd_t hd, int cmd,
1124
- void *buffer, size_t buflen);
1125
-
1126
- /* Pass LENGTH bytes of data in BUFFER to the digest object HD so that
1127
- it can update the digest values. This is the actual hash
1128
- function. */
1129
- void gcry_md_write (gcry_md_hd_t hd, const void *buffer, size_t length);
1130
-
1131
- /* Read out the final digest from HD return the digest value for
1132
- algorithm ALGO. */
1133
- unsigned char *gcry_md_read (gcry_md_hd_t hd, int algo);
1134
-
1135
- /* Convenience function to calculate the hash from the data in BUFFER
1136
- of size LENGTH using the algorithm ALGO avoiding the creating of a
1137
- hash object. The hash is returned in the caller provided buffer
1138
- DIGEST which must be large enough to hold the digest of the given
1139
- algorithm. */
1140
- void gcry_md_hash_buffer (int algo, void *digest,
1141
- const void *buffer, size_t length);
1142
-
1143
- /* Retrieve the algorithm used with HD. This does not work reliable
1144
- if more than one algorithm is enabled in HD. */
1145
- int gcry_md_get_algo (gcry_md_hd_t hd);
1146
-
1147
- /* Retrieve the length in bytes of the digest yielded by algorithm
1148
- ALGO. */
1149
- unsigned int gcry_md_get_algo_dlen (int algo);
1150
-
1151
- /* Return true if the the algorithm ALGO is enabled in the digest
1152
- object A. */
1153
- int gcry_md_is_enabled (gcry_md_hd_t a, int algo);
1154
-
1155
- /* Return true if the digest object A is allocated in "secure" memory. */
1156
- int gcry_md_is_secure (gcry_md_hd_t a);
1157
-
1158
- /* Retrieve various information about the object H. */
1159
- gcry_error_t gcry_md_info (gcry_md_hd_t h, int what, void *buffer,
1160
- size_t *nbytes);
1161
-
1162
- /* Retrieve various information about the algorithm ALGO. */
1163
- gcry_error_t gcry_md_algo_info (int algo, int what, void *buffer,
1164
- size_t *nbytes);
1165
-
1166
- /* Map the digest algorithm id ALGO to a string representation of the
1167
- algorithm name. For unknown algorithms this functions returns
1168
- "?". */
1169
- const char *gcry_md_algo_name (int algo) _GCRY_GCC_ATTR_PURE;
1170
-
1171
- /* Map the algorithm NAME to a digest algorithm Id. Return 0 if
1172
- the algorithm name is not known. */
1173
- int gcry_md_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
1174
-
1175
- /* For use with the HMAC feature, the set MAC key to the KEY of
1176
- KEYLEN. */
1177
- gcry_error_t gcry_md_setkey (gcry_md_hd_t hd, const void *key, size_t keylen);
1178
-
1179
- /* Start or stop debugging for digest handle HD; i.e. create a file
1180
- named dbgmd-<n>.<suffix> while hashing. If SUFFIX is NULL,
1181
- debugging stops and the file will be closed. */
1182
- void gcry_md_debug (gcry_md_hd_t hd, const char *suffix);
1183
-
1184
-
1185
- /* Update the hash(s) of H with the character C. This is a buffered
1186
- version of the gcry_md_write function. */
1187
- #define gcry_md_putc(h,c) \
1188
- do { \
1189
- gcry_md_hd_t h__ = (h); \
1190
- if( (h__)->bufpos == (h__)->bufsize ) \
1191
- gcry_md_write( (h__), NULL, 0 ); \
1192
- (h__)->buf[(h__)->bufpos++] = (c) & 0xff; \
1193
- } while(0)
1194
-
1195
- /* Finalize the digest calculation. This is not really needed because
1196
- gcry_md_read() does this implicitly. */
1197
- #define gcry_md_final(a) \
1198
- gcry_md_ctl ((a), GCRYCTL_FINALIZE, NULL, 0)
1199
-
1200
- /* Return 0 if the algorithm A is available for use. */
1201
- #define gcry_md_test_algo(a) \
1202
- gcry_md_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
1203
-
1204
- /* Return an DER encoded ASN.1 OID for the algorithm A in buffer B. N
1205
- must point to size_t variable with the available size of buffer B.
1206
- After return it will receive the actual size of the returned
1207
- OID. */
1208
- #define gcry_md_get_asnoid(a,b,n) \
1209
- gcry_md_algo_info((a), GCRYCTL_GET_ASNOID, (b), (n))
1210
-
1211
- /* Enable debugging for digest object A; i.e. create files named
1212
- dbgmd-<n>.<string> while hashing. B is a string used as the suffix
1213
- for the filename. This macro is deprecated, use gcry_md_debug. */
1214
- #ifndef GCRYPT_NO_DEPRECATED
1215
- #define gcry_md_start_debug(a,b) \
1216
- gcry_md_ctl( (a), GCRYCTL_START_DUMP, (b), 0 )
1217
-
1218
- /* Disable the debugging of A. This macro is deprecated, use
1219
- gcry_md_debug. */
1220
- #define gcry_md_stop_debug(a,b) \
1221
- gcry_md_ctl( (a), GCRYCTL_STOP_DUMP, (b), 0 )
1222
- #endif
1223
-
1224
- /* Get a list consisting of the IDs of the loaded message digest
1225
- modules. If LIST is zero, write the number of loaded message
1226
- digest modules to LIST_LENGTH and return. If LIST is non-zero, the
1227
- first *LIST_LENGTH algorithm IDs are stored in LIST, which must be
1228
- of according size. In case there are less message digest modules
1229
- than *LIST_LENGTH, *LIST_LENGTH is updated to the correct
1230
- number. */
1231
- gcry_error_t gcry_md_list (int *list, int *list_length);
1232
-
1233
-
1234
-
1235
- /* Alternative interface for asymmetric cryptography. This interface
1236
- is deprecated. */
1237
-
1238
- /* The algorithm IDs. */
1239
- typedef enum gcry_ac_id
1240
- {
1241
- GCRY_AC_RSA = 1,
1242
- GCRY_AC_DSA = 17,
1243
- GCRY_AC_ELG = 20,
1244
- GCRY_AC_ELG_E = 16
1245
- }
1246
- gcry_ac_id_t;
1247
-
1248
- /* Key types. */
1249
- typedef enum gcry_ac_key_type
1250
- {
1251
- GCRY_AC_KEY_SECRET,
1252
- GCRY_AC_KEY_PUBLIC
1253
- }
1254
- gcry_ac_key_type_t;
1255
-
1256
- /* Encoding methods. */
1257
- typedef enum gcry_ac_em
1258
- {
1259
- GCRY_AC_EME_PKCS_V1_5,
1260
- GCRY_AC_EMSA_PKCS_V1_5
1261
- }
1262
- gcry_ac_em_t;
1263
-
1264
- /* Encryption and Signature schemes. */
1265
- typedef enum gcry_ac_scheme
1266
- {
1267
- GCRY_AC_ES_PKCS_V1_5,
1268
- GCRY_AC_SSA_PKCS_V1_5
1269
- }
1270
- gcry_ac_scheme_t;
1271
-
1272
- /* AC data. */
1273
- #define GCRY_AC_FLAG_DEALLOC (1 << 0)
1274
- #define GCRY_AC_FLAG_COPY (1 << 1)
1275
- #define GCRY_AC_FLAG_NO_BLINDING (1 << 2)
1276
-
1277
- /* This type represents a `data set'. */
1278
- typedef struct gcry_ac_data *gcry_ac_data_t;
1279
-
1280
- /* This type represents a single `key', either a secret one or a
1281
- public one. */
1282
- typedef struct gcry_ac_key *gcry_ac_key_t;
1283
-
1284
- /* This type represents a `key pair' containing a secret and a public
1285
- key. */
1286
- typedef struct gcry_ac_key_pair *gcry_ac_key_pair_t;
1287
-
1288
- /* This type represents a `handle' that is needed by functions
1289
- performing cryptographic operations. */
1290
- typedef struct gcry_ac_handle *gcry_ac_handle_t;
1291
-
1292
- typedef gpg_error_t (*gcry_ac_data_read_cb_t) (void *opaque,
1293
- unsigned char *buffer,
1294
- size_t *buffer_n);
1295
-
1296
- typedef gpg_error_t (*gcry_ac_data_write_cb_t) (void *opaque,
1297
- unsigned char *buffer,
1298
- size_t buffer_n);
1299
-
1300
- typedef enum
1301
- {
1302
- GCRY_AC_IO_READABLE,
1303
- GCRY_AC_IO_WRITABLE
1304
- }
1305
- gcry_ac_io_mode_t;
1306
-
1307
- typedef enum
1308
- {
1309
- GCRY_AC_IO_STRING,
1310
- GCRY_AC_IO_CALLBACK
1311
- }
1312
- gcry_ac_io_type_t;
1313
-
1314
- typedef struct gcry_ac_io
1315
- {
1316
- /* This is an INTERNAL structure, do NOT use manually. */
1317
- gcry_ac_io_mode_t mode _GCRY_ATTR_INTERNAL;
1318
- gcry_ac_io_type_t type _GCRY_ATTR_INTERNAL;
1319
- union
1320
- {
1321
- union
1322
- {
1323
- struct
1324
- {
1325
- gcry_ac_data_read_cb_t cb;
1326
- void *opaque;
1327
- } callback;
1328
- struct
1329
- {
1330
- unsigned char *data;
1331
- size_t data_n;
1332
- } string;
1333
- void *opaque;
1334
- } readable;
1335
- union
1336
- {
1337
- struct
1338
- {
1339
- gcry_ac_data_write_cb_t cb;
1340
- void *opaque;
1341
- } callback;
1342
- struct
1343
- {
1344
- unsigned char **data;
1345
- size_t *data_n;
1346
- } string;
1347
- void *opaque;
1348
- } writable;
1349
- } io _GCRY_ATTR_INTERNAL;
1350
- }
1351
- gcry_ac_io_t;
1352
-
1353
- /* The caller of gcry_ac_key_pair_generate can provide one of these
1354
- structures in order to influence the key generation process in an
1355
- algorithm-specific way. */
1356
- typedef struct gcry_ac_key_spec_rsa
1357
- {
1358
- gcry_mpi_t e; /* E to use. */
1359
- } gcry_ac_key_spec_rsa_t;
1360
-
1361
- /* Structure used for passing data to the implementation of the
1362
- `EME-PKCS-V1_5' encoding method. */
1363
- typedef struct gcry_ac_eme_pkcs_v1_5
1364
- {
1365
- size_t key_size;
1366
- } gcry_ac_eme_pkcs_v1_5_t;
1367
-
1368
- typedef enum gcry_md_algos gcry_md_algo_t;
1369
-
1370
- /* Structure used for passing data to the implementation of the
1371
- `EMSA-PKCS-V1_5' encoding method. */
1372
- typedef struct gcry_ac_emsa_pkcs_v1_5
1373
- {
1374
- gcry_md_algo_t md;
1375
- size_t em_n;
1376
- } gcry_ac_emsa_pkcs_v1_5_t;
1377
-
1378
- /* Structure used for passing data to the implementation of the
1379
- `SSA-PKCS-V1_5' signature scheme. */
1380
- typedef struct gcry_ac_ssa_pkcs_v1_5
1381
- {
1382
- gcry_md_algo_t md;
1383
- } gcry_ac_ssa_pkcs_v1_5_t;
1384
-
1385
- /* Returns a new, empty data set in DATA. */
1386
- gcry_error_t gcry_ac_data_new (gcry_ac_data_t *data);
1387
-
1388
- /* Destroy the data set DATA. */
1389
- void gcry_ac_data_destroy (gcry_ac_data_t data);
1390
-
1391
- /* Create a copy of the data set DATA and store it in DATA_CP. */
1392
- gcry_error_t gcry_ac_data_copy (gcry_ac_data_t *data_cp,
1393
- gcry_ac_data_t data);
1394
-
1395
- /* Return the number of named MPI values inside of the data set
1396
- DATA. */
1397
- unsigned int gcry_ac_data_length (gcry_ac_data_t data);
1398
-
1399
- /* Destroy any values contained in the data set DATA. */
1400
- void gcry_ac_data_clear (gcry_ac_data_t data);
1401
-
1402
- /* Add the value MPI to DATA with the label NAME. If FLAGS contains
1403
- GCRY_AC_FLAG_DATA_COPY, the data set will contain copies of NAME
1404
- and MPI. If FLAGS contains GCRY_AC_FLAG_DATA_DEALLOC or
1405
- GCRY_AC_FLAG_DATA_COPY, the values contained in the data set will
1406
- be deallocated when they are to be removed from the data set. */
1407
- gcry_error_t gcry_ac_data_set (gcry_ac_data_t data, unsigned int flags,
1408
- const char *name, gcry_mpi_t mpi);
1409
-
1410
- /* Store the value labelled with NAME found in DATA in MPI. If FLAGS
1411
- contains GCRY_AC_FLAG_COPY, store a copy of the MPI value contained
1412
- in the data set. MPI may be NULL. */
1413
- gcry_error_t gcry_ac_data_get_name (gcry_ac_data_t data, unsigned int flags,
1414
- const char *name, gcry_mpi_t *mpi);
1415
-
1416
- /* Stores in NAME and MPI the named MPI value contained in the data
1417
- set DATA with the index IDX. If FLAGS contains GCRY_AC_FLAG_COPY,
1418
- store copies of the values contained in the data set. NAME or MPI
1419
- may be NULL. */
1420
- gcry_error_t gcry_ac_data_get_index (gcry_ac_data_t data, unsigned int flags,
1421
- unsigned int idx,
1422
- const char **name, gcry_mpi_t *mpi);
1423
-
1424
- /* Convert the data set DATA into a new S-Expression, which is to be
1425
- stored in SEXP, according to the identifiers contained in
1426
- IDENTIFIERS. */
1427
- gcry_error_t gcry_ac_data_to_sexp (gcry_ac_data_t data, gcry_sexp_t *sexp,
1428
- const char **identifiers);
1429
-
1430
- /* Create a new data set, which is to be stored in DATA_SET, from the
1431
- S-Expression SEXP, according to the identifiers contained in
1432
- IDENTIFIERS. */
1433
- gcry_error_t gcry_ac_data_from_sexp (gcry_ac_data_t *data, gcry_sexp_t sexp,
1434
- const char **identifiers);
1435
-
1436
- /* Initialize AC_IO according to MODE, TYPE and the variable list of
1437
- arguments. The list of variable arguments to specify depends on
1438
- the given TYPE. */
1439
- void gcry_ac_io_init (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
1440
- gcry_ac_io_type_t type, ...);
1441
-
1442
- /* Initialize AC_IO according to MODE, TYPE and the variable list of
1443
- arguments AP. The list of variable arguments to specify depends on
1444
- the given TYPE. */
1445
- void gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
1446
- gcry_ac_io_type_t type, va_list ap);
1447
-
1448
- /* Create a new ac handle. */
1449
- gcry_error_t gcry_ac_open (gcry_ac_handle_t *handle,
1450
- gcry_ac_id_t algorithm, unsigned int flags);
1451
-
1452
- /* Destroy an ac handle. */
1453
- void gcry_ac_close (gcry_ac_handle_t handle);
1454
-
1455
- /* Initialize a key from a given data set. */
1456
- gcry_error_t gcry_ac_key_init (gcry_ac_key_t *key, gcry_ac_handle_t handle,
1457
- gcry_ac_key_type_t type, gcry_ac_data_t data);
1458
-
1459
- /* Generates a new key pair via the handle HANDLE of NBITS bits and
1460
- stores it in KEY_PAIR. In case non-standard settings are wanted, a
1461
- pointer to a structure of type gcry_ac_key_spec_<algorithm>_t,
1462
- matching the selected algorithm, can be given as KEY_SPEC.
1463
- MISC_DATA is not used yet. */
1464
- gcry_error_t gcry_ac_key_pair_generate (gcry_ac_handle_t handle,
1465
- unsigned int nbits, void *spec,
1466
- gcry_ac_key_pair_t *key_pair,
1467
- gcry_mpi_t **misc_data);
1468
-
1469
- /* Returns the key of type WHICH out of the key pair KEY_PAIR. */
1470
- gcry_ac_key_t gcry_ac_key_pair_extract (gcry_ac_key_pair_t key_pair,
1471
- gcry_ac_key_type_t which);
1472
-
1473
- /* Returns the data set contained in the key KEY. */
1474
- gcry_ac_data_t gcry_ac_key_data_get (gcry_ac_key_t key);
1475
-
1476
- /* Verifies that the key KEY is sane via HANDLE. */
1477
- gcry_error_t gcry_ac_key_test (gcry_ac_handle_t handle, gcry_ac_key_t key);
1478
-
1479
- /* Stores the number of bits of the key KEY in NBITS via HANDLE. */
1480
- gcry_error_t gcry_ac_key_get_nbits (gcry_ac_handle_t handle,
1481
- gcry_ac_key_t key, unsigned int *nbits);
1482
-
1483
- /* Writes the 20 byte long key grip of the key KEY to KEY_GRIP via
1484
- HANDLE. */
1485
- gcry_error_t gcry_ac_key_get_grip (gcry_ac_handle_t handle, gcry_ac_key_t key,
1486
- unsigned char *key_grip);
1487
-
1488
- /* Destroy a key. */
1489
- void gcry_ac_key_destroy (gcry_ac_key_t key);
1490
-
1491
- /* Destroy a key pair. */
1492
- void gcry_ac_key_pair_destroy (gcry_ac_key_pair_t key_pair);
1493
-
1494
- /* Encodes a message according to the encoding method METHOD. OPTIONS
1495
- must be a pointer to a method-specific structure
1496
- (gcry_ac_em*_t). */
1497
- gcry_error_t gcry_ac_data_encode (gcry_ac_em_t method,
1498
- unsigned int flags, void *options,
1499
- gcry_ac_io_t *io_read,
1500
- gcry_ac_io_t *io_write);
1501
-
1502
- /* Decodes a message according to the encoding method METHOD. OPTIONS
1503
- must be a pointer to a method-specific structure
1504
- (gcry_ac_em*_t). */
1505
- gcry_error_t gcry_ac_data_decode (gcry_ac_em_t method,
1506
- unsigned int flags, void *options,
1507
- gcry_ac_io_t *io_read,
1508
- gcry_ac_io_t *io_write);
1509
-
1510
- /* Encrypt the plain text MPI value DATA_PLAIN with the key KEY under
1511
- the control of the flags FLAGS and store the resulting data set
1512
- into DATA_ENCRYPTED. */
1513
- gcry_error_t gcry_ac_data_encrypt (gcry_ac_handle_t handle,
1514
- unsigned int flags,
1515
- gcry_ac_key_t key,
1516
- gcry_mpi_t data_plain,
1517
- gcry_ac_data_t *data_encrypted);
1518
-
1519
- /* Decrypt the decrypted data contained in the data set DATA_ENCRYPTED
1520
- with the key KEY under the control of the flags FLAGS and store the
1521
- resulting plain text MPI value in DATA_PLAIN. */
1522
- gcry_error_t gcry_ac_data_decrypt (gcry_ac_handle_t handle,
1523
- unsigned int flags,
1524
- gcry_ac_key_t key,
1525
- gcry_mpi_t *data_plain,
1526
- gcry_ac_data_t data_encrypted);
1527
-
1528
- /* Sign the data contained in DATA with the key KEY and store the
1529
- resulting signature in the data set DATA_SIGNATURE. */
1530
- gcry_error_t gcry_ac_data_sign (gcry_ac_handle_t handle,
1531
- gcry_ac_key_t key,
1532
- gcry_mpi_t data,
1533
- gcry_ac_data_t *data_signature);
1534
-
1535
- /* Verify that the signature contained in the data set DATA_SIGNATURE
1536
- is indeed the result of signing the data contained in DATA with the
1537
- secret key belonging to the public key KEY. */
1538
- gcry_error_t gcry_ac_data_verify (gcry_ac_handle_t handle,
1539
- gcry_ac_key_t key,
1540
- gcry_mpi_t data,
1541
- gcry_ac_data_t data_signature);
1542
-
1543
- /* Encrypts the plain text readable from IO_MESSAGE through HANDLE
1544
- with the public key KEY according to SCHEME, FLAGS and OPTS. If
1545
- OPTS is not NULL, it has to be a pointer to a structure specific to
1546
- the chosen scheme (gcry_ac_es_*_t). The encrypted message is
1547
- written to IO_CIPHER. */
1548
- gcry_error_t gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle,
1549
- gcry_ac_scheme_t scheme,
1550
- unsigned int flags, void *opts,
1551
- gcry_ac_key_t key,
1552
- gcry_ac_io_t *io_message,
1553
- gcry_ac_io_t *io_cipher);
1554
-
1555
- /* Decrypts the cipher text readable from IO_CIPHER through HANDLE
1556
- with the secret key KEY according to SCHEME, @var{flags} and OPTS.
1557
- If OPTS is not NULL, it has to be a pointer to a structure specific
1558
- to the chosen scheme (gcry_ac_es_*_t). The decrypted message is
1559
- written to IO_MESSAGE. */
1560
- gcry_error_t gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle,
1561
- gcry_ac_scheme_t scheme,
1562
- unsigned int flags, void *opts,
1563
- gcry_ac_key_t key,
1564
- gcry_ac_io_t *io_cipher,
1565
- gcry_ac_io_t *io_message);
1566
-
1567
- /* Signs the message readable from IO_MESSAGE through HANDLE with the
1568
- secret key KEY according to SCHEME, FLAGS and OPTS. If OPTS is not
1569
- NULL, it has to be a pointer to a structure specific to the chosen
1570
- scheme (gcry_ac_ssa_*_t). The signature is written to
1571
- IO_SIGNATURE. */
1572
- gcry_error_t gcry_ac_data_sign_scheme (gcry_ac_handle_t handle,
1573
- gcry_ac_scheme_t scheme,
1574
- unsigned int flags, void *opts,
1575
- gcry_ac_key_t key,
1576
- gcry_ac_io_t *io_message,
1577
- gcry_ac_io_t *io_signature);
1578
-
1579
- /* Verifies through HANDLE that the signature readable from
1580
- IO_SIGNATURE is indeed the result of signing the message readable
1581
- from IO_MESSAGE with the secret key belonging to the public key KEY
1582
- according to SCHEME and OPTS. If OPTS is not NULL, it has to be an
1583
- anonymous structure (gcry_ac_ssa_*_t) specific to the chosen
1584
- scheme. */
1585
- gcry_error_t gcry_ac_data_verify_scheme (gcry_ac_handle_t handle,
1586
- gcry_ac_scheme_t scheme,
1587
- unsigned int flags, void *opts,
1588
- gcry_ac_key_t key,
1589
- gcry_ac_io_t *io_message,
1590
- gcry_ac_io_t *io_signature);
1591
-
1592
- /* Store the textual representation of the algorithm whose id is given
1593
- in ALGORITHM in NAME. This function is deprecated; use
1594
- gcry_pk_algo_name. */
1595
- #ifndef GCRYPT_NO_DEPRECATED
1596
- gcry_error_t gcry_ac_id_to_name (gcry_ac_id_t algorithm,
1597
- const char **name)
1598
- /* */ _GCRY_GCC_ATTR_DEPRECATED;
1599
- /* Store the numeric ID of the algorithm whose textual representation
1600
- is contained in NAME in ALGORITHM. This function is deprecated;
1601
- use gcry_pk_map_name. */
1602
- gcry_error_t gcry_ac_name_to_id (const char *name,
1603
- gcry_ac_id_t *algorithm)
1604
- /* */ _GCRY_GCC_ATTR_DEPRECATED;
1605
- #endif
1606
-
1607
-
1608
- /************************************
1609
- * *
1610
- * Random Generating Functions *
1611
- * *
1612
- ************************************/
1613
-
1614
- /* The possible values for the random quality. The rule of thumb is
1615
- to use STRONG for session keys and VERY_STRONG for key material.
1616
- WEAK is usually an alias for STRONG and should not be used anymore
1617
- (except with gcry_mpi_randomize); use gcry_create_nonce instead. */
1618
- typedef enum gcry_random_level
1619
- {
1620
- GCRY_WEAK_RANDOM = 0,
1621
- GCRY_STRONG_RANDOM = 1,
1622
- GCRY_VERY_STRONG_RANDOM = 2
1623
- }
1624
- gcry_random_level_t;
1625
-
1626
- /* Fill BUFFER with LENGTH bytes of random, using random numbers of
1627
- quality LEVEL. */
1628
- void gcry_randomize (void *buffer, size_t length,
1629
- enum gcry_random_level level);
1630
-
1631
- /* Add the external random from BUFFER with LENGTH bytes into the
1632
- pool. QUALITY should either be -1 for unknown or in the range of 0
1633
- to 100 */
1634
- gcry_error_t gcry_random_add_bytes (const void *buffer, size_t length,
1635
- int quality);
1636
-
1637
- /* If random numbers are used in an application, this macro should be
1638
- called from time to time so that new stuff gets added to the
1639
- internal pool of the RNG. */
1640
- #define gcry_fast_random_poll() gcry_control (GCRYCTL_FAST_POLL, NULL)
1641
-
1642
-
1643
- /* Return NBYTES of allocated random using a random numbers of quality
1644
- LEVEL. */
1645
- void *gcry_random_bytes (size_t nbytes, enum gcry_random_level level)
1646
- _GCRY_GCC_ATTR_MALLOC;
1647
-
1648
- /* Return NBYTES of allocated random using a random numbers of quality
1649
- LEVEL. The random numbers are created returned in "secure"
1650
- memory. */
1651
- void *gcry_random_bytes_secure (size_t nbytes, enum gcry_random_level level)
1652
- _GCRY_GCC_ATTR_MALLOC;
1653
-
1654
-
1655
- /* Set the big integer W to a random value of NBITS using a random
1656
- generator with quality LEVEL. Note that using a level of
1657
- GCRY_WEAK_RANDOM here, uses gcry_create_nonce internally. */
1658
- void gcry_mpi_randomize (gcry_mpi_t w,
1659
- unsigned int nbits, enum gcry_random_level level);
1660
-
1661
-
1662
- /* Create an unpredicable nonce of LENGTH bytes in BUFFER. */
1663
- void gcry_create_nonce (void *buffer, size_t length);
1664
-
1665
-
1666
-
1667
-
1668
-
1669
- /*******************************/
1670
- /* */
1671
- /* Prime Number Functions */
1672
- /* */
1673
- /*******************************/
1674
-
1675
- /* Mode values passed to a gcry_prime_check_func_t. */
1676
- #define GCRY_PRIME_CHECK_AT_FINISH 0
1677
- #define GCRY_PRIME_CHECK_AT_GOT_PRIME 1
1678
- #define GCRY_PRIME_CHECK_AT_MAYBE_PRIME 2
1679
-
1680
- /* The function should return 1 if the operation shall continue, 0 to
1681
- reject the prime candidate. */
1682
- typedef int (*gcry_prime_check_func_t) (void *arg, int mode,
1683
- gcry_mpi_t candidate);
1684
-
1685
- /* Flags for gcry_prime_generate(): */
1686
-
1687
- /* Allocate prime numbers and factors in secure memory. */
1688
- #define GCRY_PRIME_FLAG_SECRET (1 << 0)
1689
-
1690
- /* Make sure that at least one prime factor is of size
1691
- `FACTOR_BITS'. */
1692
- #define GCRY_PRIME_FLAG_SPECIAL_FACTOR (1 << 1)
1693
-
1694
- /* Generate a new prime number of PRIME_BITS bits and store it in
1695
- PRIME. If FACTOR_BITS is non-zero, one of the prime factors of
1696
- (prime - 1) / 2 must be FACTOR_BITS bits long. If FACTORS is
1697
- non-zero, allocate a new, NULL-terminated array holding the prime
1698
- factors and store it in FACTORS. FLAGS might be used to influence
1699
- the prime number generation process. */
1700
- gcry_error_t gcry_prime_generate (gcry_mpi_t *prime,
1701
- unsigned int prime_bits,
1702
- unsigned int factor_bits,
1703
- gcry_mpi_t **factors,
1704
- gcry_prime_check_func_t cb_func,
1705
- void *cb_arg,
1706
- gcry_random_level_t random_level,
1707
- unsigned int flags);
1708
-
1709
- /* Find a generator for PRIME where the factorization of (prime-1) is
1710
- in the NULL terminated array FACTORS. Return the generator as a
1711
- newly allocated MPI in R_G. If START_G is not NULL, use this as
1712
- teh start for the search. */
1713
- gcry_error_t gcry_prime_group_generator (gcry_mpi_t *r_g,
1714
- gcry_mpi_t prime,
1715
- gcry_mpi_t *factors,
1716
- gcry_mpi_t start_g);
1717
-
1718
-
1719
- /* Convenience function to release the FACTORS array. */
1720
- void gcry_prime_release_factors (gcry_mpi_t *factors);
1721
-
1722
-
1723
- /* Check wether the number X is prime. */
1724
- gcry_error_t gcry_prime_check (gcry_mpi_t x, unsigned int flags);
1725
-
1726
-
1727
-
1728
- /************************************
1729
- * *
1730
- * Miscellaneous Stuff *
1731
- * *
1732
- ************************************/
1733
-
1734
- /* Log levels used by the internal logging facility. */
1735
- enum gcry_log_levels
1736
- {
1737
- GCRY_LOG_CONT = 0, /* (Continue the last log line.) */
1738
- GCRY_LOG_INFO = 10,
1739
- GCRY_LOG_WARN = 20,
1740
- GCRY_LOG_ERROR = 30,
1741
- GCRY_LOG_FATAL = 40,
1742
- GCRY_LOG_BUG = 50,
1743
- GCRY_LOG_DEBUG = 100
1744
- };
1745
-
1746
- /* Type for progress handlers. */
1747
- typedef void (*gcry_handler_progress_t) (void *, const char *, int, int, int);
1748
-
1749
- /* Type for memory allocation handlers. */
1750
- typedef void *(*gcry_handler_alloc_t) (size_t n);
1751
-
1752
- /* Type for secure memory check handlers. */
1753
- typedef int (*gcry_handler_secure_check_t) (const void *);
1754
-
1755
- /* Type for memory reallocation handlers. */
1756
- typedef void *(*gcry_handler_realloc_t) (void *p, size_t n);
1757
-
1758
- /* Type for memory free handlers. */
1759
- typedef void (*gcry_handler_free_t) (void *);
1760
-
1761
- /* Type for out-of-memory handlers. */
1762
- typedef int (*gcry_handler_no_mem_t) (void *, size_t, unsigned int);
1763
-
1764
- /* Type for fatal error handlers. */
1765
- typedef void (*gcry_handler_error_t) (void *, int, const char *);
1766
-
1767
- /* Type for logging handlers. */
1768
- typedef void (*gcry_handler_log_t) (void *, int, const char *, va_list);
1769
-
1770
- /* Certain operations can provide progress information. This function
1771
- is used to register a handler for retrieving these information. */
1772
- void gcry_set_progress_handler (gcry_handler_progress_t cb, void *cb_data);
1773
-
1774
-
1775
- /* Register a custom memory allocation functions. */
1776
- void gcry_set_allocation_handler (
1777
- gcry_handler_alloc_t func_alloc,
1778
- gcry_handler_alloc_t func_alloc_secure,
1779
- gcry_handler_secure_check_t func_secure_check,
1780
- gcry_handler_realloc_t func_realloc,
1781
- gcry_handler_free_t func_free);
1782
-
1783
- /* Register a function used instead of the internal out of memory
1784
- handler. */
1785
- void gcry_set_outofcore_handler (gcry_handler_no_mem_t h, void *opaque);
1786
-
1787
- /* Register a function used instead of the internal fatal error
1788
- handler. */
1789
- void gcry_set_fatalerror_handler (gcry_handler_error_t fnc, void *opaque);
1790
-
1791
- /* Register a function used instead of the internal logging
1792
- facility. */
1793
- void gcry_set_log_handler (gcry_handler_log_t f, void *opaque);
1794
-
1795
- /* Reserved for future use. */
1796
- void gcry_set_gettext_handler (const char *(*f)(const char*));
1797
-
1798
- /* Libgcrypt uses its own memory allocation. It is important to use
1799
- gcry_free () to release memory allocated by libgcrypt. */
1800
- void *gcry_malloc (size_t n) _GCRY_GCC_ATTR_MALLOC;
1801
- void *gcry_calloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
1802
- void *gcry_malloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC;
1803
- void *gcry_calloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
1804
- void *gcry_realloc (void *a, size_t n);
1805
- char *gcry_strdup (const char *string) _GCRY_GCC_ATTR_MALLOC;
1806
- void *gcry_xmalloc (size_t n) _GCRY_GCC_ATTR_MALLOC;
1807
- void *gcry_xcalloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
1808
- void *gcry_xmalloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC;
1809
- void *gcry_xcalloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
1810
- void *gcry_xrealloc (void *a, size_t n);
1811
- char *gcry_xstrdup (const char * a) _GCRY_GCC_ATTR_MALLOC;
1812
- void gcry_free (void *a);
1813
-
1814
- /* Return true if A is allocated in "secure" memory. */
1815
- int gcry_is_secure (const void *a) _GCRY_GCC_ATTR_PURE;
1816
-
1817
- /* Include support for Libgcrypt modules. */
1818
- #include <gcrypt-module.h>
1819
-
1820
- #if 0 /* (Keep Emacsens' auto-indent happy.) */
1821
- {
1822
- #endif
1823
- #ifdef __cplusplus
1824
- }
1825
- #endif
1826
- #endif /* _GCRYPT_H */