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
@@ -34,8 +34,7 @@
34
34
  typedef uint8_t u8;
35
35
  typedef uint64_t limb;
36
36
  typedef limb felem[5];
37
- // This is a special gcc mode for 128-bit integers. It's implemented on 64-bit
38
- // platforms only as far as I know.
37
+ /* Special gcc mode for 128-bit integers */
39
38
  typedef unsigned uint128_t __attribute__ ((mode(TI)));
40
39
 
41
40
  /* Sum two numbers: output += in */
@@ -315,7 +314,7 @@ fmonty(limb *x2, limb *z2, /* output 2Q */
315
314
 
316
315
  memcpy(origx, x, 5 * sizeof(limb));
317
316
  fsum(x, z);
318
- fdifference_backwards(z, origx); // does x - z
317
+ fdifference_backwards(z, origx); /* does x - z */
319
318
 
320
319
  memcpy(origxprime, xprime, sizeof(limb) * 5);
321
320
  fsum(xprime, zprime);
@@ -332,19 +331,19 @@ fmonty(limb *x2, limb *z2, /* output 2Q */
332
331
  fsquare_times(xx, x, 1);
333
332
  fsquare_times(zz, z, 1);
334
333
  fmul(x2, xx, zz);
335
- fdifference_backwards(zz, xx); // does zz = xx - zz
334
+ fdifference_backwards(zz, xx); /* does zz = xx - zz */
336
335
  fscalar_product(zzz, zz, 121665);
337
336
  fsum(zzz, xx);
338
337
  fmul(z2, zz, zzz);
339
338
  }
340
339
 
341
- // -----------------------------------------------------------------------------
342
- // Maybe swap the contents of two limb arrays (@a and @b), each @len elements
343
- // long. Perform the swap iff @swap is non-zero.
344
- //
345
- // This function performs the swap without leaking any side-channel
346
- // information.
347
- // -----------------------------------------------------------------------------
340
+ /* -----------------------------------------------------------------------------
341
+ Maybe swap the contents of two limb arrays (@a and @b), each @len elements
342
+ long. Perform the swap iff @swap is non-zero.
343
+
344
+ This function performs the swap without leaking any side-channel
345
+ information.
346
+ ----------------------------------------------------------------------------- */
348
347
  static void
349
348
  swap_conditional(limb a[5], limb b[5], limb iswap) {
350
349
  unsigned i;
@@ -411,17 +410,17 @@ cmult(limb *resultx, limb *resultz, const u8 *n, const limb *q) {
411
410
  }
412
411
 
413
412
 
414
- // -----------------------------------------------------------------------------
415
- // Shamelessly copied from djb's code, tightened a little
416
- // -----------------------------------------------------------------------------
413
+ /* -----------------------------------------------------------------------------
414
+ Shamelessly copied from djb's code, tightened a little
415
+ ----------------------------------------------------------------------------- */
417
416
  static void
418
417
  crecip(felem out, const felem z) {
419
418
  felem a,t0,b,c;
420
419
 
421
- /* 2 */ fsquare_times(a, z, 1); // a = 2
420
+ /* 2 */ fsquare_times(a, z, 1); /* a = 2 */
422
421
  /* 8 */ fsquare_times(t0, a, 2);
423
- /* 9 */ fmul(b, t0, z); // b = 9
424
- /* 11 */ fmul(a, b, a); // a = 11
422
+ /* 9 */ fmul(b, t0, z); /* b = 9 */
423
+ /* 11 */ fmul(a, b, a); /* a = 11 */
425
424
  /* 22 */ fsquare_times(t0, a, 1);
426
425
  /* 2^5 - 2^0 = 31 */ fmul(b, t0, b);
427
426
  /* 2^10 - 2^5 */ fsquare_times(t0, b, 5);
@@ -2,6 +2,7 @@
2
2
  #define curve25519_donna_c64_H
3
3
 
4
4
  #include "crypto_scalarmult_curve25519.h"
5
+ #include "../scalarmult_curve25519.h"
5
6
 
6
7
  extern struct crypto_scalarmult_curve25519_implementation
7
8
  crypto_scalarmult_curve25519_donna_c64_implementation;
@@ -127,17 +127,17 @@ fe_mul121666(fe h,const fe f)
127
127
  int64_t carry8;
128
128
  int64_t carry9;
129
129
 
130
- carry9 = (h9 + (int64_t) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
131
- carry1 = (h1 + (int64_t) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
132
- carry3 = (h3 + (int64_t) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
133
- carry5 = (h5 + (int64_t) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
134
- carry7 = (h7 + (int64_t) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
135
-
136
- carry0 = (h0 + (int64_t) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
137
- carry2 = (h2 + (int64_t) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
138
- carry4 = (h4 + (int64_t) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
139
- carry6 = (h6 + (int64_t) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
140
- carry8 = (h8 + (int64_t) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
130
+ carry9 = (h9 + ((int64_t) 1 << 24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
131
+ carry1 = (h1 + ((int64_t) 1 << 24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
132
+ carry3 = (h3 + ((int64_t) 1 << 24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
133
+ carry5 = (h5 + ((int64_t) 1 << 24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
134
+ carry7 = (h7 + ((int64_t) 1 << 24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
135
+
136
+ carry0 = (h0 + ((int64_t) 1 << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
137
+ carry2 = (h2 + ((int64_t) 1 << 25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
138
+ carry4 = (h4 + ((int64_t) 1 << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
139
+ carry6 = (h6 + ((int64_t) 1 << 25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
140
+ carry8 = (h8 + ((int64_t) 1 << 25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
141
141
 
142
142
  h[0] = h0;
143
143
  h[1] = h1;
@@ -2,6 +2,7 @@
2
2
  #define curve25519_ref10_H
3
3
 
4
4
  #include "crypto_scalarmult_curve25519.h"
5
+ #include "../scalarmult_curve25519.h"
5
6
 
6
7
  extern struct crypto_scalarmult_curve25519_implementation
7
8
  crypto_scalarmult_curve25519_ref10_implementation;
@@ -16,5 +16,5 @@
16
16
  #define subc2 crypto_scalarmult_curve25519_sandy2x_subc2
17
17
  #define REDMASK51 crypto_scalarmult_curve25519_sandy2x_REDMASK51
18
18
 
19
- #endif //ifndef consts_namespace_H
19
+ #endif /* ifndef consts_namespace_H */
20
20
 
@@ -6,9 +6,10 @@
6
6
  #ifndef fe_H
7
7
  #define fe_H
8
8
 
9
- #include "crypto_uint64.h"
9
+ #include <stdint.h>
10
+ #include <stdlib.h>
10
11
 
11
- typedef crypto_uint64 fe[10];
12
+ typedef uint64_t fe[10];
12
13
 
13
14
  /*
14
15
  fe means field element.
@@ -12,12 +12,14 @@
12
12
  extern "C" {
13
13
  #endif
14
14
 
15
- #include "crypto_uint64.h"
15
+ #include <stdint.h>
16
+ #include <stdlib.h>
17
+
16
18
  #include "fe51_namespace.h"
17
19
 
18
- typedef struct
20
+ typedef struct
19
21
  {
20
- crypto_uint64 v[5];
22
+ uint64_t v[5];
21
23
  }
22
24
  fe51;
23
25
 
@@ -11,47 +11,47 @@
11
11
 
12
12
  void fe51_invert(fe51 *r, const fe51 *x)
13
13
  {
14
- fe51 z2;
15
- fe51 z9;
16
- fe51 z11;
17
- fe51 z2_5_0;
18
- fe51 z2_10_0;
19
- fe51 z2_20_0;
20
- fe51 z2_50_0;
21
- fe51 z2_100_0;
22
- fe51 t;
23
-
24
- /* 2 */ fe51_square(&z2,x);
25
- /* 4 */ fe51_square(&t,&z2);
26
- /* 8 */ fe51_square(&t,&t);
27
- /* 9 */ fe51_mul(&z9,&t,x);
28
- /* 11 */ fe51_mul(&z11,&z9,&z2);
29
- /* 22 */ fe51_square(&t,&z11);
30
- /* 2^5 - 2^0 = 31 */ fe51_mul(&z2_5_0,&t,&z9);
31
-
32
- /* 2^10 - 2^5 */ fe51_nsquare(&t,&z2_5_0, 5);
33
- /* 2^10 - 2^0 */ fe51_mul(&z2_10_0,&t,&z2_5_0);
34
-
35
- /* 2^20 - 2^10 */ fe51_nsquare(&t,&z2_10_0, 10);
36
- /* 2^20 - 2^0 */ fe51_mul(&z2_20_0,&t,&z2_10_0);
37
-
38
- /* 2^40 - 2^20 */ fe51_nsquare(&t,&z2_20_0, 20);
39
- /* 2^40 - 2^0 */ fe51_mul(&t,&t,&z2_20_0);
40
-
41
- /* 2^50 - 2^10 */ fe51_nsquare(&t,&t,10);
42
- /* 2^50 - 2^0 */ fe51_mul(&z2_50_0,&t,&z2_10_0);
43
-
44
- /* 2^100 - 2^50 */ fe51_nsquare(&t,&z2_50_0, 50);
45
- /* 2^100 - 2^0 */ fe51_mul(&z2_100_0,&t,&z2_50_0);
46
-
47
- /* 2^200 - 2^100 */ fe51_nsquare(&t,&z2_100_0, 100);
48
- /* 2^200 - 2^0 */ fe51_mul(&t,&t,&z2_100_0);
49
-
50
- /* 2^250 - 2^50 */ fe51_nsquare(&t,&t, 50);
51
- /* 2^250 - 2^0 */ fe51_mul(&t,&t,&z2_50_0);
52
-
53
- /* 2^255 - 2^5 */ fe51_nsquare(&t,&t,5);
54
- /* 2^255 - 21 */ fe51_mul(r,&t,&z11);
14
+ fe51 z2;
15
+ fe51 z9;
16
+ fe51 z11;
17
+ fe51 z2_5_0;
18
+ fe51 z2_10_0;
19
+ fe51 z2_20_0;
20
+ fe51 z2_50_0;
21
+ fe51 z2_100_0;
22
+ fe51 t;
23
+
24
+ /* 2 */ fe51_square(&z2,x);
25
+ /* 4 */ fe51_square(&t,&z2);
26
+ /* 8 */ fe51_square(&t,&t);
27
+ /* 9 */ fe51_mul(&z9,&t,x);
28
+ /* 11 */ fe51_mul(&z11,&z9,&z2);
29
+ /* 22 */ fe51_square(&t,&z11);
30
+ /* 2^5 - 2^0 = 31 */ fe51_mul(&z2_5_0,&t,&z9);
31
+
32
+ /* 2^10 - 2^5 */ fe51_nsquare(&t,&z2_5_0, 5);
33
+ /* 2^10 - 2^0 */ fe51_mul(&z2_10_0,&t,&z2_5_0);
34
+
35
+ /* 2^20 - 2^10 */ fe51_nsquare(&t,&z2_10_0, 10);
36
+ /* 2^20 - 2^0 */ fe51_mul(&z2_20_0,&t,&z2_10_0);
37
+
38
+ /* 2^40 - 2^20 */ fe51_nsquare(&t,&z2_20_0, 20);
39
+ /* 2^40 - 2^0 */ fe51_mul(&t,&t,&z2_20_0);
40
+
41
+ /* 2^50 - 2^10 */ fe51_nsquare(&t,&t,10);
42
+ /* 2^50 - 2^0 */ fe51_mul(&z2_50_0,&t,&z2_10_0);
43
+
44
+ /* 2^100 - 2^50 */ fe51_nsquare(&t,&z2_50_0, 50);
45
+ /* 2^100 - 2^0 */ fe51_mul(&z2_100_0,&t,&z2_50_0);
46
+
47
+ /* 2^200 - 2^100 */ fe51_nsquare(&t,&z2_100_0, 100);
48
+ /* 2^200 - 2^0 */ fe51_mul(&t,&t,&z2_100_0);
49
+
50
+ /* 2^250 - 2^50 */ fe51_nsquare(&t,&t, 50);
51
+ /* 2^250 - 2^0 */ fe51_mul(&t,&t,&z2_50_0);
52
+
53
+ /* 2^255 - 2^5 */ fe51_nsquare(&t,&t,5);
54
+ /* 2^255 - 21 */ fe51_mul(r,&t,&z11);
55
55
  }
56
56
 
57
57
  #endif
@@ -7,10 +7,18 @@
7
7
  #include "consts_namespace.h"
8
8
  .text
9
9
  .p2align 5
10
- .globl _fe51_mul
10
+ #ifdef ASM_HIDE_SYMBOL
11
+ ASM_HIDE_SYMBOL fe51_mul
12
+ ASM_HIDE_SYMBOL _fe51_mul
13
+ #endif
11
14
  .globl fe51_mul
12
- _fe51_mul:
15
+ .globl _fe51_mul
16
+ #ifdef __ELF__
17
+ .type fe51_mul, @function
18
+ .type _fe51_mul, @function
19
+ #endif
13
20
  fe51_mul:
21
+ _fe51_mul:
14
22
  mov %rsp,%r11
15
23
  and $31,%r11
16
24
  add $96,%r11
@@ -12,5 +12,5 @@
12
12
 
13
13
  #define fe51_invert crypto_scalarmult_curve25519_sandy2x_fe51_invert
14
14
 
15
- #endif //ifndef fe51_namespace_H
15
+ #endif /* ifndef fe51_namespace_H */
16
16
 
@@ -8,6 +8,10 @@
8
8
  #include "consts_namespace.h"
9
9
  .p2align 5
10
10
 
11
+ #ifdef ASM_HIDE_SYMBOL
12
+ ASM_HIDE_SYMBOL fe51_nsquare
13
+ ASM_HIDE_SYMBOL _fe51_nsquare
14
+ #endif
11
15
  .globl fe51_nsquare
12
16
  .globl _fe51_nsquare
13
17
  #ifdef __ELF__
@@ -8,6 +8,10 @@
8
8
  #include "consts_namespace.h"
9
9
  .p2align 5
10
10
 
11
+ #ifdef ASM_HIDE_SYMBOL
12
+ ASM_HIDE_SYMBOL fe51_pack
13
+ ASM_HIDE_SYMBOL _fe51_pack
14
+ #endif
11
15
  .globl fe51_pack
12
16
  .globl _fe51_pack
13
17
  #ifdef __ELF__
@@ -3,51 +3,50 @@
3
3
  */
4
4
 
5
5
  #include "fe.h"
6
- #include "crypto_uint64.h"
7
6
 
8
7
  #ifdef HAVE_AVX_ASM
9
8
 
10
- static crypto_uint64 load_3(const unsigned char *in)
9
+ static uint64_t load_3(const unsigned char *in)
11
10
  {
12
- crypto_uint64 result;
13
- result = (crypto_uint64) in[0];
14
- result |= ((crypto_uint64) in[1]) << 8;
15
- result |= ((crypto_uint64) in[2]) << 16;
11
+ uint64_t result;
12
+ result = (uint64_t) in[0];
13
+ result |= ((uint64_t) in[1]) << 8;
14
+ result |= ((uint64_t) in[2]) << 16;
16
15
  return result;
17
16
  }
18
17
 
19
- static crypto_uint64 load_4(const unsigned char *in)
18
+ static uint64_t load_4(const unsigned char *in)
20
19
  {
21
- crypto_uint64 result;
22
- result = (crypto_uint64) in[0];
23
- result |= ((crypto_uint64) in[1]) << 8;
24
- result |= ((crypto_uint64) in[2]) << 16;
25
- result |= ((crypto_uint64) in[3]) << 24;
20
+ uint64_t result;
21
+ result = (uint64_t) in[0];
22
+ result |= ((uint64_t) in[1]) << 8;
23
+ result |= ((uint64_t) in[2]) << 16;
24
+ result |= ((uint64_t) in[3]) << 24;
26
25
  return result;
27
26
  }
28
27
 
29
28
  void fe_frombytes(fe h,const unsigned char *s)
30
29
  {
31
- crypto_uint64 h0 = load_4(s);
32
- crypto_uint64 h1 = load_3(s + 4) << 6;
33
- crypto_uint64 h2 = load_3(s + 7) << 5;
34
- crypto_uint64 h3 = load_3(s + 10) << 3;
35
- crypto_uint64 h4 = load_3(s + 13) << 2;
36
- crypto_uint64 h5 = load_4(s + 16);
37
- crypto_uint64 h6 = load_3(s + 20) << 7;
38
- crypto_uint64 h7 = load_3(s + 23) << 5;
39
- crypto_uint64 h8 = load_3(s + 26) << 4;
40
- crypto_uint64 h9 = (load_3(s + 29) & 8388607) << 2;
41
- crypto_uint64 carry0;
42
- crypto_uint64 carry1;
43
- crypto_uint64 carry2;
44
- crypto_uint64 carry3;
45
- crypto_uint64 carry4;
46
- crypto_uint64 carry5;
47
- crypto_uint64 carry6;
48
- crypto_uint64 carry7;
49
- crypto_uint64 carry8;
50
- crypto_uint64 carry9;
30
+ uint64_t h0 = load_4(s);
31
+ uint64_t h1 = load_3(s + 4) << 6;
32
+ uint64_t h2 = load_3(s + 7) << 5;
33
+ uint64_t h3 = load_3(s + 10) << 3;
34
+ uint64_t h4 = load_3(s + 13) << 2;
35
+ uint64_t h5 = load_4(s + 16);
36
+ uint64_t h6 = load_3(s + 20) << 7;
37
+ uint64_t h7 = load_3(s + 23) << 5;
38
+ uint64_t h8 = load_3(s + 26) << 4;
39
+ uint64_t h9 = (load_3(s + 29) & 8388607) << 2;
40
+ uint64_t carry0;
41
+ uint64_t carry1;
42
+ uint64_t carry2;
43
+ uint64_t carry3;
44
+ uint64_t carry4;
45
+ uint64_t carry5;
46
+ uint64_t carry6;
47
+ uint64_t carry7;
48
+ uint64_t carry8;
49
+ uint64_t carry9;
51
50
 
52
51
  carry9 = h9 >> 25; h0 += carry9 * 19; h9 &= 0x1FFFFFF;
53
52
  carry1 = h1 >> 25; h2 += carry1; h1 &= 0x1FFFFFF;
@@ -4,6 +4,10 @@
4
4
  #include "consts_namespace.h"
5
5
  .p2align 5
6
6
 
7
+ #ifdef ASM_HIDE_SYMBOL
8
+ ASM_HIDE_SYMBOL ladder
9
+ ASM_HIDE_SYMBOL _ladder
10
+ #endif
7
11
  .globl ladder
8
12
  .globl _ladder
9
13
  #ifdef __ELF__
@@ -14,5 +14,5 @@ extern void ladder(fe *, const unsigned char *);
14
14
  }
15
15
  #endif
16
16
 
17
- #endif //ifndef ladder_H
17
+ #endif /* ifndef ladder_H */
18
18
 
@@ -4,6 +4,10 @@
4
4
  #include "consts_namespace.h"
5
5
  .p2align 5
6
6
 
7
+ #ifdef ASM_HIDE_SYMBOL
8
+ ASM_HIDE_SYMBOL ladder_base
9
+ ASM_HIDE_SYMBOL _ladder_base
10
+ #endif
7
11
  .globl ladder_base
8
12
  .globl _ladder_base
9
13
  #ifdef __ELF__
@@ -14,5 +14,5 @@ extern void ladder_base(fe *, const unsigned char *);
14
14
  }
15
15
  #endif
16
16
 
17
- #endif //ifndef ladder_base_H
17
+ #endif /* ifndef ladder_base_H */
18
18
 
@@ -4,5 +4,5 @@
4
4
  #define ladder_base crypto_scalarmult_curve25519_sandy2x_ladder_base
5
5
  #define _ladder_base _crypto_scalarmult_curve25519_sandy2x_ladder_base
6
6
 
7
- #endif //ifndef ladder_base_namespace_H
7
+ #endif /* ifndef ladder_base_namespace_H */
8
8
 
@@ -4,5 +4,5 @@
4
4
  #define ladder crypto_scalarmult_curve25519_sandy2x_ladder
5
5
  #define _ladder _crypto_scalarmult_curve25519_sandy2x_ladder
6
6
 
7
- #endif //ifndef ladder_namespace_H
7
+ #endif /* ifndef ladder_namespace_H */
8
8
 
@@ -11,10 +11,6 @@
11
11
  #include "crypto_stream_salsa20.h"
12
12
  #include "utils.h"
13
13
 
14
- static const unsigned char sigma[16] = {
15
- 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
16
- };
17
-
18
14
  int
19
15
  crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
20
16
  const unsigned char *m,
@@ -27,7 +23,7 @@ crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
27
23
  unsigned long long i;
28
24
  unsigned long long mlen0;
29
25
 
30
- crypto_core_hsalsa20(subkey, n, k, sigma);
26
+ crypto_core_hsalsa20(subkey, n, k, NULL);
31
27
 
32
28
  if (((uintptr_t) c >= (uintptr_t) m &&
33
29
  (uintptr_t) c - (uintptr_t) m < mlen) ||
@@ -93,7 +89,7 @@ crypto_secretbox_open_detached(unsigned char *m, const unsigned char *c,
93
89
  unsigned long long i;
94
90
  unsigned long long mlen0;
95
91
 
96
- crypto_core_hsalsa20(subkey, n, k, sigma);
92
+ crypto_core_hsalsa20(subkey, n, k, NULL);
97
93
  crypto_stream_salsa20(block0, crypto_stream_salsa20_KEYBYTES,
98
94
  n + 16, subkey);
99
95
  if (crypto_onetimeauth_poly1305_verify(mac, c, clen, block0) != 0) {