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
@@ -4,35 +4,20 @@ D. J. Bernstein
4
4
  Public domain.
5
5
  */
6
6
 
7
+ #include <stdint.h>
8
+ #include <stdlib.h>
9
+
7
10
  #include "crypto_core_salsa2012.h"
11
+ #include "../../sodium/common.h"
8
12
 
9
13
  #define ROUNDS 12
14
+ #define U32C(v) (v##U)
10
15
 
11
- typedef unsigned int uint32;
12
-
13
- static uint32 rotate(uint32 u,int c)
16
+ static uint32_t rotate(uint32_t u,int c)
14
17
  {
15
18
  return (u << c) | (u >> (32 - c));
16
19
  }
17
20
 
18
- static uint32 load_littleendian(const unsigned char *x)
19
- {
20
- return
21
- (uint32) (x[0]) \
22
- | (((uint32) (x[1])) << 8) \
23
- | (((uint32) (x[2])) << 16) \
24
- | (((uint32) (x[3])) << 24)
25
- ;
26
- }
27
-
28
- static void store_littleendian(unsigned char *x,uint32 u)
29
- {
30
- x[0] = u; u >>= 8;
31
- x[1] = u; u >>= 8;
32
- x[2] = u; u >>= 8;
33
- x[3] = u;
34
- }
35
-
36
21
  int crypto_core_salsa2012(
37
22
  unsigned char *out,
38
23
  const unsigned char *in,
@@ -40,26 +25,33 @@ int crypto_core_salsa2012(
40
25
  const unsigned char *c
41
26
  )
42
27
  {
43
- uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
44
- uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
28
+ uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
29
+ uint32_t j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
45
30
  int i;
46
31
 
47
- j0 = x0 = load_littleendian(c + 0);
48
- j1 = x1 = load_littleendian(k + 0);
49
- j2 = x2 = load_littleendian(k + 4);
50
- j3 = x3 = load_littleendian(k + 8);
51
- j4 = x4 = load_littleendian(k + 12);
52
- j5 = x5 = load_littleendian(c + 4);
53
- j6 = x6 = load_littleendian(in + 0);
54
- j7 = x7 = load_littleendian(in + 4);
55
- j8 = x8 = load_littleendian(in + 8);
56
- j9 = x9 = load_littleendian(in + 12);
57
- j10 = x10 = load_littleendian(c + 8);
58
- j11 = x11 = load_littleendian(k + 16);
59
- j12 = x12 = load_littleendian(k + 20);
60
- j13 = x13 = load_littleendian(k + 24);
61
- j14 = x14 = load_littleendian(k + 28);
62
- j15 = x15 = load_littleendian(c + 12);
32
+ if (c == NULL) {
33
+ j0 = x0 = U32C(0x61707865);
34
+ j5 = x5 = U32C(0x3320646e);
35
+ j10 = x10 = U32C(0x79622d32);
36
+ j15 = x15 = U32C(0x6b206574);
37
+ } else {
38
+ j0 = x0 = LOAD32_LE(c + 0);
39
+ j5 = x5 = LOAD32_LE(c + 4);
40
+ j10 = x10 = LOAD32_LE(c + 8);
41
+ j15 = x15 = LOAD32_LE(c + 12);
42
+ }
43
+ j1 = x1 = LOAD32_LE(k + 0);
44
+ j2 = x2 = LOAD32_LE(k + 4);
45
+ j3 = x3 = LOAD32_LE(k + 8);
46
+ j4 = x4 = LOAD32_LE(k + 12);
47
+ j6 = x6 = LOAD32_LE(in + 0);
48
+ j7 = x7 = LOAD32_LE(in + 4);
49
+ j8 = x8 = LOAD32_LE(in + 8);
50
+ j9 = x9 = LOAD32_LE(in + 12);
51
+ j11 = x11 = LOAD32_LE(k + 16);
52
+ j12 = x12 = LOAD32_LE(k + 20);
53
+ j13 = x13 = LOAD32_LE(k + 24);
54
+ j14 = x14 = LOAD32_LE(k + 28);
63
55
 
64
56
  for (i = ROUNDS;i > 0;i -= 2) {
65
57
  x4 ^= rotate( x0+x12, 7);
@@ -113,22 +105,22 @@ int crypto_core_salsa2012(
113
105
  x14 += j14;
114
106
  x15 += j15;
115
107
 
116
- store_littleendian(out + 0,x0);
117
- store_littleendian(out + 4,x1);
118
- store_littleendian(out + 8,x2);
119
- store_littleendian(out + 12,x3);
120
- store_littleendian(out + 16,x4);
121
- store_littleendian(out + 20,x5);
122
- store_littleendian(out + 24,x6);
123
- store_littleendian(out + 28,x7);
124
- store_littleendian(out + 32,x8);
125
- store_littleendian(out + 36,x9);
126
- store_littleendian(out + 40,x10);
127
- store_littleendian(out + 44,x11);
128
- store_littleendian(out + 48,x12);
129
- store_littleendian(out + 52,x13);
130
- store_littleendian(out + 56,x14);
131
- store_littleendian(out + 60,x15);
108
+ STORE32_LE(out + 0,x0);
109
+ STORE32_LE(out + 4,x1);
110
+ STORE32_LE(out + 8,x2);
111
+ STORE32_LE(out + 12,x3);
112
+ STORE32_LE(out + 16,x4);
113
+ STORE32_LE(out + 20,x5);
114
+ STORE32_LE(out + 24,x6);
115
+ STORE32_LE(out + 28,x7);
116
+ STORE32_LE(out + 32,x8);
117
+ STORE32_LE(out + 36,x9);
118
+ STORE32_LE(out + 40,x10);
119
+ STORE32_LE(out + 44,x11);
120
+ STORE32_LE(out + 48,x12);
121
+ STORE32_LE(out + 52,x13);
122
+ STORE32_LE(out + 56,x14);
123
+ STORE32_LE(out + 60,x15);
132
124
 
133
125
  return 0;
134
126
  }
@@ -4,35 +4,20 @@ D. J. Bernstein
4
4
  Public domain.
5
5
  */
6
6
 
7
+ #include <stdint.h>
8
+ #include <stdlib.h>
9
+
7
10
  #include "crypto_core_salsa208.h"
11
+ #include "../../sodium/common.h"
8
12
 
9
13
  #define ROUNDS 8
14
+ #define U32C(v) (v##U)
10
15
 
11
- typedef unsigned int uint32;
12
-
13
- static uint32 rotate(uint32 u,int c)
16
+ static uint32_t rotate(uint32_t u,int c)
14
17
  {
15
18
  return (u << c) | (u >> (32 - c));
16
19
  }
17
20
 
18
- static uint32 load_littleendian(const unsigned char *x)
19
- {
20
- return
21
- (uint32) (x[0]) \
22
- | (((uint32) (x[1])) << 8) \
23
- | (((uint32) (x[2])) << 16) \
24
- | (((uint32) (x[3])) << 24)
25
- ;
26
- }
27
-
28
- static void store_littleendian(unsigned char *x,uint32 u)
29
- {
30
- x[0] = u; u >>= 8;
31
- x[1] = u; u >>= 8;
32
- x[2] = u; u >>= 8;
33
- x[3] = u;
34
- }
35
-
36
21
  int crypto_core_salsa208(
37
22
  unsigned char *out,
38
23
  const unsigned char *in,
@@ -40,26 +25,33 @@ int crypto_core_salsa208(
40
25
  const unsigned char *c
41
26
  )
42
27
  {
43
- uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
44
- uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
28
+ uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
29
+ uint32_t j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
45
30
  int i;
46
31
 
47
- j0 = x0 = load_littleendian(c + 0);
48
- j1 = x1 = load_littleendian(k + 0);
49
- j2 = x2 = load_littleendian(k + 4);
50
- j3 = x3 = load_littleendian(k + 8);
51
- j4 = x4 = load_littleendian(k + 12);
52
- j5 = x5 = load_littleendian(c + 4);
53
- j6 = x6 = load_littleendian(in + 0);
54
- j7 = x7 = load_littleendian(in + 4);
55
- j8 = x8 = load_littleendian(in + 8);
56
- j9 = x9 = load_littleendian(in + 12);
57
- j10 = x10 = load_littleendian(c + 8);
58
- j11 = x11 = load_littleendian(k + 16);
59
- j12 = x12 = load_littleendian(k + 20);
60
- j13 = x13 = load_littleendian(k + 24);
61
- j14 = x14 = load_littleendian(k + 28);
62
- j15 = x15 = load_littleendian(c + 12);
32
+ if (c == NULL) {
33
+ j0 = x0 = U32C(0x61707865);
34
+ j5 = x5 = U32C(0x3320646e);
35
+ j10 = x10 = U32C(0x79622d32);
36
+ j15 = x15 = U32C(0x6b206574);
37
+ } else {
38
+ j0 = x0 = LOAD32_LE(c + 0);
39
+ j5 = x5 = LOAD32_LE(c + 4);
40
+ j10 = x10 = LOAD32_LE(c + 8);
41
+ j15 = x15 = LOAD32_LE(c + 12);
42
+ }
43
+ j1 = x1 = LOAD32_LE(k + 0);
44
+ j2 = x2 = LOAD32_LE(k + 4);
45
+ j3 = x3 = LOAD32_LE(k + 8);
46
+ j4 = x4 = LOAD32_LE(k + 12);
47
+ j6 = x6 = LOAD32_LE(in + 0);
48
+ j7 = x7 = LOAD32_LE(in + 4);
49
+ j8 = x8 = LOAD32_LE(in + 8);
50
+ j9 = x9 = LOAD32_LE(in + 12);
51
+ j11 = x11 = LOAD32_LE(k + 16);
52
+ j12 = x12 = LOAD32_LE(k + 20);
53
+ j13 = x13 = LOAD32_LE(k + 24);
54
+ j14 = x14 = LOAD32_LE(k + 28);
63
55
 
64
56
  for (i = ROUNDS;i > 0;i -= 2) {
65
57
  x4 ^= rotate( x0+x12, 7);
@@ -113,22 +105,22 @@ int crypto_core_salsa208(
113
105
  x14 += j14;
114
106
  x15 += j15;
115
107
 
116
- store_littleendian(out + 0,x0);
117
- store_littleendian(out + 4,x1);
118
- store_littleendian(out + 8,x2);
119
- store_littleendian(out + 12,x3);
120
- store_littleendian(out + 16,x4);
121
- store_littleendian(out + 20,x5);
122
- store_littleendian(out + 24,x6);
123
- store_littleendian(out + 28,x7);
124
- store_littleendian(out + 32,x8);
125
- store_littleendian(out + 36,x9);
126
- store_littleendian(out + 40,x10);
127
- store_littleendian(out + 44,x11);
128
- store_littleendian(out + 48,x12);
129
- store_littleendian(out + 52,x13);
130
- store_littleendian(out + 56,x14);
131
- store_littleendian(out + 60,x15);
108
+ STORE32_LE(out + 0,x0);
109
+ STORE32_LE(out + 4,x1);
110
+ STORE32_LE(out + 8,x2);
111
+ STORE32_LE(out + 12,x3);
112
+ STORE32_LE(out + 16,x4);
113
+ STORE32_LE(out + 20,x5);
114
+ STORE32_LE(out + 24,x6);
115
+ STORE32_LE(out + 28,x7);
116
+ STORE32_LE(out + 32,x8);
117
+ STORE32_LE(out + 36,x9);
118
+ STORE32_LE(out + 40,x10);
119
+ STORE32_LE(out + 44,x11);
120
+ STORE32_LE(out + 48,x12);
121
+ STORE32_LE(out + 52,x13);
122
+ STORE32_LE(out + 56,x14);
123
+ STORE32_LE(out + 60,x15);
132
124
 
133
125
  return 0;
134
126
  }
@@ -39,3 +39,10 @@ size_t
39
39
  crypto_generichash_blake2b_personalbytes(void) {
40
40
  return crypto_generichash_blake2b_PERSONALBYTES;
41
41
  }
42
+
43
+ size_t
44
+ crypto_generichash_blake2b_statebytes(void)
45
+ {
46
+ return (sizeof(crypto_generichash_blake2b_state) + (size_t) 63U)
47
+ & ~(size_t) 63U;
48
+ }
@@ -19,95 +19,6 @@
19
19
 
20
20
  #include "utils.h"
21
21
 
22
- static inline uint32_t load32( const void *src )
23
- {
24
- #ifdef NATIVE_LITTLE_ENDIAN
25
- uint32_t w;
26
- memcpy(&w, src, sizeof w);
27
- return w;
28
- #else
29
- const uint8_t *p = ( const uint8_t * )src;
30
- uint32_t w = *p++;
31
- w |= ( uint32_t )( *p++ ) << 8;
32
- w |= ( uint32_t )( *p++ ) << 16;
33
- w |= ( uint32_t )( *p++ ) << 24;
34
- return w;
35
- #endif
36
- }
37
-
38
- static inline uint64_t load64( const void *src )
39
- {
40
- #ifdef NATIVE_LITTLE_ENDIAN
41
- uint64_t w;
42
- memcpy(&w, src, sizeof w);
43
- return w;
44
- #else
45
- const uint8_t *p = ( const uint8_t * )src;
46
- uint64_t w = *p++;
47
- w |= ( uint64_t )( *p++ ) << 8;
48
- w |= ( uint64_t )( *p++ ) << 16;
49
- w |= ( uint64_t )( *p++ ) << 24;
50
- w |= ( uint64_t )( *p++ ) << 32;
51
- w |= ( uint64_t )( *p++ ) << 40;
52
- w |= ( uint64_t )( *p++ ) << 48;
53
- w |= ( uint64_t )( *p++ ) << 56;
54
- return w;
55
- #endif
56
- }
57
-
58
- static inline void store32( void *dst, uint32_t w )
59
- {
60
- #ifdef NATIVE_LITTLE_ENDIAN
61
- memcpy(dst, &w, sizeof w);
62
- #else
63
- uint8_t *p = ( uint8_t * )dst;
64
- *p++ = ( uint8_t )w; w >>= 8;
65
- *p++ = ( uint8_t )w; w >>= 8;
66
- *p++ = ( uint8_t )w; w >>= 8;
67
- *p++ = ( uint8_t )w;
68
- #endif
69
- }
70
-
71
- static inline void store64( void *dst, uint64_t w )
72
- {
73
- #ifdef NATIVE_LITTLE_ENDIAN
74
- memcpy(dst, &w, sizeof w);
75
- #else
76
- uint8_t *p = ( uint8_t * )dst;
77
- *p++ = ( uint8_t )w; w >>= 8;
78
- *p++ = ( uint8_t )w; w >>= 8;
79
- *p++ = ( uint8_t )w; w >>= 8;
80
- *p++ = ( uint8_t )w; w >>= 8;
81
- *p++ = ( uint8_t )w; w >>= 8;
82
- *p++ = ( uint8_t )w; w >>= 8;
83
- *p++ = ( uint8_t )w; w >>= 8;
84
- *p++ = ( uint8_t )w;
85
- #endif
86
- }
87
-
88
- static inline uint64_t load48( const void *src )
89
- {
90
- const uint8_t *p = ( const uint8_t * )src;
91
- uint64_t w = *p++;
92
- w |= ( uint64_t )( *p++ ) << 8;
93
- w |= ( uint64_t )( *p++ ) << 16;
94
- w |= ( uint64_t )( *p++ ) << 24;
95
- w |= ( uint64_t )( *p++ ) << 32;
96
- w |= ( uint64_t )( *p++ ) << 40;
97
- return w;
98
- }
99
-
100
- static inline void store48( void *dst, uint64_t w )
101
- {
102
- uint8_t *p = ( uint8_t * )dst;
103
- *p++ = ( uint8_t )w; w >>= 8;
104
- *p++ = ( uint8_t )w; w >>= 8;
105
- *p++ = ( uint8_t )w; w >>= 8;
106
- *p++ = ( uint8_t )w; w >>= 8;
107
- *p++ = ( uint8_t )w; w >>= 8;
108
- *p++ = ( uint8_t )w;
109
- }
110
-
111
22
  static inline uint32_t rotl32( const uint32_t w, const unsigned c )
112
23
  {
113
24
  return ( w << c ) | ( w >> ( 32 - c ) );
@@ -7,9 +7,12 @@
7
7
  and related and neighboring rights to this software to the public domain
8
8
  worldwide. This software is distributed without any warranty.
9
9
 
10
- You should have received a copy of the CC0 Public Domain Dedication along with
11
- this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
12
- */
10
+ All code is triple-licensed under the
11
+ [CC0](http://creativecommons.org/publicdomain/zero/1.0), the
12
+ [OpenSSL Licence](https://www.openssl.org/source/license.html), or
13
+ the [Apache Public License 2.0](http://www.apache.org/licenses/LICENSE-2.0),
14
+ at your choosing.
15
+ */
13
16
 
14
17
  #ifndef blake2_H
15
18
  #define blake2_H
@@ -31,27 +34,14 @@
31
34
  #define blake2b_salt_personal crypto_generichash_blake2b__blake2b_salt_personal
32
35
  #define blake2b_pick_best_implementation crypto_generichash_blake2b__pick_best_implementation
33
36
 
34
- #if defined(__cplusplus)
35
- extern "C" {
36
- #endif
37
-
38
- enum blake2s_constant
39
- {
40
- BLAKE2S_BLOCKBYTES = 64,
41
- BLAKE2S_OUTBYTES = 32,
42
- BLAKE2S_KEYBYTES = 32,
43
- BLAKE2S_SALTBYTES = 8,
44
- BLAKE2S_PERSONALBYTES = 8
45
- };
46
-
47
- enum blake2b_constant
48
- {
49
- BLAKE2B_BLOCKBYTES = 128,
50
- BLAKE2B_OUTBYTES = 64,
51
- BLAKE2B_KEYBYTES = 64,
52
- BLAKE2B_SALTBYTES = 16,
53
- BLAKE2B_PERSONALBYTES = 16
54
- };
37
+ enum blake2b_constant
38
+ {
39
+ BLAKE2B_BLOCKBYTES = 128,
40
+ BLAKE2B_OUTBYTES = 64,
41
+ BLAKE2B_KEYBYTES = 64,
42
+ BLAKE2B_SALTBYTES = 16,
43
+ BLAKE2B_PERSONALBYTES = 16
44
+ };
55
45
 
56
46
  #if defined(__IBMC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
57
47
  # pragma pack(1)
@@ -59,75 +49,22 @@ extern "C" {
59
49
  # pragma pack(push, 1)
60
50
  #endif
61
51
 
62
- typedef struct blake2s_param_
63
- {
64
- uint8_t digest_length; // 1
65
- uint8_t key_length; // 2
66
- uint8_t fanout; // 3
67
- uint8_t depth; // 4
68
- uint32_t leaf_length; // 8
69
- uint8_t node_offset[6];// 14
70
- uint8_t node_depth; // 15
71
- uint8_t inner_length; // 16
72
- // uint8_t reserved[0];
73
- uint8_t salt[BLAKE2S_SALTBYTES]; // 24
74
- uint8_t personal[BLAKE2S_PERSONALBYTES]; // 32
75
- } blake2s_param;
76
-
77
- CRYPTO_ALIGN( 64 ) typedef struct blake2s_state_
78
- {
79
- uint32_t h[8];
80
- uint32_t t[2];
81
- uint32_t f[2];
82
- uint8_t buf[2 * BLAKE2S_BLOCKBYTES];
83
- size_t buflen;
84
- uint8_t last_node;
85
- } blake2s_state ;
86
-
87
- typedef struct blake2b_param_
88
- {
89
- uint8_t digest_length; // 1
90
- uint8_t key_length; // 2
91
- uint8_t fanout; // 3
92
- uint8_t depth; // 4
93
- uint32_t leaf_length; // 8
94
- uint64_t node_offset; // 16
95
- uint8_t node_depth; // 17
96
- uint8_t inner_length; // 18
97
- uint8_t reserved[14]; // 32
98
- uint8_t salt[BLAKE2B_SALTBYTES]; // 48
99
- uint8_t personal[BLAKE2B_PERSONALBYTES]; // 64
100
- } blake2b_param;
101
-
102
- #ifndef DEFINE_BLAKE2B_STATE
103
- typedef crypto_generichash_blake2b_state blake2b_state;
104
- #else
105
- CRYPTO_ALIGN( 64 ) typedef struct blake2b_state_
106
- {
107
- uint64_t h[8];
108
- uint64_t t[2];
109
- uint64_t f[2];
110
- uint8_t buf[2 * BLAKE2B_BLOCKBYTES];
111
- size_t buflen;
112
- uint8_t last_node;
113
- } blake2b_state;
114
- #endif
52
+ typedef struct blake2b_param_
53
+ {
54
+ uint8_t digest_length; /* 1 */
55
+ uint8_t key_length; /* 2 */
56
+ uint8_t fanout; /* 3 */
57
+ uint8_t depth; /* 4 */
58
+ uint8_t leaf_length[4]; /* 8 */
59
+ uint8_t node_offset[8]; /* 16 */
60
+ uint8_t node_depth; /* 17 */
61
+ uint8_t inner_length; /* 18 */
62
+ uint8_t reserved[14]; /* 32 */
63
+ uint8_t salt[BLAKE2B_SALTBYTES]; /* 48 */
64
+ uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */
65
+ } blake2b_param;
115
66
 
116
- typedef struct blake2sp_state_
117
- {
118
- blake2s_state S[8][1];
119
- blake2s_state R[1];
120
- uint8_t buf[8 * BLAKE2S_BLOCKBYTES];
121
- size_t buflen;
122
- } blake2sp_state;
123
-
124
- typedef struct blake2bp_state_
125
- {
126
- blake2b_state S[4][1];
127
- blake2b_state R[1];
128
- uint8_t buf[4 * BLAKE2B_BLOCKBYTES];
129
- size_t buflen;
130
- } blake2bp_state;
67
+ typedef crypto_generichash_blake2b_state blake2b_state;
131
68
 
132
69
  #if defined(__IBMC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
133
70
  # pragma pack()
@@ -135,54 +72,26 @@ CRYPTO_ALIGN( 64 ) typedef struct blake2b_state_
135
72
  # pragma pack(pop)
136
73
  #endif
137
74
 
138
- // Streaming API
139
- int blake2s_init( blake2s_state *S, const uint8_t outlen );
140
- int blake2s_init_key( blake2s_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
141
- int blake2s_init_param( blake2s_state *S, const blake2s_param *P );
142
- int blake2s_update( blake2s_state *S, const uint8_t *in, uint64_t inlen );
143
- int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen );
144
-
145
- int blake2b_init( blake2b_state *S, const uint8_t outlen );
146
- int blake2b_init_salt_personal( blake2b_state *S, const uint8_t outlen,
147
- const void *personal, const void *salt );
148
- int blake2b_init_key( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
149
- int blake2b_init_key_salt_personal( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen,
150
- const void *salt, const void *personal );
151
- int blake2b_init_param( blake2b_state *S, const blake2b_param *P );
152
- int blake2b_update( blake2b_state *S, const uint8_t *in, uint64_t inlen );
153
- int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen );
154
-
155
- int blake2sp_init( blake2sp_state *S, const uint8_t outlen );
156
- int blake2sp_init_key( blake2sp_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
157
- int blake2sp_update( blake2sp_state *S, const uint8_t *in, uint64_t inlen );
158
- int blake2sp_final( blake2sp_state *S, uint8_t *out, uint8_t outlen );
159
-
160
- int blake2bp_init( blake2bp_state *S, const uint8_t outlen );
161
- int blake2bp_init_key( blake2bp_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
162
- int blake2bp_update( blake2bp_state *S, const uint8_t *in, uint64_t inlen );
163
- int blake2bp_final( blake2bp_state *S, uint8_t *out, uint8_t outlen );
164
-
165
- // Simple API
166
- int blake2s( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
167
- int blake2b( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
168
- int blake2b_salt_personal( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen, const void *salt, const void *personal );
169
-
170
- int blake2sp( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
171
- int blake2bp( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
172
-
173
- static inline int blake2( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen )
174
- {
175
- return blake2b( out, in, key, outlen, inlen, keylen );
176
- }
177
-
178
- typedef int ( *blake2b_compress_fn )( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] );
179
- int blake2b_pick_best_implementation(void);
180
- int blake2b_compress_ref( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] );
181
- int blake2b_compress_ssse3( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] );
182
- int blake2b_compress_sse41( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] );
183
-
184
- #if defined(__cplusplus)
185
- }
186
- #endif
75
+ /* Streaming API */
76
+ int blake2b_init( blake2b_state *S, const uint8_t outlen );
77
+ int blake2b_init_salt_personal( blake2b_state *S, const uint8_t outlen,
78
+ const void *personal, const void *salt );
79
+ int blake2b_init_key( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
80
+ int blake2b_init_key_salt_personal( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen,
81
+ const void *salt, const void *personal );
82
+ int blake2b_init_param( blake2b_state *S, const blake2b_param *P );
83
+ int blake2b_update( blake2b_state *S, const uint8_t *in, uint64_t inlen );
84
+ int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen );
85
+
86
+ /* Simple API */
87
+ int blake2b( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
88
+ int blake2b_salt_personal( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen, const void *salt, const void *personal );
89
+
90
+ typedef int ( *blake2b_compress_fn )( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] );
91
+ int blake2b_pick_best_implementation(void);
92
+ int blake2b_compress_ref( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] );
93
+ int blake2b_compress_ssse3( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] );
94
+ int blake2b_compress_sse41( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] );
95
+ int blake2b_compress_avx2( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] );
187
96
 
188
97
  #endif