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