rbnacl-libsodium 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +23 -0
  3. data/CHANGES.md +5 -0
  4. data/Gemfile +5 -2
  5. data/Rakefile +5 -0
  6. data/ext/rbnacl/extconf.rb +2 -1
  7. data/lib/rbnacl/libsodium.rb +8 -2
  8. data/lib/rbnacl/libsodium/version.rb +1 -1
  9. data/vendor/libsodium/AUTHORS +14 -0
  10. data/vendor/libsodium/ChangeLog +26 -0
  11. data/vendor/libsodium/LICENSE +1 -1
  12. data/vendor/libsodium/Makefile.am +1 -0
  13. data/vendor/libsodium/Makefile.in +9 -0
  14. data/vendor/libsodium/README.markdown +7 -0
  15. data/vendor/libsodium/aclocal.m4 +1 -0
  16. data/vendor/libsodium/appveyor.yml +25 -0
  17. data/vendor/libsodium/autom4te.cache/output.1 +640 -126
  18. data/vendor/libsodium/autom4te.cache/output.6 +19049 -0
  19. data/vendor/libsodium/autom4te.cache/requests +1151 -914
  20. data/vendor/libsodium/autom4te.cache/traces.1 +472 -426
  21. data/vendor/libsodium/autom4te.cache/traces.6 +3193 -0
  22. data/vendor/libsodium/builds/msvc/version.h +2 -2
  23. data/vendor/libsodium/builds/msvc/vs2010/libsodium.sln +50 -79
  24. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +20 -8
  25. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +208 -166
  26. data/vendor/libsodium/builds/msvc/vs2012/libsodium.sln +50 -79
  27. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +20 -8
  28. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +206 -164
  29. data/vendor/libsodium/builds/msvc/vs2013/libsodium.sln +52 -81
  30. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +20 -8
  31. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +206 -164
  32. data/vendor/libsodium/builds/msvc/vs2015/libsodium.sln +52 -81
  33. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj +20 -8
  34. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +206 -164
  35. data/vendor/libsodium/configure +639 -125
  36. data/vendor/libsodium/configure.ac +94 -16
  37. data/vendor/libsodium/dist-build/Makefile.in +9 -0
  38. data/vendor/libsodium/dist-build/emscripten-symbols.def +370 -0
  39. data/vendor/libsodium/dist-build/emscripten.sh +9 -3
  40. data/vendor/libsodium/dist-build/generate-emscripten-symbols.sh +43 -0
  41. data/vendor/libsodium/libsodium-uninstalled.pc.in +1 -1
  42. data/vendor/libsodium/libsodium.pc.in +1 -1
  43. data/vendor/libsodium/libsodium.vcxproj +70 -66
  44. data/vendor/libsodium/libsodium.vcxproj.filters +204 -192
  45. data/vendor/libsodium/m4/ax_valgrind_check.m4 +190 -0
  46. data/vendor/libsodium/msvc-scripts/Makefile.in +9 -0
  47. data/vendor/libsodium/msvc-scripts/process.bat +2 -2
  48. data/vendor/libsodium/src/Makefile.in +9 -0
  49. data/vendor/libsodium/src/libsodium/Makefile.am +31 -6
  50. data/vendor/libsodium/src/libsodium/Makefile.in +238 -42
  51. data/vendor/libsodium/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c +234 -38
  52. data/vendor/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c +208 -118
  53. data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_seal.c +2 -2
  54. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c +1 -4
  55. data/vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c +1799 -1790
  56. data/vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.h +39 -39
  57. data/vendor/libsodium/src/libsodium/crypto_core/hchacha20/core_hchacha20.c +86 -0
  58. data/vendor/libsodium/src/libsodium/crypto_core/hchacha20/core_hchacha20.h +28 -0
  59. data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c +38 -46
  60. data/vendor/libsodium/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c +47 -55
  61. data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c +47 -55
  62. data/vendor/libsodium/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c +47 -55
  63. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c +7 -0
  64. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h +0 -89
  65. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h +50 -141
  66. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-avx2.c +45 -0
  67. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-avx2.h +123 -0
  68. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-ref.c +3 -2
  69. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-sse41.c +2 -2
  70. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/{blake2b-round.h → blake2b-compress-sse41.h} +2 -28
  71. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-ssse3.c +2 -4
  72. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-ssse3.h +97 -0
  73. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-load-avx2.h +339 -0
  74. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-load-sse2.h +0 -2
  75. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-load-sse41.h +0 -2
  76. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +29 -18
  77. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c +4 -43
  78. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c +3 -32
  79. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h +1 -20
  80. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +22 -41
  81. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +12 -39
  82. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c +2 -4
  83. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.h +1 -20
  84. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.c +570 -0
  85. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.h +198 -0
  86. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-encoding.c +444 -0
  87. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-encoding.h +32 -0
  88. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ref.c +229 -0
  89. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ssse3.c +222 -0
  90. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-impl.h +40 -0
  91. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.c +238 -0
  92. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.h +251 -0
  93. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blake2b-long.c +80 -0
  94. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blake2b-long.h +8 -0
  95. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blamka-round-ref.h +38 -0
  96. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blamka-round-ssse3.h +117 -0
  97. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/pwhash_argon2i.c +164 -0
  98. data/vendor/libsodium/src/libsodium/crypto_pwhash/crypto_pwhash.c +106 -0
  99. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c +1 -1
  100. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h +4 -4
  101. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c +186 -186
  102. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c +2 -2
  103. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c +3 -2
  104. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c +33 -33
  105. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c +253 -254
  106. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c +16 -17
  107. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.h +1 -0
  108. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c +11 -11
  109. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.h +1 -0
  110. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h +1 -1
  111. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h +3 -2
  112. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h +5 -3
  113. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c +41 -41
  114. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S +10 -2
  115. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_namespace.h +1 -1
  116. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S +4 -0
  117. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S +4 -0
  118. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c +31 -32
  119. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S +4 -0
  120. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.h +1 -1
  121. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S +4 -0
  122. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.h +1 -1
  123. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base_namespace.h +1 -1
  124. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h +1 -1
  125. data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +2 -6
  126. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c +8 -28
  127. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +75 -0
  128. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c +6 -6
  129. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common.h +1 -18
  130. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c +20 -20
  131. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/types.h +4 -4
  132. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c +6 -6
  133. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c +56 -77
  134. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.h +1 -0
  135. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/vec/stream_chacha20_vec.h +1 -0
  136. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c +2 -8
  137. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +2 -8
  138. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c +2 -8
  139. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c +2 -8
  140. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c +2 -8
  141. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c +2 -8
  142. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c +1 -5
  143. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c +1 -5
  144. data/vendor/libsodium/src/libsodium/include/Makefile.am +3 -0
  145. data/vendor/libsodium/src/libsodium/include/Makefile.in +19 -8
  146. data/vendor/libsodium/src/libsodium/include/sodium.h +3 -0
  147. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_aes256gcm.h +50 -0
  148. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +94 -22
  149. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +6 -6
  150. data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h +35 -0
  151. data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +3 -0
  152. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash.h +89 -0
  153. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h +86 -0
  154. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +6 -6
  155. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +0 -11
  156. data/vendor/libsodium/src/libsodium/include/sodium/runtime.h +3 -0
  157. data/vendor/libsodium/src/libsodium/randombytes/randombytes.c +3 -0
  158. data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +5 -1
  159. data/vendor/libsodium/src/libsodium/sodium/common.h +150 -0
  160. data/vendor/libsodium/src/libsodium/sodium/core.c +3 -1
  161. data/vendor/libsodium/src/libsodium/sodium/runtime.c +37 -19
  162. data/vendor/libsodium/src/libsodium/sodium/utils.c +18 -9
  163. data/vendor/libsodium/test/Makefile.in +9 -0
  164. data/vendor/libsodium/test/default/Makefile.am +10 -0
  165. data/vendor/libsodium/test/default/Makefile.in +53 -20
  166. data/vendor/libsodium/test/default/aead_aes256gcm.c +43 -17
  167. data/vendor/libsodium/test/default/aead_chacha20poly1305.c +179 -86
  168. data/vendor/libsodium/test/default/auth7.c +5 -5
  169. data/vendor/libsodium/test/default/box.c +4 -4
  170. data/vendor/libsodium/test/default/box2.c +1 -1
  171. data/vendor/libsodium/test/default/core6.c +1 -1
  172. data/vendor/libsodium/test/default/generichash.c +12 -1
  173. data/vendor/libsodium/test/default/generichash2.c +2 -2
  174. data/vendor/libsodium/test/default/generichash3.c +21 -0
  175. data/vendor/libsodium/test/default/pwhash.c +186 -168
  176. data/vendor/libsodium/test/default/pwhash.exp +11 -30
  177. data/vendor/libsodium/test/default/pwhash_scrypt.c +349 -0
  178. data/vendor/libsodium/test/default/pwhash_scrypt.exp +31 -0
  179. data/vendor/libsodium/test/default/secretbox.c +1 -1
  180. data/vendor/libsodium/test/default/secretbox2.c +1 -1
  181. data/vendor/libsodium/test/default/sign.c +15 -0
  182. data/vendor/libsodium/test/default/sodium_utils2.c +8 -3
  183. data/vendor/libsodium/test/default/sodium_utils3.c +4 -2
  184. data/vendor/libsodium/test/default/verify1.c +0 -4
  185. data/vendor/libsodium/test/quirks/quirks.h +3 -0
  186. metadata +37 -22
  187. data/vendor/libsodium/builds/msvc/vs2010/test/test.props +0 -43
  188. data/vendor/libsodium/builds/msvc/vs2010/test/test.runner.bat +0 -78
  189. data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj +0 -244
  190. data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj.filters +0 -192
  191. data/vendor/libsodium/builds/msvc/vs2012/test/test.props +0 -43
  192. data/vendor/libsodium/builds/msvc/vs2012/test/test.runner.bat +0 -78
  193. data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj +0 -244
  194. data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj.filters +0 -192
  195. data/vendor/libsodium/builds/msvc/vs2013/test/test.props +0 -43
  196. data/vendor/libsodium/builds/msvc/vs2013/test/test.runner.bat +0 -78
  197. data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj +0 -244
  198. data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj.filters +0 -192
  199. data/vendor/libsodium/builds/msvc/vs2015/test/test.props +0 -43
  200. data/vendor/libsodium/builds/msvc/vs2015/test/test.runner.bat +0 -78
  201. data/vendor/libsodium/builds/msvc/vs2015/test/test.vcxproj +0 -244
  202. data/vendor/libsodium/builds/msvc/vs2015/test/test.vcxproj.filters +0 -192
  203. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sysendian.h +0 -146
  204. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c +0 -64
@@ -31,19 +31,19 @@ size_t crypto_box_curve25519xsalsa20poly1305_beforenmbytes(void);
31
31
  SODIUM_EXPORT
32
32
  size_t crypto_box_curve25519xsalsa20poly1305_noncebytes(void);
33
33
 
34
- #define crypto_box_curve25519xsalsa20poly1305_ZEROBYTES 32U
34
+ #define crypto_box_curve25519xsalsa20poly1305_MACBYTES 16U
35
35
  SODIUM_EXPORT
36
- size_t crypto_box_curve25519xsalsa20poly1305_zerobytes(void);
36
+ size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void);
37
37
 
38
38
  #define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES 16U
39
39
  SODIUM_EXPORT
40
40
  size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void);
41
41
 
42
- #define crypto_box_curve25519xsalsa20poly1305_MACBYTES \
43
- (crypto_box_curve25519xsalsa20poly1305_ZEROBYTES - \
44
- crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES)
42
+ #define crypto_box_curve25519xsalsa20poly1305_ZEROBYTES \
43
+ (crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES + \
44
+ crypto_box_curve25519xsalsa20poly1305_MACBYTES)
45
45
  SODIUM_EXPORT
46
- size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void);
46
+ size_t crypto_box_curve25519xsalsa20poly1305_zerobytes(void);
47
47
 
48
48
  SODIUM_EXPORT
49
49
  int crypto_box_curve25519xsalsa20poly1305(unsigned char *c,
@@ -0,0 +1,35 @@
1
+ #ifndef crypto_core_hchacha20_H
2
+ #define crypto_core_hchacha20_H
3
+
4
+ #include <stddef.h>
5
+ #include "export.h"
6
+
7
+ #ifdef __cplusplus
8
+ extern "C" {
9
+ #endif
10
+
11
+ #define crypto_core_hchacha20_OUTPUTBYTES 32U
12
+ SODIUM_EXPORT
13
+ size_t crypto_core_hchacha20_outputbytes(void);
14
+
15
+ #define crypto_core_hchacha20_INPUTBYTES 16U
16
+ SODIUM_EXPORT
17
+ size_t crypto_core_hchacha20_inputbytes(void);
18
+
19
+ #define crypto_core_hchacha20_KEYBYTES 32U
20
+ SODIUM_EXPORT
21
+ size_t crypto_core_hchacha20_keybytes(void);
22
+
23
+ #define crypto_core_hchacha20_CONSTBYTES 16U
24
+ SODIUM_EXPORT
25
+ size_t crypto_core_hchacha20_constbytes(void);
26
+
27
+ SODIUM_EXPORT
28
+ int crypto_core_hchacha20(unsigned char *out, const unsigned char *in,
29
+ const unsigned char *k, const unsigned char *c);
30
+
31
+ #ifdef __cplusplus
32
+ }
33
+ #endif
34
+
35
+ #endif
@@ -67,6 +67,9 @@ size_t crypto_generichash_blake2b_saltbytes(void);
67
67
  SODIUM_EXPORT
68
68
  size_t crypto_generichash_blake2b_personalbytes(void);
69
69
 
70
+ SODIUM_EXPORT
71
+ size_t crypto_generichash_blake2b_statebytes(void);
72
+
70
73
  SODIUM_EXPORT
71
74
  int crypto_generichash_blake2b(unsigned char *out, size_t outlen,
72
75
  const unsigned char *in,
@@ -0,0 +1,89 @@
1
+ #ifndef crypto_pwhash_H
2
+ #define crypto_pwhash_H
3
+
4
+ #include <stddef.h>
5
+
6
+ #include "crypto_pwhash_argon2i.h"
7
+ #include "export.h"
8
+
9
+ #ifdef __cplusplus
10
+ # if __GNUC__
11
+ # pragma GCC diagnostic ignored "-Wlong-long"
12
+ # endif
13
+ extern "C" {
14
+ #endif
15
+
16
+ #define crypto_pwhash_ALG_ARGON2I13 crypto_pwhash_argon2i_ALG_ARGON2I13
17
+ SODIUM_EXPORT
18
+ int crypto_pwhash_alg_argon2i13(void);
19
+
20
+ #define crypto_pwhash_ALG_DEFAULT crypto_pwhash_ALG_ARGON2I13
21
+ SODIUM_EXPORT
22
+ int crypto_pwhash_alg_default(void);
23
+
24
+ #define crypto_pwhash_SALTBYTES crypto_pwhash_argon2i_SALTBYTES
25
+ SODIUM_EXPORT
26
+ size_t crypto_pwhash_saltbytes(void);
27
+
28
+ #define crypto_pwhash_STRBYTES crypto_pwhash_argon2i_STRBYTES
29
+ SODIUM_EXPORT
30
+ size_t crypto_pwhash_strbytes(void);
31
+
32
+ #define crypto_pwhash_STRPREFIX crypto_pwhash_argon2i_STRPREFIX
33
+ SODIUM_EXPORT
34
+ const char *crypto_pwhash_strprefix(void);
35
+
36
+ #define crypto_pwhash_OPSLIMIT_INTERACTIVE crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE
37
+ SODIUM_EXPORT
38
+ size_t crypto_pwhash_opslimit_interactive(void);
39
+
40
+ #define crypto_pwhash_MEMLIMIT_INTERACTIVE crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE
41
+ SODIUM_EXPORT
42
+ size_t crypto_pwhash_memlimit_interactive(void);
43
+
44
+ #define crypto_pwhash_OPSLIMIT_MODERATE crypto_pwhash_argon2i_OPSLIMIT_MODERATE
45
+ SODIUM_EXPORT
46
+ size_t crypto_pwhash_opslimit_moderate(void);
47
+
48
+ #define crypto_pwhash_MEMLIMIT_MODERATE crypto_pwhash_argon2i_MEMLIMIT_MODERATE
49
+ SODIUM_EXPORT
50
+ size_t crypto_pwhash_memlimit_moderate(void);
51
+
52
+ #define crypto_pwhash_OPSLIMIT_SENSITIVE crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE
53
+ SODIUM_EXPORT
54
+ size_t crypto_pwhash_opslimit_sensitive(void);
55
+
56
+ #define crypto_pwhash_MEMLIMIT_SENSITIVE crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE
57
+ SODIUM_EXPORT
58
+ size_t crypto_pwhash_memlimit_sensitive(void);
59
+
60
+ SODIUM_EXPORT
61
+ int crypto_pwhash(unsigned char * const out, unsigned long long outlen,
62
+ const char * const passwd, unsigned long long passwdlen,
63
+ const unsigned char * const salt,
64
+ unsigned long long opslimit, size_t memlimit, int alg)
65
+ __attribute__ ((warn_unused_result));
66
+
67
+ SODIUM_EXPORT
68
+ int crypto_pwhash_str(char out[crypto_pwhash_STRBYTES],
69
+ const char * const passwd, unsigned long long passwdlen,
70
+ unsigned long long opslimit, size_t memlimit)
71
+ __attribute__ ((warn_unused_result));
72
+
73
+ SODIUM_EXPORT
74
+ int crypto_pwhash_str_verify(const char str[crypto_pwhash_STRBYTES],
75
+ const char * const passwd,
76
+ unsigned long long passwdlen)
77
+ __attribute__ ((warn_unused_result));
78
+
79
+ #define crypto_pwhash_PRIMITIVE "argon2i"
80
+ SODIUM_EXPORT
81
+ const char *crypto_pwhash_primitive(void)
82
+ __attribute__ ((warn_unused_result));
83
+
84
+ #ifdef __cplusplus
85
+ }
86
+ #endif
87
+
88
+ #endif
89
+
@@ -0,0 +1,86 @@
1
+ #ifndef crypto_pwhash_argon2i_H
2
+ #define crypto_pwhash_argon2i_H
3
+
4
+ #include <stddef.h>
5
+
6
+ #include "export.h"
7
+
8
+ #ifdef __cplusplus
9
+ # if __GNUC__
10
+ # pragma GCC diagnostic ignored "-Wlong-long"
11
+ # endif
12
+ extern "C" {
13
+ #endif
14
+
15
+ #define crypto_pwhash_argon2i_ALG_ARGON2I13 1
16
+ SODIUM_EXPORT
17
+ int crypto_pwhash_argon2i_alg_argon2i13(void);
18
+
19
+ #define crypto_pwhash_argon2i_SALTBYTES 16U
20
+ SODIUM_EXPORT
21
+ size_t crypto_pwhash_argon2i_saltbytes(void);
22
+
23
+ #define crypto_pwhash_argon2i_STRBYTES 128U
24
+ SODIUM_EXPORT
25
+ size_t crypto_pwhash_argon2i_strbytes(void);
26
+
27
+ #define crypto_pwhash_argon2i_STRPREFIX "$argon2i$"
28
+ SODIUM_EXPORT
29
+ const char *crypto_pwhash_argon2i_strprefix(void);
30
+
31
+ #define crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE 4ULL
32
+ SODIUM_EXPORT
33
+ size_t crypto_pwhash_argon2i_opslimit_interactive(void);
34
+
35
+ #define crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE 33554432ULL
36
+ SODIUM_EXPORT
37
+ size_t crypto_pwhash_argon2i_memlimit_interactive(void);
38
+
39
+ #define crypto_pwhash_argon2i_OPSLIMIT_MODERATE 6ULL
40
+ SODIUM_EXPORT
41
+ size_t crypto_pwhash_argon2i_opslimit_moderate(void);
42
+
43
+ #define crypto_pwhash_argon2i_MEMLIMIT_MODERATE 134217728ULL
44
+ SODIUM_EXPORT
45
+ size_t crypto_pwhash_argon2i_memlimit_moderate(void);
46
+
47
+ #define crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE 8ULL
48
+ SODIUM_EXPORT
49
+ size_t crypto_pwhash_argon2i_opslimit_sensitive(void);
50
+
51
+ #define crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE 536870912ULL
52
+ SODIUM_EXPORT
53
+ size_t crypto_pwhash_argon2i_memlimit_sensitive(void);
54
+
55
+ SODIUM_EXPORT
56
+ int crypto_pwhash_argon2i(unsigned char * const out,
57
+ unsigned long long outlen,
58
+ const char * const passwd,
59
+ unsigned long long passwdlen,
60
+ const unsigned char * const salt,
61
+ unsigned long long opslimit, size_t memlimit,
62
+ int alg)
63
+ __attribute__ ((warn_unused_result));
64
+
65
+ SODIUM_EXPORT
66
+ int crypto_pwhash_argon2i_str(char out[crypto_pwhash_argon2i_STRBYTES],
67
+ const char * const passwd,
68
+ unsigned long long passwdlen,
69
+ unsigned long long opslimit, size_t memlimit)
70
+ __attribute__ ((warn_unused_result));
71
+
72
+ SODIUM_EXPORT
73
+ int crypto_pwhash_argon2i_str_verify(const char str[crypto_pwhash_argon2i_STRBYTES],
74
+ const char * const passwd,
75
+ unsigned long long passwdlen)
76
+ __attribute__ ((warn_unused_result));
77
+
78
+ /* ------------------------------------------------------------------------- */
79
+
80
+ int _crypto_pwhash_argon2i_pick_best_implementation(void);
81
+
82
+ #ifdef __cplusplus
83
+ }
84
+ #endif
85
+
86
+ #endif
@@ -19,19 +19,19 @@ size_t crypto_secretbox_xsalsa20poly1305_keybytes(void);
19
19
  SODIUM_EXPORT
20
20
  size_t crypto_secretbox_xsalsa20poly1305_noncebytes(void);
21
21
 
22
- #define crypto_secretbox_xsalsa20poly1305_ZEROBYTES 32U
22
+ #define crypto_secretbox_xsalsa20poly1305_MACBYTES 16U
23
23
  SODIUM_EXPORT
24
- size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void);
24
+ size_t crypto_secretbox_xsalsa20poly1305_macbytes(void);
25
25
 
26
26
  #define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U
27
27
  SODIUM_EXPORT
28
28
  size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void);
29
29
 
30
- #define crypto_secretbox_xsalsa20poly1305_MACBYTES \
31
- (crypto_secretbox_xsalsa20poly1305_ZEROBYTES - \
32
- crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES)
30
+ #define crypto_secretbox_xsalsa20poly1305_ZEROBYTES \
31
+ (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + \
32
+ crypto_secretbox_xsalsa20poly1305_MACBYTES)
33
33
  SODIUM_EXPORT
34
- size_t crypto_secretbox_xsalsa20poly1305_macbytes(void);
34
+ size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void);
35
35
 
36
36
  SODIUM_EXPORT
37
37
  int crypto_secretbox_xsalsa20poly1305(unsigned char *c,
@@ -23,19 +23,8 @@ extern "C" {
23
23
  #endif
24
24
 
25
25
  #define crypto_sign_edwards25519sha512batch_BYTES 64U
26
- SODIUM_EXPORT
27
- size_t crypto_sign_edwards25519sha512batch_bytes(void)
28
- __attribute__ ((deprecated));
29
-
30
26
  #define crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES 32U
31
- SODIUM_EXPORT
32
- size_t crypto_sign_edwards25519sha512batch_publickeybytes(void)
33
- __attribute__ ((deprecated));
34
-
35
27
  #define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES (32U + 32U)
36
- SODIUM_EXPORT
37
- size_t crypto_sign_edwards25519sha512batch_secretkeybytes(void)
38
- __attribute__ ((deprecated));
39
28
 
40
29
  SODIUM_EXPORT
41
30
  int crypto_sign_edwards25519sha512batch(unsigned char *sm,
@@ -26,6 +26,9 @@ int sodium_runtime_has_sse41(void);
26
26
  SODIUM_EXPORT
27
27
  int sodium_runtime_has_avx(void);
28
28
 
29
+ SODIUM_EXPORT
30
+ int sodium_runtime_has_avx2(void);
31
+
29
32
  SODIUM_EXPORT
30
33
  int sodium_runtime_has_pclmul(void);
31
34
 
@@ -17,6 +17,9 @@
17
17
  # include "randombytes_nativeclient.h"
18
18
  #endif
19
19
 
20
+ /* C++Builder defines a "random" macro */
21
+ #undef random
22
+
20
23
  #ifndef __EMSCRIPTEN__
21
24
  #ifdef __native_client__
22
25
  static const randombytes_implementation *implementation =
@@ -16,7 +16,7 @@
16
16
  #include <stdint.h>
17
17
  #include <stdlib.h>
18
18
  #include <string.h>
19
- #ifndef _MSC_VER
19
+ #if !defined(_MSC_VER) && !defined(__BORLANDC__)
20
20
  # include <unistd.h>
21
21
  #endif
22
22
 
@@ -36,6 +36,10 @@ extern "C"
36
36
  # endif
37
37
  BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
38
38
  # pragma comment(lib, "advapi32.lib")
39
+ # ifdef __BORLANDC__
40
+ # define _ftime ftime
41
+ # define _timeb timeb
42
+ # endif
39
43
  #endif
40
44
 
41
45
  #define SALSA20_RANDOM_BLOCK_SIZE crypto_core_salsa20_OUTPUTBYTES
@@ -0,0 +1,150 @@
1
+ #ifndef common_H
2
+ #define common_H 1
3
+
4
+ #include <stdint.h>
5
+ #include <stdlib.h>
6
+ #include <string.h>
7
+
8
+ #define LOAD64_LE(SRC) load64_le(SRC)
9
+ static inline uint64_t
10
+ load64_le(const uint8_t src[8])
11
+ {
12
+ #ifdef NATIVE_LITTLE_ENDIAN
13
+ uint64_t w;
14
+ memcpy(&w, src, sizeof w);
15
+ return w;
16
+ #else
17
+ uint64_t w = (uint64_t) src[0];
18
+ w |= (uint64_t) src[1] << 8;
19
+ w |= (uint64_t) src[2] << 16;
20
+ w |= (uint64_t) src[3] << 24;
21
+ w |= (uint64_t) src[4] << 32;
22
+ w |= (uint64_t) src[5] << 40;
23
+ w |= (uint64_t) src[6] << 48;
24
+ w |= (uint64_t) src[7] << 56;
25
+ return w;
26
+ #endif
27
+ }
28
+
29
+ #define STORE64_LE(DST, W) store64_le((DST), (W))
30
+ static inline void
31
+ store64_le(uint8_t dst[8], uint64_t w)
32
+ {
33
+ #ifdef NATIVE_LITTLE_ENDIAN
34
+ memcpy(dst, &w, sizeof w);
35
+ #else
36
+ dst[0] = (uint8_t) w; w >>= 8;
37
+ dst[1] = (uint8_t) w; w >>= 8;
38
+ dst[2] = (uint8_t) w; w >>= 8;
39
+ dst[3] = (uint8_t) w; w >>= 8;
40
+ dst[4] = (uint8_t) w; w >>= 8;
41
+ dst[5] = (uint8_t) w; w >>= 8;
42
+ dst[6] = (uint8_t) w; w >>= 8;
43
+ dst[7] = (uint8_t) w;
44
+ #endif
45
+ }
46
+
47
+ #define LOAD32_LE(SRC) load32_le(SRC)
48
+ static inline uint32_t
49
+ load32_le(const uint8_t src[4])
50
+ {
51
+ #ifdef NATIVE_LITTLE_ENDIAN
52
+ uint32_t w;
53
+ memcpy(&w, src, sizeof w);
54
+ return w;
55
+ #else
56
+ uint32_t w = (uint32_t) src[0];
57
+ w |= (uint32_t) src[1] << 8;
58
+ w |= (uint32_t) src[2] << 16;
59
+ w |= (uint32_t) src[3] << 24;
60
+ return w;
61
+ #endif
62
+ }
63
+
64
+ #define STORE32_LE(DST, W) store32_le((DST), (W))
65
+ static inline void
66
+ store32_le(uint8_t dst[4], uint32_t w)
67
+ {
68
+ #ifdef NATIVE_LITTLE_ENDIAN
69
+ memcpy(dst, &w, sizeof w);
70
+ #else
71
+ dst[0] = (uint8_t) w; w >>= 8;
72
+ dst[1] = (uint8_t) w; w >>= 8;
73
+ dst[2] = (uint8_t) w; w >>= 8;
74
+ dst[3] = (uint8_t) w;
75
+ #endif
76
+ }
77
+
78
+ /* ----- */
79
+
80
+ #define LOAD64_BE(SRC) load64_be(SRC)
81
+ static inline uint64_t
82
+ load64_be(const uint8_t src[8])
83
+ {
84
+ #ifdef NATIVE_BIG_ENDIAN
85
+ uint64_t w;
86
+ memcpy(&w, src, sizeof w);
87
+ return w;
88
+ #else
89
+ uint64_t w = (uint64_t) src[7];
90
+ w |= (uint64_t) src[6] << 8;
91
+ w |= (uint64_t) src[5] << 16;
92
+ w |= (uint64_t) src[4] << 24;
93
+ w |= (uint64_t) src[3] << 32;
94
+ w |= (uint64_t) src[2] << 40;
95
+ w |= (uint64_t) src[1] << 48;
96
+ w |= (uint64_t) src[0] << 56;
97
+ return w;
98
+ #endif
99
+ }
100
+
101
+ #define LOAD32_BE(SRC) load32_be(SRC)
102
+ static inline uint32_t
103
+ load32_be(const uint8_t src[4])
104
+ {
105
+ #ifdef NATIVE_BIG_ENDIAN
106
+ uint32_t w;
107
+ memcpy(&w, src, sizeof w);
108
+ return w;
109
+ #else
110
+ uint32_t w = (uint32_t) src[3];
111
+ w |= (uint32_t) src[2] << 8;
112
+ w |= (uint32_t) src[1] << 16;
113
+ w |= (uint32_t) src[0] << 24;
114
+ return w;
115
+ #endif
116
+ }
117
+
118
+ #define STORE64_BE(DST, W) store64_be((DST), (W))
119
+ static inline void
120
+ store64_be(uint8_t dst[8], uint64_t w)
121
+ {
122
+ #ifdef NATIVE_BIG_ENDIAN
123
+ memcpy(dst, &w, sizeof w);
124
+ #else
125
+ dst[7] = (uint8_t) w; w >>= 8;
126
+ dst[6] = (uint8_t) w; w >>= 8;
127
+ dst[5] = (uint8_t) w; w >>= 8;
128
+ dst[4] = (uint8_t) w; w >>= 8;
129
+ dst[3] = (uint8_t) w; w >>= 8;
130
+ dst[2] = (uint8_t) w; w >>= 8;
131
+ dst[1] = (uint8_t) w; w >>= 8;
132
+ dst[0] = (uint8_t) w;
133
+ #endif
134
+ }
135
+
136
+ #define STORE32_BE(DST, W) store32_be((DST), (W))
137
+ static inline void
138
+ store32_be(uint8_t dst[4], uint32_t w)
139
+ {
140
+ #ifdef NATIVE_BIG_ENDIAN
141
+ memcpy(dst, &w, sizeof w);
142
+ #else
143
+ dst[3] = (uint8_t) w; w >>= 8;
144
+ dst[2] = (uint8_t) w; w >>= 8;
145
+ dst[1] = (uint8_t) w; w >>= 8;
146
+ dst[0] = (uint8_t) w;
147
+ #endif
148
+ }
149
+
150
+ #endif