rbnacl-libsodium 0.4.5 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (282) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbnacl/libsodium/version.rb +1 -1
  3. data/vendor/libsodium/AUTHORS +14 -9
  4. data/vendor/libsodium/ChangeLog +26 -0
  5. data/vendor/libsodium/LICENSE +1 -1
  6. data/vendor/libsodium/Makefile.am +1 -0
  7. data/vendor/libsodium/README.markdown +185 -46
  8. data/vendor/libsodium/THANKS +10 -0
  9. data/vendor/libsodium/builds/msvc/properties/Common.props +21 -0
  10. data/vendor/libsodium/builds/msvc/properties/DLL.props +16 -0
  11. data/vendor/libsodium/builds/msvc/properties/Debug.props +29 -0
  12. data/vendor/libsodium/builds/msvc/properties/DebugDEXE.props +21 -0
  13. data/vendor/libsodium/builds/msvc/properties/DebugDLL.props +20 -0
  14. data/vendor/libsodium/builds/msvc/properties/DebugLEXE.props +20 -0
  15. data/vendor/libsodium/builds/msvc/properties/DebugLIB.props +20 -0
  16. data/vendor/libsodium/builds/msvc/properties/DebugLTCG.props +19 -0
  17. data/vendor/libsodium/builds/msvc/properties/DebugSEXE.props +21 -0
  18. data/vendor/libsodium/builds/msvc/properties/EXE.props +17 -0
  19. data/vendor/libsodium/builds/msvc/properties/LIB.props +16 -0
  20. data/vendor/libsodium/builds/msvc/properties/LTCG.props +13 -0
  21. data/vendor/libsodium/builds/msvc/properties/Link.props +21 -0
  22. data/vendor/libsodium/builds/msvc/properties/Messages.props +15 -0
  23. data/vendor/libsodium/builds/msvc/properties/Output.props +30 -0
  24. data/vendor/libsodium/builds/msvc/properties/Release.props +41 -0
  25. data/vendor/libsodium/builds/msvc/properties/ReleaseDEXE.props +20 -0
  26. data/vendor/libsodium/builds/msvc/properties/ReleaseDLL.props +19 -0
  27. data/vendor/libsodium/builds/msvc/properties/ReleaseLEXE.props +20 -0
  28. data/vendor/libsodium/builds/msvc/properties/ReleaseLIB.props +19 -0
  29. data/vendor/libsodium/builds/msvc/properties/ReleaseLTCG.props +19 -0
  30. data/vendor/libsodium/builds/msvc/properties/ReleaseSEXE.props +20 -0
  31. data/vendor/libsodium/builds/msvc/properties/Win32.props +20 -0
  32. data/vendor/libsodium/builds/msvc/properties/x64.props +23 -0
  33. data/vendor/libsodium/builds/msvc/resource.h +0 -0
  34. data/vendor/libsodium/builds/msvc/resource.rc +0 -0
  35. data/vendor/libsodium/builds/msvc/version.h +29 -0
  36. data/vendor/libsodium/builds/msvc/vs2010/libsodium.import.props +52 -0
  37. data/vendor/libsodium/builds/msvc/vs2010/libsodium.import.xml +17 -0
  38. data/vendor/libsodium/builds/msvc/vs2010/libsodium.sln +79 -0
  39. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.props +43 -0
  40. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +345 -0
  41. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +1037 -0
  42. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.xml +15 -0
  43. data/vendor/libsodium/builds/msvc/vs2010/test/test.props +37 -0
  44. data/vendor/libsodium/builds/msvc/vs2010/test/test.runner.bat +78 -0
  45. data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj +220 -0
  46. data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj.filters +168 -0
  47. data/vendor/libsodium/builds/msvc/vs2012/libsodium.import.props +52 -0
  48. data/vendor/libsodium/builds/msvc/vs2012/libsodium.import.xml +17 -0
  49. data/vendor/libsodium/builds/msvc/vs2012/libsodium.sln +79 -0
  50. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.props +43 -0
  51. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +345 -0
  52. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +1037 -0
  53. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.xml +15 -0
  54. data/vendor/libsodium/builds/msvc/vs2012/test/test.props +37 -0
  55. data/vendor/libsodium/builds/msvc/vs2012/test/test.runner.bat +78 -0
  56. data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj +220 -0
  57. data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj.filters +168 -0
  58. data/vendor/libsodium/builds/msvc/vs2013/libsodium.import.props +52 -0
  59. data/vendor/libsodium/builds/msvc/vs2013/libsodium.import.xml +17 -0
  60. data/vendor/libsodium/builds/msvc/vs2013/libsodium.sln +81 -0
  61. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.props +43 -0
  62. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +345 -0
  63. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +1037 -0
  64. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.xml +15 -0
  65. data/vendor/libsodium/builds/msvc/vs2013/test/test.props +37 -0
  66. data/vendor/libsodium/builds/msvc/vs2013/test/test.runner.bat +78 -0
  67. data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj +220 -0
  68. data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj.filters +168 -0
  69. data/vendor/libsodium/configure.ac +87 -68
  70. data/vendor/libsodium/dist-build/Makefile.am +10 -0
  71. data/vendor/libsodium/dist-build/android-arm.sh +3 -0
  72. data/vendor/libsodium/dist-build/android-armv7.sh +3 -0
  73. data/vendor/libsodium/dist-build/android-build.sh +37 -0
  74. data/vendor/libsodium/dist-build/android-mips.sh +3 -0
  75. data/vendor/libsodium/dist-build/android-x86.sh +3 -0
  76. data/vendor/libsodium/dist-build/emscripten.sh +13 -0
  77. data/vendor/libsodium/dist-build/{iphone.sh → ios.sh} +2 -2
  78. data/vendor/libsodium/dist-build/msys2-win32.sh +10 -0
  79. data/vendor/libsodium/dist-build/msys2-win64.sh +10 -0
  80. data/vendor/libsodium/libsodium.vcxproj +25 -13
  81. data/vendor/libsodium/libsodium.vcxproj.filters +60 -24
  82. data/vendor/libsodium/msvc-scripts/process.bat +3 -7
  83. data/vendor/libsodium/packaging/nuget/package.bat +13 -0
  84. data/vendor/libsodium/packaging/nuget/package.config +4 -0
  85. data/vendor/libsodium/packaging/nuget/package.gsl +255 -0
  86. data/vendor/libsodium/packaging/nuget/package.nuspec +93 -0
  87. data/vendor/libsodium/packaging/nuget/package.targets +128 -0
  88. data/vendor/libsodium/packaging/nuget/package.xml +22 -0
  89. data/vendor/libsodium/src/libsodium/Makefile.am +32 -20
  90. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c +0 -5
  91. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/{ref → cp}/api.h +0 -1
  92. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/hmac_hmacsha256.c +110 -0
  93. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/{ref → cp}/verify_hmacsha256.c +0 -0
  94. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512_api.c +11 -0
  95. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/api.h +9 -0
  96. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/hmac_hmacsha512.c +110 -0
  97. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/verify_hmacsha512.c +10 -0
  98. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c +0 -5
  99. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/{ref → cp}/api.h +0 -1
  100. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/hmac_hmacsha512256.c +54 -0
  101. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/{ref → cp}/verify_hmacsha512256.c +2 -1
  102. data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_easy.c +94 -0
  103. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c +0 -5
  104. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h +0 -1
  105. data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20_api.c +0 -5
  106. data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/api.h +0 -1
  107. data/vendor/libsodium/src/libsodium/crypto_core/salsa20/core_salsa20_api.c +0 -5
  108. data/vendor/libsodium/src/libsodium/crypto_core/salsa20/ref/api.h +0 -1
  109. data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c +0 -5
  110. data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/ref/api.h +0 -1
  111. data/vendor/libsodium/src/libsodium/crypto_core/salsa208/core_salsa208_api.c +0 -5
  112. data/vendor/libsodium/src/libsodium/crypto_core/salsa208/ref/api.h +0 -1
  113. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c +15 -5
  114. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/api.h +0 -2
  115. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h +14 -6
  116. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +95 -0
  117. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/generichash_blake2b.c +50 -3
  118. data/vendor/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c +4 -10
  119. data/vendor/libsodium/src/libsodium/crypto_hash/crypto_hash.c +11 -0
  120. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/{ref → cp}/api.h +3 -1
  121. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c +294 -0
  122. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256_api.c +0 -5
  123. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/{ref → cp}/api.h +3 -1
  124. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c +321 -0
  125. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512_api.c +0 -5
  126. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c +51 -127
  127. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h +12 -0
  128. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +221 -0
  129. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +209 -0
  130. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c +0 -5
  131. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c +1 -140
  132. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt-common.c +250 -0
  133. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt.h +100 -0
  134. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256_nosse.c +302 -0
  135. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pbkdf2-sha256.c +94 -0
  136. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pbkdf2-sha256.h +45 -0
  137. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pwhash_scryptxsalsa208sha256.c +172 -0
  138. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/scrypt_platform.c +96 -0
  139. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256_sse.c +391 -0
  140. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sysendian.h +146 -0
  141. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/api.h +2 -2
  142. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c +39 -9
  143. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/api.h +2 -2
  144. data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c +6 -0
  145. data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +94 -0
  146. data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/api.h +0 -1
  147. data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c +3 -3
  148. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/api.h +0 -1
  149. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.c +3 -3
  150. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/api.h +0 -1
  151. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c +6 -0
  152. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +5 -3
  153. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +28 -18
  154. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +14 -9
  155. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c +0 -5
  156. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/api.h +0 -1
  157. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c +0 -5
  158. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c +21 -21
  159. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/api.h +0 -1
  160. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h +6 -0
  161. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c +42 -42
  162. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c +0 -5
  163. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table-be.h +4 -4
  164. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table-le.h +4 -4
  165. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes256-ctr.c +15 -14
  166. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/api.h +0 -1
  167. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/ecrypt-sync.h +1 -1
  168. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/stream_aes256estream_api.c +0 -5
  169. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S +153 -160
  170. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/api.h +2 -5
  171. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c +9 -3
  172. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +9 -3
  173. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c +0 -5
  174. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/api.h +0 -1
  175. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c +0 -5
  176. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/api.h +0 -1
  177. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c +0 -5
  178. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/api.h +0 -1
  179. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c +0 -5
  180. data/vendor/libsodium/src/libsodium/crypto_verify/64/ref/api.h +2 -0
  181. data/vendor/libsodium/src/libsodium/crypto_verify/64/ref/verify_64.c +72 -0
  182. data/vendor/libsodium/src/libsodium/crypto_verify/64/verify_64_api.c +6 -0
  183. data/vendor/libsodium/src/libsodium/include/Makefile.am +6 -7
  184. data/vendor/libsodium/src/libsodium/include/sodium.h +4 -3
  185. data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth.h +3 -0
  186. data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +31 -9
  187. data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h +58 -0
  188. data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +26 -9
  189. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box.h +13 -0
  190. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +38 -24
  191. data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h +6 -11
  192. data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h +6 -11
  193. data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h +6 -11
  194. data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h +6 -11
  195. data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash.h +7 -8
  196. data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +36 -16
  197. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash.h +13 -4
  198. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +25 -7
  199. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +25 -7
  200. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +3 -0
  201. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +5 -5
  202. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305_donna.h +3 -0
  203. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptxsalsa208sha256.h +48 -0
  204. data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +31 -0
  205. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +17 -0
  206. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +21 -11
  207. data/vendor/libsodium/src/libsodium/include/sodium/crypto_shorthash.h +3 -0
  208. data/vendor/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h +8 -7
  209. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign.h +3 -0
  210. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h +16 -17
  211. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +18 -14
  212. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream.h +3 -0
  213. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h +18 -18
  214. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes256estream.h +19 -18
  215. data/vendor/libsodium/src/libsodium/include/sodium/{crypto_stream_salsa20.h.in → crypto_stream_salsa20.h} +8 -19
  216. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h +8 -8
  217. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h +8 -8
  218. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +10 -11
  219. data/vendor/libsodium/src/libsodium/include/sodium/crypto_verify_16.h +1 -4
  220. data/vendor/libsodium/src/libsodium/include/sodium/crypto_verify_32.h +1 -4
  221. data/vendor/libsodium/src/libsodium/include/sodium/crypto_verify_64.h +22 -0
  222. data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +3 -0
  223. data/vendor/libsodium/src/libsodium/include/sodium/runtime.h +27 -0
  224. data/vendor/libsodium/src/libsodium/include/sodium/utils.h +15 -3
  225. data/vendor/libsodium/src/libsodium/randombytes/randombytes.c +3 -1
  226. data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +18 -7
  227. data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +57 -9
  228. data/vendor/libsodium/src/libsodium/sodium/compat.c +62 -0
  229. data/vendor/libsodium/src/libsodium/sodium/core.c +2 -0
  230. data/vendor/libsodium/src/libsodium/sodium/runtime.c +134 -0
  231. data/vendor/libsodium/src/libsodium/sodium/utils.c +100 -8
  232. data/vendor/libsodium/test/default/Makefile.am +63 -3
  233. data/vendor/libsodium/test/default/auth6.c +21 -0
  234. data/vendor/libsodium/test/default/auth6.exp +8 -0
  235. data/vendor/libsodium/test/default/auth7.c +37 -0
  236. data/vendor/libsodium/test/default/auth7.exp +0 -0
  237. data/vendor/libsodium/test/default/box_easy.c +59 -0
  238. data/vendor/libsodium/test/default/box_easy.exp +19 -0
  239. data/vendor/libsodium/test/default/box_easy2.c +31 -0
  240. data/vendor/libsodium/test/default/box_easy2.exp +1 -0
  241. data/vendor/libsodium/test/default/cmptest.h +7 -1
  242. data/vendor/libsodium/test/default/generichash3.c +36 -0
  243. data/vendor/libsodium/test/default/generichash3.exp +64 -0
  244. data/vendor/libsodium/test/default/pwhash.c +59 -0
  245. data/vendor/libsodium/test/default/pwhash.exp +2 -0
  246. data/vendor/libsodium/test/default/scalarmult7.c +0 -2
  247. data/vendor/libsodium/test/default/scalarmult8.c +0 -2
  248. data/vendor/libsodium/test/default/secretbox_easy.c +51 -0
  249. data/vendor/libsodium/test/default/secretbox_easy.exp +19 -0
  250. data/vendor/libsodium/test/default/secretbox_easy2.c +27 -0
  251. data/vendor/libsodium/test/default/secretbox_easy2.exp +1 -0
  252. data/vendor/libsodium/test/default/sign.c +1106 -0
  253. data/vendor/libsodium/test/default/sign.exp +3 -0
  254. data/vendor/libsodium/test/default/sodium_utils.c +8 -0
  255. data/vendor/libsodium/test/default/sodium_utils.exp +2 -1
  256. data/vendor/libsodium/test/default/sodium_version.c +1 -1
  257. data/vendor/libsodium/test/default/verify1.c +34 -0
  258. data/vendor/libsodium/test/default/verify1.exp +6 -0
  259. metadata +138 -33
  260. data/vendor/libsodium/dist-build/android.sh +0 -48
  261. data/vendor/libsodium/dist-build/msys.sh +0 -9
  262. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/ref/hmac_hmacsha256.c +0 -83
  263. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/ref/hmac_hmacsha512256.c +0 -86
  264. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/ref/hash_sha256.c +0 -69
  265. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/ref/hash_sha512.c +0 -71
  266. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/checksum +0 -1
  267. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256_api.c +0 -16
  268. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/ref/api.h +0 -9
  269. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/ref/blocks_sha256.c +0 -212
  270. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/checksum +0 -1
  271. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512_api.c +0 -16
  272. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/ref/api.h +0 -9
  273. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/ref/blocks_sha512.c +0 -239
  274. data/vendor/libsodium/src/libsodium/crypto_hashblocks/try.c +0 -78
  275. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/api.h +0 -8
  276. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/auth_poly1305_53.c +0 -1661
  277. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/verify_poly1305_53.c +0 -10
  278. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/portable-jane.h +0 -772
  279. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hashblocks_sha256.h +0 -32
  280. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hashblocks_sha512.h +0 -32
  281. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305_53.h +0 -34
  282. data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h.in +0 -44
@@ -0,0 +1,27 @@
1
+
2
+ #ifndef __SODIUM_RUNTIME_H__
3
+ #define __SODIUM_RUNTIME_H__ 1
4
+
5
+ #include "export.h"
6
+
7
+ #ifdef __cplusplus
8
+ extern "C" {
9
+ #endif
10
+
11
+ SODIUM_EXPORT
12
+ int sodium_runtime_get_cpu_features(void);
13
+
14
+ SODIUM_EXPORT
15
+ int sodium_runtime_has_neon(void);
16
+
17
+ SODIUM_EXPORT
18
+ int sodium_runtime_has_sse2(void);
19
+
20
+ SODIUM_EXPORT
21
+ int sodium_runtime_has_sse3(void);
22
+
23
+ #ifdef __cplusplus
24
+ }
25
+ #endif
26
+
27
+ #endif
@@ -23,11 +23,23 @@ SODIUM_EXPORT
23
23
  void sodium_memzero(void * const pnt, const size_t len);
24
24
 
25
25
  SODIUM_EXPORT
26
- int sodium_memcmp(const void * const b1_, const void * const b2_, size_t size);
26
+ int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len);
27
27
 
28
28
  SODIUM_EXPORT
29
- char *sodium_bin2hex(char * const hex, const size_t hexlen,
30
- const unsigned char *bin, const size_t binlen);
29
+ char *sodium_bin2hex(char * const hex, const size_t hex_maxlen,
30
+ const unsigned char * const bin, const size_t bin_len);
31
+
32
+ SODIUM_EXPORT
33
+ int sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen,
34
+ const char * const hex, const size_t hex_len,
35
+ const char * const ignore, size_t * const bin_len,
36
+ const char ** const hex_end);
37
+
38
+ SODIUM_EXPORT
39
+ int sodium_mlock(void * const addr, const size_t len);
40
+
41
+ SODIUM_EXPORT
42
+ int sodium_munlock(void * const addr, const size_t len);
31
43
 
32
44
  #ifdef __cplusplus
33
45
  }
@@ -46,7 +46,9 @@ randombytes_uniform(const uint32_t upper_bound)
46
46
  void
47
47
  randombytes_buf(void * const buf, const size_t size)
48
48
  {
49
- implementation->buf(buf, size);
49
+ if (size > (size_t) 0U) {
50
+ implementation->buf(buf, size);
51
+ }
50
52
  }
51
53
 
52
54
  int
@@ -1,6 +1,7 @@
1
1
 
2
2
  #include <sys/types.h>
3
3
  #ifndef _WIN32
4
+ # include <sys/stat.h>
4
5
  # include <sys/time.h>
5
6
  #endif
6
7
 
@@ -85,6 +86,7 @@ safe_read(const int fd, void * const buf_, size_t count)
85
86
  unsigned char *buf = (unsigned char *) buf_;
86
87
  ssize_t readnb;
87
88
 
89
+ assert(count > (size_t) 0U);
88
90
  do {
89
91
  while ((readnb = read(fd, buf, count)) < (ssize_t) 0 &&
90
92
  errno == EINTR);
@@ -106,17 +108,23 @@ safe_read(const int fd, void * const buf_, size_t count)
106
108
  static int
107
109
  randombytes_salsa20_random_random_dev_open(void)
108
110
  {
109
- static const char * const devices[] = {
111
+ struct stat st;
112
+ static const char *devices[] = {
110
113
  # ifndef USE_BLOCKING_RANDOM
111
- "/dev/arandom", "/dev/urandom",
114
+ "/dev/urandom",
112
115
  # endif
113
116
  "/dev/random", NULL
114
117
  };
115
- const char * const *device = devices;
118
+ const char ** device = devices;
119
+ int fd;
116
120
 
117
121
  do {
118
- if (access(*device, F_OK | R_OK) == 0) {
119
- return open(*device, O_RDONLY);
122
+ if (access(*device, F_OK | R_OK) == 0 &&
123
+ (fd = open(*device, O_RDONLY)) != -1) {
124
+ if (fstat(fd, &st) == 0 && S_ISCHR(st.st_mode)) {
125
+ return fd;
126
+ }
127
+ (void) close(fd);
120
128
  }
121
129
  device++;
122
130
  } while (*device != NULL);
@@ -127,6 +135,8 @@ randombytes_salsa20_random_random_dev_open(void)
127
135
  static void
128
136
  randombytes_salsa20_random_init(void)
129
137
  {
138
+ const int errno_save = errno;
139
+
130
140
  stream.nonce = sodium_hrtime();
131
141
  assert(stream.nonce != (uint64_t) 0U);
132
142
 
@@ -134,6 +144,7 @@ randombytes_salsa20_random_init(void)
134
144
  randombytes_salsa20_random_random_dev_open()) == -1) {
135
145
  abort();
136
146
  }
147
+ errno = errno_save;
137
148
  }
138
149
 
139
150
  #else /* _WIN32 */
@@ -144,8 +155,8 @@ randombytes_salsa20_random_init(void)
144
155
  stream.nonce = sodium_hrtime();
145
156
  assert(stream.nonce != (uint64_t) 0U);
146
157
 
147
- if (! CryptAcquireContext(&stream.hcrypt_prov, NULL, NULL,
148
- PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
158
+ if (! CryptAcquireContextW(&stream.hcrypt_prov, NULL, NULL,
159
+ PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
149
160
  abort();
150
161
  }
151
162
  }
@@ -1,6 +1,7 @@
1
1
 
2
2
  #include <sys/types.h>
3
3
  #ifndef _WIN32
4
+ # include <sys/stat.h>
4
5
  # include <sys/time.h>
5
6
  #endif
6
7
 
@@ -12,7 +13,6 @@
12
13
  #include <stdlib.h>
13
14
  #include <string.h>
14
15
  #ifndef _WIN32
15
- # include <poll.h>
16
16
  # include <unistd.h>
17
17
  #endif
18
18
 
@@ -25,6 +25,39 @@
25
25
  # include <wincrypt.h>
26
26
  #endif
27
27
 
28
+ #ifdef __OpenBSD__
29
+
30
+ uint32_t
31
+ randombytes_sysrandom(void)
32
+ {
33
+ return arc4random();
34
+ }
35
+
36
+ void
37
+ randombytes_sysrandom_stir(void)
38
+ {
39
+ }
40
+
41
+ uint32_t
42
+ randombytes_sysrandom_uniform(const uint32_t upper_bound)
43
+ {
44
+ return arc4random_uniform(upper_bound);
45
+ }
46
+
47
+ void
48
+ randombytes_sysrandom_buf(void * const buf, const size_t size)
49
+ {
50
+ return arc4random_buf(buf, size);
51
+ }
52
+
53
+ int
54
+ randombytes_sysrandom_close(void)
55
+ {
56
+ return 0;
57
+ }
58
+
59
+ #else /* __OpenBSD__ */
60
+
28
61
  typedef struct SysRandom_ {
29
62
  #ifdef _WIN32
30
63
  HCRYPTPROV hcrypt_prov;
@@ -45,6 +78,7 @@ safe_read(const int fd, void * const buf_, size_t count)
45
78
  unsigned char *buf = (unsigned char *) buf_;
46
79
  ssize_t readnb;
47
80
 
81
+ assert(count > (size_t) 0U);
48
82
  do {
49
83
  while ((readnb = read(fd, buf, count)) < (ssize_t) 0 &&
50
84
  errno == EINTR);
@@ -66,17 +100,23 @@ safe_read(const int fd, void * const buf_, size_t count)
66
100
  static int
67
101
  randombytes_sysrandom_random_dev_open(void)
68
102
  {
69
- static const char * const devices[] = {
103
+ struct stat st;
104
+ static const char *devices[] = {
70
105
  # ifndef USE_BLOCKING_RANDOM
71
- "/dev/arandom", "/dev/urandom",
106
+ "/dev/urandom",
72
107
  # endif
73
108
  "/dev/random", NULL
74
109
  };
75
- const char * const *device = devices;
110
+ const char ** device = devices;
111
+ int fd;
76
112
 
77
113
  do {
78
- if (access(*device, F_OK | R_OK) == 0) {
79
- return open(*device, O_RDONLY);
114
+ if (access(*device, F_OK | R_OK) == 0 &&
115
+ (fd = open(*device, O_RDONLY)) != -1) {
116
+ if (fstat(fd, &st) == 0 && S_ISCHR(st.st_mode)) {
117
+ return fd;
118
+ }
119
+ (void) close(fd);
80
120
  }
81
121
  device++;
82
122
  } while (*device != NULL);
@@ -87,10 +127,13 @@ randombytes_sysrandom_random_dev_open(void)
87
127
  static void
88
128
  randombytes_sysrandom_init(void)
89
129
  {
130
+ const int errno_save = errno;
131
+
90
132
  if ((stream.random_data_source_fd =
91
133
  randombytes_sysrandom_random_dev_open()) == -1) {
92
134
  abort();
93
135
  }
136
+ errno = errno_save;
94
137
  }
95
138
 
96
139
  #else /* _WIN32 */
@@ -98,8 +141,8 @@ randombytes_sysrandom_init(void)
98
141
  static void
99
142
  randombytes_sysrandom_init(void)
100
143
  {
101
- if (! CryptAcquireContext(&stream.hcrypt_prov, NULL, NULL,
102
- PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
144
+ if (! CryptAcquireContextW(&stream.hcrypt_prov, NULL, NULL,
145
+ PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
103
146
  abort();
104
147
  }
105
148
  }
@@ -166,7 +209,10 @@ randombytes_sysrandom_buf(void * const buf, const size_t size)
166
209
  abort();
167
210
  }
168
211
  #else
169
- if (! CryptGenRandom(stream.hcrypt_prov, size, (BYTE *) buf)) {
212
+ if (size > 0xffffffff) {
213
+ abort();
214
+ }
215
+ if (! CryptGenRandom(stream.hcrypt_prov, (DWORD) size, (BYTE *) buf)) {
170
216
  abort();
171
217
  }
172
218
  #endif
@@ -196,6 +242,8 @@ randombytes_sysrandom_uniform(const uint32_t upper_bound)
196
242
  return r % upper_bound;
197
243
  }
198
244
 
245
+ #endif
246
+
199
247
  const char *
200
248
  randombytes_sysrandom_implementation_name(void)
201
249
  {
@@ -8,11 +8,14 @@
8
8
  #include "crypto_scalarmult_curve25519.h"
9
9
  #include "crypto_secretbox_xsalsa20poly1305.h"
10
10
  #include "crypto_sign_ed25519.h"
11
+ #include "crypto_stream_salsa20.h"
11
12
  #include "crypto_stream_xsalsa20.h"
12
13
  #include "crypto_verify_16.h"
13
14
  #include "crypto_verify_32.h"
14
15
  #include "export.h"
15
16
 
17
+ #ifdef EXPORT_ORIGINAL_IMPLEMENTATIONS
18
+
16
19
  #ifdef __cplusplus
17
20
  extern "C" {
18
21
  #endif
@@ -147,6 +150,21 @@ crypto_scalarmult_curve25519_ref(unsigned char *q, const unsigned char *n,
147
150
  return crypto_scalarmult_curve25519(q, n, p);
148
151
  }
149
152
 
153
+ #undef crypto_scalarmult_curve25519_donna_c64_base
154
+ SODIUM_EXPORT int
155
+ crypto_scalarmult_curve25519_donna_c64_base(unsigned char *q, const unsigned char *n)
156
+ {
157
+ return crypto_scalarmult_curve25519_base(q, n);
158
+ }
159
+
160
+ #undef crypto_scalarmult_curve25519_donna_c64
161
+ SODIUM_EXPORT int
162
+ crypto_scalarmult_curve25519_donna_c64(unsigned char *q, const unsigned char *n,
163
+ const unsigned char *p)
164
+ {
165
+ return crypto_scalarmult_curve25519(q, n, p);
166
+ }
167
+
150
168
  #undef crypto_secretbox_xsalsa20poly1305_ref
151
169
  SODIUM_EXPORT int
152
170
  crypto_secretbox_xsalsa20poly1305_ref(unsigned char *c,
@@ -243,6 +261,50 @@ crypto_onetimeauth_poly1305_ref(unsigned char *out,
243
261
  return crypto_onetimeauth_poly1305(out, in, inlen, k);
244
262
  }
245
263
 
264
+ #undef crypto_stream_salsa20_amd64_xmm6
265
+ SODIUM_EXPORT int
266
+ crypto_stream_salsa20_amd64_xmm6(unsigned char *c,
267
+ unsigned long long clen,
268
+ const unsigned char *n,
269
+ const unsigned char *k)
270
+ {
271
+ return crypto_stream_salsa20(c, clen, n, k);
272
+ }
273
+
274
+ #undef crypto_stream_salsa20_ref
275
+ SODIUM_EXPORT int
276
+ crypto_stream_salsa20_ref(unsigned char *c,
277
+ unsigned long long clen,
278
+ const unsigned char *n,
279
+ const unsigned char *k)
280
+ {
281
+ return crypto_stream_salsa20(c, clen, n, k);
282
+ }
283
+
284
+ #undef crypto_stream_salsa20_amd64_xmm6_xor
285
+ SODIUM_EXPORT int
286
+ crypto_stream_salsa20_amd64_xmm6_xor(unsigned char *c,
287
+ const unsigned char *m,
288
+ unsigned long long mlen,
289
+ const unsigned char *n,
290
+ const unsigned char *k)
291
+ {
292
+ return crypto_stream_salsa20_xor(c, m, mlen, n, k);
293
+ }
294
+
295
+ #undef crypto_stream_salsa20_ref_xor
296
+ SODIUM_EXPORT int
297
+ crypto_stream_salsa20_ref_xor(unsigned char *c,
298
+ const unsigned char *m,
299
+ unsigned long long mlen,
300
+ const unsigned char *n,
301
+ const unsigned char *k)
302
+ {
303
+ return crypto_stream_salsa20_xor(c, m, mlen, n, k);
304
+ }
305
+
246
306
  #ifdef __cplusplus
247
307
  }
248
308
  #endif
309
+
310
+ #endif
@@ -2,6 +2,7 @@
2
2
  #include "core.h"
3
3
  #include "crypto_onetimeauth.h"
4
4
  #include "randombytes.h"
5
+ #include "runtime.h"
5
6
 
6
7
  static int initialized;
7
8
 
@@ -11,6 +12,7 @@ sodium_init(void)
11
12
  if (initialized != 0) {
12
13
  return 1;
13
14
  }
15
+ sodium_runtime_get_cpu_features();
14
16
  if (crypto_onetimeauth_pick_best_implementation() == NULL) {
15
17
  return -1;
16
18
  }
@@ -0,0 +1,134 @@
1
+
2
+ #ifdef HAVE_ANDROID_GETCPUFEATURES
3
+ # include <cpu-features.h>
4
+ #endif
5
+
6
+ #include "runtime.h"
7
+
8
+ typedef struct CPUFeatures_ {
9
+ int initialized;
10
+ int has_neon;
11
+ int has_sse2;
12
+ int has_sse3;
13
+ } CPUFeatures;
14
+
15
+ static CPUFeatures _cpu_features;
16
+
17
+ #define CPUID_SSE2 0x04000000
18
+ #define CPUIDECX_SSE3 0x00000001
19
+
20
+ static int
21
+ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
22
+ {
23
+ #ifndef __arm__
24
+ cpu_features->has_neon = 0;
25
+ return -1;
26
+ #else
27
+ # ifdef __APPLE__
28
+ # ifdef __ARM_NEON__
29
+ cpu_features->has_neon = 1;
30
+ # else
31
+ cpu_features->has_neon = 0;
32
+ # endif
33
+ # elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_NEON)
34
+ cpu_features->has_neon =
35
+ (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0x0;
36
+ # else
37
+ cpu_features->has_neon = 0;
38
+ # endif
39
+ return 0;
40
+ #endif
41
+ }
42
+
43
+ static void
44
+ _cpuid(unsigned int cpu_info[4U], const unsigned int cpu_info_type)
45
+ {
46
+ #ifdef _MSC_VER
47
+ __cpuidex((int *) cpu_info, cpu_info_type, 0);
48
+ #elif defined(HAVE_CPUID)
49
+ cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
50
+ # ifdef __i386__
51
+ __asm__ __volatile__ ("pushfl; pushfl; "
52
+ "popl %0; "
53
+ "movl %0, %1; xorl %2, %0; "
54
+ "pushl %0; "
55
+ "popfl; pushfl; popl %0; popfl" :
56
+ "=&r" (cpu_info[0]), "=&r" (cpu_info[1]) :
57
+ "i" (0x200000));
58
+ if (((cpu_info[0] ^ cpu_info[1]) & 0x200000) == 0x0) {
59
+ return;
60
+ }
61
+ # endif
62
+ # ifdef __i386__
63
+ __asm__ __volatile__ ("xchgl %%ebx, %k1; cpuid; xchgl %%ebx, %k1" :
64
+ "=a" (cpu_info[0]), "=&r" (cpu_info[1]),
65
+ "=c" (cpu_info[2]), "=d" (cpu_info[3]) :
66
+ "0" (cpu_info_type), "2" (0U));
67
+ # elif defined(__x86_64__)
68
+ __asm__ __volatile__ ("xchgq %%rbx, %q1; cpuid; xchgq %%rbx, %q1" :
69
+ "=a" (cpu_info[0]), "=&r" (cpu_info[1]),
70
+ "=c" (cpu_info[2]), "=d" (cpu_info[3]) :
71
+ "0" (cpu_info_type), "2" (0U));
72
+ # else
73
+ __asm__ __volatile__ ("cpuid" :
74
+ "=a" (cpu_info[0]), "=b" (cpu_info[1]),
75
+ "=c" (cpu_info[2]), "=d" (cpu_info[3]) :
76
+ "0" (cpu_info_type), "2" (0U));
77
+ # endif
78
+ #else
79
+ cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
80
+ #endif
81
+ }
82
+
83
+ static int
84
+ _sodium_runtime_intel_cpu_features(CPUFeatures * const cpu_features)
85
+ {
86
+ unsigned int cpu_info[4];
87
+ unsigned int id;
88
+
89
+ _cpuid(cpu_info, 0x0);
90
+ if ((id = cpu_info[0]) == 0U) {
91
+ return -1;
92
+ }
93
+ _cpuid(cpu_info, 0x00000001);
94
+ #ifndef HAVE_EMMINTRIN_H
95
+ cpu_features->has_sse2 = 0;
96
+ #else
97
+ cpu_features->has_sse2 = ((cpu_info[3] & CPUID_SSE2) != 0x0);
98
+ #endif
99
+
100
+ #ifndef HAVE_PMMINTRIN_H
101
+ cpu_features->has_sse3 = 0;
102
+ #else
103
+ cpu_features->has_sse3 = ((cpu_info[2] & CPUIDECX_SSE3) != 0x0);
104
+ #endif
105
+
106
+ return 0;
107
+ }
108
+
109
+ int
110
+ sodium_runtime_get_cpu_features(void)
111
+ {
112
+ int ret = -1;
113
+
114
+ ret &= _sodium_runtime_arm_cpu_features(&_cpu_features);
115
+ ret &= _sodium_runtime_intel_cpu_features(&_cpu_features);
116
+ _cpu_features.initialized = 1;
117
+
118
+ return ret;
119
+ }
120
+
121
+ int
122
+ sodium_runtime_has_neon(void) {
123
+ return _cpu_features.has_neon;
124
+ }
125
+
126
+ int
127
+ sodium_runtime_has_sse2(void) {
128
+ return _cpu_features.has_sse2;
129
+ }
130
+
131
+ int
132
+ sodium_runtime_has_sse3(void) {
133
+ return _cpu_features.has_sse3;
134
+ }