rbnacl-libsodium 1.0.13 → 1.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +5 -0
  3. data/lib/rbnacl/libsodium.rb +1 -0
  4. data/lib/rbnacl/libsodium/version.rb +1 -1
  5. data/vendor/libsodium/AUTHORS +2 -2
  6. data/vendor/libsodium/ChangeLog +64 -0
  7. data/vendor/libsodium/Makefile.am +1 -0
  8. data/vendor/libsodium/README.markdown +1 -3
  9. data/vendor/libsodium/THANKS +13 -3
  10. data/vendor/libsodium/builds/Makefile.am +65 -0
  11. data/vendor/libsodium/builds/msvc/resource.rc +2 -2
  12. data/vendor/libsodium/builds/msvc/version.h +3 -3
  13. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +168 -173
  14. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +382 -394
  15. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +168 -173
  16. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +382 -394
  17. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +168 -173
  18. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +382 -394
  19. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj +168 -173
  20. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +382 -394
  21. data/vendor/libsodium/builds/msvc/vs2017/libsodium/libsodium.vcxproj +168 -173
  22. data/vendor/libsodium/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters +382 -394
  23. data/vendor/libsodium/configure.ac +59 -10
  24. data/vendor/libsodium/contrib/Findsodium.cmake +2 -0
  25. data/vendor/libsodium/dist-build/emscripten-symbols.def +72 -32
  26. data/vendor/libsodium/dist-build/emscripten.sh +33 -6
  27. data/vendor/libsodium/dist-build/generate-emscripten-symbols.sh +52 -38
  28. data/vendor/libsodium/dist-build/ios.sh +2 -2
  29. data/vendor/libsodium/libsodium.vcxproj +168 -173
  30. data/vendor/libsodium/libsodium.vcxproj.filters +220 -235
  31. data/vendor/libsodium/m4/ax_check_catchable_abrt.m4 +57 -0
  32. data/vendor/libsodium/m4/ax_check_gnu_make.m4 +2 -2
  33. data/vendor/libsodium/m4/ax_pthread.m4 +2 -2
  34. data/vendor/libsodium/msvc-scripts/process.bat +3 -3
  35. data/vendor/libsodium/packaging/dotnet-core/README.md +5 -5
  36. data/vendor/libsodium/packaging/dotnet-core/libsodium.props +5 -2
  37. data/vendor/libsodium/packaging/dotnet-core/prepare.py +13 -31
  38. data/vendor/libsodium/packaging/dotnet-core/recipes/linux-x64 +4 -0
  39. data/vendor/libsodium/packaging/nuget/package.config +1 -1
  40. data/vendor/libsodium/src/libsodium/Makefile.am +11 -12
  41. data/vendor/libsodium/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c +11 -4
  42. data/vendor/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c +17 -4
  43. data/vendor/libsodium/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c +8 -1
  44. data/vendor/libsodium/src/libsodium/crypto_box/crypto_box.c +6 -0
  45. data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_easy.c +5 -4
  46. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c +11 -4
  47. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c +6 -0
  48. data/vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c +78 -17
  49. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c +74 -64
  50. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c +2 -0
  51. data/vendor/libsodium/src/libsodium/crypto_kx/crypto_kx.c +7 -0
  52. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +1 -1
  53. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +1 -0
  54. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c +17 -17
  55. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.c +53 -48
  56. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.h +37 -11
  57. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-encoding.c +23 -179
  58. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-avx2.c +4 -12
  59. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-avx512f.c +244 -0
  60. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ref.c +3 -12
  61. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ssse3.c +4 -12
  62. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.c +1 -5
  63. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.h +1 -1
  64. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blamka-round-avx512f.h +145 -0
  65. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/pwhash_argon2i.c +91 -14
  66. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/pwhash_argon2id.c +35 -14
  67. data/vendor/libsodium/src/libsodium/crypto_pwhash/crypto_pwhash.c +41 -4
  68. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c +31 -17
  69. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h +4 -0
  70. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c +5 -1
  71. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c +30 -1
  72. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c +8 -0
  73. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c +3 -3
  74. data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c +6 -0
  75. data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +5 -4
  76. data/vendor/libsodium/src/libsodium/crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c +11 -4
  77. data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c +6 -0
  78. data/vendor/libsodium/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c +311 -0
  79. data/vendor/libsodium/src/libsodium/crypto_sign/crypto_sign.c +6 -0
  80. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ed25519_ref10.h +3 -0
  81. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +9 -2
  82. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c +1 -1
  83. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +6 -5
  84. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519.c +6 -0
  85. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c +3 -2
  86. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c +3 -2
  87. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/u0.h +1 -1
  88. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c +3 -2
  89. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20.c +12 -0
  90. data/vendor/libsodium/src/libsodium/crypto_stream/crypto_stream.c +6 -0
  91. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20.c +7 -1
  92. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/u0.h +1 -1
  93. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c +6 -0
  94. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208.c +6 -0
  95. data/vendor/libsodium/src/libsodium/crypto_stream/xchacha20/stream_xchacha20.c +6 -0
  96. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c +6 -0
  97. data/vendor/libsodium/src/libsodium/crypto_verify/sodium/verify.c +66 -29
  98. data/vendor/libsodium/src/libsodium/include/Makefile.am +1 -1
  99. data/vendor/libsodium/src/libsodium/include/sodium.h +2 -2
  100. data/vendor/libsodium/src/libsodium/include/sodium/core.h +9 -0
  101. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_aes256gcm.h +26 -0
  102. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +16 -4
  103. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h +10 -4
  104. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box.h +4 -0
  105. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h +6 -0
  106. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +24 -15
  107. data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h +8 -4
  108. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash.h +40 -18
  109. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h +8 -2
  110. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2id.h +8 -2
  111. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +11 -3
  112. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +4 -0
  113. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h +6 -0
  114. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +17 -8
  115. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h +102 -0
  116. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign.h +4 -0
  117. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h +4 -0
  118. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +1 -0
  119. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream.h +4 -0
  120. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h +10 -0
  121. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h +4 -0
  122. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h +4 -0
  123. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h +15 -5
  124. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h +4 -0
  125. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +4 -0
  126. data/vendor/libsodium/src/libsodium/include/sodium/export.h +9 -0
  127. data/vendor/libsodium/src/libsodium/include/sodium/private/common.h +11 -0
  128. data/vendor/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h +2 -30
  129. data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +2 -0
  130. data/vendor/libsodium/src/libsodium/include/sodium/runtime.h +12 -9
  131. data/vendor/libsodium/src/libsodium/include/sodium/utils.h +36 -0
  132. data/vendor/libsodium/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c +3 -2
  133. data/vendor/libsodium/src/libsodium/randombytes/randombytes.c +18 -14
  134. data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +11 -10
  135. data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +20 -8
  136. data/vendor/libsodium/src/libsodium/sodium/codecs.c +333 -0
  137. data/vendor/libsodium/src/libsodium/sodium/core.c +36 -4
  138. data/vendor/libsodium/src/libsodium/sodium/runtime.c +18 -0
  139. data/vendor/libsodium/src/libsodium/sodium/utils.c +87 -100
  140. data/vendor/libsodium/test/constcheck.sh +19 -0
  141. data/vendor/libsodium/test/default/Makefile.am +39 -7
  142. data/vendor/libsodium/test/default/aead_aes256gcm.c +6 -0
  143. data/vendor/libsodium/test/default/aead_chacha20poly1305.c +16 -0
  144. data/vendor/libsodium/test/default/aead_xchacha20poly1305.c +25 -15
  145. data/vendor/libsodium/test/default/auth.c +13 -0
  146. data/vendor/libsodium/test/default/auth.exp +8 -0
  147. data/vendor/libsodium/test/default/box.c +3 -0
  148. data/vendor/libsodium/test/default/box2.c +2 -0
  149. data/vendor/libsodium/test/default/box_easy.c +1 -4
  150. data/vendor/libsodium/test/default/box_easy2.c +7 -3
  151. data/vendor/libsodium/test/default/chacha20.c +9 -2
  152. data/vendor/libsodium/test/default/cmptest.h +47 -1
  153. data/vendor/libsodium/test/default/codecs.c +226 -0
  154. data/vendor/libsodium/test/default/codecs.exp +28 -0
  155. data/vendor/libsodium/test/default/core3.c +42 -15
  156. data/vendor/libsodium/test/default/ed25519_convert.c +17 -0
  157. data/vendor/libsodium/test/default/kdf.c +8 -4
  158. data/vendor/libsodium/test/default/keygen.c +5 -2
  159. data/vendor/libsodium/test/default/kx.c +30 -0
  160. data/vendor/libsodium/test/default/metamorphic.c +187 -0
  161. data/vendor/libsodium/test/default/metamorphic.exp +1 -0
  162. data/vendor/libsodium/test/default/misuse.c +145 -0
  163. data/vendor/libsodium/test/default/misuse.exp +0 -0
  164. data/vendor/libsodium/test/default/onetimeauth.c +2 -0
  165. data/vendor/libsodium/test/default/{pwhash.c → pwhash_argon2i.c} +133 -106
  166. data/vendor/libsodium/test/default/{pwhash.exp → pwhash_argon2i.exp} +0 -1
  167. data/vendor/libsodium/test/default/pwhash_argon2id.c +254 -144
  168. data/vendor/libsodium/test/default/pwhash_argon2id.exp +2 -3
  169. data/vendor/libsodium/test/default/pwhash_scrypt.c +61 -18
  170. data/vendor/libsodium/test/default/pwhash_scrypt.exp +6 -0
  171. data/vendor/libsodium/test/default/randombytes.c +8 -3
  172. data/vendor/libsodium/test/default/secretbox.c +8 -0
  173. data/vendor/libsodium/test/default/secretbox2.c +5 -0
  174. data/vendor/libsodium/test/default/secretbox_easy.c +19 -1
  175. data/vendor/libsodium/test/default/secretbox_easy.exp +2 -0
  176. data/vendor/libsodium/test/default/secretbox_easy2.c +4 -0
  177. data/vendor/libsodium/test/default/secretstream.c +280 -0
  178. data/vendor/libsodium/test/default/secretstream.exp +1 -0
  179. data/vendor/libsodium/test/default/sign.c +31 -0
  180. data/vendor/libsodium/test/default/sodium_core.c +23 -1
  181. data/vendor/libsodium/test/default/sodium_core.exp +1 -1
  182. data/vendor/libsodium/test/default/sodium_utils.c +45 -56
  183. data/vendor/libsodium/test/default/sodium_utils.exp +0 -8
  184. data/vendor/libsodium/test/default/stream.c +2 -0
  185. data/vendor/libsodium/test/default/stream2.c +1 -0
  186. data/vendor/libsodium/test/default/xchacha20.c +58 -7
  187. metadata +21 -18
  188. data/vendor/libsodium/dist-build/emscripten-wasm.sh +0 -132
  189. data/vendor/libsodium/m4/pkg.m4 +0 -214
  190. data/vendor/libsodium/packaging/dotnet-core/desktop.targets +0 -16
  191. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/afternm_aes128ctr.c +0 -174
  192. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/beforenm_aes128ctr.c +0 -66
  193. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/common.h +0 -766
  194. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/consts.h +0 -28
  195. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/consts_aes128ctr.c +0 -28
  196. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/int128.h +0 -50
  197. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/int128_aes128ctr.c +0 -149
  198. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/stream_aes128ctr_nacl.c +0 -31
  199. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/xor_afternm_aes128ctr.c +0 -195
  200. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr.c +0 -19
  201. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h +0 -65
@@ -30,6 +30,12 @@ size_t crypto_aead_chacha20poly1305_ietf_npubbytes(void);
30
30
  SODIUM_EXPORT
31
31
  size_t crypto_aead_chacha20poly1305_ietf_abytes(void);
32
32
 
33
+ #define crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX \
34
+ SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ietf_ABYTES, \
35
+ (64ULL * (1ULL << 32) - 64ULL) - crypto_aead_chacha20poly1305_ietf_ABYTES)
36
+ SODIUM_EXPORT
37
+ size_t crypto_aead_chacha20poly1305_ietf_messagebytes_max(void);
38
+
33
39
  SODIUM_EXPORT
34
40
  int crypto_aead_chacha20poly1305_ietf_encrypt(unsigned char *c,
35
41
  unsigned long long *clen_p,
@@ -98,6 +104,11 @@ size_t crypto_aead_chacha20poly1305_npubbytes(void);
98
104
  SODIUM_EXPORT
99
105
  size_t crypto_aead_chacha20poly1305_abytes(void);
100
106
 
107
+ #define crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX \
108
+ (SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ABYTES)
109
+ SODIUM_EXPORT
110
+ size_t crypto_aead_chacha20poly1305_messagebytes_max(void);
111
+
101
112
  SODIUM_EXPORT
102
113
  int crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
103
114
  unsigned long long *clen_p,
@@ -150,10 +161,11 @@ void crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_chacha20pol
150
161
 
151
162
  /* Aliases */
152
163
 
153
- #define crypto_aead_chacha20poly1305_IETF_KEYBYTES crypto_aead_chacha20poly1305_ietf_KEYBYTES
154
- #define crypto_aead_chacha20poly1305_IETF_NSECBYTES crypto_aead_chacha20poly1305_ietf_NSECBYTES
155
- #define crypto_aead_chacha20poly1305_IETF_NPUBBYTES crypto_aead_chacha20poly1305_ietf_NPUBBYTES
156
- #define crypto_aead_chacha20poly1305_IETF_ABYTES crypto_aead_chacha20poly1305_ietf_ABYTES
164
+ #define crypto_aead_chacha20poly1305_IETF_KEYBYTES crypto_aead_chacha20poly1305_ietf_KEYBYTES
165
+ #define crypto_aead_chacha20poly1305_IETF_NSECBYTES crypto_aead_chacha20poly1305_ietf_NSECBYTES
166
+ #define crypto_aead_chacha20poly1305_IETF_NPUBBYTES crypto_aead_chacha20poly1305_ietf_NPUBBYTES
167
+ #define crypto_aead_chacha20poly1305_IETF_ABYTES crypto_aead_chacha20poly1305_ietf_ABYTES
168
+ #define crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX
157
169
 
158
170
  #ifdef __cplusplus
159
171
  }
@@ -27,6 +27,11 @@ size_t crypto_aead_xchacha20poly1305_ietf_npubbytes(void);
27
27
  SODIUM_EXPORT
28
28
  size_t crypto_aead_xchacha20poly1305_ietf_abytes(void);
29
29
 
30
+ #define crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX \
31
+ (SODIUM_SIZE_MAX - crypto_aead_xchacha20poly1305_ietf_ABYTES)
32
+ SODIUM_EXPORT
33
+ size_t crypto_aead_xchacha20poly1305_ietf_messagebytes_max(void);
34
+
30
35
  SODIUM_EXPORT
31
36
  int crypto_aead_xchacha20poly1305_ietf_encrypt(unsigned char *c,
32
37
  unsigned long long *clen_p,
@@ -79,10 +84,11 @@ void crypto_aead_xchacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchac
79
84
 
80
85
  /* Aliases */
81
86
 
82
- #define crypto_aead_xchacha20poly1305_IETF_KEYBYTES crypto_aead_xchacha20poly1305_ietf_KEYBYTES
83
- #define crypto_aead_xchacha20poly1305_IETF_NSECBYTES crypto_aead_xchacha20poly1305_ietf_NSECBYTES
84
- #define crypto_aead_xchacha20poly1305_IETF_NPUBBYTES crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
85
- #define crypto_aead_xchacha20poly1305_IETF_ABYTES crypto_aead_xchacha20poly1305_ietf_ABYTES
87
+ #define crypto_aead_xchacha20poly1305_IETF_KEYBYTES crypto_aead_xchacha20poly1305_ietf_KEYBYTES
88
+ #define crypto_aead_xchacha20poly1305_IETF_NSECBYTES crypto_aead_xchacha20poly1305_ietf_NSECBYTES
89
+ #define crypto_aead_xchacha20poly1305_IETF_NPUBBYTES crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
90
+ #define crypto_aead_xchacha20poly1305_IETF_ABYTES crypto_aead_xchacha20poly1305_ietf_ABYTES
91
+ #define crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX
86
92
 
87
93
  #ifdef __cplusplus
88
94
  }
@@ -40,6 +40,10 @@ size_t crypto_box_noncebytes(void);
40
40
  SODIUM_EXPORT
41
41
  size_t crypto_box_macbytes(void);
42
42
 
43
+ #define crypto_box_MESSAGEBYTES_MAX crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX
44
+ SODIUM_EXPORT
45
+ size_t crypto_box_messagebytes_max(void);
46
+
43
47
  #define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305"
44
48
  SODIUM_EXPORT
45
49
  const char *crypto_box_primitive(void);
@@ -3,6 +3,7 @@
3
3
  #define crypto_box_curve25519xchacha20poly1305_H
4
4
 
5
5
  #include <stddef.h>
6
+ #include "crypto_stream_xchacha20.h"
6
7
  #include "export.h"
7
8
 
8
9
  #ifdef __cplusplus
@@ -36,6 +37,11 @@ size_t crypto_box_curve25519xchacha20poly1305_noncebytes(void);
36
37
  SODIUM_EXPORT
37
38
  size_t crypto_box_curve25519xchacha20poly1305_macbytes(void);
38
39
 
40
+ #define crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX \
41
+ (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_box_curve25519xchacha20poly1305_MACBYTES)
42
+ SODIUM_EXPORT
43
+ size_t crypto_box_curve25519xchacha20poly1305_messagebytes_max(void);
44
+
39
45
  SODIUM_EXPORT
40
46
  int crypto_box_curve25519xchacha20poly1305_seed_keypair(unsigned char *pk,
41
47
  unsigned char *sk,
@@ -2,6 +2,7 @@
2
2
  #define crypto_box_curve25519xsalsa20poly1305_H
3
3
 
4
4
  #include <stddef.h>
5
+ #include "crypto_stream_xsalsa20.h"
5
6
  #include "export.h"
6
7
 
7
8
  #ifdef __cplusplus
@@ -35,6 +36,29 @@ size_t crypto_box_curve25519xsalsa20poly1305_noncebytes(void);
35
36
  SODIUM_EXPORT
36
37
  size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void);
37
38
 
39
+ /* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */
40
+ #define crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX \
41
+ (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_box_curve25519xsalsa20poly1305_MACBYTES)
42
+ SODIUM_EXPORT
43
+ size_t crypto_box_curve25519xsalsa20poly1305_messagebytes_max(void);
44
+
45
+ SODIUM_EXPORT
46
+ int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
47
+ unsigned char *sk,
48
+ const unsigned char *seed);
49
+
50
+ SODIUM_EXPORT
51
+ int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk,
52
+ unsigned char *sk);
53
+
54
+ SODIUM_EXPORT
55
+ int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
56
+ const unsigned char *pk,
57
+ const unsigned char *sk)
58
+ __attribute__ ((warn_unused_result));
59
+
60
+ /* -- NaCl compatibility interface ; Requires padding -- */
61
+
38
62
  #define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES 16U
39
63
  SODIUM_EXPORT
40
64
  size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void);
@@ -63,21 +87,6 @@ int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m,
63
87
  const unsigned char *sk)
64
88
  __attribute__ ((warn_unused_result));
65
89
 
66
- SODIUM_EXPORT
67
- int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
68
- unsigned char *sk,
69
- const unsigned char *seed);
70
-
71
- SODIUM_EXPORT
72
- int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk,
73
- unsigned char *sk);
74
-
75
- SODIUM_EXPORT
76
- int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
77
- const unsigned char *pk,
78
- const unsigned char *sk)
79
- __attribute__ ((warn_unused_result));
80
-
81
90
  SODIUM_EXPORT
82
91
  int crypto_box_curve25519xsalsa20poly1305_afternm(unsigned char *c,
83
92
  const unsigned char *m,
@@ -10,19 +10,23 @@ extern "C" {
10
10
 
11
11
  #define crypto_core_salsa208_OUTPUTBYTES 64U
12
12
  SODIUM_EXPORT
13
- size_t crypto_core_salsa208_outputbytes(void);
13
+ size_t crypto_core_salsa208_outputbytes(void)
14
+ __attribute__ ((deprecated));
14
15
 
15
16
  #define crypto_core_salsa208_INPUTBYTES 16U
16
17
  SODIUM_EXPORT
17
- size_t crypto_core_salsa208_inputbytes(void);
18
+ size_t crypto_core_salsa208_inputbytes(void)
19
+ __attribute__ ((deprecated));
18
20
 
19
21
  #define crypto_core_salsa208_KEYBYTES 32U
20
22
  SODIUM_EXPORT
21
- size_t crypto_core_salsa208_keybytes(void);
23
+ size_t crypto_core_salsa208_keybytes(void)
24
+ __attribute__ ((deprecated));
22
25
 
23
26
  #define crypto_core_salsa208_CONSTBYTES 16U
24
27
  SODIUM_EXPORT
25
- size_t crypto_core_salsa208_constbytes(void);
28
+ size_t crypto_core_salsa208_constbytes(void)
29
+ __attribute__ ((deprecated));
26
30
 
27
31
  SODIUM_EXPORT
28
32
  int crypto_core_salsa208(unsigned char *out, const unsigned char *in,
@@ -22,78 +22,84 @@ int crypto_pwhash_alg_argon2i13(void);
22
22
  SODIUM_EXPORT
23
23
  int crypto_pwhash_alg_argon2id13(void);
24
24
 
25
- #define crypto_pwhash_ALG_DEFAULT crypto_pwhash_ALG_ARGON2I13
25
+ #define crypto_pwhash_ALG_DEFAULT crypto_pwhash_ALG_ARGON2ID13
26
26
  SODIUM_EXPORT
27
27
  int crypto_pwhash_alg_default(void);
28
28
 
29
- #define crypto_pwhash_BYTES_MIN crypto_pwhash_argon2i_BYTES_MIN
29
+ #define crypto_pwhash_BYTES_MIN crypto_pwhash_argon2id_BYTES_MIN
30
30
  SODIUM_EXPORT
31
31
  size_t crypto_pwhash_bytes_min(void);
32
32
 
33
- #define crypto_pwhash_BYTES_MAX crypto_pwhash_argon2i_BYTES_MAX
33
+ #define crypto_pwhash_BYTES_MAX crypto_pwhash_argon2id_BYTES_MAX
34
34
  SODIUM_EXPORT
35
35
  size_t crypto_pwhash_bytes_max(void);
36
36
 
37
- #define crypto_pwhash_PASSWD_MIN crypto_pwhash_argon2i_PASSWD_MIN
37
+ #define crypto_pwhash_PASSWD_MIN crypto_pwhash_argon2id_PASSWD_MIN
38
38
  SODIUM_EXPORT
39
39
  size_t crypto_pwhash_passwd_min(void);
40
40
 
41
- #define crypto_pwhash_PASSWD_MAX crypto_pwhash_argon2i_PASSWD_MAX
41
+ #define crypto_pwhash_PASSWD_MAX crypto_pwhash_argon2id_PASSWD_MAX
42
42
  SODIUM_EXPORT
43
43
  size_t crypto_pwhash_passwd_max(void);
44
44
 
45
- #define crypto_pwhash_SALTBYTES crypto_pwhash_argon2i_SALTBYTES
45
+ #define crypto_pwhash_SALTBYTES crypto_pwhash_argon2id_SALTBYTES
46
46
  SODIUM_EXPORT
47
47
  size_t crypto_pwhash_saltbytes(void);
48
48
 
49
- #define crypto_pwhash_STRBYTES crypto_pwhash_argon2i_STRBYTES
49
+ #define crypto_pwhash_STRBYTES crypto_pwhash_argon2id_STRBYTES
50
50
  SODIUM_EXPORT
51
51
  size_t crypto_pwhash_strbytes(void);
52
52
 
53
- #define crypto_pwhash_STRPREFIX crypto_pwhash_argon2i_STRPREFIX
53
+ #define crypto_pwhash_STRPREFIX crypto_pwhash_argon2id_STRPREFIX
54
54
  SODIUM_EXPORT
55
55
  const char *crypto_pwhash_strprefix(void);
56
56
 
57
- #define crypto_pwhash_OPSLIMIT_MIN crypto_pwhash_argon2i_OPSLIMIT_MIN
57
+ #define crypto_pwhash_OPSLIMIT_MIN crypto_pwhash_argon2id_OPSLIMIT_MIN
58
58
  SODIUM_EXPORT
59
59
  size_t crypto_pwhash_opslimit_min(void);
60
60
 
61
- #define crypto_pwhash_OPSLIMIT_MAX crypto_pwhash_argon2i_OPSLIMIT_MAX
61
+ #define crypto_pwhash_OPSLIMIT_MAX crypto_pwhash_argon2id_OPSLIMIT_MAX
62
62
  SODIUM_EXPORT
63
63
  size_t crypto_pwhash_opslimit_max(void);
64
64
 
65
- #define crypto_pwhash_MEMLIMIT_MIN crypto_pwhash_argon2i_MEMLIMIT_MIN
65
+ #define crypto_pwhash_MEMLIMIT_MIN crypto_pwhash_argon2id_MEMLIMIT_MIN
66
66
  SODIUM_EXPORT
67
67
  size_t crypto_pwhash_memlimit_min(void);
68
68
 
69
- #define crypto_pwhash_MEMLIMIT_MAX crypto_pwhash_argon2i_MEMLIMIT_MAX
69
+ #define crypto_pwhash_MEMLIMIT_MAX crypto_pwhash_argon2id_MEMLIMIT_MAX
70
70
  SODIUM_EXPORT
71
71
  size_t crypto_pwhash_memlimit_max(void);
72
72
 
73
- #define crypto_pwhash_OPSLIMIT_INTERACTIVE crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE
73
+ #define crypto_pwhash_OPSLIMIT_INTERACTIVE crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE
74
74
  SODIUM_EXPORT
75
75
  size_t crypto_pwhash_opslimit_interactive(void);
76
76
 
77
- #define crypto_pwhash_MEMLIMIT_INTERACTIVE crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE
77
+ #define crypto_pwhash_MEMLIMIT_INTERACTIVE crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE
78
78
  SODIUM_EXPORT
79
79
  size_t crypto_pwhash_memlimit_interactive(void);
80
80
 
81
- #define crypto_pwhash_OPSLIMIT_MODERATE crypto_pwhash_argon2i_OPSLIMIT_MODERATE
81
+ #define crypto_pwhash_OPSLIMIT_MODERATE crypto_pwhash_argon2id_OPSLIMIT_MODERATE
82
82
  SODIUM_EXPORT
83
83
  size_t crypto_pwhash_opslimit_moderate(void);
84
84
 
85
- #define crypto_pwhash_MEMLIMIT_MODERATE crypto_pwhash_argon2i_MEMLIMIT_MODERATE
85
+ #define crypto_pwhash_MEMLIMIT_MODERATE crypto_pwhash_argon2id_MEMLIMIT_MODERATE
86
86
  SODIUM_EXPORT
87
87
  size_t crypto_pwhash_memlimit_moderate(void);
88
88
 
89
- #define crypto_pwhash_OPSLIMIT_SENSITIVE crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE
89
+ #define crypto_pwhash_OPSLIMIT_SENSITIVE crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE
90
90
  SODIUM_EXPORT
91
91
  size_t crypto_pwhash_opslimit_sensitive(void);
92
92
 
93
- #define crypto_pwhash_MEMLIMIT_SENSITIVE crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE
93
+ #define crypto_pwhash_MEMLIMIT_SENSITIVE crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE
94
94
  SODIUM_EXPORT
95
95
  size_t crypto_pwhash_memlimit_sensitive(void);
96
96
 
97
+ /*
98
+ * With this function, do not forget to store all parameters, including the
99
+ * algorithm identifier in order to produce deterministic output.
100
+ * The crypto_pwhash_* definitions, including crypto_pwhash_ALG_DEFAULT,
101
+ * may change.
102
+ */
97
103
  SODIUM_EXPORT
98
104
  int crypto_pwhash(unsigned char * const out, unsigned long long outlen,
99
105
  const char * const passwd, unsigned long long passwdlen,
@@ -101,18 +107,34 @@ int crypto_pwhash(unsigned char * const out, unsigned long long outlen,
101
107
  unsigned long long opslimit, size_t memlimit, int alg)
102
108
  __attribute__ ((warn_unused_result));
103
109
 
110
+ /*
111
+ * The output string already includes all the required parameters, including
112
+ * the algorithm identifier. The string is all that has to be stored in
113
+ * order to verify a password.
114
+ */
104
115
  SODIUM_EXPORT
105
116
  int crypto_pwhash_str(char out[crypto_pwhash_STRBYTES],
106
117
  const char * const passwd, unsigned long long passwdlen,
107
118
  unsigned long long opslimit, size_t memlimit)
108
119
  __attribute__ ((warn_unused_result));
109
120
 
121
+ SODIUM_EXPORT
122
+ int crypto_pwhash_str_alg(char out[crypto_pwhash_STRBYTES],
123
+ const char * const passwd, unsigned long long passwdlen,
124
+ unsigned long long opslimit, size_t memlimit, int alg)
125
+ __attribute__ ((warn_unused_result));
126
+
110
127
  SODIUM_EXPORT
111
128
  int crypto_pwhash_str_verify(const char str[crypto_pwhash_STRBYTES],
112
129
  const char * const passwd,
113
130
  unsigned long long passwdlen)
114
131
  __attribute__ ((warn_unused_result));
115
132
 
133
+ SODIUM_EXPORT
134
+ int crypto_pwhash_str_needs_rehash(const char str[crypto_pwhash_STRBYTES],
135
+ unsigned long long opslimit, size_t memlimit)
136
+ __attribute__ ((warn_unused_result));
137
+
116
138
  #define crypto_pwhash_PRIMITIVE "argon2i"
117
139
  SODIUM_EXPORT
118
140
  const char *crypto_pwhash_primitive(void)
@@ -22,7 +22,7 @@ int crypto_pwhash_argon2i_alg_argon2i13(void);
22
22
  SODIUM_EXPORT
23
23
  size_t crypto_pwhash_argon2i_bytes_min(void);
24
24
 
25
- #define crypto_pwhash_argon2i_BYTES_MAX 4294967295U
25
+ #define crypto_pwhash_argon2i_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)
26
26
  SODIUM_EXPORT
27
27
  size_t crypto_pwhash_argon2i_bytes_max(void);
28
28
 
@@ -58,7 +58,8 @@ size_t crypto_pwhash_argon2i_opslimit_max(void);
58
58
  SODIUM_EXPORT
59
59
  size_t crypto_pwhash_argon2i_memlimit_min(void);
60
60
 
61
- #define crypto_pwhash_argon2i_MEMLIMIT_MAX ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
61
+ #define crypto_pwhash_argon2i_MEMLIMIT_MAX \
62
+ ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
62
63
  SODIUM_EXPORT
63
64
  size_t crypto_pwhash_argon2i_memlimit_max(void);
64
65
 
@@ -109,6 +110,11 @@ int crypto_pwhash_argon2i_str_verify(const char str[crypto_pwhash_argon2i_STRBYT
109
110
  unsigned long long passwdlen)
110
111
  __attribute__ ((warn_unused_result));
111
112
 
113
+ SODIUM_EXPORT
114
+ int crypto_pwhash_argon2i_str_needs_rehash(const char str[crypto_pwhash_argon2i_STRBYTES],
115
+ unsigned long long opslimit, size_t memlimit)
116
+ __attribute__ ((warn_unused_result));
117
+
112
118
  #ifdef __cplusplus
113
119
  }
114
120
  #endif
@@ -22,7 +22,7 @@ int crypto_pwhash_argon2id_alg_argon2id13(void);
22
22
  SODIUM_EXPORT
23
23
  size_t crypto_pwhash_argon2id_bytes_min(void);
24
24
 
25
- #define crypto_pwhash_argon2id_BYTES_MAX 4294967295U
25
+ #define crypto_pwhash_argon2id_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)
26
26
  SODIUM_EXPORT
27
27
  size_t crypto_pwhash_argon2id_bytes_max(void);
28
28
 
@@ -58,7 +58,8 @@ size_t crypto_pwhash_argon2id_opslimit_max(void);
58
58
  SODIUM_EXPORT
59
59
  size_t crypto_pwhash_argon2id_memlimit_min(void);
60
60
 
61
- #define crypto_pwhash_argon2id_MEMLIMIT_MAX ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
61
+ #define crypto_pwhash_argon2id_MEMLIMIT_MAX \
62
+ ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
62
63
  SODIUM_EXPORT
63
64
  size_t crypto_pwhash_argon2id_memlimit_max(void);
64
65
 
@@ -109,6 +110,11 @@ int crypto_pwhash_argon2id_str_verify(const char str[crypto_pwhash_argon2id_STRB
109
110
  unsigned long long passwdlen)
110
111
  __attribute__ ((warn_unused_result));
111
112
 
113
+ SODIUM_EXPORT
114
+ int crypto_pwhash_argon2id_str_needs_rehash(const char str[crypto_pwhash_argon2id_STRBYTES],
115
+ unsigned long long opslimit, size_t memlimit)
116
+ __attribute__ ((warn_unused_result));
117
+
112
118
  #ifdef __cplusplus
113
119
  }
114
120
  #endif
@@ -18,7 +18,8 @@ extern "C" {
18
18
  SODIUM_EXPORT
19
19
  size_t crypto_pwhash_scryptsalsa208sha256_bytes_min(void);
20
20
 
21
- #define crypto_pwhash_scryptsalsa208sha256_BYTES_MAX SIZE_MAX
21
+ #define crypto_pwhash_scryptsalsa208sha256_BYTES_MAX \
22
+ SODIUM_MIN(SODIUM_SIZE_MAX, 0x1fffffffe0ULL)
22
23
  SODIUM_EXPORT
23
24
  size_t crypto_pwhash_scryptsalsa208sha256_bytes_max(void);
24
25
 
@@ -26,7 +27,7 @@ size_t crypto_pwhash_scryptsalsa208sha256_bytes_max(void);
26
27
  SODIUM_EXPORT
27
28
  size_t crypto_pwhash_scryptsalsa208sha256_passwd_min(void);
28
29
 
29
- #define crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX SIZE_MAX
30
+ #define crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX SODIUM_SIZE_MAX
30
31
  SODIUM_EXPORT
31
32
  size_t crypto_pwhash_scryptsalsa208sha256_passwd_max(void);
32
33
 
@@ -54,7 +55,8 @@ size_t crypto_pwhash_scryptsalsa208sha256_opslimit_max(void);
54
55
  SODIUM_EXPORT
55
56
  size_t crypto_pwhash_scryptsalsa208sha256_memlimit_min(void);
56
57
 
57
- #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX ((SIZE_MAX >= 68719476736U) ? 68719476736U : SIZE_MAX)
58
+ #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX \
59
+ SODIUM_MIN(SIZE_MAX, 68719476736ULL)
58
60
  SODIUM_EXPORT
59
61
  size_t crypto_pwhash_scryptsalsa208sha256_memlimit_max(void);
60
62
 
@@ -105,6 +107,12 @@ int crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdl
105
107
  uint8_t * buf, size_t buflen)
106
108
  __attribute__ ((warn_unused_result));
107
109
 
110
+ SODIUM_EXPORT
111
+ int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
112
+ unsigned long long opslimit,
113
+ size_t memlimit)
114
+ __attribute__ ((warn_unused_result));
115
+
108
116
  #ifdef __cplusplus
109
117
  }
110
118
  #endif
@@ -29,6 +29,10 @@ size_t crypto_secretbox_macbytes(void);
29
29
  SODIUM_EXPORT
30
30
  const char *crypto_secretbox_primitive(void);
31
31
 
32
+ #define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX
33
+ SODIUM_EXPORT
34
+ size_t crypto_secretbox_messagebytes_max(void);
35
+
32
36
  SODIUM_EXPORT
33
37
  int crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
34
38
  unsigned long long mlen, const unsigned char *n,
@@ -2,6 +2,7 @@
2
2
  #define crypto_secretbox_xchacha20poly1305_H
3
3
 
4
4
  #include <stddef.h>
5
+ #include "crypto_stream_xchacha20.h"
5
6
  #include "export.h"
6
7
 
7
8
  #ifdef __cplusplus
@@ -23,6 +24,11 @@ size_t crypto_secretbox_xchacha20poly1305_noncebytes(void);
23
24
  SODIUM_EXPORT
24
25
  size_t crypto_secretbox_xchacha20poly1305_macbytes(void);
25
26
 
27
+ #define crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX \
28
+ (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES)
29
+ SODIUM_EXPORT
30
+ size_t crypto_secretbox_xchacha20poly1305_messagebytes_max(void);
31
+
26
32
  SODIUM_EXPORT
27
33
  int crypto_secretbox_xchacha20poly1305_easy(unsigned char *c,
28
34
  const unsigned char *m,