rbnacl-libsodium 1.0.11 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (465) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +4 -0
  3. data/lib/rbnacl/libsodium/version.rb +1 -1
  4. data/vendor/libsodium/AUTHORS +45 -33
  5. data/vendor/libsodium/ChangeLog +63 -2
  6. data/vendor/libsodium/LICENSE +1 -1
  7. data/vendor/libsodium/Makefile.am +1 -0
  8. data/vendor/libsodium/Makefile.in +17 -14
  9. data/vendor/libsodium/README.markdown +1 -0
  10. data/vendor/libsodium/THANKS +38 -4
  11. data/vendor/libsodium/aclocal.m4 +25 -24
  12. data/vendor/libsodium/autogen.sh +12 -7
  13. data/vendor/libsodium/autom4te.cache/output.0 +5066 -2281
  14. data/vendor/libsodium/autom4te.cache/output.1 +1013 -600
  15. data/vendor/libsodium/autom4te.cache/output.2 +5066 -2281
  16. data/vendor/libsodium/autom4te.cache/requests +426 -1584
  17. data/vendor/libsodium/autom4te.cache/traces.0 +2044 -876
  18. data/vendor/libsodium/autom4te.cache/traces.1 +996 -523
  19. data/vendor/libsodium/autom4te.cache/traces.2 +1996 -828
  20. data/vendor/libsodium/build-aux/compile +5 -4
  21. data/vendor/libsodium/build-aux/config.guess +120 -68
  22. data/vendor/libsodium/build-aux/config.sub +51 -22
  23. data/vendor/libsodium/build-aux/depcomp +3 -3
  24. data/vendor/libsodium/build-aux/install-sh +2 -2
  25. data/vendor/libsodium/build-aux/missing +3 -3
  26. data/vendor/libsodium/build-aux/test-driver +3 -3
  27. data/vendor/libsodium/builds/msvc/properties/Win32.props +4 -1
  28. data/vendor/libsodium/builds/msvc/properties/x64.props +4 -1
  29. data/vendor/libsodium/builds/msvc/resource.h +14 -0
  30. data/vendor/libsodium/builds/msvc/resource.rc +63 -0
  31. data/vendor/libsodium/builds/msvc/version.h +7 -4
  32. data/vendor/libsodium/builds/msvc/vs2010/libsodium.import.props +1 -1
  33. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.props +10 -5
  34. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +182 -139
  35. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +632 -470
  36. data/vendor/libsodium/builds/msvc/vs2012/libsodium.import.props +1 -1
  37. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.props +10 -5
  38. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +182 -129
  39. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +632 -470
  40. data/vendor/libsodium/builds/msvc/vs2013/libsodium.import.props +1 -1
  41. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.props +10 -5
  42. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +182 -129
  43. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +632 -470
  44. data/vendor/libsodium/builds/msvc/vs2015/libsodium.import.props +1 -1
  45. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.props +10 -5
  46. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj +181 -118
  47. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +632 -470
  48. data/vendor/libsodium/builds/msvc/vs2017/libsodium.import.props +52 -0
  49. data/vendor/libsodium/builds/msvc/vs2017/libsodium.import.xml +17 -0
  50. data/vendor/libsodium/builds/msvc/vs2017/libsodium.sln +52 -0
  51. data/vendor/libsodium/builds/msvc/vs2017/libsodium/libsodium.props +48 -0
  52. data/vendor/libsodium/builds/msvc/vs2017/libsodium/libsodium.vcxproj +320 -0
  53. data/vendor/libsodium/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters +962 -0
  54. data/vendor/libsodium/builds/msvc/vs2017/libsodium/libsodium.xml +15 -0
  55. data/vendor/libsodium/configure +1002 -589
  56. data/vendor/libsodium/configure.ac +48 -21
  57. data/vendor/libsodium/contrib/Findsodium.cmake +267 -0
  58. data/vendor/libsodium/contrib/Makefile.am +3 -0
  59. data/vendor/libsodium/contrib/Makefile.in +483 -0
  60. data/vendor/libsodium/dist-build/Makefile.in +11 -7
  61. data/vendor/libsodium/dist-build/android-armv8-a.sh +1 -1
  62. data/vendor/libsodium/dist-build/android-build.sh +25 -17
  63. data/vendor/libsodium/dist-build/android-mips32.sh +1 -1
  64. data/vendor/libsodium/dist-build/android-mips64.sh +1 -1
  65. data/vendor/libsodium/dist-build/android-x86_64.sh +1 -1
  66. data/vendor/libsodium/dist-build/emscripten-symbols.def +150 -2
  67. data/vendor/libsodium/dist-build/emscripten-wasm.sh +132 -0
  68. data/vendor/libsodium/dist-build/emscripten.sh +8 -6
  69. data/vendor/libsodium/dist-build/ios.sh +29 -5
  70. data/vendor/libsodium/libsodium.vcxproj +139 -77
  71. data/vendor/libsodium/libsodium.vcxproj.filters +315 -144
  72. data/vendor/libsodium/m4/ax_check_catchable_segv.m4 +42 -0
  73. data/vendor/libsodium/m4/ax_check_compile_flag.m4 +6 -4
  74. data/vendor/libsodium/m4/ax_check_define.m4 +3 -3
  75. data/vendor/libsodium/m4/ax_check_gnu_make.m4 +31 -25
  76. data/vendor/libsodium/m4/ax_check_link_flag.m4 +8 -6
  77. data/vendor/libsodium/m4/ax_pthread.m4 +275 -275
  78. data/vendor/libsodium/m4/ax_valgrind_check.m4 +92 -41
  79. data/vendor/libsodium/m4/pkg.m4 +1 -1
  80. data/vendor/libsodium/msvc-scripts/Makefile.in +11 -7
  81. data/vendor/libsodium/msvc-scripts/process.bat +4 -3
  82. data/vendor/libsodium/packaging/dotnet-core/README.md +59 -0
  83. data/vendor/libsodium/packaging/dotnet-core/desktop.targets +16 -0
  84. data/vendor/libsodium/packaging/dotnet-core/libsodium.props +33 -0
  85. data/vendor/libsodium/packaging/dotnet-core/prepare.py +262 -0
  86. data/vendor/libsodium/packaging/dotnet-core/recipes/alpine-x64 +3 -0
  87. data/vendor/libsodium/packaging/dotnet-core/recipes/build +9 -0
  88. data/vendor/libsodium/packaging/dotnet-core/recipes/centos-x64 +3 -0
  89. data/vendor/libsodium/packaging/dotnet-core/recipes/debian-x64 +4 -0
  90. data/vendor/libsodium/packaging/dotnet-core/recipes/fedora-x64 +3 -0
  91. data/vendor/libsodium/packaging/dotnet-core/recipes/opensuse-x64 +3 -0
  92. data/vendor/libsodium/packaging/dotnet-core/recipes/pack +5 -0
  93. data/vendor/libsodium/packaging/dotnet-core/recipes/test +27 -0
  94. data/vendor/libsodium/packaging/dotnet-core/recipes/ubuntu-x64 +4 -0
  95. data/vendor/libsodium/packaging/nuget/package.config +1 -1
  96. data/vendor/libsodium/packaging/nuget/package.gsl +3 -3
  97. data/vendor/libsodium/src/Makefile.in +11 -7
  98. data/vendor/libsodium/src/libsodium/Makefile.am +113 -98
  99. data/vendor/libsodium/src/libsodium/Makefile.in +1034 -1236
  100. data/vendor/libsodium/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c +31 -12
  101. data/vendor/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c +31 -10
  102. data/vendor/libsodium/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c +153 -0
  103. data/vendor/libsodium/src/libsodium/crypto_auth/crypto_auth.c +7 -0
  104. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/{cp/hmac_hmacsha256.c → auth_hmacsha256.c} +43 -35
  105. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/{cp/hmac_hmacsha512.c → auth_hmacsha512.c} +43 -35
  106. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/{cp/hmac_hmacsha512256.c → auth_hmacsha512256.c} +48 -9
  107. data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_easy.c +4 -3
  108. data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_seal.c +2 -1
  109. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c +197 -0
  110. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_seal_curve25519xchacha20poly1305.c +79 -0
  111. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c +150 -0
  112. data/vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c +1156 -662
  113. data/vendor/libsodium/src/libsodium/crypto_core/hchacha20/core_hchacha20.c +12 -5
  114. data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/{core_hsalsa20_api.c → core_hsalsa20.c} +0 -0
  115. data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c +95 -0
  116. data/vendor/libsodium/src/libsodium/crypto_core/salsa/ref/core_salsa_ref.c +195 -0
  117. data/vendor/libsodium/src/libsodium/crypto_generichash/{blake2/generichash_blake2_api.c → blake2b/generichash_blake2.c} +7 -0
  118. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2.h +109 -0
  119. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c +49 -0
  120. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h +140 -0
  121. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c +92 -0
  122. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.c +87 -0
  123. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.h +103 -0
  124. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c +90 -0
  125. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.h +103 -0
  126. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-load-avx2.h +340 -0
  127. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse2.h +164 -0
  128. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse41.h +307 -0
  129. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c +494 -0
  130. data/vendor/libsodium/src/libsodium/crypto_generichash/{blake2 → blake2b}/ref/generichash_blake2b.c +22 -26
  131. data/vendor/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c +7 -0
  132. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c +254 -0
  133. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/{hash_sha256_api.c → hash_sha256.c} +4 -2
  134. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c +280 -0
  135. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/{hash_sha512_api.c → hash_sha512.c} +4 -2
  136. data/vendor/libsodium/src/libsodium/crypto_kdf/blake2b/kdf_blake2b.c +52 -0
  137. data/vendor/libsodium/src/libsodium/crypto_kdf/crypto_kdf.c +49 -0
  138. data/vendor/libsodium/src/libsodium/crypto_kx/crypto_kx.c +136 -0
  139. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c +6 -0
  140. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.c +34 -27
  141. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h +1 -1
  142. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +203 -156
  143. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +178 -134
  144. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c +22 -4
  145. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.h +10 -12
  146. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c +564 -315
  147. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.h +1 -1
  148. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.c +131 -84
  149. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.h +23 -18
  150. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-encoding.c +163 -145
  151. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-encoding.h +2 -1
  152. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-avx2.c +247 -0
  153. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ref.c +42 -29
  154. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ssse3.c +71 -47
  155. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.c +100 -65
  156. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.h +77 -23
  157. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blake2b-long.c +30 -31
  158. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blamka-round-avx2.h +150 -0
  159. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blamka-round-ref.h +28 -26
  160. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blamka-round-ssse3.h +102 -99
  161. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/pwhash_argon2i.c +90 -41
  162. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/pwhash_argon2id.c +213 -0
  163. data/vendor/libsodium/src/libsodium/crypto_pwhash/crypto_pwhash.c +72 -4
  164. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c +34 -37
  165. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h +27 -32
  166. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c +120 -86
  167. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c +16 -13
  168. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.h +4 -4
  169. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c +98 -50
  170. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c +23 -18
  171. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c +105 -105
  172. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c +395 -330
  173. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c +225 -198
  174. data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c +7 -0
  175. data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +6 -5
  176. data/vendor/libsodium/src/libsodium/crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c +170 -0
  177. data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c +83 -0
  178. data/vendor/libsodium/src/libsodium/crypto_shorthash/crypto_shorthash.c +7 -0
  179. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.c +65 -0
  180. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash_ref.h +24 -0
  181. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c +71 -0
  182. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/{shorthash_siphash24_api.c → shorthash_siphash24.c} +0 -0
  183. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphashx24.c +11 -0
  184. data/vendor/libsodium/src/libsodium/crypto_sign/crypto_sign.c +33 -0
  185. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ed25519_ref10.h +18 -0
  186. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +18 -13
  187. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c +29 -26
  188. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +75 -36
  189. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +39 -15
  190. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519.c +91 -0
  191. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/afternm_aes128ctr.c +174 -0
  192. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/beforenm_aes128ctr.c +66 -0
  193. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/common.h +766 -0
  194. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/consts.h +28 -0
  195. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/consts_aes128ctr.c +28 -0
  196. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/int128.h +50 -0
  197. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/int128_aes128ctr.c +149 -0
  198. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/stream_aes128ctr_nacl.c +31 -0
  199. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/nacl/xor_afternm_aes128ctr.c +195 -0
  200. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/{stream_aes128ctr_api.c → stream_aes128ctr.c} +6 -3
  201. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c +179 -0
  202. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.h +8 -0
  203. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c +173 -0
  204. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.h +8 -0
  205. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/u0.h +86 -0
  206. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/u1.h +98 -0
  207. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/u4.h +175 -0
  208. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/u8.h +357 -0
  209. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/{stream_chacha20_ref.c → chacha20_ref.c} +93 -94
  210. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.h +8 -0
  211. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20.c +39 -7
  212. data/vendor/libsodium/src/libsodium/crypto_stream/crypto_stream.c +7 -0
  213. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/salsa20_ref.c +120 -0
  214. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/salsa20_ref.h +8 -0
  215. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20.c +93 -0
  216. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20.h +16 -0
  217. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/{amd64_xmm6/stream_salsa20_amd64_xmm6.S → xmm6/salsa20_xmm6-asm.S} +20 -12
  218. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.c +31 -0
  219. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.h +8 -0
  220. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.c +131 -0
  221. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.h +8 -0
  222. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c +122 -0
  223. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.h +8 -0
  224. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/u0.h +195 -0
  225. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/u1.h +207 -0
  226. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/u4.h +547 -0
  227. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h +476 -0
  228. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012_ref.c +106 -0
  229. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c +20 -0
  230. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208_ref.c +106 -0
  231. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208.c +20 -0
  232. data/vendor/libsodium/src/libsodium/crypto_stream/xchacha20/stream_xchacha20.c +63 -0
  233. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c +60 -0
  234. data/vendor/libsodium/src/libsodium/crypto_verify/sodium/verify.c +61 -0
  235. data/vendor/libsodium/src/libsodium/include/Makefile.am +8 -6
  236. data/vendor/libsodium/src/libsodium/include/Makefile.in +29 -21
  237. data/vendor/libsodium/src/libsodium/include/sodium.h +15 -4
  238. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_aes256gcm.h +4 -0
  239. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +6 -0
  240. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h +91 -0
  241. data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth.h +3 -0
  242. data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +5 -0
  243. data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h +4 -0
  244. data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +4 -0
  245. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h +153 -0
  246. data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash.h +4 -0
  247. data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +3 -4
  248. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +4 -3
  249. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +4 -3
  250. data/vendor/libsodium/src/libsodium/include/sodium/crypto_kdf.h +51 -0
  251. data/vendor/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h +42 -0
  252. data/vendor/libsodium/src/libsodium/include/sodium/crypto_kx.h +64 -0
  253. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +4 -0
  254. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +11 -9
  255. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash.h +37 -1
  256. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h +40 -10
  257. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2id.h +116 -0
  258. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +37 -4
  259. data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +0 -4
  260. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +3 -0
  261. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h +62 -0
  262. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +5 -1
  263. data/vendor/libsodium/src/libsodium/include/sodium/crypto_shorthash.h +3 -0
  264. data/vendor/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h +18 -0
  265. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign.h +22 -0
  266. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h +28 -0
  267. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream.h +3 -0
  268. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h +10 -5
  269. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h +14 -3
  270. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h +4 -0
  271. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h +3 -0
  272. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h +3 -0
  273. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h +53 -0
  274. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +4 -0
  275. data/vendor/libsodium/src/libsodium/include/sodium/private/common.h +84 -17
  276. data/vendor/libsodium/src/libsodium/include/sodium/private/implementations.h +11 -0
  277. data/vendor/libsodium/src/libsodium/include/sodium/private/sse2_64_32.h +50 -0
  278. data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +10 -2
  279. data/vendor/libsodium/src/libsodium/include/sodium/utils.h +4 -5
  280. data/vendor/libsodium/src/libsodium/include/sodium/version.h.in +4 -0
  281. data/vendor/libsodium/src/libsodium/randombytes/randombytes.c +47 -19
  282. data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +30 -50
  283. data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +25 -15
  284. data/vendor/libsodium/src/libsodium/sodium/core.c +25 -23
  285. data/vendor/libsodium/src/libsodium/sodium/runtime.c +66 -57
  286. data/vendor/libsodium/src/libsodium/sodium/utils.c +120 -106
  287. data/vendor/libsodium/src/libsodium/sodium/version.c +10 -0
  288. data/vendor/libsodium/test/Makefile.in +11 -7
  289. data/vendor/libsodium/test/default/Makefile.am +65 -5
  290. data/vendor/libsodium/test/default/Makefile.in +243 -78
  291. data/vendor/libsodium/test/default/aead_aes256gcm.c +2 -2
  292. data/vendor/libsodium/test/default/aead_xchacha20poly1305.c +188 -0
  293. data/vendor/libsodium/test/default/aead_xchacha20poly1305.exp +51 -0
  294. data/vendor/libsodium/test/default/auth.c +11 -7
  295. data/vendor/libsodium/test/default/auth2.c +15 -12
  296. data/vendor/libsodium/test/default/auth3.c +18 -15
  297. data/vendor/libsodium/test/default/auth5.c +3 -2
  298. data/vendor/libsodium/test/default/auth6.c +4 -3
  299. data/vendor/libsodium/test/default/auth7.c +3 -2
  300. data/vendor/libsodium/test/default/box.c +57 -52
  301. data/vendor/libsodium/test/default/box2.c +41 -36
  302. data/vendor/libsodium/test/default/box7.c +4 -3
  303. data/vendor/libsodium/test/default/box8.c +4 -3
  304. data/vendor/libsodium/test/default/box_easy.c +36 -32
  305. data/vendor/libsodium/test/default/box_easy2.c +41 -34
  306. data/vendor/libsodium/test/default/box_seal.c +7 -6
  307. data/vendor/libsodium/test/default/box_seed.c +10 -8
  308. data/vendor/libsodium/test/default/chacha20.c +18 -3
  309. data/vendor/libsodium/test/default/chacha20.exp +45 -0
  310. data/vendor/libsodium/test/default/cmptest.h +1 -0
  311. data/vendor/libsodium/test/default/core1.c +10 -9
  312. data/vendor/libsodium/test/default/core2.c +13 -12
  313. data/vendor/libsodium/test/default/core3.c +13 -12
  314. data/vendor/libsodium/test/default/core4.c +11 -12
  315. data/vendor/libsodium/test/default/core5.c +13 -12
  316. data/vendor/libsodium/test/default/core6.c +15 -13
  317. data/vendor/libsodium/test/default/ed25519_convert.c +12 -9
  318. data/vendor/libsodium/test/default/hash.c +10 -6
  319. data/vendor/libsodium/test/default/hash3.c +3 -2
  320. data/vendor/libsodium/test/default/index-wasm.html.tpl +118 -0
  321. data/vendor/libsodium/test/default/kdf.c +61 -0
  322. data/vendor/libsodium/test/default/kdf.exp +77 -0
  323. data/vendor/libsodium/test/default/keygen.c +64 -0
  324. data/vendor/libsodium/test/default/keygen.exp +1 -0
  325. data/vendor/libsodium/test/default/kx.c +119 -0
  326. data/vendor/libsodium/test/default/kx.exp +7 -0
  327. data/vendor/libsodium/test/default/nacl-test-wrapper.sh +9 -2
  328. data/vendor/libsodium/test/default/onetimeauth.c +26 -23
  329. data/vendor/libsodium/test/default/onetimeauth2.c +22 -20
  330. data/vendor/libsodium/test/default/onetimeauth7.c +3 -2
  331. data/vendor/libsodium/test/default/pwhash.c +209 -157
  332. data/vendor/libsodium/test/default/pwhash_argon2id.c +388 -0
  333. data/vendor/libsodium/test/default/pwhash_argon2id.exp +15 -0
  334. data/vendor/libsodium/test/default/pwhash_scrypt.c +232 -224
  335. data/vendor/libsodium/test/default/pwhash_scrypt.exp +2 -1
  336. data/vendor/libsodium/test/default/pwhash_scrypt_ll.c +39 -41
  337. data/vendor/libsodium/test/default/randombytes.c +34 -13
  338. data/vendor/libsodium/test/default/randombytes.exp +1 -0
  339. data/vendor/libsodium/test/default/scalarmult.c +21 -18
  340. data/vendor/libsodium/test/default/scalarmult2.c +8 -6
  341. data/vendor/libsodium/test/default/scalarmult5.c +13 -10
  342. data/vendor/libsodium/test/default/scalarmult6.c +17 -14
  343. data/vendor/libsodium/test/default/scalarmult7.c +9 -10
  344. data/vendor/libsodium/test/default/secretbox.c +39 -36
  345. data/vendor/libsodium/test/default/secretbox2.c +28 -25
  346. data/vendor/libsodium/test/default/secretbox7.c +3 -2
  347. data/vendor/libsodium/test/default/secretbox8.c +4 -3
  348. data/vendor/libsodium/test/default/secretbox_easy.c +40 -37
  349. data/vendor/libsodium/test/default/secretbox_easy2.c +19 -18
  350. data/vendor/libsodium/test/default/shorthash.c +4 -4
  351. data/vendor/libsodium/test/default/sign.c +70 -13
  352. data/vendor/libsodium/test/default/sign.exp +2 -0
  353. data/vendor/libsodium/test/default/siphashx24.c +33 -0
  354. data/vendor/libsodium/test/default/siphashx24.exp +64 -0
  355. data/vendor/libsodium/test/default/sodium_core.c +9 -8
  356. data/vendor/libsodium/test/default/sodium_utils.c +52 -46
  357. data/vendor/libsodium/test/default/sodium_utils2.c +17 -8
  358. data/vendor/libsodium/test/default/sodium_utils3.c +15 -6
  359. data/vendor/libsodium/test/default/sodium_version.c +7 -1
  360. data/vendor/libsodium/test/default/stream.c +31 -18
  361. data/vendor/libsodium/test/default/stream.exp +65 -0
  362. data/vendor/libsodium/test/default/stream2.c +13 -9
  363. data/vendor/libsodium/test/default/stream3.c +12 -10
  364. data/vendor/libsodium/test/default/stream4.c +30 -27
  365. data/vendor/libsodium/test/default/verify1.c +5 -4
  366. data/vendor/libsodium/test/default/xchacha20.c +376 -0
  367. data/vendor/libsodium/test/default/xchacha20.exp +5 -0
  368. data/vendor/libsodium/test/quirks/quirks.h +4 -3
  369. metadata +140 -111
  370. data/vendor/libsodium/autom4te.cache/output.3 +0 -17240
  371. data/vendor/libsodium/autom4te.cache/output.4 +0 -17517
  372. data/vendor/libsodium/autom4te.cache/output.5 +0 -18535
  373. data/vendor/libsodium/autom4te.cache/output.6 +0 -19077
  374. data/vendor/libsodium/autom4te.cache/output.7 +0 -19837
  375. data/vendor/libsodium/autom4te.cache/traces.3 +0 -2833
  376. data/vendor/libsodium/autom4te.cache/traces.4 +0 -2951
  377. data/vendor/libsodium/autom4te.cache/traces.5 +0 -3042
  378. data/vendor/libsodium/autom4te.cache/traces.6 +0 -3194
  379. data/vendor/libsodium/autom4te.cache/traces.7 +0 -3614
  380. data/vendor/libsodium/builds/msvc/properties/ARM.props +0 -20
  381. data/vendor/libsodium/compile +0 -347
  382. data/vendor/libsodium/config.guess +0 -1568
  383. data/vendor/libsodium/config.sub +0 -1793
  384. data/vendor/libsodium/depcomp +0 -791
  385. data/vendor/libsodium/install-sh +0 -527
  386. data/vendor/libsodium/ltmain.sh +0 -9655
  387. data/vendor/libsodium/missing +0 -215
  388. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c +0 -16
  389. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/verify_hmacsha256.c +0 -11
  390. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512_api.c +0 -16
  391. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/verify_hmacsha512.c +0 -12
  392. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c +0 -16
  393. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/verify_hmacsha512256.c +0 -14
  394. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c +0 -41
  395. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c +0 -22
  396. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c +0 -18
  397. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c +0 -42
  398. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c +0 -29
  399. data/vendor/libsodium/src/libsodium/crypto_core/hchacha20/core_hchacha20.h +0 -28
  400. data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c +0 -100
  401. data/vendor/libsodium/src/libsodium/crypto_core/salsa20/core_salsa20_api.c +0 -21
  402. data/vendor/libsodium/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c +0 -126
  403. data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c +0 -21
  404. data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c +0 -126
  405. data/vendor/libsodium/src/libsodium/crypto_core/salsa208/core_salsa208_api.c +0 -21
  406. data/vendor/libsodium/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c +0 -126
  407. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h +0 -48
  408. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h +0 -97
  409. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-avx2.c +0 -45
  410. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-avx2.h +0 -123
  411. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-ref.c +0 -94
  412. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-sse41.c +0 -80
  413. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-sse41.h +0 -97
  414. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-ssse3.c +0 -87
  415. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-ssse3.h +0 -97
  416. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-load-avx2.h +0 -339
  417. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-load-sse2.h +0 -66
  418. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-load-sse41.h +0 -400
  419. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +0 -456
  420. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c +0 -269
  421. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c +0 -298
  422. data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-impl.h +0 -40
  423. data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c +0 -35
  424. data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c +0 -26
  425. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c +0 -72
  426. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/description +0 -1
  427. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c +0 -39
  428. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c +0 -159
  429. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c +0 -59
  430. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common.h +0 -771
  431. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts.h +0 -28
  432. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c +0 -14
  433. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h +0 -56
  434. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c +0 -131
  435. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/stream_aes128ctr.c +0 -29
  436. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/types.h +0 -10
  437. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c +0 -180
  438. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.h +0 -28
  439. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/vec/stream_chacha20_vec.c +0 -336
  440. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/vec/stream_chacha20_vec.h +0 -28
  441. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c +0 -55
  442. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +0 -63
  443. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c +0 -19
  444. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c +0 -51
  445. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c +0 -54
  446. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c +0 -11
  447. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c +0 -51
  448. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c +0 -54
  449. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c +0 -11
  450. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c +0 -24
  451. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c +0 -35
  452. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c +0 -11
  453. data/vendor/libsodium/src/libsodium/crypto_verify/16/ref/verify_16.c +0 -17
  454. data/vendor/libsodium/src/libsodium/crypto_verify/16/verify_16_api.c +0 -6
  455. data/vendor/libsodium/src/libsodium/crypto_verify/32/ref/verify_32.c +0 -17
  456. data/vendor/libsodium/src/libsodium/crypto_verify/32/verify_32_api.c +0 -6
  457. data/vendor/libsodium/src/libsodium/crypto_verify/64/ref/verify_64.c +0 -17
  458. data/vendor/libsodium/src/libsodium/crypto_verify/64/verify_64_api.c +0 -6
  459. data/vendor/libsodium/src/libsodium/include/sodium/crypto_int32.h +0 -8
  460. data/vendor/libsodium/src/libsodium/include/sodium/crypto_int64.h +0 -8
  461. data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint16.h +0 -8
  462. data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint32.h +0 -8
  463. data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint64.h +0 -8
  464. data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint8.h +0 -8
  465. data/vendor/libsodium/test-driver +0 -139
@@ -24,16 +24,17 @@
24
24
  * SUCH DAMAGE.
25
25
  */
26
26
 
27
- #include <stdlib.h>
28
- #include <sys/types.h>
29
-
27
+ #include <limits.h>
30
28
  #include <stdint.h>
29
+ #include <stdlib.h>
31
30
  #include <string.h>
32
31
 
32
+ #include <sys/types.h>
33
+
33
34
  #include "crypto_auth_hmacsha256.h"
34
35
  #include "pbkdf2-sha256.h"
35
- #include "utils.h"
36
36
  #include "private/common.h"
37
+ #include "utils.h"
37
38
 
38
39
  /**
39
40
  * PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen):
@@ -41,21 +42,23 @@
41
42
  * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1).
42
43
  */
43
44
  void
44
- PBKDF2_SHA256(const uint8_t * passwd, size_t passwdlen, const uint8_t * salt,
45
- size_t saltlen, uint64_t c, uint8_t * buf, size_t dkLen)
45
+ PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen, const uint8_t *salt,
46
+ size_t saltlen, uint64_t c, uint8_t *buf, size_t dkLen)
46
47
  {
47
48
  crypto_auth_hmacsha256_state PShctx, hctx;
48
- size_t i;
49
- uint8_t ivec[4];
50
- uint8_t U[32];
51
- uint8_t T[32];
52
- uint64_t j;
53
- int k;
54
- size_t clen;
49
+ size_t i;
50
+ uint8_t ivec[4];
51
+ uint8_t U[32];
52
+ uint8_t T[32];
53
+ uint64_t j;
54
+ int k;
55
+ size_t clen;
55
56
 
57
+ #if SIZE_MAX > 0x1fffffffe0ULL
56
58
  if (dkLen > 0x1fffffffe0ULL) {
57
59
  abort();
58
60
  }
61
+ #endif
59
62
  crypto_auth_hmacsha256_init(&PShctx, passwd, passwdlen);
60
63
  crypto_auth_hmacsha256_update(&PShctx, salt, saltlen);
61
64
 
@@ -28,10 +28,10 @@
28
28
  #ifndef pbkdf2_sha256_H
29
29
  #define pbkdf2_sha256_H
30
30
 
31
- #include <sys/types.h>
32
-
33
31
  #include <stdint.h>
34
32
 
33
+ #include <sys/types.h>
34
+
35
35
  #include "crypto_auth_hmacsha256.h"
36
36
 
37
37
  /**
@@ -39,7 +39,7 @@
39
39
  * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and
40
40
  * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1).
41
41
  */
42
- void PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t,
43
- uint64_t, uint8_t *, size_t);
42
+ void PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t, uint64_t,
43
+ uint8_t *, size_t);
44
44
 
45
45
  #endif /* !_SHA256_H_ */
@@ -7,16 +7,17 @@
7
7
 
8
8
  #include "crypto_pwhash_scryptsalsa208sha256.h"
9
9
  #include "crypto_scrypt.h"
10
+ #include "private/common.h"
10
11
  #include "randombytes.h"
11
12
  #include "utils.h"
12
13
 
13
- #define SETTING_SIZE(saltbytes) \
14
- ((sizeof "$7$" - 1U) + \
15
- (1U /* N_log2 */) + (5U /* r */) + (5U /* p */) + BYTES2CHARS(saltbytes))
14
+ #define SETTING_SIZE(saltbytes) \
15
+ ((sizeof "$7$" - 1U) + (1U /* N_log2 */) + (5U /* r */) + (5U /* p */) + \
16
+ BYTES2CHARS(saltbytes))
16
17
 
17
18
  static int
18
19
  pickparams(unsigned long long opslimit, const size_t memlimit,
19
- uint32_t * const N_log2, uint32_t * const p, uint32_t * const r)
20
+ uint32_t *const N_log2, uint32_t *const p, uint32_t *const r)
20
21
  {
21
22
  unsigned long long maxN;
22
23
  unsigned long long maxrp;
@@ -26,7 +27,7 @@ pickparams(unsigned long long opslimit, const size_t memlimit,
26
27
  }
27
28
  *r = 8;
28
29
  if (opslimit < memlimit / 32) {
29
- *p = 1;
30
+ *p = 1;
30
31
  maxN = opslimit / (*r * 4);
31
32
  for (*N_log2 = 1; *N_log2 < 63; *N_log2 += 1) {
32
33
  if ((uint64_t)(1) << *N_log2 > maxN / 2) {
@@ -36,21 +37,45 @@ pickparams(unsigned long long opslimit, const size_t memlimit,
36
37
  } else {
37
38
  maxN = memlimit / ((size_t) *r * 128);
38
39
  for (*N_log2 = 1; *N_log2 < 63; *N_log2 += 1) {
39
- if ((uint64_t) (1) << *N_log2 > maxN / 2) {
40
+ if ((uint64_t)(1) << *N_log2 > maxN / 2) {
40
41
  break;
41
42
  }
42
43
  }
43
- maxrp = (opslimit / 4) / ((uint64_t) (1) << *N_log2);
44
+ maxrp = (opslimit / 4) / ((uint64_t)(1) << *N_log2);
44
45
  /* LCOV_EXCL_START */
45
46
  if (maxrp > 0x3fffffff) {
46
47
  maxrp = 0x3fffffff;
47
48
  }
48
49
  /* LCOV_EXCL_STOP */
49
- *p = (uint32_t) (maxrp) / *r;
50
+ *p = (uint32_t)(maxrp) / *r;
50
51
  }
51
52
  return 0;
52
53
  }
53
54
 
55
+ size_t
56
+ crypto_pwhash_scryptsalsa208sha256_bytes_min(void)
57
+ {
58
+ return crypto_pwhash_scryptsalsa208sha256_BYTES_MIN;
59
+ }
60
+
61
+ size_t
62
+ crypto_pwhash_scryptsalsa208sha256_bytes_max(void)
63
+ {
64
+ return crypto_pwhash_scryptsalsa208sha256_BYTES_MAX;
65
+ }
66
+
67
+ size_t
68
+ crypto_pwhash_scryptsalsa208sha256_passwd_min(void)
69
+ {
70
+ return crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN;
71
+ }
72
+
73
+ size_t
74
+ crypto_pwhash_scryptsalsa208sha256_passwd_max(void)
75
+ {
76
+ return crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX;
77
+ }
78
+
54
79
  size_t
55
80
  crypto_pwhash_scryptsalsa208sha256_saltbytes(void)
56
81
  {
@@ -69,6 +94,30 @@ crypto_pwhash_scryptsalsa208sha256_strprefix(void)
69
94
  return crypto_pwhash_scryptsalsa208sha256_STRPREFIX;
70
95
  }
71
96
 
97
+ size_t
98
+ crypto_pwhash_scryptsalsa208sha256_opslimit_min(void)
99
+ {
100
+ return crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN;
101
+ }
102
+
103
+ size_t
104
+ crypto_pwhash_scryptsalsa208sha256_opslimit_max(void)
105
+ {
106
+ return crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX;
107
+ }
108
+
109
+ size_t
110
+ crypto_pwhash_scryptsalsa208sha256_memlimit_min(void)
111
+ {
112
+ return crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN;
113
+ }
114
+
115
+ size_t
116
+ crypto_pwhash_scryptsalsa208sha256_memlimit_max(void)
117
+ {
118
+ return crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX;
119
+ }
120
+
72
121
  size_t
73
122
  crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(void)
74
123
  {
@@ -94,63 +143,62 @@ crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void)
94
143
  }
95
144
 
96
145
  int
97
- crypto_pwhash_scryptsalsa208sha256(unsigned char * const out,
98
- unsigned long long outlen,
99
- const char * const passwd,
100
- unsigned long long passwdlen,
101
- const unsigned char * const salt,
102
- unsigned long long opslimit,
103
- size_t memlimit)
146
+ crypto_pwhash_scryptsalsa208sha256(unsigned char *const out,
147
+ unsigned long long outlen,
148
+ const char *const passwd,
149
+ unsigned long long passwdlen,
150
+ const unsigned char *const salt,
151
+ unsigned long long opslimit, size_t memlimit)
104
152
  {
105
153
  uint32_t N_log2;
106
154
  uint32_t p;
107
155
  uint32_t r;
108
156
 
109
157
  memset(out, 0, outlen);
110
- if (passwdlen > SIZE_MAX || outlen > SIZE_MAX) {
158
+ if (passwdlen > crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX ||
159
+ outlen > crypto_pwhash_scryptsalsa208sha256_BYTES_MAX) {
111
160
  errno = EFBIG; /* LCOV_EXCL_LINE */
112
- return -1; /* LCOV_EXCL_LINE */
161
+ return -1; /* LCOV_EXCL_LINE */
113
162
  }
114
- if (pickparams(opslimit, memlimit, &N_log2, &p, &r) != 0) {
163
+ if (outlen < crypto_pwhash_scryptsalsa208sha256_BYTES_MIN ||
164
+ pickparams(opslimit, memlimit, &N_log2, &p, &r) != 0) {
115
165
  errno = EINVAL; /* LCOV_EXCL_LINE */
116
- return -1; /* LCOV_EXCL_LINE */
166
+ return -1; /* LCOV_EXCL_LINE */
117
167
  }
118
- return crypto_pwhash_scryptsalsa208sha256_ll((const uint8_t *) passwd,
119
- (size_t) passwdlen,
120
- (const uint8_t *) salt,
121
- crypto_pwhash_scryptsalsa208sha256_SALTBYTES,
122
- (uint64_t) (1) << N_log2, r, p,
123
- out, (size_t) outlen);
168
+ return crypto_pwhash_scryptsalsa208sha256_ll(
169
+ (const uint8_t *) passwd, (size_t) passwdlen, (const uint8_t *) salt,
170
+ crypto_pwhash_scryptsalsa208sha256_SALTBYTES, (uint64_t)(1) << N_log2,
171
+ r, p, out, (size_t) outlen);
124
172
  }
125
173
 
126
174
  int
127
- crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
128
- const char * const passwd,
129
- unsigned long long passwdlen,
130
- unsigned long long opslimit,
131
- size_t memlimit)
132
- {
133
- uint8_t salt[crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES];
134
- char setting[crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES + 1U];
175
+ crypto_pwhash_scryptsalsa208sha256_str(
176
+ char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
177
+ const char *const passwd, unsigned long long passwdlen,
178
+ unsigned long long opslimit, size_t memlimit)
179
+ {
180
+ uint8_t salt[crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES];
181
+ char setting[crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES + 1U];
135
182
  escrypt_local_t escrypt_local;
136
183
  uint32_t N_log2;
137
184
  uint32_t p;
138
185
  uint32_t r;
139
186
 
140
187
  memset(out, 0, crypto_pwhash_scryptsalsa208sha256_STRBYTES);
141
- if (passwdlen > SIZE_MAX) {
188
+ if (passwdlen > crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX) {
142
189
  errno = EFBIG; /* LCOV_EXCL_LINE */
143
- return -1; /* LCOV_EXCL_LINE */
190
+ return -1; /* LCOV_EXCL_LINE */
144
191
  }
145
- if (pickparams(opslimit, memlimit, &N_log2, &p, &r) != 0) {
192
+ if (passwdlen < crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN ||
193
+ pickparams(opslimit, memlimit, &N_log2, &p, &r) != 0) {
146
194
  errno = EINVAL; /* LCOV_EXCL_LINE */
147
- return -1; /* LCOV_EXCL_LINE */
195
+ return -1; /* LCOV_EXCL_LINE */
148
196
  }
149
197
  randombytes_buf(salt, sizeof salt);
150
- if (escrypt_gensalt_r(N_log2, r, p, salt, sizeof salt,
151
- (uint8_t *) setting, sizeof setting) == NULL) {
198
+ if (escrypt_gensalt_r(N_log2, r, p, salt, sizeof salt, (uint8_t *) setting,
199
+ sizeof setting) == NULL) {
152
200
  errno = EINVAL; /* LCOV_EXCL_LINE */
153
- return -1; /* LCOV_EXCL_LINE */
201
+ return -1; /* LCOV_EXCL_LINE */
154
202
  }
155
203
  if (escrypt_init_local(&escrypt_local) != 0) {
156
204
  return -1; /* LCOV_EXCL_LINE */
@@ -166,21 +214,21 @@ crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha2
166
214
  }
167
215
  escrypt_free_local(&escrypt_local);
168
216
 
169
- (void) sizeof
170
- (int[SETTING_SIZE(crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES)
171
- == crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES ? 1 : -1]);
172
- (void) sizeof
173
- (int[crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES + 1U +
174
- crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES_ENCODED + 1U
175
- == crypto_pwhash_scryptsalsa208sha256_STRBYTES ? 1 : -1]);
217
+ COMPILER_ASSERT(
218
+ SETTING_SIZE(crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES) ==
219
+ crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES);
220
+ COMPILER_ASSERT(
221
+ crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES + 1U +
222
+ crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES_ENCODED + 1U ==
223
+ crypto_pwhash_scryptsalsa208sha256_STRBYTES);
176
224
 
177
225
  return 0;
178
226
  }
179
227
 
180
228
  int
181
- crypto_pwhash_scryptsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
182
- const char * const passwd,
183
- unsigned long long passwdlen)
229
+ crypto_pwhash_scryptsalsa208sha256_str_verify(
230
+ const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
231
+ const char *const passwd, unsigned long long passwdlen)
184
232
  {
185
233
  char wanted[crypto_pwhash_scryptsalsa208sha256_STRBYTES];
186
234
  escrypt_local_t escrypt_local;
@@ -19,7 +19,7 @@
19
19
  */
20
20
 
21
21
  #ifdef HAVE_SYS_MMAN_H
22
- # include <sys/mman.h>
22
+ #include <sys/mman.h>
23
23
  #endif
24
24
  #include <errno.h>
25
25
  #include <stdlib.h>
@@ -28,26 +28,27 @@
28
28
  #include "runtime.h"
29
29
 
30
30
  #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
31
- # define MAP_ANON MAP_ANONYMOUS
31
+ #define MAP_ANON MAP_ANONYMOUS
32
32
  #endif
33
33
 
34
34
  void *
35
- alloc_region(escrypt_region_t * region, size_t size)
35
+ alloc_region(escrypt_region_t *region, size_t size)
36
36
  {
37
- uint8_t * base, * aligned;
37
+ uint8_t *base, *aligned;
38
38
  #if defined(MAP_ANON) && defined(HAVE_MMAP)
39
39
  if ((base = (uint8_t *) mmap(NULL, size, PROT_READ | PROT_WRITE,
40
40
  #ifdef MAP_NOCORE
41
- MAP_ANON | MAP_PRIVATE | MAP_NOCORE,
41
+ MAP_ANON | MAP_PRIVATE | MAP_NOCORE,
42
42
  #else
43
- MAP_ANON | MAP_PRIVATE,
43
+ MAP_ANON | MAP_PRIVATE,
44
44
  #endif
45
- -1, 0)) == MAP_FAILED)
45
+ -1, 0)) == MAP_FAILED)
46
46
  base = NULL; /* LCOV_EXCL_LINE */
47
- aligned = base;
47
+ aligned = base;
48
48
  #elif defined(HAVE_POSIX_MEMALIGN)
49
- if ((errno = posix_memalign((void **) &base, 64, size)) != 0)
49
+ if ((errno = posix_memalign((void **) &base, 64, size)) != 0) {
50
50
  base = NULL;
51
+ }
51
52
  aligned = base;
52
53
  #else
53
54
  base = aligned = NULL;
@@ -55,46 +56,50 @@ alloc_region(escrypt_region_t * region, size_t size)
55
56
  errno = ENOMEM;
56
57
  else if ((base = (uint8_t *) malloc(size + 63)) != NULL) {
57
58
  aligned = base + 63;
58
- aligned -= (uintptr_t)aligned & 63;
59
+ aligned -= (uintptr_t) aligned & 63;
59
60
  }
60
61
  #endif
61
- region->base = base;
62
+ region->base = base;
62
63
  region->aligned = aligned;
63
- region->size = base ? size : 0;
64
+ region->size = base ? size : 0;
65
+
64
66
  return aligned;
65
67
  }
66
68
 
67
69
  static inline void
68
- init_region(escrypt_region_t * region)
70
+ init_region(escrypt_region_t *region)
69
71
  {
70
72
  region->base = region->aligned = NULL;
71
- region->size = 0;
73
+ region->size = 0;
72
74
  }
73
75
 
74
76
  int
75
- free_region(escrypt_region_t * region)
77
+ free_region(escrypt_region_t *region)
76
78
  {
77
79
  if (region->base) {
78
80
  #if defined(MAP_ANON) && defined(HAVE_MMAP)
79
- if (munmap(region->base, region->size))
81
+ if (munmap(region->base, region->size)) {
80
82
  return -1; /* LCOV_EXCL_LINE */
83
+ }
81
84
  #else
82
85
  free(region->base);
83
86
  #endif
84
87
  }
85
88
  init_region(region);
89
+
86
90
  return 0;
87
91
  }
88
92
 
89
93
  int
90
- escrypt_init_local(escrypt_local_t * local)
94
+ escrypt_init_local(escrypt_local_t *local)
91
95
  {
92
96
  init_region(local);
97
+
93
98
  return 0;
94
99
  }
95
100
 
96
101
  int
97
- escrypt_free_local(escrypt_local_t * local)
102
+ escrypt_free_local(escrypt_local_t *local)
98
103
  {
99
104
  return free_region(local);
100
105
  }
@@ -28,57 +28,59 @@
28
28
  * online backup system.
29
29
  */
30
30
 
31
- #if defined(HAVE_EMMINTRIN_H) || \
32
- (defined(_MSC_VER) && (defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86)))
33
- #ifdef __GNUC__
34
- # pragma GCC target("sse2")
35
- #endif
36
- #include <emmintrin.h>
37
- #if defined(__XOP__) && defined(DISABLED)
38
- # include <x86intrin.h>
39
- #endif
40
-
41
31
  #include <errno.h>
42
32
  #include <limits.h>
43
33
  #include <stdint.h>
44
34
  #include <stdlib.h>
45
35
  #include <string.h>
46
36
 
47
- #include "../pbkdf2-sha256.h"
48
- #include "../crypto_scrypt.h"
49
37
  #include "private/common.h"
38
+ #include "private/sse2_64_32.h"
39
+
40
+ #ifdef HAVE_EMMINTRIN_H
41
+
42
+ # ifdef __GNUC__
43
+ # pragma GCC target("sse2")
44
+ # endif
45
+ # include <emmintrin.h>
46
+ # if defined(__XOP__) && defined(DISABLED)
47
+ # include <x86intrin.h>
48
+ # endif
49
+
50
+ # include "../crypto_scrypt.h"
51
+ # include "../pbkdf2-sha256.h"
50
52
 
51
- #if defined(__XOP__) && defined(DISABLED)
52
- #define ARX(out, in1, in2, s) \
53
+ # if defined(__XOP__) && defined(DISABLED)
54
+ # define ARX(out, in1, in2, s) \
53
55
  out = _mm_xor_si128(out, _mm_roti_epi32(_mm_add_epi32(in1, in2), s));
54
- #else
55
- #define ARX(out, in1, in2, s) \
56
- { \
57
- __m128i T = _mm_add_epi32(in1, in2); \
58
- out = _mm_xor_si128(out, _mm_slli_epi32(T, s)); \
59
- out = _mm_xor_si128(out, _mm_srli_epi32(T, 32-s)); \
56
+ # else
57
+ # define ARX(out, in1, in2, s) \
58
+ { \
59
+ __m128i T = _mm_add_epi32(in1, in2); \
60
+ out = _mm_xor_si128(out, _mm_slli_epi32(T, s)); \
61
+ out = _mm_xor_si128(out, _mm_srli_epi32(T, 32 - s)); \
60
62
  }
61
- #endif
62
-
63
- #define SALSA20_2ROUNDS \
64
- /* Operate on "columns". */ \
65
- ARX(X1, X0, X3, 7) \
66
- ARX(X2, X1, X0, 9) \
67
- ARX(X3, X2, X1, 13) \
68
- ARX(X0, X3, X2, 18) \
69
- \
70
- /* Rearrange data. */ \
63
+ # endif
64
+
65
+ # define SALSA20_2ROUNDS \
66
+ /* Operate on "columns". */ \
67
+ ARX(X1, X0, X3, 7) \
68
+ ARX(X2, X1, X0, 9) \
69
+ ARX(X3, X2, X1, 13) \
70
+ ARX(X0, X3, X2, 18) \
71
+ \
72
+ /* Rearrange data. */ \
71
73
  X1 = _mm_shuffle_epi32(X1, 0x93); \
72
74
  X2 = _mm_shuffle_epi32(X2, 0x4E); \
73
75
  X3 = _mm_shuffle_epi32(X3, 0x39); \
74
- \
75
- /* Operate on "rows". */ \
76
- ARX(X3, X0, X1, 7) \
77
- ARX(X2, X3, X0, 9) \
78
- ARX(X1, X2, X3, 13) \
79
- ARX(X0, X1, X2, 18) \
80
- \
81
- /* Rearrange data. */ \
76
+ \
77
+ /* Operate on "rows". */ \
78
+ ARX(X3, X0, X1, 7) \
79
+ ARX(X2, X3, X0, 9) \
80
+ ARX(X1, X2, X3, 13) \
81
+ ARX(X0, X1, X2, 18) \
82
+ \
83
+ /* Rearrange data. */ \
82
84
  X1 = _mm_shuffle_epi32(X1, 0x39); \
83
85
  X2 = _mm_shuffle_epi32(X2, 0x4E); \
84
86
  X3 = _mm_shuffle_epi32(X3, 0x93);
@@ -86,20 +88,19 @@
86
88
  /**
87
89
  * Apply the salsa20/8 core to the block provided in (X0 ... X3) ^ (Z0 ... Z3).
88
90
  */
89
- #define SALSA20_8_XOR(in, out) \
90
- { \
91
- __m128i Y0 = X0 = _mm_xor_si128(X0, (in)[0]); \
92
- __m128i Y1 = X1 = _mm_xor_si128(X1, (in)[1]); \
93
- __m128i Y2 = X2 = _mm_xor_si128(X2, (in)[2]); \
94
- __m128i Y3 = X3 = _mm_xor_si128(X3, (in)[3]); \
95
- SALSA20_2ROUNDS \
96
- SALSA20_2ROUNDS \
97
- SALSA20_2ROUNDS \
98
- SALSA20_2ROUNDS \
99
- (out)[0] = X0 = _mm_add_epi32(X0, Y0); \
100
- (out)[1] = X1 = _mm_add_epi32(X1, Y1); \
101
- (out)[2] = X2 = _mm_add_epi32(X2, Y2); \
102
- (out)[3] = X3 = _mm_add_epi32(X3, Y3); \
91
+ # define SALSA20_8_XOR(in, out) \
92
+ { \
93
+ __m128i Y0 = X0 = _mm_xor_si128(X0, (in)[0]); \
94
+ __m128i Y1 = X1 = _mm_xor_si128(X1, (in)[1]); \
95
+ __m128i Y2 = X2 = _mm_xor_si128(X2, (in)[2]); \
96
+ __m128i Y3 = X3 = _mm_xor_si128(X3, (in)[3]); \
97
+ SALSA20_2ROUNDS \
98
+ SALSA20_2ROUNDS \
99
+ SALSA20_2ROUNDS \
100
+ SALSA20_2ROUNDS(out)[0] = X0 = _mm_add_epi32(X0, Y0); \
101
+ (out)[1] = X1 = _mm_add_epi32(X1, Y1); \
102
+ (out)[2] = X2 = _mm_add_epi32(X2, Y2); \
103
+ (out)[3] = X3 = _mm_add_epi32(X3, Y3); \
103
104
  }
104
105
 
105
106
  /**
@@ -108,10 +109,10 @@
108
109
  * bytes in length; the output Bout must also be the same size.
109
110
  */
110
111
  static inline void
111
- blockmix_salsa8(const __m128i * Bin, __m128i * Bout, size_t r)
112
+ blockmix_salsa8(const __m128i *Bin, __m128i *Bout, size_t r)
112
113
  {
113
114
  __m128i X0, X1, X2, X3;
114
- size_t i;
115
+ size_t i;
115
116
 
116
117
  /* 1: X <-- B_{2r - 1} */
117
118
  X0 = Bin[8 * r - 4];
@@ -146,24 +147,24 @@ blockmix_salsa8(const __m128i * Bin, __m128i * Bout, size_t r)
146
147
  SALSA20_8_XOR(&Bin[i * 8 + 4], &Bout[(r + i) * 4 + 4])
147
148
  }
148
149
 
149
- #define XOR4(in) \
150
+ # define XOR4(in) \
150
151
  X0 = _mm_xor_si128(X0, (in)[0]); \
151
152
  X1 = _mm_xor_si128(X1, (in)[1]); \
152
153
  X2 = _mm_xor_si128(X2, (in)[2]); \
153
154
  X3 = _mm_xor_si128(X3, (in)[3]);
154
155
 
155
- #define XOR4_2(in1, in2) \
156
+ # define XOR4_2(in1, in2) \
156
157
  X0 = _mm_xor_si128((in1)[0], (in2)[0]); \
157
158
  X1 = _mm_xor_si128((in1)[1], (in2)[1]); \
158
159
  X2 = _mm_xor_si128((in1)[2], (in2)[2]); \
159
160
  X3 = _mm_xor_si128((in1)[3], (in2)[3]);
160
161
 
161
162
  static inline uint32_t
162
- blockmix_salsa8_xor(const __m128i * Bin1, const __m128i * Bin2, __m128i * Bout,
163
- size_t r)
163
+ blockmix_salsa8_xor(const __m128i *Bin1, const __m128i *Bin2, __m128i *Bout,
164
+ size_t r)
164
165
  {
165
166
  __m128i X0, X1, X2, X3;
166
- size_t i;
167
+ size_t i;
167
168
 
168
169
  /* 1: X <-- B_{2r - 1} */
169
170
  XOR4_2(&Bin1[8 * r - 4], &Bin2[8 * r - 4])
@@ -201,11 +202,11 @@ blockmix_salsa8_xor(const __m128i * Bin1, const __m128i * Bin2, __m128i * Bout,
201
202
  return _mm_cvtsi128_si32(X0);
202
203
  }
203
204
 
204
- #undef ARX
205
- #undef SALSA20_2ROUNDS
206
- #undef SALSA20_8_XOR
207
- #undef XOR4
208
- #undef XOR4_2
205
+ # undef ARX
206
+ # undef SALSA20_2ROUNDS
207
+ # undef SALSA20_8_XOR
208
+ # undef XOR4
209
+ # undef XOR4_2
209
210
 
210
211
  /**
211
212
  * integerify(B, r):
@@ -213,9 +214,9 @@ blockmix_salsa8_xor(const __m128i * Bin1, const __m128i * Bin2, __m128i * Bout,
213
214
  * Note that B's layout is permuted compared to the generic implementation.
214
215
  */
215
216
  static inline uint32_t
216
- integerify(const void * B, size_t r)
217
+ integerify(const void *B, size_t r)
217
218
  {
218
- return *(const uint32_t *)((uintptr_t)(B) + (2 * r - 1) * 64);
219
+ return *(const uint32_t *) ((uintptr_t)(B) + (2 * r - 1) * 64);
219
220
  }
220
221
 
221
222
  /**
@@ -227,20 +228,19 @@ integerify(const void * B, size_t r)
227
228
  * multiple of 64 bytes.
228
229
  */
229
230
  static void
230
- smix(uint8_t * B, size_t r, uint32_t N, void * V, void * XY)
231
+ smix(uint8_t *B, size_t r, uint32_t N, void *V, void *XY)
231
232
  {
232
- size_t s = 128 * r;
233
- __m128i * X = (__m128i *) V, * Y;
234
- uint32_t * X32 = (uint32_t *) V;
235
- uint32_t i, j;
236
- size_t k;
233
+ size_t s = 128 * r;
234
+ __m128i * X = (__m128i *) V, *Y;
235
+ uint32_t *X32 = (uint32_t *) V;
236
+ uint32_t i, j;
237
+ size_t k;
237
238
 
238
239
  /* 1: X <-- B */
239
240
  /* 3: V_i <-- X */
240
241
  for (k = 0; k < 2 * r; k++) {
241
242
  for (i = 0; i < 16; i++) {
242
- X32[k * 16 + i] =
243
- LOAD32_LE(&B[(k * 16 + (i * 5 % 16)) * 4]);
243
+ X32[k * 16 + i] = LOAD32_LE(&B[(k * 16 + (i * 5 % 16)) * 4]);
244
244
  }
245
245
  }
246
246
 
@@ -248,18 +248,18 @@ smix(uint8_t * B, size_t r, uint32_t N, void * V, void * XY)
248
248
  for (i = 1; i < N - 1; i += 2) {
249
249
  /* 4: X <-- H(X) */
250
250
  /* 3: V_i <-- X */
251
- Y = (__m128i *)((uintptr_t)(V) + i * s);
251
+ Y = (__m128i *) ((uintptr_t)(V) + i * s);
252
252
  blockmix_salsa8(X, Y, r);
253
253
 
254
254
  /* 4: X <-- H(X) */
255
255
  /* 3: V_i <-- X */
256
- X = (__m128i *)((uintptr_t)(V) + (i + 1) * s);
256
+ X = (__m128i *) ((uintptr_t)(V) + (i + 1) * s);
257
257
  blockmix_salsa8(Y, X, r);
258
258
  }
259
259
 
260
260
  /* 4: X <-- H(X) */
261
261
  /* 3: V_i <-- X */
262
- Y = (__m128i *)((uintptr_t)(V) + i * s);
262
+ Y = (__m128i *) ((uintptr_t)(V) + i * s);
263
263
  blockmix_salsa8(X, Y, r);
264
264
 
265
265
  /* 4: X <-- H(X) */
@@ -268,19 +268,19 @@ smix(uint8_t * B, size_t r, uint32_t N, void * V, void * XY)
268
268
  blockmix_salsa8(Y, X, r);
269
269
 
270
270
  X32 = (uint32_t *) XY;
271
- Y = (__m128i *)((uintptr_t)(XY) + s);
271
+ Y = (__m128i *) ((uintptr_t)(XY) + s);
272
272
 
273
273
  /* 7: j <-- Integerify(X) mod N */
274
274
  j = integerify(X, r) & (N - 1);
275
275
 
276
276
  /* 6: for i = 0 to N - 1 do */
277
277
  for (i = 0; i < N; i += 2) {
278
- __m128i * V_j = (__m128i *)((uintptr_t)(V) + j * s);
278
+ __m128i *V_j = (__m128i *) ((uintptr_t)(V) + j * s);
279
279
 
280
280
  /* 8: X <-- H(X \xor V_j) */
281
281
  /* 7: j <-- Integerify(X) mod N */
282
- j = blockmix_salsa8_xor(X, V_j, Y, r) & (N - 1);
283
- V_j = (__m128i *)((uintptr_t)(V) + j * s);
282
+ j = blockmix_salsa8_xor(X, V_j, Y, r) & (N - 1);
283
+ V_j = (__m128i *) ((uintptr_t)(V) + j * s);
284
284
 
285
285
  /* 8: X <-- H(X \xor V_j) */
286
286
  /* 7: j <-- Integerify(X) mod N */
@@ -306,25 +306,23 @@ smix(uint8_t * B, size_t r, uint32_t N, void * V, void * XY)
306
306
  * Return 0 on success; or -1 on error.
307
307
  */
308
308
  int
309
- escrypt_kdf_sse(escrypt_local_t * local,
310
- const uint8_t * passwd, size_t passwdlen,
311
- const uint8_t * salt, size_t saltlen,
312
- uint64_t N, uint32_t _r, uint32_t _p,
313
- uint8_t * buf, size_t buflen)
309
+ escrypt_kdf_sse(escrypt_local_t *local, const uint8_t *passwd, size_t passwdlen,
310
+ const uint8_t *salt, size_t saltlen, uint64_t N, uint32_t _r,
311
+ uint32_t _p, uint8_t *buf, size_t buflen)
314
312
  {
315
- size_t B_size, V_size, XY_size, need;
313
+ size_t B_size, V_size, XY_size, need;
316
314
  uint8_t * B;
317
- uint32_t * V, * XY;
318
- size_t r = _r, p = _p;
319
- uint32_t i;
315
+ uint32_t *V, *XY;
316
+ size_t r = _r, p = _p;
317
+ uint32_t i;
320
318
 
321
- /* Sanity-check parameters. */
322
- #if SIZE_MAX > UINT32_MAX
319
+ /* Sanity-check parameters. */
320
+ # if SIZE_MAX > UINT32_MAX
323
321
  if (buflen > (((uint64_t)(1) << 32) - 1) * 32) {
324
322
  errno = EFBIG;
325
323
  return -1;
326
324
  }
327
- #endif
325
+ # endif
328
326
  if ((uint64_t)(r) * (uint64_t)(p) >= ((uint64_t) 1 << 30)) {
329
327
  errno = EFBIG;
330
328
  return -1;
@@ -342,37 +340,39 @@ escrypt_kdf_sse(escrypt_local_t * local,
342
340
  return -1;
343
341
  }
344
342
  if ((r > SIZE_MAX / 128 / p) ||
345
- #if SIZE_MAX / 256 <= UINT32_MAX
343
+ # if SIZE_MAX / 256 <= UINT32_MAX
346
344
  (r > SIZE_MAX / 256) ||
347
- #endif
345
+ # endif
348
346
  (N > SIZE_MAX / 128 / r)) {
349
347
  errno = ENOMEM;
350
348
  return -1;
351
349
  }
352
350
 
353
351
  /* Allocate memory. */
354
- B_size = (size_t)128 * r * p;
355
- V_size = (size_t)128 * r * N;
356
- need = B_size + V_size;
352
+ B_size = (size_t) 128 * r * p;
353
+ V_size = (size_t) 128 * r * N;
354
+ need = B_size + V_size;
357
355
  if (need < V_size) {
358
356
  errno = ENOMEM;
359
357
  return -1;
360
358
  }
361
- XY_size = (size_t)256 * r + 64;
359
+ XY_size = (size_t) 256 * r + 64;
362
360
  need += XY_size;
363
361
  if (need < XY_size) {
364
362
  errno = ENOMEM;
365
363
  return -1;
366
364
  }
367
365
  if (local->size < need) {
368
- if (free_region(local))
366
+ if (free_region(local)) {
369
367
  return -1; /* LCOV_EXCL_LINE */
370
- if (!alloc_region(local, need))
368
+ }
369
+ if (!alloc_region(local, need)) {
371
370
  return -1; /* LCOV_EXCL_LINE */
371
+ }
372
372
  }
373
- B = (uint8_t *)local->aligned;
374
- V = (uint32_t *)((uint8_t *)B + B_size);
375
- XY = (uint32_t *)((uint8_t *)V + V_size);
373
+ B = (uint8_t *) local->aligned;
374
+ V = (uint32_t *) ((uint8_t *) B + B_size);
375
+ XY = (uint32_t *) ((uint8_t *) V + V_size);
376
376
 
377
377
  /* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */
378
378
  PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, B, B_size);
@@ -380,7 +380,7 @@ escrypt_kdf_sse(escrypt_local_t * local,
380
380
  /* 2: for i = 0 to p - 1 do */
381
381
  for (i = 0; i < p; i++) {
382
382
  /* 3: B_i <-- MF(B_i, N) */
383
- smix(&B[(size_t)128 * i * r], r, (uint32_t) N, V, XY);
383
+ smix(&B[(size_t) 128 * i * r], r, (uint32_t) N, V, XY);
384
384
  }
385
385
 
386
386
  /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */