rbnacl-libsodium 1.0.15.1 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -6
  3. data/CHANGES.md +50 -42
  4. data/Gemfile +1 -1
  5. data/README.md +3 -1
  6. data/Rakefile +46 -0
  7. data/ext/rbnacl/extconf.rb +16 -1
  8. data/lib/rbnacl/libsodium.rb +16 -8
  9. data/lib/rbnacl/libsodium/version.rb +1 -1
  10. data/rbnacl-libsodium.gemspec +3 -0
  11. data/vendor/libsodium/AUTHORS +20 -5
  12. data/vendor/libsodium/ChangeLog +25 -0
  13. data/vendor/libsodium/Makefile.in +3 -1
  14. data/vendor/libsodium/README.markdown +2 -1
  15. data/vendor/libsodium/aclocal.m4 +1 -0
  16. data/vendor/libsodium/autom4te.cache/output.1 +836 -123
  17. data/vendor/libsodium/autom4te.cache/output.4 +21342 -0
  18. data/vendor/libsodium/autom4te.cache/requests +801 -554
  19. data/vendor/libsodium/autom4te.cache/traces.1 +717 -596
  20. data/vendor/libsodium/autom4te.cache/traces.4 +4355 -0
  21. data/vendor/libsodium/builds/Makefile.in +3 -1
  22. data/vendor/libsodium/builds/msvc/resource.h +1 -1
  23. data/vendor/libsodium/builds/msvc/resource.rc +2 -2
  24. data/vendor/libsodium/builds/msvc/version.h +2 -2
  25. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +17 -8
  26. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +60 -24
  27. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +17 -8
  28. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +60 -24
  29. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +17 -8
  30. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +60 -24
  31. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj +17 -8
  32. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +60 -24
  33. data/vendor/libsodium/builds/msvc/vs2017/libsodium/libsodium.vcxproj +17 -8
  34. data/vendor/libsodium/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters +60 -24
  35. data/vendor/libsodium/configure +834 -121
  36. data/vendor/libsodium/configure.ac +55 -13
  37. data/vendor/libsodium/contrib/Findsodium.cmake +22 -3
  38. data/vendor/libsodium/contrib/Makefile.in +3 -1
  39. data/vendor/libsodium/dist-build/Makefile.in +3 -1
  40. data/vendor/libsodium/dist-build/android-build.sh +2 -2
  41. data/vendor/libsodium/dist-build/emscripten-symbols.def +38 -26
  42. data/vendor/libsodium/dist-build/emscripten.sh +23 -8
  43. data/vendor/libsodium/dist-build/msys2-win32.sh +1 -1
  44. data/vendor/libsodium/dist-build/msys2-win64.sh +1 -1
  45. data/vendor/libsodium/libsodium.vcxproj +17 -8
  46. data/vendor/libsodium/libsodium.vcxproj.filters +41 -14
  47. data/vendor/libsodium/m4/ax_tls.m4 +74 -0
  48. data/vendor/libsodium/msvc-scripts/Makefile.in +3 -1
  49. data/vendor/libsodium/msvc-scripts/process.bat +2 -2
  50. data/vendor/libsodium/packaging/dotnet-core/README.md +5 -5
  51. data/vendor/libsodium/packaging/dotnet-core/prepare.py +7 -7
  52. data/vendor/libsodium/packaging/nuget/package.config +1 -1
  53. data/vendor/libsodium/regen-msvc/libsodium.vcxproj +326 -0
  54. data/vendor/libsodium/regen-msvc/libsodium.vcxproj.filters +23 -0
  55. data/vendor/libsodium/regen-msvc/libsodium.vcxproj.filters.tpl +35 -0
  56. data/vendor/libsodium/regen-msvc/libsodium.vcxproj.tpl +93 -0
  57. data/vendor/libsodium/regen-msvc/regen-msvc.py +136 -0
  58. data/vendor/libsodium/regen-msvc/tl_libsodium.vcxproj.filters.tpl +23 -0
  59. data/vendor/libsodium/regen-msvc/tl_libsodium.vcxproj.tpl +331 -0
  60. data/vendor/libsodium/src/Makefile.in +3 -1
  61. data/vendor/libsodium/src/libsodium/Makefile.am +40 -24
  62. data/vendor/libsodium/src/libsodium/Makefile.in +238 -180
  63. data/vendor/libsodium/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c +10 -2
  64. data/vendor/libsodium/src/libsodium/crypto_core/ed25519/core_ed25519.c +79 -0
  65. data/vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c +2031 -0
  66. data/vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/base.h +1344 -0
  67. data/vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/base2.h +40 -0
  68. data/vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h +20 -0
  69. data/vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/fe.h +220 -0
  70. data/vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_51/base.h +1344 -0
  71. data/vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_51/base2.h +40 -0
  72. data/vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h +21 -0
  73. data/vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_51/fe.h +116 -0
  74. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2.h +1 -1
  75. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c +2 -1
  76. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c +14 -82
  77. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c +1 -0
  78. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c +3 -3
  79. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c +3 -3
  80. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +1 -7
  81. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c +1 -0
  82. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c +0 -6
  83. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.c +19 -92
  84. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.h +72 -4
  85. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.c +5 -1
  86. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.h +1 -1
  87. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c +10 -7
  88. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c +108 -231
  89. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.h +1 -1
  90. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c +27 -27
  91. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c +2 -1
  92. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c +6 -3
  93. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c +3 -11
  94. data/vendor/libsodium/src/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c +86 -0
  95. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +28 -26
  96. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c +32 -30
  97. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +14 -115
  98. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +56 -13
  99. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/{ed25519_ref10.h → sign_ed25519_ref10.h} +2 -5
  100. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519.c +1 -1
  101. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20.c +1 -0
  102. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20.c +1 -0
  103. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h +1 -1
  104. data/vendor/libsodium/src/libsodium/include/Makefile.am +2 -0
  105. data/vendor/libsodium/src/libsodium/include/Makefile.in +13 -9
  106. data/vendor/libsodium/src/libsodium/include/sodium.h +2 -0
  107. data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h +37 -0
  108. data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h +8 -0
  109. data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +8 -0
  110. data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h +41 -0
  111. data/vendor/libsodium/src/libsodium/include/sodium/private/common.h +18 -0
  112. data/vendor/libsodium/src/libsodium/include/sodium/private/ed25519_ref10.h +125 -0
  113. data/vendor/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h +1050 -0
  114. data/vendor/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h +518 -0
  115. data/vendor/libsodium/src/libsodium/include/sodium/runtime.h +3 -0
  116. data/vendor/libsodium/src/libsodium/include/sodium/utils.h +3 -0
  117. data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +182 -102
  118. data/vendor/libsodium/src/libsodium/sodium/core.c +30 -2
  119. data/vendor/libsodium/src/libsodium/sodium/runtime.c +14 -0
  120. data/vendor/libsodium/src/libsodium/sodium/utils.c +46 -0
  121. data/vendor/libsodium/test/Makefile.in +3 -1
  122. data/vendor/libsodium/test/default/Makefile.am +16 -0
  123. data/vendor/libsodium/test/default/Makefile.in +71 -23
  124. data/vendor/libsodium/test/default/aead_aes256gcm.c +1 -1
  125. data/vendor/libsodium/test/default/cmptest.h +4 -0
  126. data/vendor/libsodium/test/default/core3.c +44 -4
  127. data/vendor/libsodium/test/default/core3.exp +2 -0
  128. data/vendor/libsodium/test/default/core4.c +1 -1
  129. data/vendor/libsodium/test/default/core_ed25519.c +151 -0
  130. data/vendor/libsodium/test/default/core_ed25519.exp +1 -0
  131. data/vendor/libsodium/test/default/ed25519_convert.c +9 -1
  132. data/vendor/libsodium/test/default/index.html.tpl +17 -3
  133. data/vendor/libsodium/test/default/kdf.c +4 -2
  134. data/vendor/libsodium/test/default/metamorphic.c +8 -8
  135. data/vendor/libsodium/test/default/misuse.c +29 -1
  136. data/vendor/libsodium/test/default/pwhash_argon2i.c +9 -3
  137. data/vendor/libsodium/test/default/pwhash_argon2i.exp +2 -2
  138. data/vendor/libsodium/test/default/pwhash_argon2id.c +7 -2
  139. data/vendor/libsodium/test/default/pwhash_argon2id.exp +2 -2
  140. data/vendor/libsodium/test/default/scalarmult.c +0 -2
  141. data/vendor/libsodium/test/default/scalarmult.exp +0 -1
  142. data/vendor/libsodium/test/default/scalarmult_ed25519.c +90 -0
  143. data/vendor/libsodium/test/default/scalarmult_ed25519.exp +1 -0
  144. data/vendor/libsodium/test/default/secretbox_easy2.c +1 -1
  145. data/vendor/libsodium/test/default/secretstream.c +52 -3
  146. data/vendor/libsodium/test/default/sign.c +16 -0
  147. data/vendor/libsodium/test/default/sodium_core.c +1 -0
  148. data/vendor/libsodium/test/default/sodium_utils.c +2 -1
  149. data/vendor/libsodium/test/default/xchacha20.c +2 -1
  150. metadata +63 -12
  151. data/vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/base.h +0 -1344
  152. data/vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/base2.h +0 -40
  153. data/vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c +0 -2797
  154. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c +0 -545
  155. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.h +0 -10
  156. data/vendor/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h +0 -132
  157. data/vendor/libsodium/test/default/index-wasm.html.tpl +0 -118
@@ -6,6 +6,6 @@ c121209f0ba70aed93d49200e5dc82cce013cef25ea31e160bf8db3cf448a59d1a56f6c19259e18e
6
6
  91c337ce8918a5805a59b00bd1819d3eb4356807cbd2a80b271c4b482dce03f5b02ae4eb831ff668cbb327b93c300b41da4852e5547bea8342d518dd9311aaeb5f90eccf66d548f9275631f0b1fd4b299cec5d2e86a59e55dc7b3afab6204447b21d1ef1da824abaf31a25a0d6135c4fe81d34a06816c8a6eab19141f5687108500f3719a862af8c5fee36e130c69921e11ce83dfc72c5ec3b862c1bccc5fd63ad57f432fbcca6f9e18d5a59015950cdf053
7
7
  [tv] pwhash failure (maybe intentional): [6]
8
8
  e942951dfbc2d508294b10f9e97b47d0cd04e668a043cb95679cc1139df7c27cd54367688725be9d069f5704c12223e7e4ca181fbd0bed18bb4634795e545a6c04a7306933a41a794baedbb628d41bc285e0b9084055ae136f6b63624c874f5a1e1d8be7b0b7227a171d2d7ed578d88bfdcf18323198962d0dcad4126fd3f21adeb1e11d66252ea0c58c91696e91031bfdcc2a9dc0e028d17b9705ba2d7bcdcd1e3ba75b4b1fea
9
- 9fbbc02a420b00614a49a8e8d89834df368fa54dbef5dce7f9928f4d09f45ce22766598c0c979a707b1df130ab8d63802447923f6e8b89b3c183d71d694161569b1937d8b58f0091fcb8b1f48f2e3f43067bb2498b727fb62cc776ed39219613aa2083619385ec64dfb38f3cda7fddce9cec708a1aa5e9b09d6a5f063cda6c644c5e4a6c1bba9362b27f050984ee3a91bbed69160c95d63c04724f
10
- 28645e1a4f5bc2a58786c87f0d88c2c68047b874b122e2c3936fb6adf26d7ca8fbcb872a8aef282ff202526a91b8ca1d0926c4ae0f5429c342bfd4987916b147ccaa1624bbb2d3f197e56601a541939a1a867ee659515d379d252c8b53aa2297b6008f97bc4a246040b0fb4f46754482884ff04bdade7ffc74989c68ec085de660ef2071db22bacc227d43af282a2336049d78fe0b8ff543628dc8
9
+ fd329873387429cb79faaec4f65c35649f65de0aabc1f092ca9dee20029d8ae6c3a97e9940763e1703a7fef5a20eb7f210123fc8c6d3f1745d19d5e3c1eb392ab4a6070c8a6b9ecbeabae0711326e81530099541a882d4bd7733c4a7477ae72b6928c46cd07264172a9d2cfb7d649594f877f8b447d9c01b17996b85db5a71f733f8cc5fd0436540a5b7a1d79de09e20c3abe6515501b3156cd51e
10
+ bbbc4c7963593601d4d685ed9d89682374f8e6b3ce92ce8ccc702728ec8bf839fd7cb8e37ddb09be8c18c7e0ed099949665227a00fb33e1f63ca830dbeb13b29d987b445b3e081cd8428bdb2f9e003e12bea98230fd30842fa193af9169171b550322072c88330ea464cbe02b6ee044374d3f3d174c23617b707159a11926c56601123dcc30508ec84fdb0797b7ab23a77eeefb2a0be2ef45e903c
11
11
  OK
@@ -121,14 +121,14 @@ tv2(void)
121
121
  "8d220b20c60d7c07ec1fd93c52c31020300c6c1facd77937a597c7a6",
122
122
  127,
123
123
  "5541fbc995d5c197ba290346d2c559dedf405cf97e5f95482143202f9e74f5c2",
124
- 155, 4, 1397645, 1 },
124
+ 155, 4, 397645, 1 },
125
125
  { "a347ae92bce9f80f6f595a4480fc9c2fe7e7d7148d371e9487d75f5c23008ffae0"
126
126
  "65577a928febd9b1973a5a95073acdbeb6a030cfc0d79caa2dc5cd011cef02c08d"
127
127
  "a232d76d52dfbca38ca8dcbd665b17d1665f7cf5fe59772ec909733b24de97d6f5"
128
128
  "8d220b20c60d7c07ec1fd93c52c31020300c6c1facd77937a597c7a6",
129
129
  127,
130
130
  "5541fbc995d5c197ba290346d2c559dedf405cf97e5f95482143202f9e74f5c2",
131
- 155, 3, 1397645, 1 },
131
+ 155, 3, 397645, 1 },
132
132
  };
133
133
  char passwd[256];
134
134
  unsigned char salt[crypto_pwhash_SALTBYTES];
@@ -177,6 +177,8 @@ tv2(void)
177
177
  1ULL << 12, crypto_pwhash_argon2id_alg_argon2id13()) != -1) {
178
178
  printf("[tv2] pwhash with a long password length should have failed\n");
179
179
  }
180
+ assert(crypto_pwhash_argon2id(out, sizeof out, "password", strlen("password"), salt,
181
+ OPSLIMIT, MEMLIMIT, crypto_pwhash_alg_argon2i13()) == -1);
180
182
  }
181
183
 
182
184
  static void
@@ -266,6 +268,9 @@ str_tests(void)
266
268
  crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT + 1, MEMLIMIT) != -1) {
267
269
  printf("needs_rehash() false negative (2)\n");
268
270
  }
271
+ if (crypto_pwhash_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT / 2) != 1) {
272
+ printf("pwhash_str_needs_rehash() didn't handle argon2id\n");
273
+ }
269
274
  if (crypto_pwhash_str_needs_rehash(str_out + 1, OPSLIMIT, MEMLIMIT) != -1 ||
270
275
  crypto_pwhash_argon2id_str_needs_rehash(str_out + 1, OPSLIMIT, MEMLIMIT) != -1) {
271
276
  printf("needs_rehash() didn't fail with an invalid hash string\n");
@@ -6,8 +6,8 @@
6
6
  d6e9d6cabd42fb9ba7162fe9b8e41d59d3c7034756cb460c9affe393308bd0225ce0371f2e6c3ca32aca2002bf2d3909c6b6e7dfc4a00e850ff4f570f8f749d4bb6f0091e554be67a9095ae1eefaa1a933316cbec3c2fd4a14a5b6941bda9b7eabd821d79abde2475a53af1a8571c7ee46460be415882e0b393f48c12f740a6a72cba9773000602e13b40d3dfa6ac1d4ec43a838b7e3e165fecad4b2498389e60a3ff9f0f8f4b9fca1126e64f49501e38690
7
7
  7fb72409b0987f8190c3729710e98c3f80c5a8727d425fdcde7f3644d467fe973f5b5fee683bd3fce812cb9ae5e9921a2d06c2f1905e4e839692f2b934b682f11a2fe2b90482ea5dd234863516dba6f52dc0702d324ec77d860c2e181f84472bd7104fedce071ffa93c5309494ad51623d214447a7b2b1462dc7d5d55a1f6fd5b54ce024118d86f0c6489d16545aaa87b6689dad9f2fb47fda9894f8e12b87d978b483ccd4cc5fd9595cdc7a818452f915ce2f7df95ec12b1c72e3788d473441d884f9748eb14703c21b45d82fd667b85f5b2d98c13303b3fe76285531a826b6fc0fe8e3dddecf
8
8
  4e702bc5f891df884c6ddaa243aa846ce3c087fe930fef0f36b3c2be34164ccc295db509254743f18f947159c813bcd5dd8d94a3aec93bbe57605d1fad1aef1112687c3d4ef1cb329d21f1632f626818d766915d886e8d819e4b0b9c9307f4b6afc081e13b0cf31db382ff1bf05a16aac7af696336d75e99f82163e0f371e1d25c4add808e215697ad3f779a51a462f8bf52610af21fc69dba6b072606f2dabca7d4ae1d91d919
9
- 2d232f9dc4de96628b2a4c2b39ceb6a813011fb74a3ba1da096761fabe08f563bd91366aba5c5e35aecd98643cabc16ce560dca261a963230a1fa2af52f2413a57a827c6ee13bcec0c123d195914a55700ccb5756196a86fb9cb4aeacccc0e6dd850f4386b705aaae147ea347543b7fbe24553d9da41f1b335b6e9980cdb966cf7b48520eb42a7269380c885dbefbccf447851fcacbe1753a5b9e1
10
- 34b207147fb7ef83e1ca1a97e30aa6e08ea9b6b1048c59c9c13050dff33e76ce3c440d7f018f817e6b8593e78f339ba633b9d7ec3519b5eafbcc4bc2d20b5136bbc7e5b7e92ff37d024bbbecf5738f718ab22c8adcdb82ceffc233b8ad61f91850abdfe8bb119775d9c4243ec1ac761dfbd132489228dfeab5268c7f0ddc29f56b957d1b76c874cdd77e16139e0df9b847248fd782c9a1147b8480
9
+ 20e7ba6faa2c0a4b07f3ff38e15e252a069c2c62bac3f2785d311764d73e67fd713be342ee938e6df4de6af1a89a44b8589838864457bcfe3cf0f2d329b800ab9f5810b6325588eb4e0c56f99192b2cc76dc8194dc1097fe5ed12ac4214481c03c3597131ba164a56e7187e2da565a8cd529668e9a37faa58a1701c49a14edf7a50dec4143b456cba6d14c957bb655e99ce96bc506961216ef887a
10
+ 8fb6ed1862cdd2a399e10956c60dc9b2670338ea59c3414d0443216925ba24c6e89a17f3e56c12893dcbc9bc498e8308aea9627d9c9e47912d6342b631008719edfa2db364b97e60cf47a97ad9aa3b7f139d80ddda44f1ef2af881ce027a15644218cac6cc74751469ae56be0469fbc760825882b3e8abca55daaae5753575106cf867cd69932602c63ec880ad8811d9aa4870a9e0b39fef47c92e
11
11
  [tv3] pwhash_argon2id_str failure (maybe intentional): [0]
12
12
  [tv3] pwhash_argon2id_str failure (maybe intentional): [1]
13
13
  [tv3] pwhash_argon2id_str failure (maybe intentional): [3]
@@ -54,8 +54,6 @@ main(void)
54
54
 
55
55
  ret = crypto_scalarmult(k, bobsk, small_order_p);
56
56
  assert(ret == -1);
57
- sodium_bin2hex(hex, sizeof hex, k, crypto_scalarmult_BYTES);
58
- printf("%s\n", hex);
59
57
 
60
58
  sodium_free(bobpk);
61
59
  sodium_free(alicepk);
@@ -2,4 +2,3 @@
2
2
  de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f
3
3
  4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742
4
4
  4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742
5
- 0000000000000000000000000000000000000000000000000000000000000000
@@ -0,0 +1,90 @@
1
+ #define TEST_NAME "scalarmult_ed25519"
2
+ #include "cmptest.h"
3
+
4
+ static const unsigned char non_canonical_p[32] = {
5
+ 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
7
+ };
8
+ static const unsigned char non_canonical_invalid_p[32] = {
9
+ 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
10
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
11
+ };
12
+ static const unsigned char max_canonical_p[32] = {
13
+ 0xe4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
14
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
15
+ };
16
+
17
+ static const unsigned char B[32] = {
18
+ 0x58, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
19
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66
20
+ };
21
+
22
+ int
23
+ main(void)
24
+ {
25
+ unsigned char *n, *p, *q, *q2;
26
+
27
+ n = (unsigned char *) sodium_malloc(crypto_scalarmult_ed25519_SCALARBYTES);
28
+ p = (unsigned char *) sodium_malloc(crypto_scalarmult_ed25519_BYTES);
29
+ q = (unsigned char *) sodium_malloc(crypto_scalarmult_ed25519_BYTES);
30
+ q2 = (unsigned char *) sodium_malloc(crypto_scalarmult_ed25519_BYTES);
31
+
32
+ randombytes_buf(n, crypto_scalarmult_ed25519_SCALARBYTES);
33
+ if (crypto_scalarmult_ed25519_base(q, n) != 0) {
34
+ printf("crypto_scalarmult_ed25519_base() failed\n");
35
+ }
36
+ memcpy(p, B, crypto_scalarmult_ed25519_BYTES);
37
+ if (crypto_scalarmult_ed25519(q2, n, p) != 0) {
38
+ printf("crypto_scalarmult_ed25519() failed\n");
39
+ }
40
+ if (memcmp(q, q2, crypto_scalarmult_ed25519_BYTES) != 0) {
41
+ printf("crypto_scalarmult_ed25519_base(n) != crypto_scalarmult_ed25519(n, 9)\n");
42
+ }
43
+
44
+ memset(n, 0, crypto_scalarmult_ed25519_SCALARBYTES);
45
+ if (crypto_scalarmult_ed25519_base(q, n) != -1) {
46
+ printf("crypto_scalarmult_ed25519_base(0) failed\n");
47
+ }
48
+ if (crypto_scalarmult_ed25519(q2, n, p) != -1) {
49
+ printf("crypto_scalarmult_ed25519(0) passed\n");
50
+ }
51
+
52
+ n[0] = 1;
53
+ if (crypto_scalarmult_ed25519_base(q, n) != 0) {
54
+ printf("crypto_scalarmult_ed25519_base() failed\n");
55
+ }
56
+ if (crypto_scalarmult_ed25519(q2, n, p) != 0) {
57
+ printf("crypto_scalarmult_ed25519() passed\n");
58
+ }
59
+
60
+ if (crypto_scalarmult_ed25519(q, n, non_canonical_p) != -1) {
61
+ printf("crypto_scalarmult_ed25519() didn't fail\n");
62
+ }
63
+ if (crypto_scalarmult_ed25519(q, n, non_canonical_invalid_p) != -1) {
64
+ printf("crypto_scalarmult_ed25519() didn't fail\n");
65
+ }
66
+ if (crypto_scalarmult_ed25519(q, n, max_canonical_p) != 0) {
67
+ printf("crypto_scalarmult_ed25519() failed\n");
68
+ }
69
+
70
+ memset(p, 0, crypto_scalarmult_ed25519_BYTES);
71
+ if (crypto_scalarmult_ed25519(q, n, p) != -1) {
72
+ printf("crypto_scalarmult_ed25519() didn't fail\n");
73
+ }
74
+ n[0] = 8;
75
+ if (crypto_scalarmult_ed25519(q, n, p) != -1) {
76
+ printf("crypto_scalarmult_ed25519() didn't fail\n");
77
+ }
78
+
79
+ sodium_free(q2);
80
+ sodium_free(q);
81
+ sodium_free(p);
82
+ sodium_free(n);
83
+
84
+ assert(crypto_scalarmult_ed25519_BYTES == crypto_scalarmult_ed25519_bytes());
85
+ assert(crypto_scalarmult_ed25519_SCALARBYTES == crypto_scalarmult_ed25519_scalarbytes());
86
+
87
+ printf("OK\n");
88
+
89
+ return 0;
90
+ }
@@ -22,7 +22,7 @@ main(void)
22
22
  k = (unsigned char *) sodium_malloc(crypto_secretbox_KEYBYTES);
23
23
  mac = (unsigned char *) sodium_malloc(crypto_secretbox_MACBYTES);
24
24
  crypto_secretbox_keygen(k);
25
- randombytes_buf(m, (unsigned long long) mlen);
25
+ randombytes_buf(m, mlen);
26
26
  randombytes_buf(nonce, crypto_secretbox_NONCEBYTES);
27
27
  crypto_secretbox_easy(c, m, (unsigned long long) mlen, nonce, k);
28
28
  if (crypto_secretbox_open_easy(
@@ -5,12 +5,12 @@
5
5
  int
6
6
  main(void)
7
7
  {
8
- crypto_secretstream_xchacha20poly1305_state *state;
8
+ crypto_secretstream_xchacha20poly1305_state *state, *statesave;
9
9
  crypto_secretstream_xchacha20poly1305_state state_copy;
10
10
  unsigned char *ad;
11
11
  unsigned char *header;
12
12
  unsigned char *k;
13
- unsigned char *c1, *c2, *c3;
13
+ unsigned char *c1, *c2, *c3, *csave;
14
14
  unsigned char *m1, *m2, *m3;
15
15
  unsigned char *m1_, *m2_, *m3_;
16
16
  unsigned long long res_len;
@@ -21,6 +21,8 @@ main(void)
21
21
 
22
22
  state = (crypto_secretstream_xchacha20poly1305_state *)
23
23
  sodium_malloc(crypto_secretstream_xchacha20poly1305_statebytes());
24
+ statesave = (crypto_secretstream_xchacha20poly1305_state *)
25
+ sodium_malloc(crypto_secretstream_xchacha20poly1305_statebytes());
24
26
  header = (unsigned char *)
25
27
  sodium_malloc(crypto_secretstream_xchacha20poly1305_HEADERBYTES);
26
28
 
@@ -35,6 +37,8 @@ main(void)
35
37
  sodium_malloc(m2_len + crypto_secretstream_xchacha20poly1305_ABYTES);
36
38
  c3 = (unsigned char *)
37
39
  sodium_malloc(m3_len + crypto_secretstream_xchacha20poly1305_ABYTES);
40
+ csave = (unsigned char *)
41
+ sodium_malloc((m1_len | m2_len | m3_len) + crypto_secretstream_xchacha20poly1305_ABYTES);
38
42
 
39
43
  ad = (unsigned char *) sodium_malloc(ad_len);
40
44
  m1 = (unsigned char *) sodium_malloc(m1_len);
@@ -113,7 +117,7 @@ main(void)
113
117
 
114
118
  ret = crypto_secretstream_xchacha20poly1305_pull
115
119
  (state, m3, NULL, &tag,
116
- c3, m3_len + crypto_secretstream_xchacha20poly1305_ABYTES, NULL, 0);
120
+ c3, m3_len + crypto_secretstream_xchacha20poly1305_ABYTES, ad, ad_len);
117
121
  assert(ret == -1);
118
122
 
119
123
  /* previous without a tag */
@@ -196,6 +200,49 @@ main(void)
196
200
  c2, m2_len + crypto_secretstream_xchacha20poly1305_ABYTES, NULL, 0);
197
201
  assert(ret == 0);
198
202
 
203
+ /* with explicit rekeying using TAG_REKEY */
204
+
205
+ ret = crypto_secretstream_xchacha20poly1305_init_push(state, header, k);
206
+ assert(ret == 0);
207
+
208
+ memcpy(statesave, state, sizeof *state);
209
+
210
+ ret = crypto_secretstream_xchacha20poly1305_push
211
+ (state, c1, NULL, m1, m1_len, NULL, 0, crypto_secretstream_xchacha20poly1305_TAG_REKEY);
212
+ assert(ret == 0);
213
+
214
+ ret = crypto_secretstream_xchacha20poly1305_push
215
+ (state, c2, NULL, m2, m2_len, NULL, 0, 0);
216
+ assert(ret == 0);
217
+
218
+ memcpy(csave, c2, m2_len + crypto_secretstream_xchacha20poly1305_ABYTES);
219
+
220
+ ret = crypto_secretstream_xchacha20poly1305_init_pull(state, header, k);
221
+ assert(ret == 0);
222
+ ret = crypto_secretstream_xchacha20poly1305_pull
223
+ (state, m1, NULL, &tag,
224
+ c1, m1_len + crypto_secretstream_xchacha20poly1305_ABYTES, &tag, 0);
225
+ assert(ret == 0);
226
+ assert(tag == crypto_secretstream_xchacha20poly1305_TAG_REKEY);
227
+
228
+ ret = crypto_secretstream_xchacha20poly1305_pull
229
+ (state, m2, NULL, &tag,
230
+ c2, m2_len + crypto_secretstream_xchacha20poly1305_ABYTES, &tag, 0);
231
+ assert(ret == 0);
232
+ assert(tag == 0);
233
+
234
+ memcpy(state, statesave, sizeof *state);
235
+
236
+ ret = crypto_secretstream_xchacha20poly1305_push
237
+ (state, c1, NULL, m1, m1_len, NULL, 0, 0);
238
+ assert(ret == 0);
239
+
240
+ ret = crypto_secretstream_xchacha20poly1305_push
241
+ (state, c2, NULL, m2, m2_len, NULL, 0, 0);
242
+ assert(ret == 0);
243
+
244
+ assert(memcmp(csave, c2, m2_len + crypto_secretstream_xchacha20poly1305_ABYTES) != 0);
245
+
199
246
  /* New stream */
200
247
 
201
248
  ret = crypto_secretstream_xchacha20poly1305_init_push(state, header, k);
@@ -249,11 +296,13 @@ main(void)
249
296
  sodium_free(m2);
250
297
  sodium_free(m1);
251
298
  sodium_free(ad);
299
+ sodium_free(csave);
252
300
  sodium_free(c3);
253
301
  sodium_free(c2);
254
302
  sodium_free(c1);
255
303
  sodium_free(k);
256
304
  sodium_free(header);
305
+ sodium_free(statesave);
257
306
  sodium_free(state);
258
307
 
259
308
  assert(crypto_secretstream_xchacha20poly1305_abytes() ==
@@ -1041,6 +1041,11 @@ static TestData test_data[] = {
1041
1041
  {{0xf5,0xe5,0x76,0x7c,0xf1,0x53,0x31,0x95,0x17,0x63,0x0f,0x22,0x68,0x76,0xb8,0x6c,0x81,0x60,0xcc,0x58,0x3b,0xc0,0x13,0x74,0x4c,0x6b,0xf2,0x55,0xf5,0xcc,0x0e,0xe5,},{0x27,0x81,0x17,0xfc,0x14,0x4c,0x72,0x34,0x0f,0x67,0xd0,0xf2,0x31,0x6e,0x83,0x86,0xce,0xff,0xbf,0x2b,0x24,0x28,0xc9,0xc5,0x1f,0xef,0x7c,0x59,0x7f,0x1d,0x42,0x6e,},{0x0a,0xab,0x4c,0x90,0x05,0x01,0xb3,0xe2,0x4d,0x7c,0xdf,0x46,0x63,0x32,0x6a,0x3a,0x87,0xdf,0x5e,0x48,0x43,0xb2,0xcb,0xdb,0x67,0xcb,0xf6,0xe4,0x60,0xfe,0xc3,0x50,0xaa,0x53,0x71,0xb1,0x50,0x8f,0x9f,0x45,0x28,0xec,0xea,0x23,0xc4,0x36,0xd9,0x4b,0x5e,0x8f,0xcd,0x4f,0x68,0x1e,0x30,0xa6,0xac,0x00,0xa9,0x70,0x4a,0x18,0x8a,0x03,},"\x08\xb8\xb2\xb7\x33\x42\x42\x43\x76\x0f\xe4\x26\xa4\xb5\x49\x08\x63\x21\x10\xa6\x6c\x2f\x65\x91\xea\xbd\x33\x45\xe3\xe4\xeb\x98\xfa\x6e\x26\x4b\xf0\x9e\xfe\x12\xee\x50\xf8\xf5\x4e\x9f\x77\xb1\xe3\x55\xf6\xc5\x05\x44\xe2\x3f\xb1\x43\x3d\xdf\x73\xbe\x84\xd8\x79\xde\x7c\x00\x46\xdc\x49\x96\xd9\xe7\x73\xf4\xbc\x9e\xfe\x57\x38\x82\x9a\xdb\x26\xc8\x1b\x37\xc9\x3a\x1b\x27\x0b\x20\x32\x9d\x65\x86\x75\xfc\x6e\xa5\x34\xe0\x81\x0a\x44\x32\x82\x6b\xf5\x8c\x94\x1e\xfb\x65\xd5\x7a\x33\x8b\xbd\x2e\x26\x64\x0f\x89\xff\xbc\x1a\x85\x8e\xfc\xb8\x55\x0e\xe3\xa5\xe1\x99\x8b\xd1\x77\xe9\x3a\x73\x63\xc3\x44\xfe\x6b\x19\x9e\xe5\xd0\x2e\x82\xd5\x22\xc4\xfe\xba\x15\x45\x2f\x80\x28\x8a\x82\x1a\x57\x91\x16\xec\x6d\xad\x2b\x3b\x31\x0d\xa9\x03\x40\x1a\xa6\x21\x00\xab\x5d\x1a\x36\x55\x3e\x06\x20\x3b\x33\x89\x0c\xc9\xb8\x32\xf7\x9e\xf8\x05\x60\xcc\xb9\xa3\x9c\xe7\x67\x96\x7e\xd6\x28\xc6\xad\x57\x3c\xb1\x16\xdb\xef\xef\xd7\x54\x99\xda\x96\xbd\x68\xa8\xa9\x7b\x92\x8a\x8b\xbc\x10\x3b\x66\x21\xfc\xde\x2b\xec\xa1\x23\x1d\x20\x6b\xe6\xcd\x9e\xc7\xaf\xf6\xf6\xc9\x4f\xcd\x72\x04\xed\x34\x55\xc6\x8c\x83\xf4\xa4\x1d\xa4\xaf\x2b\x74\xef\x5c\x53\xf1\xd8\xac\x70\xbd\xcb\x7e\xd1\x85\xce\x81\xbd\x84\x35\x9d\x44\x25\x4d\x95\x62\x9e\x98\x55\xa9\x4a\x7c\x19\x58\xd1\xf8\xad\xa5\xd0\x53\x2e\xd8\xa5\xaa\x3f\xb2\xd1\x7b\xa7\x0e\xb6\x24\x8e\x59\x4e\x1a\x22\x97\xac\xbb\xb3\x9d\x50\x2f\x1a\x8c\x6e\xb6\xf1\xce\x22\xb3\xde\x1a\x1f\x40\xcc\x24\x55\x41\x19\xa8\x31\xa9\xaa\xd6\x07\x9c\xad\x88\x42\x5d\xe6\xbd\xe1\xa9\x18\x7e\xbb\x60\x92\xcf\x67\xbf\x2b\x13\xfd\x65\xf2\x70\x88\xd7\x8b\x7e\x88\x3c\x87\x59\xd2\xc4\xf5\xc6\x5a\xdb\x75\x53\x87\x8a\xd5\x75\xf9\xfa\xd8\x78\xe8\x0a\x0c\x9b\xa6\x3b\xcb\xcc\x27\x32\xe6\x94\x85\xbb\xc9\xc9\x0b\xfb\xd6\x24\x81\xd9\x08\x9b\xec\xcf\x80\xcf\xe2\xdf\x16\xa2\xcf\x65\xbd\x92\xdd\x59\x7b\x07\x07\xe0\x91\x7a\xf4\x8b\xbb\x75\xfe\xd4\x13\xd2\x38\xf5\x55\x5a\x7a\x56\x9d\x80\xc3\x41\x4a\x8d\x08\x59\xdc\x65\xa4\x61\x28\xba\xb2\x7a\xf8\x7a\x71\x31\x4f\x31\x8c\x78\x2b\x23\xeb\xfe\x80\x8b\x82\xb0\xce\x26\x40\x1d\x2e\x22\xf0\x4d\x83\xd1\x25\x5d\xc5\x1a\xdd\xd3\xb7\x5a\x2b\x1a\xe0\x78\x45\x04\xdf\x54\x3a\xf8\x96\x9b\xe3\xea\x70\x82\xff\x7f\xc9\x88\x8c\x14\x4d\xa2\xaf\x58\x42\x9e\xc9\x60\x31\xdb\xca\xd3\xda\xd9\xaf\x0d\xcb\xaa\xaf\x26\x8c\xb8\xfc\xff\xea\xd9\x4f\x3c\x7c\xa4\x95\xe0\x56\xa9\xb4\x7a\xcd\xb7\x51\xfb\x73\xe6\x66\xc6\xc6\x55\xad\xe8\x29\x72\x97\xd0\x7a\xd1\xba\x5e\x43\xf1\xbc\xa3\x23\x01\x65\x13\x39\xe2\x29\x04\xcc\x8c\x42\xf5\x8c\x30\xc0\x4a\xaf\xdb\x03\x8d\xda\x08\x47\xdd\x98\x8d\xcd\xa6\xf3\xbf\xd1\x5c\x4b\x4c\x45\x25\x00\x4a\xa0\x6e\xef\xf8\xca\x61\x78\x3a\xac\xec\x57\xfb\x3d\x1f\x92\xb0\xfe\x2f\xd1\xa8\x5f\x67\x24\x51\x7b\x65\xe6\x14\xad\x68\x08\xd6\xf6\xee\x34\xdf\xf7\x31\x0f\xdc\x82\xae\xbf\xd9\x04\xb0\x1e\x1d\xc5\x4b\x29\x27\x09\x4b\x2d\xb6\x8d\x6f\x90\x3b\x68\x40\x1a\xde\xbf\x5a\x7e\x08\xd7\x8f\xf4\xef\x5d\x63\x65\x3a\x65\x04\x0c\xf9\xbf\xd4\xac\xa7\x98\x4a\x74\xd3\x71\x45\x98\x67\x80\xfc\x0b\x16\xac\x45\x16\x49\xde\x61\x88\xa7\xdb\xdf\x19\x1f\x64\xb5\xfc\x5e\x2a\xb4\x7b\x57\xf7\xf7\x27\x6c\xd4\x19\xc1\x7a\x3c\xa8\xe1\xb9\x39\xae\x49\xe4\x88\xac\xba\x6b\x96\x56\x10\xb5\x48\x01\x09\xc8\xb1\x7b\x80\xe1\xb7\xb7\x50\xdf\xc7\x59\x8d\x5d\x50\x11\xfd\x2d\xcc\x56\x00\xa3\x2e\xf5\xb5\x2a\x1e\xcc\x82\x0e\x30\x8a\xa3\x42\x72\x1a\xac\x09\x43\xbf\x66\x86\xb6\x4b\x25\x79\x37\x65\x04\xcc\xc4\x93\xd9\x7e\x6a\xed\x3f\xb0\xf9\xcd\x71\xa4\x3d\xd4\x97\xf0\x1f\x17\xc0\xe2\xcb\x37\x97\xaa\x2a\x2f\x25\x66\x56\x16\x8e\x6c\x49\x6a\xfc\x5f\xb9\x32\x46\xf6\xb1\x11\x63\x98\xa3\x46\xf1\xa6\x41\xf3\xb0\x41\xe9\x89\xf7\x91\x4f\x90\xcc\x2c\x7f\xff\x35\x78\x76\xe5\x06\xb5\x0d\x33\x4b\xa7\x7c\x22\x5b\xc3\x07\xba\x53\x71\x52\xf3\xf1\x61\x0e\x4e\xaf\xe5\x95\xf6\xd9\xd9\x0d\x11\xfa\xa9\x33\xa1\x5e\xf1\x36\x95\x46\x86\x8a\x7f\x3a\x45\xa9\x67\x68\xd4\x0f\xd9\xd0\x34\x12\xc0\x91\xc6\x31\x5c\xf4\xfd\xe7\xcb\x68\x60\x69\x37\x38\x0d\xb2\xea\xaa\x70\x7b\x4c\x41\x85\xc3\x2e\xdd\xcd\xd3\x06\x70\x5e\x4d\xc1\xff\xc8\x72\xee\xee\x47\x5a\x64\xdf\xac\x86\xab\xa4\x1c\x06\x18\x98\x3f\x87\x41\xc5\xef\x68\xd3\xa1\x01\xe8\xa3\xb8\xca\xc6\x0c\x90\x5c\x15\xfc\x91\x08\x40\xb9\x4c\x00\xa0\xb9\xd0"},
1042
1042
  };
1043
1043
 
1044
+ static const unsigned char non_canonical_p[32] = {
1045
+ 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1046
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
1047
+ };
1048
+
1044
1049
  static void add_l(unsigned char * const S)
1045
1050
  {
1046
1051
  static const unsigned char l[32] =
@@ -1176,6 +1181,13 @@ int main(void)
1176
1181
  sig[63] ^= (j << 5);
1177
1182
  }
1178
1183
 
1184
+ #ifndef ED25519_COMPAT
1185
+ if (crypto_sign_verify_detached(sig,
1186
+ (const unsigned char *)test_data[i].m,
1187
+ i, non_canonical_p) != -1) {
1188
+ printf("detached signature verification with non-canonical key should have failed\n");
1189
+ }
1190
+ #endif
1179
1191
  memset(pk, 0, sizeof pk);
1180
1192
  if (crypto_sign_verify_detached(sig,
1181
1193
  (const unsigned char *)test_data[i].m,
@@ -1311,5 +1323,9 @@ int main(void)
1311
1323
  == crypto_sign_ed25519_secretkeybytes());
1312
1324
  assert(crypto_sign_statebytes() == crypto_sign_ed25519ph_statebytes());
1313
1325
 
1326
+ #ifdef ED25519_NONDETERMINISTIC
1327
+ exit(0);
1328
+ #endif
1329
+
1314
1330
  return 0;
1315
1331
  }
@@ -28,6 +28,7 @@ main(void)
28
28
  (void) sodium_runtime_has_avx512f();
29
29
  (void) sodium_runtime_has_pclmul();
30
30
  (void) sodium_runtime_has_aesni();
31
+ (void) sodium_runtime_has_rdrand();
31
32
 
32
33
  sodium_set_misuse_handler(misuse_handler);
33
34
  #ifndef __EMSCRIPTEN__
@@ -9,7 +9,6 @@ main(void)
9
9
  unsigned char buf2[1000];
10
10
  unsigned char buf1_rev[1000];
11
11
  unsigned char buf2_rev[1000];
12
- char buf3[33];
13
12
  unsigned char nonce[24];
14
13
  char nonce_hex[49];
15
14
  unsigned char *bin_padded;
@@ -173,5 +172,7 @@ main(void)
173
172
  sodium_free(bin_padded);
174
173
  }
175
174
 
175
+ sodium_stackzero(512);
176
+
176
177
  return 0;
177
178
  }
@@ -244,7 +244,7 @@ tv_secretbox_xchacha20poly1305(void)
244
244
  assert(crypto_secretbox_xchacha20poly1305_easy(out2, m, m_len, nonce, key) == 0);
245
245
  assert(memcmp(out, out2,
246
246
  crypto_secretbox_xchacha20poly1305_MACBYTES + m_len) == 0);
247
- n = randombytes_uniform(crypto_secretbox_xchacha20poly1305_MACBYTES + m_len);
247
+ n = randombytes_uniform(crypto_secretbox_xchacha20poly1305_MACBYTES + (uint32_t) m_len);
248
248
  assert(crypto_secretbox_xchacha20poly1305_open_easy
249
249
  (out2, out2, crypto_secretbox_xchacha20poly1305_MACBYTES - 1,
250
250
  nonce, key) == -1);
@@ -291,6 +291,7 @@ tv_secretbox_xchacha20poly1305(void)
291
291
  assert(crypto_secretbox_xchacha20poly1305_keybytes() == crypto_secretbox_xchacha20poly1305_KEYBYTES);
292
292
  assert(crypto_secretbox_xchacha20poly1305_noncebytes() == crypto_secretbox_xchacha20poly1305_NONCEBYTES);
293
293
  assert(crypto_secretbox_xchacha20poly1305_macbytes() == crypto_secretbox_xchacha20poly1305_MACBYTES);
294
+ assert(crypto_secretbox_xchacha20poly1305_messagebytes_max() == crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX);
294
295
 
295
296
  printf("tv_secretbox_xchacha20: ok\n");
296
297
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbnacl-libsodium
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15.1
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artiom Di
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-11-08 00:00:00.000000000 Z
12
+ date: 2017-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rbnacl
@@ -53,6 +53,34 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '10'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake-compiler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 0.9.7
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 0.9.7
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake-compiler-dock
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: 0.5.2
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: 0.5.2
56
84
  description:
57
85
  email:
58
86
  - kron82@gmail.com
@@ -88,11 +116,13 @@ files:
88
116
  - vendor/libsodium/autom4te.cache/output.1
89
117
  - vendor/libsodium/autom4te.cache/output.2
90
118
  - vendor/libsodium/autom4te.cache/output.3
119
+ - vendor/libsodium/autom4te.cache/output.4
91
120
  - vendor/libsodium/autom4te.cache/requests
92
121
  - vendor/libsodium/autom4te.cache/traces.0
93
122
  - vendor/libsodium/autom4te.cache/traces.1
94
123
  - vendor/libsodium/autom4te.cache/traces.2
95
124
  - vendor/libsodium/autom4te.cache/traces.3
125
+ - vendor/libsodium/autom4te.cache/traces.4
96
126
  - vendor/libsodium/build-aux/compile
97
127
  - vendor/libsodium/build-aux/config.guess
98
128
  - vendor/libsodium/build-aux/config.sub
@@ -205,6 +235,7 @@ files:
205
235
  - vendor/libsodium/m4/ax_check_gnu_make.m4
206
236
  - vendor/libsodium/m4/ax_check_link_flag.m4
207
237
  - vendor/libsodium/m4/ax_pthread.m4
238
+ - vendor/libsodium/m4/ax_tls.m4
208
239
  - vendor/libsodium/m4/ax_valgrind_check.m4
209
240
  - vendor/libsodium/m4/ld-output-def.m4
210
241
  - vendor/libsodium/m4/libtool.m4
@@ -233,6 +264,13 @@ files:
233
264
  - vendor/libsodium/packaging/nuget/package.bat
234
265
  - vendor/libsodium/packaging/nuget/package.config
235
266
  - vendor/libsodium/packaging/nuget/package.gsl
267
+ - vendor/libsodium/regen-msvc/libsodium.vcxproj
268
+ - vendor/libsodium/regen-msvc/libsodium.vcxproj.filters
269
+ - vendor/libsodium/regen-msvc/libsodium.vcxproj.filters.tpl
270
+ - vendor/libsodium/regen-msvc/libsodium.vcxproj.tpl
271
+ - vendor/libsodium/regen-msvc/regen-msvc.py
272
+ - vendor/libsodium/regen-msvc/tl_libsodium.vcxproj.filters.tpl
273
+ - vendor/libsodium/regen-msvc/tl_libsodium.vcxproj.tpl
236
274
  - vendor/libsodium/src/Makefile.am
237
275
  - vendor/libsodium/src/Makefile.in
238
276
  - vendor/libsodium/src/libsodium/Makefile.am
@@ -250,9 +288,16 @@ files:
250
288
  - vendor/libsodium/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c
251
289
  - vendor/libsodium/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_seal_curve25519xchacha20poly1305.c
252
290
  - vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c
253
- - vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/base.h
254
- - vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/base2.h
255
- - vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c
291
+ - vendor/libsodium/src/libsodium/crypto_core/ed25519/core_ed25519.c
292
+ - vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c
293
+ - vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/base.h
294
+ - vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/base2.h
295
+ - vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h
296
+ - vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/fe.h
297
+ - vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_51/base.h
298
+ - vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_51/base2.h
299
+ - vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h
300
+ - vendor/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_51/fe.h
256
301
  - vendor/libsodium/src/libsodium/crypto_core/hchacha20/core_hchacha20.c
257
302
  - vendor/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20.c
258
303
  - vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c
@@ -317,8 +362,6 @@ files:
317
362
  - vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c
318
363
  - vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c
319
364
  - vendor/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c
320
- - vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c
321
- - vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.h
322
365
  - vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c
323
366
  - vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.h
324
367
  - vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S
@@ -342,6 +385,7 @@ files:
342
385
  - vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S
343
386
  - vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c
344
387
  - vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.h
388
+ - vendor/libsodium/src/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c
345
389
  - vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c
346
390
  - vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c
347
391
  - vendor/libsodium/src/libsodium/crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c
@@ -354,11 +398,11 @@ files:
354
398
  - vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24.c
355
399
  - vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphashx24.c
356
400
  - vendor/libsodium/src/libsodium/crypto_sign/crypto_sign.c
357
- - vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ed25519_ref10.h
358
401
  - vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c
359
402
  - vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c
360
403
  - vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c
361
404
  - vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c
405
+ - vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign_ed25519_ref10.h
362
406
  - vendor/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519.c
363
407
  - vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c
364
408
  - vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.h
@@ -409,6 +453,7 @@ files:
409
453
  - vendor/libsodium/src/libsodium/include/sodium/crypto_box.h
410
454
  - vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h
411
455
  - vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h
456
+ - vendor/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h
412
457
  - vendor/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h
413
458
  - vendor/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h
414
459
  - vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h
@@ -430,6 +475,7 @@ files:
430
475
  - vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h
431
476
  - vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h
432
477
  - vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h
478
+ - vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h
433
479
  - vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox.h
434
480
  - vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h
435
481
  - vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h
@@ -451,7 +497,9 @@ files:
451
497
  - vendor/libsodium/src/libsodium/include/sodium/crypto_verify_64.h
452
498
  - vendor/libsodium/src/libsodium/include/sodium/export.h
453
499
  - vendor/libsodium/src/libsodium/include/sodium/private/common.h
454
- - vendor/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h
500
+ - vendor/libsodium/src/libsodium/include/sodium/private/ed25519_ref10.h
501
+ - vendor/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h
502
+ - vendor/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h
455
503
  - vendor/libsodium/src/libsodium/include/sodium/private/implementations.h
456
504
  - vendor/libsodium/src/libsodium/include/sodium/private/mutex.h
457
505
  - vendor/libsodium/src/libsodium/include/sodium/private/sse2_64_32.h
@@ -527,6 +575,8 @@ files:
527
575
  - vendor/libsodium/test/default/core5.exp
528
576
  - vendor/libsodium/test/default/core6.c
529
577
  - vendor/libsodium/test/default/core6.exp
578
+ - vendor/libsodium/test/default/core_ed25519.c
579
+ - vendor/libsodium/test/default/core_ed25519.exp
530
580
  - vendor/libsodium/test/default/ed25519_convert.c
531
581
  - vendor/libsodium/test/default/ed25519_convert.exp
532
582
  - vendor/libsodium/test/default/generichash.c
@@ -540,7 +590,6 @@ files:
540
590
  - vendor/libsodium/test/default/hash2.exp
541
591
  - vendor/libsodium/test/default/hash3.c
542
592
  - vendor/libsodium/test/default/hash3.exp
543
- - vendor/libsodium/test/default/index-wasm.html.tpl
544
593
  - vendor/libsodium/test/default/index.html.tpl
545
594
  - vendor/libsodium/test/default/kdf.c
546
595
  - vendor/libsodium/test/default/kdf.exp
@@ -580,6 +629,8 @@ files:
580
629
  - vendor/libsodium/test/default/scalarmult6.exp
581
630
  - vendor/libsodium/test/default/scalarmult7.c
582
631
  - vendor/libsodium/test/default/scalarmult7.exp
632
+ - vendor/libsodium/test/default/scalarmult_ed25519.c
633
+ - vendor/libsodium/test/default/scalarmult_ed25519.exp
583
634
  - vendor/libsodium/test/default/secretbox.c
584
635
  - vendor/libsodium/test/default/secretbox.exp
585
636
  - vendor/libsodium/test/default/secretbox2.c
@@ -636,7 +687,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
636
687
  requirements:
637
688
  - - ">="
638
689
  - !ruby/object:Gem::Version
639
- version: '0'
690
+ version: 2.2.6
640
691
  required_rubygems_version: !ruby/object:Gem::Requirement
641
692
  requirements:
642
693
  - - ">="
@@ -644,7 +695,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
644
695
  version: '0'
645
696
  requirements: []
646
697
  rubyforge_project:
647
- rubygems_version: 2.6.12
698
+ rubygems_version: 2.6.13
648
699
  signing_key:
649
700
  specification_version: 4
650
701
  summary: rbnacl with bundled libsodium