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
@@ -1,40 +0,0 @@
1
- /*
2
- BLAKE2 reference source code package - reference C implementations
3
-
4
- Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
5
-
6
- To the extent possible under law, the author(s) have dedicated all copyright
7
- and related and neighboring rights to this software to the public domain
8
- worldwide. This software is distributed without any warranty.
9
-
10
- You should have received a copy of the CC0 Public Domain Dedication along with
11
- this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
12
- */
13
-
14
- #ifndef argon2_impl_H
15
- #define argon2_impl_H
16
-
17
- #include <stdint.h>
18
- #include <string.h>
19
-
20
- static inline uint32_t rotl32( const uint32_t w, const unsigned c )
21
- {
22
- return ( w << c ) | ( w >> ( 32 - c ) );
23
- }
24
-
25
- static inline uint64_t rotl64( const uint64_t w, const unsigned c )
26
- {
27
- return ( w << c ) | ( w >> ( 64 - c ) );
28
- }
29
-
30
- static inline uint32_t rotr32( const uint32_t w, const unsigned c )
31
- {
32
- return ( w >> c ) | ( w << ( 32 - c ) );
33
- }
34
-
35
- static inline uint64_t rotr64( const uint64_t w, const unsigned c )
36
- {
37
- return ( w >> c ) | ( w << ( 64 - c ) );
38
- }
39
-
40
- #endif
@@ -1,35 +0,0 @@
1
- #include "crypto_onetimeauth_poly1305.h"
2
- #include "crypto_secretbox_xsalsa20poly1305.h"
3
- #include "crypto_stream_xsalsa20.h"
4
-
5
- int crypto_secretbox_xsalsa20poly1305(
6
- unsigned char *c,
7
- const unsigned char *m,unsigned long long mlen,
8
- const unsigned char *n,
9
- const unsigned char *k
10
- )
11
- {
12
- int i;
13
- if (mlen < 32) return -1;
14
- crypto_stream_xsalsa20_xor(c,m,mlen,n,k);
15
- crypto_onetimeauth_poly1305(c + 16,c + 32,mlen - 32,c);
16
- for (i = 0;i < 16;++i) c[i] = 0;
17
- return 0;
18
- }
19
-
20
- int crypto_secretbox_xsalsa20poly1305_open(
21
- unsigned char *m,
22
- const unsigned char *c,unsigned long long clen,
23
- const unsigned char *n,
24
- const unsigned char *k
25
- )
26
- {
27
- int i;
28
- unsigned char subkey[32];
29
- if (clen < 32) return -1;
30
- crypto_stream_xsalsa20(subkey,32,n,k);
31
- if (crypto_onetimeauth_poly1305_verify(c + 16,c + 32,clen - 32,subkey) != 0) return -1;
32
- crypto_stream_xsalsa20_xor(m,c,clen,n,k);
33
- for (i = 0;i < 32;++i) m[i] = 0;
34
- return 0;
35
- }
@@ -1,26 +0,0 @@
1
- #include "crypto_secretbox_xsalsa20poly1305.h"
2
-
3
- size_t
4
- crypto_secretbox_xsalsa20poly1305_keybytes(void) {
5
- return crypto_secretbox_xsalsa20poly1305_KEYBYTES;
6
- }
7
-
8
- size_t
9
- crypto_secretbox_xsalsa20poly1305_noncebytes(void) {
10
- return crypto_secretbox_xsalsa20poly1305_NONCEBYTES;
11
- }
12
-
13
- size_t
14
- crypto_secretbox_xsalsa20poly1305_zerobytes(void) {
15
- return crypto_secretbox_xsalsa20poly1305_ZEROBYTES;
16
- }
17
-
18
- size_t
19
- crypto_secretbox_xsalsa20poly1305_boxzerobytes(void) {
20
- return crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES;
21
- }
22
-
23
- size_t
24
- crypto_secretbox_xsalsa20poly1305_macbytes(void) {
25
- return crypto_secretbox_xsalsa20poly1305_MACBYTES;
26
- }
@@ -1,72 +0,0 @@
1
- #include "crypto_shorthash_siphash24.h"
2
- #include "private/common.h"
3
-
4
- typedef uint64_t u64;
5
- typedef uint32_t u32;
6
- typedef uint8_t u8;
7
-
8
- #define ROTL(x,b) (u64)( ((x) << (b)) | ( (x) >> (64 - (b))) )
9
-
10
- #define SIPROUND \
11
- do { \
12
- v0 += v1; v1=ROTL(v1,13); v1 ^= v0; v0=ROTL(v0,32); \
13
- v2 += v3; v3=ROTL(v3,16); v3 ^= v2; \
14
- v0 += v3; v3=ROTL(v3,21); v3 ^= v0; \
15
- v2 += v1; v1=ROTL(v1,17); v1 ^= v2; v2=ROTL(v2,32); \
16
- } while(0)
17
-
18
- int crypto_shorthash_siphash24(unsigned char *out, const unsigned char *in,
19
- unsigned long long inlen, const unsigned char *k)
20
- {
21
- /* "somepseudorandomlygeneratedbytes" */
22
- u64 v0 = 0x736f6d6570736575ULL;
23
- u64 v1 = 0x646f72616e646f6dULL;
24
- u64 v2 = 0x6c7967656e657261ULL;
25
- u64 v3 = 0x7465646279746573ULL;
26
- u64 b;
27
- u64 k0 = LOAD64_LE( k );
28
- u64 k1 = LOAD64_LE( k + 8 );
29
- u64 m;
30
- const u8 *end = in + inlen - ( inlen % sizeof( u64 ) );
31
- const int left = inlen & 7;
32
- b = ( ( u64 )inlen ) << 56;
33
- v3 ^= k1;
34
- v2 ^= k0;
35
- v1 ^= k1;
36
- v0 ^= k0;
37
-
38
- for ( ; in != end; in += 8 )
39
- {
40
- m = LOAD64_LE( in );
41
- v3 ^= m;
42
- SIPROUND;
43
- SIPROUND;
44
- v0 ^= m;
45
- }
46
-
47
- switch( left )
48
- {
49
- case 7: b |= ( ( u64 )in[ 6] ) << 48;
50
- case 6: b |= ( ( u64 )in[ 5] ) << 40;
51
- case 5: b |= ( ( u64 )in[ 4] ) << 32;
52
- case 4: b |= ( ( u64 )in[ 3] ) << 24;
53
- case 3: b |= ( ( u64 )in[ 2] ) << 16;
54
- case 2: b |= ( ( u64 )in[ 1] ) << 8;
55
- case 1: b |= ( ( u64 )in[ 0] ); break;
56
- case 0: break;
57
- }
58
-
59
- v3 ^= b;
60
- SIPROUND;
61
- SIPROUND;
62
- v0 ^= b;
63
- v2 ^= 0xff;
64
- SIPROUND;
65
- SIPROUND;
66
- SIPROUND;
67
- SIPROUND;
68
- b = v0 ^ v1 ^ v2 ^ v3;
69
- STORE64_LE( out, b );
70
- return 0;
71
- }
72
-
@@ -1 +0,0 @@
1
- EdDSA signatures using Curve25519
@@ -1,39 +0,0 @@
1
-
2
- #include <string.h>
3
-
4
- #include "crypto_sign_ed25519.h"
5
-
6
- size_t
7
- crypto_sign_ed25519_bytes(void) {
8
- return crypto_sign_ed25519_BYTES;
9
- }
10
-
11
- size_t
12
- crypto_sign_ed25519_seedbytes(void) {
13
- return crypto_sign_ed25519_SEEDBYTES;
14
- }
15
-
16
- size_t
17
- crypto_sign_ed25519_publickeybytes(void) {
18
- return crypto_sign_ed25519_PUBLICKEYBYTES;
19
- }
20
-
21
- size_t
22
- crypto_sign_ed25519_secretkeybytes(void) {
23
- return crypto_sign_ed25519_SECRETKEYBYTES;
24
- }
25
-
26
- int
27
- crypto_sign_ed25519_sk_to_seed(unsigned char *seed, const unsigned char *sk)
28
- {
29
- memmove(seed, sk, crypto_sign_ed25519_SEEDBYTES);
30
- return 0;
31
- }
32
-
33
- int
34
- crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk)
35
- {
36
- memmove(pk, sk + crypto_sign_ed25519_SEEDBYTES,
37
- crypto_sign_ed25519_PUBLICKEYBYTES);
38
- return 0;
39
- }
@@ -1,159 +0,0 @@
1
- /* Author: Peter Schwabe, ported from an assembly implementation by Emilia Käsper
2
- * Date: 2009-03-19
3
- * Public domain */
4
-
5
- #include "crypto_stream_aes128ctr.h"
6
- #include "int128.h"
7
- #include "common.h"
8
- #include "consts.h"
9
-
10
- int crypto_stream_aes128ctr_afternm(unsigned char *out, unsigned long long len, const unsigned char *nonce, const unsigned char *c)
11
- {
12
-
13
- int128 xmm0;
14
- int128 xmm1;
15
- int128 xmm2;
16
- int128 xmm3;
17
- int128 xmm4;
18
- int128 xmm5;
19
- int128 xmm6;
20
- int128 xmm7;
21
-
22
- int128 xmm8;
23
- int128 xmm9;
24
- int128 xmm10;
25
- int128 xmm11;
26
- int128 xmm12;
27
- int128 xmm13;
28
- int128 xmm14;
29
- int128 xmm15;
30
-
31
- int128 nonce_stack;
32
- unsigned long long lensav;
33
- unsigned char bl[128];
34
- unsigned char *blp;
35
- unsigned char *np;
36
- unsigned char b;
37
-
38
- uint32 tmp;
39
-
40
- /* Copy nonce on the stack */
41
- copy2(&nonce_stack, (const int128 *) (nonce + 0));
42
- np = (unsigned char *)&nonce_stack;
43
-
44
- enc_block:
45
-
46
- xmm0 = *(int128 *) (np + 0);
47
- copy2(&xmm1, &xmm0);
48
- shufb(&xmm1, SWAP32);
49
- copy2(&xmm2, &xmm1);
50
- copy2(&xmm3, &xmm1);
51
- copy2(&xmm4, &xmm1);
52
- copy2(&xmm5, &xmm1);
53
- copy2(&xmm6, &xmm1);
54
- copy2(&xmm7, &xmm1);
55
-
56
- add_uint32_big(&xmm1, 1);
57
- add_uint32_big(&xmm2, 2);
58
- add_uint32_big(&xmm3, 3);
59
- add_uint32_big(&xmm4, 4);
60
- add_uint32_big(&xmm5, 5);
61
- add_uint32_big(&xmm6, 6);
62
- add_uint32_big(&xmm7, 7);
63
-
64
- shufb(&xmm0, M0);
65
- shufb(&xmm1, M0SWAP);
66
- shufb(&xmm2, M0SWAP);
67
- shufb(&xmm3, M0SWAP);
68
- shufb(&xmm4, M0SWAP);
69
- shufb(&xmm5, M0SWAP);
70
- shufb(&xmm6, M0SWAP);
71
- shufb(&xmm7, M0SWAP);
72
-
73
- bitslice(xmm7, xmm6, xmm5, xmm4, xmm3, xmm2, xmm1, xmm0, xmm8)
74
-
75
- aesround( 1, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
76
- aesround( 2, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
77
- aesround( 3, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
78
- aesround( 4, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
79
- aesround( 5, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
80
- aesround( 6, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
81
- aesround( 7, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
82
- aesround( 8, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
83
- aesround( 9, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
84
- lastround(xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
85
-
86
- bitslice(xmm13, xmm10, xmm15, xmm11, xmm14, xmm12, xmm9, xmm8, xmm0)
87
-
88
- if(len < 128) goto partial;
89
- if(len == 128) goto full;
90
-
91
- tmp = LOAD32_BE(np + 12);
92
- tmp += 8;
93
- STORE32_BE(np + 12, tmp);
94
-
95
- *(int128 *) (out + 0) = xmm8;
96
- *(int128 *) (out + 16) = xmm9;
97
- *(int128 *) (out + 32) = xmm12;
98
- *(int128 *) (out + 48) = xmm14;
99
- *(int128 *) (out + 64) = xmm11;
100
- *(int128 *) (out + 80) = xmm15;
101
- *(int128 *) (out + 96) = xmm10;
102
- *(int128 *) (out + 112) = xmm13;
103
-
104
- len -= 128;
105
- out += 128;
106
-
107
- goto enc_block;
108
-
109
- partial:
110
-
111
- lensav = len;
112
- len >>= 4;
113
-
114
- tmp = LOAD32_BE(np + 12);
115
- tmp += len;
116
- STORE32_BE(np + 12, tmp);
117
-
118
- blp = bl;
119
- *(int128 *)(blp + 0) = xmm8;
120
- *(int128 *)(blp + 16) = xmm9;
121
- *(int128 *)(blp + 32) = xmm12;
122
- *(int128 *)(blp + 48) = xmm14;
123
- *(int128 *)(blp + 64) = xmm11;
124
- *(int128 *)(blp + 80) = xmm15;
125
- *(int128 *)(blp + 96) = xmm10;
126
- *(int128 *)(blp + 112) = xmm13;
127
-
128
- bytes:
129
-
130
- if(lensav == 0) goto end;
131
-
132
- b = blp[0]; /* clang false positive */
133
- *(unsigned char *)(out + 0) = b;
134
-
135
- blp += 1;
136
- out +=1;
137
- lensav -= 1;
138
-
139
- goto bytes;
140
-
141
- full:
142
-
143
- tmp = LOAD32_BE(np + 12);
144
- tmp += 8;
145
- STORE32_BE(np + 12, tmp);
146
-
147
- *(int128 *) (out + 0) = xmm8;
148
- *(int128 *) (out + 16) = xmm9;
149
- *(int128 *) (out + 32) = xmm12;
150
- *(int128 *) (out + 48) = xmm14;
151
- *(int128 *) (out + 64) = xmm11;
152
- *(int128 *) (out + 80) = xmm15;
153
- *(int128 *) (out + 96) = xmm10;
154
- *(int128 *) (out + 112) = xmm13;
155
-
156
- end:
157
- return 0;
158
-
159
- }
@@ -1,59 +0,0 @@
1
- /* Author: Peter Schwabe, ported from an assembly implementation by Emilia Käsper
2
- * Date: 2009-03-19
3
- * Public domain */
4
-
5
- #include "crypto_stream_aes128ctr.h"
6
- #include "consts.h"
7
- #include "int128.h"
8
- #include "common.h"
9
-
10
- int crypto_stream_aes128ctr_beforenm(unsigned char *c, const unsigned char *k)
11
- {
12
-
13
- /*
14
- int64 x0;
15
- int64 x1;
16
- int64 x2;
17
- int64 x3;
18
- int64 e;
19
- int64 q0;
20
- int64 q1;
21
- int64 q2;
22
- int64 q3;
23
- */
24
-
25
- int128 xmm0;
26
- int128 xmm1;
27
- int128 xmm2;
28
- int128 xmm3;
29
- int128 xmm4;
30
- int128 xmm5;
31
- int128 xmm6;
32
- int128 xmm7;
33
- int128 xmm8;
34
- int128 xmm9;
35
- int128 xmm10;
36
- int128 xmm11;
37
- int128 xmm12;
38
- int128 xmm13;
39
- int128 xmm14;
40
- int128 xmm15;
41
- int128 t;
42
-
43
- bitslicekey0(k, c)
44
-
45
- keyexpbs1(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
46
- keyexpbs(xmm0, xmm1, xmm4, xmm6, xmm3, xmm7, xmm2, xmm5, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm1);, 2,c)
47
- keyexpbs(xmm0, xmm1, xmm3, xmm2, xmm6, xmm5, xmm4, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm6);, 3,c)
48
- keyexpbs(xmm0, xmm1, xmm6, xmm4, xmm2, xmm7, xmm3, xmm5, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm3);, 4,c)
49
-
50
- keyexpbs(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm3);, 5,c)
51
- keyexpbs(xmm0, xmm1, xmm4, xmm6, xmm3, xmm7, xmm2, xmm5, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm5);, 6,c)
52
- keyexpbs(xmm0, xmm1, xmm3, xmm2, xmm6, xmm5, xmm4, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm3);, 7,c)
53
- keyexpbs(xmm0, xmm1, xmm6, xmm4, xmm2, xmm7, xmm3, xmm5, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm7);, 8,c)
54
-
55
- keyexpbs(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm0); xor_rcon(&xmm1); xor_rcon(&xmm6); xor_rcon(&xmm3);, 9,c)
56
- keyexpbs10(xmm0, xmm1, xmm4, xmm6, xmm3, xmm7, xmm2, xmm5, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
57
-
58
- return 0;
59
- }
@@ -1,771 +0,0 @@
1
- /* Author: Peter Schwabe, ported from an assembly implementation by Emilia Käsper
2
- Date: 2009-03-19
3
- Public domain */
4
- #ifndef COMMON_H
5
- #define COMMON_H
6
-
7
- #include "types.h"
8
- #include "private/common.h"
9
-
10
- /* Macros required only for key expansion */
11
-
12
- #define keyexpbs1(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7, bskey) \
13
- rotbyte(&b0);\
14
- rotbyte(&b1);\
15
- rotbyte(&b2);\
16
- rotbyte(&b3);\
17
- rotbyte(&b4);\
18
- rotbyte(&b5);\
19
- rotbyte(&b6);\
20
- rotbyte(&b7);\
21
- ;\
22
- sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7);\
23
- ;\
24
- xor_rcon(&b0);\
25
- shufb(&b0, EXPB0);\
26
- shufb(&b1, EXPB0);\
27
- shufb(&b4, EXPB0);\
28
- shufb(&b6, EXPB0);\
29
- shufb(&b3, EXPB0);\
30
- shufb(&b7, EXPB0);\
31
- shufb(&b2, EXPB0);\
32
- shufb(&b5, EXPB0);\
33
- shufb(&b0, EXPB0);\
34
- ;\
35
- t0 = *(int128 *)(bskey + 0);\
36
- t1 = *(int128 *)(bskey + 16);\
37
- t2 = *(int128 *)(bskey + 32);\
38
- t3 = *(int128 *)(bskey + 48);\
39
- t4 = *(int128 *)(bskey + 64);\
40
- t5 = *(int128 *)(bskey + 80);\
41
- t6 = *(int128 *)(bskey + 96);\
42
- t7 = *(int128 *)(bskey + 112);\
43
- ;\
44
- xor2(&b0, &t0);\
45
- xor2(&b1, &t1);\
46
- xor2(&b4, &t2);\
47
- xor2(&b6, &t3);\
48
- xor2(&b3, &t4);\
49
- xor2(&b7, &t5);\
50
- xor2(&b2, &t6);\
51
- xor2(&b5, &t7);\
52
- ;\
53
- rshift32_littleendian(&t0, 8);\
54
- rshift32_littleendian(&t1, 8);\
55
- rshift32_littleendian(&t2, 8);\
56
- rshift32_littleendian(&t3, 8);\
57
- rshift32_littleendian(&t4, 8);\
58
- rshift32_littleendian(&t5, 8);\
59
- rshift32_littleendian(&t6, 8);\
60
- rshift32_littleendian(&t7, 8);\
61
- ;\
62
- xor2(&b0, &t0);\
63
- xor2(&b1, &t1);\
64
- xor2(&b4, &t2);\
65
- xor2(&b6, &t3);\
66
- xor2(&b3, &t4);\
67
- xor2(&b7, &t5);\
68
- xor2(&b2, &t6);\
69
- xor2(&b5, &t7);\
70
- ;\
71
- rshift32_littleendian(&t0, 8);\
72
- rshift32_littleendian(&t1, 8);\
73
- rshift32_littleendian(&t2, 8);\
74
- rshift32_littleendian(&t3, 8);\
75
- rshift32_littleendian(&t4, 8);\
76
- rshift32_littleendian(&t5, 8);\
77
- rshift32_littleendian(&t6, 8);\
78
- rshift32_littleendian(&t7, 8);\
79
- ;\
80
- xor2(&b0, &t0);\
81
- xor2(&b1, &t1);\
82
- xor2(&b4, &t2);\
83
- xor2(&b6, &t3);\
84
- xor2(&b3, &t4);\
85
- xor2(&b7, &t5);\
86
- xor2(&b2, &t6);\
87
- xor2(&b5, &t7);\
88
- ;\
89
- rshift32_littleendian(&t0, 8);\
90
- rshift32_littleendian(&t1, 8);\
91
- rshift32_littleendian(&t2, 8);\
92
- rshift32_littleendian(&t3, 8);\
93
- rshift32_littleendian(&t4, 8);\
94
- rshift32_littleendian(&t5, 8);\
95
- rshift32_littleendian(&t6, 8);\
96
- rshift32_littleendian(&t7, 8);\
97
- ;\
98
- xor2(&b0, &t0);\
99
- xor2(&b1, &t1);\
100
- xor2(&b4, &t2);\
101
- xor2(&b6, &t3);\
102
- xor2(&b3, &t4);\
103
- xor2(&b7, &t5);\
104
- xor2(&b2, &t6);\
105
- xor2(&b5, &t7);\
106
- ;\
107
- *(int128 *)(bskey + 128) = b0;\
108
- *(int128 *)(bskey + 144) = b1;\
109
- *(int128 *)(bskey + 160) = b4;\
110
- *(int128 *)(bskey + 176) = b6;\
111
- *(int128 *)(bskey + 192) = b3;\
112
- *(int128 *)(bskey + 208) = b7;\
113
- *(int128 *)(bskey + 224) = b2;\
114
- *(int128 *)(bskey + 240) = b5;\
115
-
116
- #define keyexpbs10(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7, bskey) ;\
117
- toggle(&b0);\
118
- toggle(&b1);\
119
- toggle(&b5);\
120
- toggle(&b6);\
121
- rotbyte(&b0);\
122
- rotbyte(&b1);\
123
- rotbyte(&b2);\
124
- rotbyte(&b3);\
125
- rotbyte(&b4);\
126
- rotbyte(&b5);\
127
- rotbyte(&b6);\
128
- rotbyte(&b7);\
129
- ;\
130
- sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7);\
131
- ;\
132
- xor_rcon(&b1);\
133
- xor_rcon(&b4);\
134
- xor_rcon(&b3);\
135
- xor_rcon(&b7);\
136
- shufb(&b0, EXPB0);\
137
- shufb(&b1, EXPB0);\
138
- shufb(&b4, EXPB0);\
139
- shufb(&b6, EXPB0);\
140
- shufb(&b3, EXPB0);\
141
- shufb(&b7, EXPB0);\
142
- shufb(&b2, EXPB0);\
143
- shufb(&b5, EXPB0);\
144
- ;\
145
- t0 = *(int128 *)(bskey + 9 * 128 + 0);\
146
- t1 = *(int128 *)(bskey + 9 * 128 + 16);\
147
- t2 = *(int128 *)(bskey + 9 * 128 + 32);\
148
- t3 = *(int128 *)(bskey + 9 * 128 + 48);\
149
- t4 = *(int128 *)(bskey + 9 * 128 + 64);\
150
- t5 = *(int128 *)(bskey + 9 * 128 + 80);\
151
- t6 = *(int128 *)(bskey + 9 * 128 + 96);\
152
- t7 = *(int128 *)(bskey + 9 * 128 + 112);\
153
- ;\
154
- toggle(&t0);\
155
- toggle(&t1);\
156
- toggle(&t5);\
157
- toggle(&t6);\
158
- ;\
159
- xor2(&b0, &t0);\
160
- xor2(&b1, &t1);\
161
- xor2(&b4, &t2);\
162
- xor2(&b6, &t3);\
163
- xor2(&b3, &t4);\
164
- xor2(&b7, &t5);\
165
- xor2(&b2, &t6);\
166
- xor2(&b5, &t7);\
167
- ;\
168
- rshift32_littleendian(&t0, 8);\
169
- rshift32_littleendian(&t1, 8);\
170
- rshift32_littleendian(&t2, 8);\
171
- rshift32_littleendian(&t3, 8);\
172
- rshift32_littleendian(&t4, 8);\
173
- rshift32_littleendian(&t5, 8);\
174
- rshift32_littleendian(&t6, 8);\
175
- rshift32_littleendian(&t7, 8);\
176
- ;\
177
- xor2(&b0, &t0);\
178
- xor2(&b1, &t1);\
179
- xor2(&b4, &t2);\
180
- xor2(&b6, &t3);\
181
- xor2(&b3, &t4);\
182
- xor2(&b7, &t5);\
183
- xor2(&b2, &t6);\
184
- xor2(&b5, &t7);\
185
- ;\
186
- rshift32_littleendian(&t0, 8);\
187
- rshift32_littleendian(&t1, 8);\
188
- rshift32_littleendian(&t2, 8);\
189
- rshift32_littleendian(&t3, 8);\
190
- rshift32_littleendian(&t4, 8);\
191
- rshift32_littleendian(&t5, 8);\
192
- rshift32_littleendian(&t6, 8);\
193
- rshift32_littleendian(&t7, 8);\
194
- ;\
195
- xor2(&b0, &t0);\
196
- xor2(&b1, &t1);\
197
- xor2(&b4, &t2);\
198
- xor2(&b6, &t3);\
199
- xor2(&b3, &t4);\
200
- xor2(&b7, &t5);\
201
- xor2(&b2, &t6);\
202
- xor2(&b5, &t7);\
203
- ;\
204
- rshift32_littleendian(&t0, 8);\
205
- rshift32_littleendian(&t1, 8);\
206
- rshift32_littleendian(&t2, 8);\
207
- rshift32_littleendian(&t3, 8);\
208
- rshift32_littleendian(&t4, 8);\
209
- rshift32_littleendian(&t5, 8);\
210
- rshift32_littleendian(&t6, 8);\
211
- rshift32_littleendian(&t7, 8);\
212
- ;\
213
- xor2(&b0, &t0);\
214
- xor2(&b1, &t1);\
215
- xor2(&b4, &t2);\
216
- xor2(&b6, &t3);\
217
- xor2(&b3, &t4);\
218
- xor2(&b7, &t5);\
219
- xor2(&b2, &t6);\
220
- xor2(&b5, &t7);\
221
- ;\
222
- shufb(&b0, M0);\
223
- shufb(&b1, M0);\
224
- shufb(&b2, M0);\
225
- shufb(&b3, M0);\
226
- shufb(&b4, M0);\
227
- shufb(&b5, M0);\
228
- shufb(&b6, M0);\
229
- shufb(&b7, M0);\
230
- ;\
231
- *(int128 *)(bskey + 1280) = b0;\
232
- *(int128 *)(bskey + 1296) = b1;\
233
- *(int128 *)(bskey + 1312) = b4;\
234
- *(int128 *)(bskey + 1328) = b6;\
235
- *(int128 *)(bskey + 1344) = b3;\
236
- *(int128 *)(bskey + 1360) = b7;\
237
- *(int128 *)(bskey + 1376) = b2;\
238
- *(int128 *)(bskey + 1392) = b5;\
239
-
240
-
241
- #define keyexpbs(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7, rcon, i, bskey) \
242
- toggle(&b0);\
243
- toggle(&b1);\
244
- toggle(&b5);\
245
- toggle(&b6);\
246
- rotbyte(&b0);\
247
- rotbyte(&b1);\
248
- rotbyte(&b2);\
249
- rotbyte(&b3);\
250
- rotbyte(&b4);\
251
- rotbyte(&b5);\
252
- rotbyte(&b6);\
253
- rotbyte(&b7);\
254
- ;\
255
- sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7);\
256
- ;\
257
- rcon;\
258
- shufb(&b0, EXPB0);\
259
- shufb(&b1, EXPB0);\
260
- shufb(&b4, EXPB0);\
261
- shufb(&b6, EXPB0);\
262
- shufb(&b3, EXPB0);\
263
- shufb(&b7, EXPB0);\
264
- shufb(&b2, EXPB0);\
265
- shufb(&b5, EXPB0);\
266
- ;\
267
- t0 = *(int128 *)(bskey + (i-1) * 128 + 0);\
268
- t1 = *(int128 *)(bskey + (i-1) * 128 + 16);\
269
- t2 = *(int128 *)(bskey + (i-1) * 128 + 32);\
270
- t3 = *(int128 *)(bskey + (i-1) * 128 + 48);\
271
- t4 = *(int128 *)(bskey + (i-1) * 128 + 64);\
272
- t5 = *(int128 *)(bskey + (i-1) * 128 + 80);\
273
- t6 = *(int128 *)(bskey + (i-1) * 128 + 96);\
274
- t7 = *(int128 *)(bskey + (i-1) * 128 + 112);\
275
- ;\
276
- toggle(&t0);\
277
- toggle(&t1);\
278
- toggle(&t5);\
279
- toggle(&t6);\
280
- ;\
281
- xor2(&b0, &t0);\
282
- xor2(&b1, &t1);\
283
- xor2(&b4, &t2);\
284
- xor2(&b6, &t3);\
285
- xor2(&b3, &t4);\
286
- xor2(&b7, &t5);\
287
- xor2(&b2, &t6);\
288
- xor2(&b5, &t7);\
289
- ;\
290
- rshift32_littleendian(&t0, 8);\
291
- rshift32_littleendian(&t1, 8);\
292
- rshift32_littleendian(&t2, 8);\
293
- rshift32_littleendian(&t3, 8);\
294
- rshift32_littleendian(&t4, 8);\
295
- rshift32_littleendian(&t5, 8);\
296
- rshift32_littleendian(&t6, 8);\
297
- rshift32_littleendian(&t7, 8);\
298
- ;\
299
- xor2(&b0, &t0);\
300
- xor2(&b1, &t1);\
301
- xor2(&b4, &t2);\
302
- xor2(&b6, &t3);\
303
- xor2(&b3, &t4);\
304
- xor2(&b7, &t5);\
305
- xor2(&b2, &t6);\
306
- xor2(&b5, &t7);\
307
- ;\
308
- rshift32_littleendian(&t0, 8);\
309
- rshift32_littleendian(&t1, 8);\
310
- rshift32_littleendian(&t2, 8);\
311
- rshift32_littleendian(&t3, 8);\
312
- rshift32_littleendian(&t4, 8);\
313
- rshift32_littleendian(&t5, 8);\
314
- rshift32_littleendian(&t6, 8);\
315
- rshift32_littleendian(&t7, 8);\
316
- ;\
317
- xor2(&b0, &t0);\
318
- xor2(&b1, &t1);\
319
- xor2(&b4, &t2);\
320
- xor2(&b6, &t3);\
321
- xor2(&b3, &t4);\
322
- xor2(&b7, &t5);\
323
- xor2(&b2, &t6);\
324
- xor2(&b5, &t7);\
325
- ;\
326
- rshift32_littleendian(&t0, 8);\
327
- rshift32_littleendian(&t1, 8);\
328
- rshift32_littleendian(&t2, 8);\
329
- rshift32_littleendian(&t3, 8);\
330
- rshift32_littleendian(&t4, 8);\
331
- rshift32_littleendian(&t5, 8);\
332
- rshift32_littleendian(&t6, 8);\
333
- rshift32_littleendian(&t7, 8);\
334
- ;\
335
- xor2(&b0, &t0);\
336
- xor2(&b1, &t1);\
337
- xor2(&b4, &t2);\
338
- xor2(&b6, &t3);\
339
- xor2(&b3, &t4);\
340
- xor2(&b7, &t5);\
341
- xor2(&b2, &t6);\
342
- xor2(&b5, &t7);\
343
- ;\
344
- *(int128 *)(bskey + i*128 + 0) = b0;\
345
- *(int128 *)(bskey + i*128 + 16) = b1;\
346
- *(int128 *)(bskey + i*128 + 32) = b4;\
347
- *(int128 *)(bskey + i*128 + 48) = b6;\
348
- *(int128 *)(bskey + i*128 + 64) = b3;\
349
- *(int128 *)(bskey + i*128 + 80) = b7;\
350
- *(int128 *)(bskey + i*128 + 96) = b2;\
351
- *(int128 *)(bskey + i*128 + 112) = b5;\
352
-
353
- /* Macros used in multiple contexts */
354
-
355
- #define bitslicekey0(key, bskey) \
356
- xmm0 = *(const int128 *) (key + 0);\
357
- shufb(&xmm0, M0);\
358
- copy2(&xmm1, &xmm0);\
359
- copy2(&xmm2, &xmm0);\
360
- copy2(&xmm3, &xmm0);\
361
- copy2(&xmm4, &xmm0);\
362
- copy2(&xmm5, &xmm0);\
363
- copy2(&xmm6, &xmm0);\
364
- copy2(&xmm7, &xmm0);\
365
- ;\
366
- bitslice(xmm7, xmm6, xmm5, xmm4, xmm3, xmm2, xmm1, xmm0, t);\
367
- ;\
368
- *(int128 *) (bskey + 0) = xmm0;\
369
- *(int128 *) (bskey + 16) = xmm1;\
370
- *(int128 *) (bskey + 32) = xmm2;\
371
- *(int128 *) (bskey + 48) = xmm3;\
372
- *(int128 *) (bskey + 64) = xmm4;\
373
- *(int128 *) (bskey + 80) = xmm5;\
374
- *(int128 *) (bskey + 96) = xmm6;\
375
- *(int128 *) (bskey + 112) = xmm7;\
376
-
377
-
378
- #define bitslicekey10(key, bskey) \
379
- xmm0 = *(int128 *) (key + 0);\
380
- copy2(xmm1, xmm0);\
381
- copy2(xmm2, xmm0);\
382
- copy2(xmm3, xmm0);\
383
- copy2(xmm4, xmm0);\
384
- copy2(xmm5, xmm0);\
385
- copy2(xmm6, xmm0);\
386
- copy2(xmm7, xmm0);\
387
- ;\
388
- bitslice(xmm7, xmm6, xmm5, xmm4, xmm3, xmm2, xmm1, xmm0, t);\
389
- ;\
390
- toggle(&xmm6);\
391
- toggle(&xmm5);\
392
- toggle(&xmm1);\
393
- toggle(&xmm0);\
394
- ;\
395
- *(int128 *) (bskey + 0 + 1280) = xmm0;\
396
- *(int128 *) (bskey + 16 + 1280) = xmm1;\
397
- *(int128 *) (bskey + 32 + 1280) = xmm2;\
398
- *(int128 *) (bskey + 48 + 1280) = xmm3;\
399
- *(int128 *) (bskey + 64 + 1280) = xmm4;\
400
- *(int128 *) (bskey + 80 + 1280) = xmm5;\
401
- *(int128 *) (bskey + 96 + 1280) = xmm6;\
402
- *(int128 *) (bskey + 112 + 1280) = xmm7;\
403
-
404
-
405
- #define bitslicekey(i,key,bskey) \
406
- xmm0 = *(int128 *) (key + 0);\
407
- shufb(&xmm0, M0);\
408
- copy2(&xmm1, &xmm0);\
409
- copy2(&xmm2, &xmm0);\
410
- copy2(&xmm3, &xmm0);\
411
- copy2(&xmm4, &xmm0);\
412
- copy2(&xmm5, &xmm0);\
413
- copy2(&xmm6, &xmm0);\
414
- copy2(&xmm7, &xmm0);\
415
- ;\
416
- bitslice(xmm7, xmm6, xmm5, xmm4, xmm3, xmm2, xmm1, xmm0, t);\
417
- ;\
418
- toggle(&xmm6);\
419
- toggle(&xmm5);\
420
- toggle(&xmm1);\
421
- toggle(&xmm0);\
422
- ;\
423
- *(int128 *) (bskey + 0 + 128*i) = xmm0;\
424
- *(int128 *) (bskey + 16 + 128*i) = xmm1;\
425
- *(int128 *) (bskey + 32 + 128*i) = xmm2;\
426
- *(int128 *) (bskey + 48 + 128*i) = xmm3;\
427
- *(int128 *) (bskey + 64 + 128*i) = xmm4;\
428
- *(int128 *) (bskey + 80 + 128*i) = xmm5;\
429
- *(int128 *) (bskey + 96 + 128*i) = xmm6;\
430
- *(int128 *) (bskey + 112 + 128*i) = xmm7;\
431
-
432
-
433
- #define bitslice(x0, x1, x2, x3, x4, x5, x6, x7, t) \
434
- swapmove(x0, x1, 1, BS0, t);\
435
- swapmove(x2, x3, 1, BS0, t);\
436
- swapmove(x4, x5, 1, BS0, t);\
437
- swapmove(x6, x7, 1, BS0, t);\
438
- ;\
439
- swapmove(x0, x2, 2, BS1, t);\
440
- swapmove(x1, x3, 2, BS1, t);\
441
- swapmove(x4, x6, 2, BS1, t);\
442
- swapmove(x5, x7, 2, BS1, t);\
443
- ;\
444
- swapmove(x0, x4, 4, BS2, t);\
445
- swapmove(x1, x5, 4, BS2, t);\
446
- swapmove(x2, x6, 4, BS2, t);\
447
- swapmove(x3, x7, 4, BS2, t);\
448
-
449
-
450
- #define swapmove(a, b, n, m, t) \
451
- copy2(&t, &b);\
452
- rshift64_littleendian(&t, n);\
453
- xor2(&t, &a);\
454
- and2(&t, &m);\
455
- xor2(&a, &t);\
456
- lshift64_littleendian(&t, n);\
457
- xor2(&b, &t);
458
-
459
- #define rotbyte(x) \
460
- shufb(x, ROTB) /* TODO: Make faster */
461
-
462
-
463
- /* Macros used for encryption (and decryption) */
464
-
465
- #define shiftrows(x0, x1, x2, x3, x4, x5, x6, x7, i, M, bskey) \
466
- xor2(&x0, (const int128 *)(bskey + 128*(i-1) + 0));\
467
- shufb(&x0, M);\
468
- xor2(&x1, (const int128 *)(bskey + 128*(i-1) + 16));\
469
- shufb(&x1, M);\
470
- xor2(&x2, (const int128 *)(bskey + 128*(i-1) + 32));\
471
- shufb(&x2, M);\
472
- xor2(&x3, (const int128 *)(bskey + 128*(i-1) + 48));\
473
- shufb(&x3, M);\
474
- xor2(&x4, (const int128 *)(bskey + 128*(i-1) + 64));\
475
- shufb(&x4, M);\
476
- xor2(&x5, (const int128 *)(bskey + 128*(i-1) + 80));\
477
- shufb(&x5, M);\
478
- xor2(&x6, (const int128 *)(bskey + 128*(i-1) + 96));\
479
- shufb(&x6, M);\
480
- xor2(&x7, (const int128 *)(bskey + 128*(i-1) + 112));\
481
- shufb(&x7, M);\
482
-
483
-
484
- #define mixcolumns(x0, x1, x2, x3, x4, x5, x6, x7, t0, t1, t2, t3, t4, t5, t6, t7) \
485
- shufd(&t0, &x0, 0x93);\
486
- shufd(&t1, &x1, 0x93);\
487
- shufd(&t2, &x2, 0x93);\
488
- shufd(&t3, &x3, 0x93);\
489
- shufd(&t4, &x4, 0x93);\
490
- shufd(&t5, &x5, 0x93);\
491
- shufd(&t6, &x6, 0x93);\
492
- shufd(&t7, &x7, 0x93);\
493
- ;\
494
- xor2(&x0, &t0);\
495
- xor2(&x1, &t1);\
496
- xor2(&x2, &t2);\
497
- xor2(&x3, &t3);\
498
- xor2(&x4, &t4);\
499
- xor2(&x5, &t5);\
500
- xor2(&x6, &t6);\
501
- xor2(&x7, &t7);\
502
- ;\
503
- xor2(&t0, &x7);\
504
- xor2(&t1, &x0);\
505
- xor2(&t2, &x1);\
506
- xor2(&t1, &x7);\
507
- xor2(&t3, &x2);\
508
- xor2(&t4, &x3);\
509
- xor2(&t5, &x4);\
510
- xor2(&t3, &x7);\
511
- xor2(&t6, &x5);\
512
- xor2(&t7, &x6);\
513
- xor2(&t4, &x7);\
514
- ;\
515
- shufd(&x0, &x0, 0x4e);\
516
- shufd(&x1, &x1, 0x4e);\
517
- shufd(&x2, &x2, 0x4e);\
518
- shufd(&x3, &x3, 0x4e);\
519
- shufd(&x4, &x4, 0x4e);\
520
- shufd(&x5, &x5, 0x4e);\
521
- shufd(&x6, &x6, 0x4e);\
522
- shufd(&x7, &x7, 0x4e);\
523
- ;\
524
- xor2(&t0, &x0);\
525
- xor2(&t1, &x1);\
526
- xor2(&t2, &x2);\
527
- xor2(&t3, &x3);\
528
- xor2(&t4, &x4);\
529
- xor2(&t5, &x5);\
530
- xor2(&t6, &x6);\
531
- xor2(&t7, &x7);\
532
-
533
-
534
- #define aesround(i, b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7, bskey) \
535
- shiftrows(b0, b1, b2, b3, b4, b5, b6, b7, i, SR, bskey);\
536
- sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7);\
537
- mixcolumns(b0, b1, b4, b6, b3, b7, b2, b5, t0, t1, t2, t3, t4, t5, t6, t7);\
538
-
539
-
540
- #define lastround(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7, bskey) \
541
- shiftrows(b0, b1, b2, b3, b4, b5, b6, b7, 10, SRM0, bskey);\
542
- sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7);\
543
- xor2(&b0,(const int128 *)(bskey + 128*10));\
544
- xor2(&b1,(const int128 *)(bskey + 128*10+16));\
545
- xor2(&b4,(const int128 *)(bskey + 128*10+32));\
546
- xor2(&b6,(const int128 *)(bskey + 128*10+48));\
547
- xor2(&b3,(const int128 *)(bskey + 128*10+64));\
548
- xor2(&b7,(const int128 *)(bskey + 128*10+80));\
549
- xor2(&b2,(const int128 *)(bskey + 128*10+96));\
550
- xor2(&b5,(const int128 *)(bskey + 128*10+112));\
551
-
552
-
553
- #define sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, s0, s1, s2, s3) \
554
- InBasisChange(b0, b1, b2, b3, b4, b5, b6, b7); \
555
- Inv_GF256(b6, b5, b0, b3, b7, b1, b4, b2, t0, t1, t2, t3, s0, s1, s2, s3); \
556
- OutBasisChange(b7, b1, b4, b2, b6, b5, b0, b3); \
557
-
558
-
559
- #define InBasisChange(b0, b1, b2, b3, b4, b5, b6, b7) \
560
- xor2(&b5, &b6);\
561
- xor2(&b2, &b1);\
562
- xor2(&b5, &b0);\
563
- xor2(&b6, &b2);\
564
- xor2(&b3, &b0);\
565
- ;\
566
- xor2(&b6, &b3);\
567
- xor2(&b3, &b7);\
568
- xor2(&b3, &b4);\
569
- xor2(&b7, &b5);\
570
- xor2(&b3, &b1);\
571
- ;\
572
- xor2(&b4, &b5);\
573
- xor2(&b2, &b7);\
574
- xor2(&b1, &b5);\
575
-
576
- #define OutBasisChange(b0, b1, b2, b3, b4, b5, b6, b7) \
577
- xor2(&b0, &b6);\
578
- xor2(&b1, &b4);\
579
- xor2(&b2, &b0);\
580
- xor2(&b4, &b6);\
581
- xor2(&b6, &b1);\
582
- ;\
583
- xor2(&b1, &b5);\
584
- xor2(&b5, &b3);\
585
- xor2(&b2, &b5);\
586
- xor2(&b3, &b7);\
587
- xor2(&b7, &b5);\
588
- ;\
589
- xor2(&b4, &b7);\
590
-
591
- #define Mul_GF4(x0, x1, y0, y1, t0) \
592
- copy2(&t0, &y0);\
593
- xor2(&t0, &y1);\
594
- and2(&t0, &x0);\
595
- xor2(&x0, &x1);\
596
- and2(&x0, &y1);\
597
- and2(&x1, &y0);\
598
- xor2(&x0, &x1);\
599
- xor2(&x1, &t0);\
600
-
601
- #define Mul_GF4_N(x0, x1, y0, y1, t0) \
602
- copy2(&t0, &y0);\
603
- xor2(&t0, &y1);\
604
- and2(&t0, &x0);\
605
- xor2(&x0, &x1);\
606
- and2(&x0, &y1);\
607
- and2(&x1, &y0);\
608
- xor2(&x1, &x0);\
609
- xor2(&x0, &t0);\
610
-
611
- #define Mul_GF4_2(x0, x1, x2, x3, y0, y1, t0, t1) \
612
- copy2(&t0, = y0);\
613
- xor2(&t0, &y1);\
614
- copy2(&t1, &t0);\
615
- and2(&t0, &x0);\
616
- and2(&t1, &x2);\
617
- xor2(&x0, &x1);\
618
- xor2(&x2, &x3);\
619
- and2(&x0, &y1);\
620
- and2(&x2, &y1);\
621
- and2(&x1, &y0);\
622
- and2(&x3, &y0);\
623
- xor2(&x0, &x1);\
624
- xor2(&x2, &x3);\
625
- xor2(&x1, &t0);\
626
- xor2(&x3, &t1);\
627
-
628
- #define Mul_GF16(x0, x1, x2, x3, y0, y1, y2, y3, t0, t1, t2, t3) \
629
- copy2(&t0, &x0);\
630
- copy2(&t1, &x1);\
631
- Mul_GF4(x0, x1, y0, y1, t2);\
632
- xor2(&t0, &x2);\
633
- xor2(&t1, &x3);\
634
- xor2(&y0, &y2);\
635
- xor2(&y1, &y3);\
636
- Mul_GF4_N(t0, t1, y0, y1, t2);\
637
- Mul_GF4(x2, x3, y2, y3, t3);\
638
- ;\
639
- xor2(&x0, &t0);\
640
- xor2(&x2, &t0);\
641
- xor2(&x1, &t1);\
642
- xor2(&x3, &t1);\
643
-
644
- #define Mul_GF16_2(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, t0, t1, t2, t3) \
645
- copy2(&t0, &x0);\
646
- copy2(&t1, &x1);\
647
- Mul_GF4(x0, x1, y0, y1, t2);\
648
- xor2(&t0, &x2);\
649
- xor2(&t1, &x3);\
650
- xor2(&y0, &y2);\
651
- xor2(&y1, &y3);\
652
- Mul_GF4_N(t0, t1, y0, y1, t3);\
653
- Mul_GF4(x2, x3, y2, y3, t2);\
654
- ;\
655
- xor2(&x0, &t0);\
656
- xor2(&x2, &t0);\
657
- xor2(&x1, &t1);\
658
- xor2(&x3, &t1);\
659
- ;\
660
- copy2(&t0, &x4);\
661
- copy2(&t1, &x5);\
662
- xor2(&t0, &x6);\
663
- xor2(&t1, &x7);\
664
- Mul_GF4_N(t0, t1, y0, y1, t3);\
665
- Mul_GF4(x6, x7, y2, y3, t2);\
666
- xor2(&y0, &y2);\
667
- xor2(&y1, &y3);\
668
- Mul_GF4(x4, x5, y0, y1, t3);\
669
- ;\
670
- xor2(&x4, &t0);\
671
- xor2(&x6, &t0);\
672
- xor2(&x5, &t1);\
673
- xor2(&x7, &t1);\
674
-
675
- #define Inv_GF16(x0, x1, x2, x3, t0, t1, t2, t3) \
676
- copy2(&t0, &x1);\
677
- copy2(&t1, &x0);\
678
- and2(&t0, &x3);\
679
- or2(&t1, &x2);\
680
- copy2(&t2, &x1);\
681
- copy2(&t3, &x0);\
682
- or2(&t2, &x2);\
683
- or2(&t3, &x3);\
684
- xor2(&t2, &t3);\
685
- ;\
686
- xor2(&t0, &t2);\
687
- xor2(&t1, &t2);\
688
- ;\
689
- Mul_GF4_2(x0, x1, x2, x3, t1, t0, t2, t3);\
690
-
691
-
692
- #define Inv_GF256(x0, x1, x2, x3, x4, x5, x6, x7, t0, t1, t2, t3, s0, s1, s2, s3) \
693
- copy2(&t3, &x4);\
694
- copy2(&t2, &x5);\
695
- copy2(&t1, &x1);\
696
- copy2(&s1, &x7);\
697
- copy2(&s0, &x0);\
698
- ;\
699
- xor2(&t3, &x6);\
700
- xor2(&t2, &x7);\
701
- xor2(&t1, &x3);\
702
- xor2(&s1, &x6);\
703
- xor2(&s0, &x2);\
704
- ;\
705
- copy2(&s2, &t3);\
706
- copy2(&t0, &t2);\
707
- copy2(&s3, &t3);\
708
- ;\
709
- or2(&t2, &t1);\
710
- or2(&t3, &s0);\
711
- xor2(&s3, &t0);\
712
- and2(&s2, &s0);\
713
- and2(&t0, &t1);\
714
- xor2(&s0, &t1);\
715
- and2(&s3, &s0);\
716
- copy2(&s0, &x3);\
717
- xor2(&s0, &x2);\
718
- and2(&s1, &s0);\
719
- xor2(&t3, &s1);\
720
- xor2(&t2, &s1);\
721
- copy2(&s1, &x4);\
722
- xor2(&s1, &x5);\
723
- copy2(&s0, &x1);\
724
- copy2(&t1, &s1);\
725
- xor2(&s0, &x0);\
726
- or2(&t1, &s0);\
727
- and2(&s1, &s0);\
728
- xor2(&t0, &s1);\
729
- xor2(&t3, &s3);\
730
- xor2(&t2, &s2);\
731
- xor2(&t1, &s3);\
732
- xor2(&t0, &s2);\
733
- xor2(&t1, &s2);\
734
- copy2(&s0, &x7);\
735
- copy2(&s1, &x6);\
736
- copy2(&s2, &x5);\
737
- copy2(&s3, &x4);\
738
- and2(&s0, &x3);\
739
- and2(&s1, &x2);\
740
- and2(&s2, &x1);\
741
- or2(&s3, &x0);\
742
- xor2(&t3, &s0);\
743
- xor2(&t2, &s1);\
744
- xor2(&t1, &s2);\
745
- xor2(&t0, &s3);\
746
- ;\
747
- copy2(&s0, &t3);\
748
- xor2(&s0, &t2);\
749
- and2(&t3, &t1);\
750
- copy2(&s2, &t0);\
751
- xor2(&s2, &t3);\
752
- copy2(&s3, &s0);\
753
- and2(&s3, &s2);\
754
- xor2(&s3, &t2);\
755
- copy2(&s1, &t1);\
756
- xor2(&s1, &t0);\
757
- xor2(&t3, &t2);\
758
- and2(&s1, &t3);\
759
- xor2(&s1, &t0);\
760
- xor2(&t1, &s1);\
761
- copy2(&t2, &s2);\
762
- xor2(&t2, &s1);\
763
- and2(&t2, &t0);\
764
- xor2(&t1, &t2);\
765
- xor2(&s2, &t2);\
766
- and2(&s2, &s3);\
767
- xor2(&s2, &s0);\
768
- ;\
769
- Mul_GF16_2(x0, x1, x2, x3, x4, x5, x6, x7, s3, s2, s1, t1, s0, t0, t2, t3);\
770
-
771
- #endif