rbnacl-libsodium 0.4.5a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (409) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +35 -0
  3. data/.gitmodules +3 -0
  4. data/CHANGES.md +3 -0
  5. data/Gemfile +6 -0
  6. data/LICENSE +21 -0
  7. data/README.md +23 -0
  8. data/Rakefile +1 -0
  9. data/ext/rbnacl/extconf.rb +30 -0
  10. data/lib/rbnacl/libsodium.rb +11 -0
  11. data/lib/rbnacl/libsodium/version.rb +5 -0
  12. data/rbnacl-libsodium.gemspec +25 -0
  13. data/vendor/libsodium/AUTHORS +101 -0
  14. data/vendor/libsodium/ChangeLog +68 -0
  15. data/vendor/libsodium/LICENSE +16 -0
  16. data/vendor/libsodium/Makefile.am +20 -0
  17. data/vendor/libsodium/README +1 -0
  18. data/vendor/libsodium/README.markdown +246 -0
  19. data/vendor/libsodium/THANKS +17 -0
  20. data/vendor/libsodium/autogen.sh +16 -0
  21. data/vendor/libsodium/configure.ac +405 -0
  22. data/vendor/libsodium/dist-build/android.sh +48 -0
  23. data/vendor/libsodium/dist-build/iphone.sh +16 -0
  24. data/vendor/libsodium/dist-build/msys.sh +9 -0
  25. data/vendor/libsodium/libsodium.pc.in +11 -0
  26. data/vendor/libsodium/libsodium.sln +38 -0
  27. data/vendor/libsodium/libsodium.vcxproj +508 -0
  28. data/vendor/libsodium/libsodium.vcxproj.filters +569 -0
  29. data/vendor/libsodium/logo.png +0 -0
  30. data/vendor/libsodium/m4/ax_check_compile_flag.m4 +73 -0
  31. data/vendor/libsodium/m4/ax_check_gnu_make.m4 +78 -0
  32. data/vendor/libsodium/m4/ax_check_link_flag.m4 +72 -0
  33. data/vendor/libsodium/m4/ld-output-def.m4 +29 -0
  34. data/vendor/libsodium/m4/pkg.m4 +214 -0
  35. data/vendor/libsodium/msvc-scripts/Makefile.am +4 -0
  36. data/vendor/libsodium/msvc-scripts/process.bat +8 -0
  37. data/vendor/libsodium/msvc-scripts/rep.vbs +12 -0
  38. data/vendor/libsodium/msvc-scripts/sodium.props +25 -0
  39. data/vendor/libsodium/src/Makefile.am +3 -0
  40. data/vendor/libsodium/src/libsodium/Makefile.am +232 -0
  41. data/vendor/libsodium/src/libsodium/crypto_auth/crypto_auth.c +34 -0
  42. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c +16 -0
  43. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/checksum +1 -0
  44. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/ref/api.h +10 -0
  45. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/ref/hmac_hmacsha256.c +83 -0
  46. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/ref/verify_hmacsha256.c +9 -0
  47. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c +16 -0
  48. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/checksum +1 -0
  49. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/ref/api.h +10 -0
  50. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/ref/hmac_hmacsha512256.c +86 -0
  51. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/ref/verify_hmacsha512256.c +9 -0
  52. data/vendor/libsodium/src/libsodium/crypto_auth/try.c +119 -0
  53. data/vendor/libsodium/src/libsodium/crypto_box/crypto_box.c +95 -0
  54. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c +41 -0
  55. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/checksum +1 -0
  56. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c +22 -0
  57. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h +19 -0
  58. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c +19 -0
  59. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c +27 -0
  60. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c +12 -0
  61. data/vendor/libsodium/src/libsodium/crypto_box/try.c +195 -0
  62. data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/checksum +1 -0
  63. data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20_api.c +26 -0
  64. data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/api.h +11 -0
  65. data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c +108 -0
  66. data/vendor/libsodium/src/libsodium/crypto_core/salsa20/checksum +1 -0
  67. data/vendor/libsodium/src/libsodium/crypto_core/salsa20/core_salsa20_api.c +26 -0
  68. data/vendor/libsodium/src/libsodium/crypto_core/salsa20/ref/api.h +11 -0
  69. data/vendor/libsodium/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c +134 -0
  70. data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/checksum +1 -0
  71. data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c +26 -0
  72. data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/ref/api.h +11 -0
  73. data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c +134 -0
  74. data/vendor/libsodium/src/libsodium/crypto_core/salsa208/checksum +1 -0
  75. data/vendor/libsodium/src/libsodium/crypto_core/salsa208/core_salsa208_api.c +26 -0
  76. data/vendor/libsodium/src/libsodium/crypto_core/salsa208/ref/api.h +11 -0
  77. data/vendor/libsodium/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c +134 -0
  78. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c +31 -0
  79. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/api.h +4 -0
  80. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h +132 -0
  81. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h +169 -0
  82. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +364 -0
  83. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c +355 -0
  84. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/generichash_blake2b.c +61 -0
  85. data/vendor/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c +84 -0
  86. data/vendor/libsodium/src/libsodium/crypto_hash/crypto_hash.c +9 -0
  87. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/checksum +1 -0
  88. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256_api.c +11 -0
  89. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/ref/api.h +8 -0
  90. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/ref/hash_sha256.c +69 -0
  91. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/checksum +1 -0
  92. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512_api.c +11 -0
  93. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/ref/api.h +8 -0
  94. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/ref/hash_sha512.c +71 -0
  95. data/vendor/libsodium/src/libsodium/crypto_hash/try.c +76 -0
  96. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/checksum +1 -0
  97. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256_api.c +16 -0
  98. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/ref/api.h +9 -0
  99. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/ref/blocks_sha256.c +212 -0
  100. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/checksum +1 -0
  101. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512_api.c +16 -0
  102. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/ref/api.h +9 -0
  103. data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/ref/blocks_sha512.c +239 -0
  104. data/vendor/libsodium/src/libsodium/crypto_hashblocks/try.c +78 -0
  105. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c +34 -0
  106. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/api.h +8 -0
  107. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/auth_poly1305_53.c +1661 -0
  108. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/verify_poly1305_53.c +10 -0
  109. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/api.h +8 -0
  110. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c +151 -0
  111. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/portable-jane.h +772 -0
  112. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c +10 -0
  113. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c +36 -0
  114. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c +16 -0
  115. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c +152 -0
  116. data/vendor/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c +34 -0
  117. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/checksum +1 -0
  118. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/api.h +9 -0
  119. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c +13 -0
  120. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c +426 -0
  121. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/api.h +8 -0
  122. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/base_curve25519_ref.c +20 -0
  123. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/smult_curve25519_ref.c +268 -0
  124. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519_api.c +14 -0
  125. data/vendor/libsodium/src/libsodium/crypto_scalarmult/try.c +125 -0
  126. data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c +48 -0
  127. data/vendor/libsodium/src/libsodium/crypto_secretbox/try.c +129 -0
  128. data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/checksum +1 -0
  129. data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/api.h +12 -0
  130. data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c +35 -0
  131. data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c +26 -0
  132. data/vendor/libsodium/src/libsodium/crypto_shorthash/crypto_shorthash.c +27 -0
  133. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/api.h +8 -0
  134. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c +91 -0
  135. data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.c +11 -0
  136. data/vendor/libsodium/src/libsodium/crypto_sign/crypto_sign.c +61 -0
  137. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/description +1 -0
  138. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/api.h +14 -0
  139. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base.h +1344 -0
  140. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base2.h +40 -0
  141. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d.h +1 -0
  142. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d2.h +1 -0
  143. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe.h +56 -0
  144. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_0.c +19 -0
  145. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_1.c +19 -0
  146. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_add.c +57 -0
  147. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c +63 -0
  148. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_copy.c +29 -0
  149. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_frombytes.c +73 -0
  150. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_invert.c +14 -0
  151. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnegative.c +16 -0
  152. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnonzero.c +19 -0
  153. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_mul.c +253 -0
  154. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_neg.c +45 -0
  155. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_pow22523.c +13 -0
  156. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq.c +149 -0
  157. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq2.c +160 -0
  158. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sub.c +57 -0
  159. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_tobytes.c +119 -0
  160. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge.h +95 -0
  161. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.c +11 -0
  162. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.h +97 -0
  163. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_double_scalarmult.c +96 -0
  164. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c +50 -0
  165. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.c +11 -0
  166. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.h +88 -0
  167. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.c +11 -0
  168. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.h +88 -0
  169. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p2.c +12 -0
  170. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p3.c +13 -0
  171. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_0.c +8 -0
  172. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.c +11 -0
  173. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.h +73 -0
  174. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_0.c +9 -0
  175. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_dbl.c +12 -0
  176. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_cached.c +17 -0
  177. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_p2.c +12 -0
  178. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c +14 -0
  179. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_precomp_0.c +8 -0
  180. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c +105 -0
  181. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.c +11 -0
  182. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.h +97 -0
  183. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_tobytes.c +14 -0
  184. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +31 -0
  185. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +40 -0
  186. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow22523.h +160 -0
  187. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow225521.h +160 -0
  188. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc.h +15 -0
  189. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_muladd.c +368 -0
  190. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_reduce.c +275 -0
  191. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +38 -0
  192. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sqrtm1.h +1 -0
  193. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c +26 -0
  194. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/api.h +13 -0
  195. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519.h +54 -0
  196. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c +348 -0
  197. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519.h +34 -0
  198. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c +230 -0
  199. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519.h +51 -0
  200. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c +146 -0
  201. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c +102 -0
  202. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c +21 -0
  203. data/vendor/libsodium/src/libsodium/crypto_sign/try.c +87 -0
  204. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/checksum +1 -0
  205. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c +159 -0
  206. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/api.h +14 -0
  207. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c +59 -0
  208. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common.h +788 -0
  209. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c +64 -0
  210. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts.h +28 -0
  211. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c +14 -0
  212. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h +47 -0
  213. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c +131 -0
  214. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/stream_aes128ctr.c +28 -0
  215. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/types.h +10 -0
  216. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c +181 -0
  217. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c +21 -0
  218. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table-be.h +274 -0
  219. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table-le.h +274 -0
  220. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table.h +56 -0
  221. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes256-ctr.c +238 -0
  222. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes256.h +171 -0
  223. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/api.h +14 -0
  224. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/ecrypt-sync.h +27 -0
  225. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/stream_aes256estream_api.c +21 -0
  226. data/vendor/libsodium/src/libsodium/crypto_stream/crypto_stream.c +36 -0
  227. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h +1 -0
  228. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S +950 -0
  229. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/checksum +1 -0
  230. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/api.h +8 -0
  231. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c +55 -0
  232. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +58 -0
  233. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c +16 -0
  234. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/checksum +1 -0
  235. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/api.h +11 -0
  236. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c +51 -0
  237. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c +54 -0
  238. data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c +16 -0
  239. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/checksum +1 -0
  240. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/api.h +10 -0
  241. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c +51 -0
  242. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c +54 -0
  243. data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c +16 -0
  244. data/vendor/libsodium/src/libsodium/crypto_stream/try.c +122 -0
  245. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/checksum +1 -0
  246. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/api.h +11 -0
  247. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c +24 -0
  248. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c +25 -0
  249. data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c +16 -0
  250. data/vendor/libsodium/src/libsodium/crypto_verify/16/checksum +1 -0
  251. data/vendor/libsodium/src/libsodium/crypto_verify/16/ref/api.h +2 -0
  252. data/vendor/libsodium/src/libsodium/crypto_verify/16/ref/verify_16.c +24 -0
  253. data/vendor/libsodium/src/libsodium/crypto_verify/16/verify_16_api.c +6 -0
  254. data/vendor/libsodium/src/libsodium/crypto_verify/32/checksum +1 -0
  255. data/vendor/libsodium/src/libsodium/crypto_verify/32/ref/api.h +2 -0
  256. data/vendor/libsodium/src/libsodium/crypto_verify/32/ref/verify_32.c +40 -0
  257. data/vendor/libsodium/src/libsodium/crypto_verify/32/verify_32_api.c +6 -0
  258. data/vendor/libsodium/src/libsodium/crypto_verify/try.c +76 -0
  259. data/vendor/libsodium/src/libsodium/include/Makefile.am +63 -0
  260. data/vendor/libsodium/src/libsodium/include/sodium.h +48 -0
  261. data/vendor/libsodium/src/libsodium/include/sodium/core.h +18 -0
  262. data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth.h +36 -0
  263. data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +36 -0
  264. data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +36 -0
  265. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box.h +83 -0
  266. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +72 -0
  267. data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h +40 -0
  268. data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h +40 -0
  269. data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h +40 -0
  270. data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h +40 -0
  271. data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash.h +70 -0
  272. data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +87 -0
  273. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash.h +23 -0
  274. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +29 -0
  275. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +29 -0
  276. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hashblocks_sha256.h +32 -0
  277. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hashblocks_sha512.h +32 -0
  278. data/vendor/libsodium/src/libsodium/include/sodium/crypto_int32.h +8 -0
  279. data/vendor/libsodium/src/libsodium/include/sodium/crypto_int64.h +8 -0
  280. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +37 -0
  281. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +65 -0
  282. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305_53.h +34 -0
  283. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305_donna.h +34 -0
  284. data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h +36 -0
  285. data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h.in +44 -0
  286. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +47 -0
  287. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +44 -0
  288. data/vendor/libsodium/src/libsodium/include/sodium/crypto_shorthash.h +33 -0
  289. data/vendor/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h +29 -0
  290. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign.h +61 -0
  291. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h +52 -0
  292. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +44 -0
  293. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream.h +46 -0
  294. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h +60 -0
  295. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes256estream.h +61 -0
  296. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h.in +54 -0
  297. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h +43 -0
  298. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h +43 -0
  299. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +44 -0
  300. data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint16.h +8 -0
  301. data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint32.h +8 -0
  302. data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint64.h +8 -0
  303. data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint8.h +8 -0
  304. data/vendor/libsodium/src/libsodium/include/sodium/crypto_verify_16.h +25 -0
  305. data/vendor/libsodium/src/libsodium/include/sodium/crypto_verify_32.h +25 -0
  306. data/vendor/libsodium/src/libsodium/include/sodium/export.h +32 -0
  307. data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +53 -0
  308. data/vendor/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h +45 -0
  309. data/vendor/libsodium/src/libsodium/include/sodium/randombytes_sysrandom.h +45 -0
  310. data/vendor/libsodium/src/libsodium/include/sodium/utils.h +36 -0
  311. data/vendor/libsodium/src/libsodium/include/sodium/version.h.in +29 -0
  312. data/vendor/libsodium/src/libsodium/randombytes/randombytes.c +63 -0
  313. data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +317 -0
  314. data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +212 -0
  315. data/vendor/libsodium/src/libsodium/sodium/compat.c +248 -0
  316. data/vendor/libsodium/src/libsodium/sodium/core.c +21 -0
  317. data/vendor/libsodium/src/libsodium/sodium/utils.c +94 -0
  318. data/vendor/libsodium/src/libsodium/sodium/version.c +20 -0
  319. data/vendor/libsodium/test/Makefile.am +5 -0
  320. data/vendor/libsodium/test/default/Makefile.am +277 -0
  321. data/vendor/libsodium/test/default/auth.c +21 -0
  322. data/vendor/libsodium/test/default/auth.exp +4 -0
  323. data/vendor/libsodium/test/default/auth2.c +36 -0
  324. data/vendor/libsodium/test/default/auth2.exp +4 -0
  325. data/vendor/libsodium/test/default/auth3.c +36 -0
  326. data/vendor/libsodium/test/default/auth3.exp +1 -0
  327. data/vendor/libsodium/test/default/auth5.c +37 -0
  328. data/vendor/libsodium/test/default/auth5.exp +0 -0
  329. data/vendor/libsodium/test/default/box.c +65 -0
  330. data/vendor/libsodium/test/default/box.exp +19 -0
  331. data/vendor/libsodium/test/default/box2.c +66 -0
  332. data/vendor/libsodium/test/default/box2.exp +17 -0
  333. data/vendor/libsodium/test/default/box7.c +37 -0
  334. data/vendor/libsodium/test/default/box7.exp +0 -0
  335. data/vendor/libsodium/test/default/box8.c +44 -0
  336. data/vendor/libsodium/test/default/box8.exp +0 -0
  337. data/vendor/libsodium/test/default/cmptest.h +51 -0
  338. data/vendor/libsodium/test/default/core1.c +32 -0
  339. data/vendor/libsodium/test/default/core1.exp +4 -0
  340. data/vendor/libsodium/test/default/core2.c +35 -0
  341. data/vendor/libsodium/test/default/core2.exp +4 -0
  342. data/vendor/libsodium/test/default/core3.c +42 -0
  343. data/vendor/libsodium/test/default/core3.exp +1 -0
  344. data/vendor/libsodium/test/default/core4.c +35 -0
  345. data/vendor/libsodium/test/default/core4.exp +8 -0
  346. data/vendor/libsodium/test/default/core5.c +34 -0
  347. data/vendor/libsodium/test/default/core5.exp +4 -0
  348. data/vendor/libsodium/test/default/core6.c +49 -0
  349. data/vendor/libsodium/test/default/core6.exp +4 -0
  350. data/vendor/libsodium/test/default/generichash.c +27 -0
  351. data/vendor/libsodium/test/default/generichash.exp +64 -0
  352. data/vendor/libsodium/test/default/generichash2.c +31 -0
  353. data/vendor/libsodium/test/default/generichash2.exp +64 -0
  354. data/vendor/libsodium/test/default/hash.c +16 -0
  355. data/vendor/libsodium/test/default/hash.exp +1 -0
  356. data/vendor/libsodium/test/default/hash2.exp +1 -0
  357. data/vendor/libsodium/test/default/hash3.c +16 -0
  358. data/vendor/libsodium/test/default/hash3.exp +1 -0
  359. data/vendor/libsodium/test/default/onetimeauth.c +44 -0
  360. data/vendor/libsodium/test/default/onetimeauth.exp +2 -0
  361. data/vendor/libsodium/test/default/onetimeauth2.c +42 -0
  362. data/vendor/libsodium/test/default/onetimeauth2.exp +1 -0
  363. data/vendor/libsodium/test/default/onetimeauth7.c +37 -0
  364. data/vendor/libsodium/test/default/onetimeauth7.exp +0 -0
  365. data/vendor/libsodium/test/default/pre.js +33 -0
  366. data/vendor/libsodium/test/default/randombytes.c +16 -0
  367. data/vendor/libsodium/test/default/scalarmult.c +25 -0
  368. data/vendor/libsodium/test/default/scalarmult.exp +4 -0
  369. data/vendor/libsodium/test/default/scalarmult2.c +25 -0
  370. data/vendor/libsodium/test/default/scalarmult2.exp +4 -0
  371. data/vendor/libsodium/test/default/scalarmult5.c +32 -0
  372. data/vendor/libsodium/test/default/scalarmult5.exp +4 -0
  373. data/vendor/libsodium/test/default/scalarmult6.c +32 -0
  374. data/vendor/libsodium/test/default/scalarmult6.exp +4 -0
  375. data/vendor/libsodium/test/default/scalarmult7.c +34 -0
  376. data/vendor/libsodium/test/default/scalarmult7.exp +1 -0
  377. data/vendor/libsodium/test/default/scalarmult8.c +34 -0
  378. data/vendor/libsodium/test/default/scalarmult8.exp +1 -0
  379. data/vendor/libsodium/test/default/secretbox.c +58 -0
  380. data/vendor/libsodium/test/default/secretbox.exp +19 -0
  381. data/vendor/libsodium/test/default/secretbox2.c +59 -0
  382. data/vendor/libsodium/test/default/secretbox2.exp +17 -0
  383. data/vendor/libsodium/test/default/secretbox7.c +33 -0
  384. data/vendor/libsodium/test/default/secretbox7.exp +0 -0
  385. data/vendor/libsodium/test/default/secretbox8.c +40 -0
  386. data/vendor/libsodium/test/default/secretbox8.exp +0 -0
  387. data/vendor/libsodium/test/default/shorthash.c +23 -0
  388. data/vendor/libsodium/test/default/shorthash.exp +64 -0
  389. data/vendor/libsodium/test/default/sodium_core.c +11 -0
  390. data/vendor/libsodium/test/default/sodium_core.exp +1 -0
  391. data/vendor/libsodium/test/default/sodium_utils.c +27 -0
  392. data/vendor/libsodium/test/default/sodium_utils.exp +6 -0
  393. data/vendor/libsodium/test/default/sodium_version.c +13 -0
  394. data/vendor/libsodium/test/default/sodium_version.exp +3 -0
  395. data/vendor/libsodium/test/default/stream.c +30 -0
  396. data/vendor/libsodium/test/default/stream.exp +1 -0
  397. data/vendor/libsodium/test/default/stream2.c +28 -0
  398. data/vendor/libsodium/test/default/stream2.exp +1 -0
  399. data/vendor/libsodium/test/default/stream3.c +30 -0
  400. data/vendor/libsodium/test/default/stream3.exp +4 -0
  401. data/vendor/libsodium/test/default/stream4.c +55 -0
  402. data/vendor/libsodium/test/default/stream4.exp +17 -0
  403. data/vendor/libsodium/test/default/stream5.c +29 -0
  404. data/vendor/libsodium/test/default/stream5.exp +1 -0
  405. data/vendor/libsodium/test/default/stream6.c +54 -0
  406. data/vendor/libsodium/test/default/stream6.exp +17 -0
  407. data/vendor/libsodium/test/default/wintest.bat +56 -0
  408. data/vendor/libsodium/test/quirks/windows/windows-quirks.h +18 -0
  409. metadata +500 -0
@@ -0,0 +1,14 @@
1
+ #include "ge.h"
2
+
3
+ void ge_tobytes(unsigned char *s,const ge_p2 *h)
4
+ {
5
+ fe recip;
6
+ fe x;
7
+ fe y;
8
+
9
+ fe_invert(recip,h->Z);
10
+ fe_mul(x,h->X,recip);
11
+ fe_mul(y,h->Y,recip);
12
+ fe_tobytes(s,y);
13
+ s[31] ^= fe_isnegative(x) << 7;
14
+ }
@@ -0,0 +1,31 @@
1
+ #include "api.h"
2
+ #include "randombytes.h"
3
+ #include "crypto_hash_sha512.h"
4
+ #include "ge.h"
5
+
6
+ int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
7
+ const unsigned char *seed)
8
+ {
9
+ ge_p3 A;
10
+ int i;
11
+
12
+ crypto_hash_sha512(sk,seed,32);
13
+ sk[0] &= 248;
14
+ sk[31] &= 63;
15
+ sk[31] |= 64;
16
+
17
+ ge_scalarmult_base(&A,sk);
18
+ ge_p3_tobytes(pk,&A);
19
+
20
+ for (i = 0;i < 32;++i) sk[i] = seed[i];
21
+ for (i = 0;i < 32;++i) sk[32 + i] = pk[i];
22
+ return 0;
23
+ }
24
+
25
+ int crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
26
+ {
27
+ unsigned char seed[32];
28
+
29
+ randombytes(seed,32);
30
+ return crypto_sign_seed_keypair(pk,sk,seed);
31
+ }
@@ -0,0 +1,40 @@
1
+ #include "api.h"
2
+ #include "crypto_hash_sha512.h"
3
+ #include "crypto_verify_32.h"
4
+ #include "ge.h"
5
+ #include "sc.h"
6
+
7
+ int crypto_sign_open(
8
+ unsigned char *m,unsigned long long *mlen,
9
+ const unsigned char *sm,unsigned long long smlen,
10
+ const unsigned char *pk
11
+ )
12
+ {
13
+ unsigned char h[64];
14
+ unsigned char checkr[32];
15
+ ge_p3 A;
16
+ ge_p2 R;
17
+ unsigned long long i;
18
+
19
+ *mlen = -1;
20
+ if (smlen < 64) return -1;
21
+ if (sm[63] & 224) return -1;
22
+ if (ge_frombytes_negate_vartime(&A,pk) != 0) return -1;
23
+
24
+ for (i = 0;i < smlen;++i) m[i] = sm[i];
25
+ for (i = 0;i < 32;++i) m[32 + i] = pk[i];
26
+ crypto_hash_sha512(h,m,smlen);
27
+ sc_reduce(h);
28
+
29
+ ge_double_scalarmult_vartime(&R,h,&A,sm + 32);
30
+ ge_tobytes(checkr,&R);
31
+ if (crypto_verify_32(checkr,sm) != 0) {
32
+ for (i = 0;i < smlen;++i) m[i] = 0;
33
+ return -1;
34
+ }
35
+
36
+ for (i = 0;i < smlen - 64;++i) m[i] = sm[64 + i];
37
+ for (i = smlen - 64;i < smlen;++i) m[i] = 0;
38
+ *mlen = smlen - 64;
39
+ return 0;
40
+ }
@@ -0,0 +1,160 @@
1
+
2
+ /* qhasm: fe z1 */
3
+
4
+ /* qhasm: fe z2 */
5
+
6
+ /* qhasm: fe z8 */
7
+
8
+ /* qhasm: fe z9 */
9
+
10
+ /* qhasm: fe z11 */
11
+
12
+ /* qhasm: fe z22 */
13
+
14
+ /* qhasm: fe z_5_0 */
15
+
16
+ /* qhasm: fe z_10_5 */
17
+
18
+ /* qhasm: fe z_10_0 */
19
+
20
+ /* qhasm: fe z_20_10 */
21
+
22
+ /* qhasm: fe z_20_0 */
23
+
24
+ /* qhasm: fe z_40_20 */
25
+
26
+ /* qhasm: fe z_40_0 */
27
+
28
+ /* qhasm: fe z_50_10 */
29
+
30
+ /* qhasm: fe z_50_0 */
31
+
32
+ /* qhasm: fe z_100_50 */
33
+
34
+ /* qhasm: fe z_100_0 */
35
+
36
+ /* qhasm: fe z_200_100 */
37
+
38
+ /* qhasm: fe z_200_0 */
39
+
40
+ /* qhasm: fe z_250_50 */
41
+
42
+ /* qhasm: fe z_250_0 */
43
+
44
+ /* qhasm: fe z_252_2 */
45
+
46
+ /* qhasm: fe z_252_3 */
47
+
48
+ /* qhasm: enter pow22523 */
49
+
50
+ /* qhasm: z2 = z1^2^1 */
51
+ /* asm 1: fe_sq(>z2=fe#1,<z1=fe#11); for (i = 1;i < 1;++i) fe_sq(>z2=fe#1,>z2=fe#1); */
52
+ /* asm 2: fe_sq(>z2=t0,<z1=z); for (i = 1;i < 1;++i) fe_sq(>z2=t0,>z2=t0); */
53
+ fe_sq(t0,z); for (i = 1;i < 1;++i) fe_sq(t0,t0);
54
+
55
+ /* qhasm: z8 = z2^2^2 */
56
+ /* asm 1: fe_sq(>z8=fe#2,<z2=fe#1); for (i = 1;i < 2;++i) fe_sq(>z8=fe#2,>z8=fe#2); */
57
+ /* asm 2: fe_sq(>z8=t1,<z2=t0); for (i = 1;i < 2;++i) fe_sq(>z8=t1,>z8=t1); */
58
+ fe_sq(t1,t0); for (i = 1;i < 2;++i) fe_sq(t1,t1);
59
+
60
+ /* qhasm: z9 = z1*z8 */
61
+ /* asm 1: fe_mul(>z9=fe#2,<z1=fe#11,<z8=fe#2); */
62
+ /* asm 2: fe_mul(>z9=t1,<z1=z,<z8=t1); */
63
+ fe_mul(t1,z,t1);
64
+
65
+ /* qhasm: z11 = z2*z9 */
66
+ /* asm 1: fe_mul(>z11=fe#1,<z2=fe#1,<z9=fe#2); */
67
+ /* asm 2: fe_mul(>z11=t0,<z2=t0,<z9=t1); */
68
+ fe_mul(t0,t0,t1);
69
+
70
+ /* qhasm: z22 = z11^2^1 */
71
+ /* asm 1: fe_sq(>z22=fe#1,<z11=fe#1); for (i = 1;i < 1;++i) fe_sq(>z22=fe#1,>z22=fe#1); */
72
+ /* asm 2: fe_sq(>z22=t0,<z11=t0); for (i = 1;i < 1;++i) fe_sq(>z22=t0,>z22=t0); */
73
+ fe_sq(t0,t0); for (i = 1;i < 1;++i) fe_sq(t0,t0);
74
+
75
+ /* qhasm: z_5_0 = z9*z22 */
76
+ /* asm 1: fe_mul(>z_5_0=fe#1,<z9=fe#2,<z22=fe#1); */
77
+ /* asm 2: fe_mul(>z_5_0=t0,<z9=t1,<z22=t0); */
78
+ fe_mul(t0,t1,t0);
79
+
80
+ /* qhasm: z_10_5 = z_5_0^2^5 */
81
+ /* asm 1: fe_sq(>z_10_5=fe#2,<z_5_0=fe#1); for (i = 1;i < 5;++i) fe_sq(>z_10_5=fe#2,>z_10_5=fe#2); */
82
+ /* asm 2: fe_sq(>z_10_5=t1,<z_5_0=t0); for (i = 1;i < 5;++i) fe_sq(>z_10_5=t1,>z_10_5=t1); */
83
+ fe_sq(t1,t0); for (i = 1;i < 5;++i) fe_sq(t1,t1);
84
+
85
+ /* qhasm: z_10_0 = z_10_5*z_5_0 */
86
+ /* asm 1: fe_mul(>z_10_0=fe#1,<z_10_5=fe#2,<z_5_0=fe#1); */
87
+ /* asm 2: fe_mul(>z_10_0=t0,<z_10_5=t1,<z_5_0=t0); */
88
+ fe_mul(t0,t1,t0);
89
+
90
+ /* qhasm: z_20_10 = z_10_0^2^10 */
91
+ /* asm 1: fe_sq(>z_20_10=fe#2,<z_10_0=fe#1); for (i = 1;i < 10;++i) fe_sq(>z_20_10=fe#2,>z_20_10=fe#2); */
92
+ /* asm 2: fe_sq(>z_20_10=t1,<z_10_0=t0); for (i = 1;i < 10;++i) fe_sq(>z_20_10=t1,>z_20_10=t1); */
93
+ fe_sq(t1,t0); for (i = 1;i < 10;++i) fe_sq(t1,t1);
94
+
95
+ /* qhasm: z_20_0 = z_20_10*z_10_0 */
96
+ /* asm 1: fe_mul(>z_20_0=fe#2,<z_20_10=fe#2,<z_10_0=fe#1); */
97
+ /* asm 2: fe_mul(>z_20_0=t1,<z_20_10=t1,<z_10_0=t0); */
98
+ fe_mul(t1,t1,t0);
99
+
100
+ /* qhasm: z_40_20 = z_20_0^2^20 */
101
+ /* asm 1: fe_sq(>z_40_20=fe#3,<z_20_0=fe#2); for (i = 1;i < 20;++i) fe_sq(>z_40_20=fe#3,>z_40_20=fe#3); */
102
+ /* asm 2: fe_sq(>z_40_20=t2,<z_20_0=t1); for (i = 1;i < 20;++i) fe_sq(>z_40_20=t2,>z_40_20=t2); */
103
+ fe_sq(t2,t1); for (i = 1;i < 20;++i) fe_sq(t2,t2);
104
+
105
+ /* qhasm: z_40_0 = z_40_20*z_20_0 */
106
+ /* asm 1: fe_mul(>z_40_0=fe#2,<z_40_20=fe#3,<z_20_0=fe#2); */
107
+ /* asm 2: fe_mul(>z_40_0=t1,<z_40_20=t2,<z_20_0=t1); */
108
+ fe_mul(t1,t2,t1);
109
+
110
+ /* qhasm: z_50_10 = z_40_0^2^10 */
111
+ /* asm 1: fe_sq(>z_50_10=fe#2,<z_40_0=fe#2); for (i = 1;i < 10;++i) fe_sq(>z_50_10=fe#2,>z_50_10=fe#2); */
112
+ /* asm 2: fe_sq(>z_50_10=t1,<z_40_0=t1); for (i = 1;i < 10;++i) fe_sq(>z_50_10=t1,>z_50_10=t1); */
113
+ fe_sq(t1,t1); for (i = 1;i < 10;++i) fe_sq(t1,t1);
114
+
115
+ /* qhasm: z_50_0 = z_50_10*z_10_0 */
116
+ /* asm 1: fe_mul(>z_50_0=fe#1,<z_50_10=fe#2,<z_10_0=fe#1); */
117
+ /* asm 2: fe_mul(>z_50_0=t0,<z_50_10=t1,<z_10_0=t0); */
118
+ fe_mul(t0,t1,t0);
119
+
120
+ /* qhasm: z_100_50 = z_50_0^2^50 */
121
+ /* asm 1: fe_sq(>z_100_50=fe#2,<z_50_0=fe#1); for (i = 1;i < 50;++i) fe_sq(>z_100_50=fe#2,>z_100_50=fe#2); */
122
+ /* asm 2: fe_sq(>z_100_50=t1,<z_50_0=t0); for (i = 1;i < 50;++i) fe_sq(>z_100_50=t1,>z_100_50=t1); */
123
+ fe_sq(t1,t0); for (i = 1;i < 50;++i) fe_sq(t1,t1);
124
+
125
+ /* qhasm: z_100_0 = z_100_50*z_50_0 */
126
+ /* asm 1: fe_mul(>z_100_0=fe#2,<z_100_50=fe#2,<z_50_0=fe#1); */
127
+ /* asm 2: fe_mul(>z_100_0=t1,<z_100_50=t1,<z_50_0=t0); */
128
+ fe_mul(t1,t1,t0);
129
+
130
+ /* qhasm: z_200_100 = z_100_0^2^100 */
131
+ /* asm 1: fe_sq(>z_200_100=fe#3,<z_100_0=fe#2); for (i = 1;i < 100;++i) fe_sq(>z_200_100=fe#3,>z_200_100=fe#3); */
132
+ /* asm 2: fe_sq(>z_200_100=t2,<z_100_0=t1); for (i = 1;i < 100;++i) fe_sq(>z_200_100=t2,>z_200_100=t2); */
133
+ fe_sq(t2,t1); for (i = 1;i < 100;++i) fe_sq(t2,t2);
134
+
135
+ /* qhasm: z_200_0 = z_200_100*z_100_0 */
136
+ /* asm 1: fe_mul(>z_200_0=fe#2,<z_200_100=fe#3,<z_100_0=fe#2); */
137
+ /* asm 2: fe_mul(>z_200_0=t1,<z_200_100=t2,<z_100_0=t1); */
138
+ fe_mul(t1,t2,t1);
139
+
140
+ /* qhasm: z_250_50 = z_200_0^2^50 */
141
+ /* asm 1: fe_sq(>z_250_50=fe#2,<z_200_0=fe#2); for (i = 1;i < 50;++i) fe_sq(>z_250_50=fe#2,>z_250_50=fe#2); */
142
+ /* asm 2: fe_sq(>z_250_50=t1,<z_200_0=t1); for (i = 1;i < 50;++i) fe_sq(>z_250_50=t1,>z_250_50=t1); */
143
+ fe_sq(t1,t1); for (i = 1;i < 50;++i) fe_sq(t1,t1);
144
+
145
+ /* qhasm: z_250_0 = z_250_50*z_50_0 */
146
+ /* asm 1: fe_mul(>z_250_0=fe#1,<z_250_50=fe#2,<z_50_0=fe#1); */
147
+ /* asm 2: fe_mul(>z_250_0=t0,<z_250_50=t1,<z_50_0=t0); */
148
+ fe_mul(t0,t1,t0);
149
+
150
+ /* qhasm: z_252_2 = z_250_0^2^2 */
151
+ /* asm 1: fe_sq(>z_252_2=fe#1,<z_250_0=fe#1); for (i = 1;i < 2;++i) fe_sq(>z_252_2=fe#1,>z_252_2=fe#1); */
152
+ /* asm 2: fe_sq(>z_252_2=t0,<z_250_0=t0); for (i = 1;i < 2;++i) fe_sq(>z_252_2=t0,>z_252_2=t0); */
153
+ fe_sq(t0,t0); for (i = 1;i < 2;++i) fe_sq(t0,t0);
154
+
155
+ /* qhasm: z_252_3 = z_252_2*z1 */
156
+ /* asm 1: fe_mul(>z_252_3=fe#12,<z_252_2=fe#1,<z1=fe#11); */
157
+ /* asm 2: fe_mul(>z_252_3=out,<z_252_2=t0,<z1=z); */
158
+ fe_mul(out,t0,z);
159
+
160
+ /* qhasm: return */
@@ -0,0 +1,160 @@
1
+
2
+ /* qhasm: fe z1 */
3
+
4
+ /* qhasm: fe z2 */
5
+
6
+ /* qhasm: fe z8 */
7
+
8
+ /* qhasm: fe z9 */
9
+
10
+ /* qhasm: fe z11 */
11
+
12
+ /* qhasm: fe z22 */
13
+
14
+ /* qhasm: fe z_5_0 */
15
+
16
+ /* qhasm: fe z_10_5 */
17
+
18
+ /* qhasm: fe z_10_0 */
19
+
20
+ /* qhasm: fe z_20_10 */
21
+
22
+ /* qhasm: fe z_20_0 */
23
+
24
+ /* qhasm: fe z_40_20 */
25
+
26
+ /* qhasm: fe z_40_0 */
27
+
28
+ /* qhasm: fe z_50_10 */
29
+
30
+ /* qhasm: fe z_50_0 */
31
+
32
+ /* qhasm: fe z_100_50 */
33
+
34
+ /* qhasm: fe z_100_0 */
35
+
36
+ /* qhasm: fe z_200_100 */
37
+
38
+ /* qhasm: fe z_200_0 */
39
+
40
+ /* qhasm: fe z_250_50 */
41
+
42
+ /* qhasm: fe z_250_0 */
43
+
44
+ /* qhasm: fe z_255_5 */
45
+
46
+ /* qhasm: fe z_255_21 */
47
+
48
+ /* qhasm: enter pow225521 */
49
+
50
+ /* qhasm: z2 = z1^2^1 */
51
+ /* asm 1: fe_sq(>z2=fe#1,<z1=fe#11); for (i = 1;i < 1;++i) fe_sq(>z2=fe#1,>z2=fe#1); */
52
+ /* asm 2: fe_sq(>z2=t0,<z1=z); for (i = 1;i < 1;++i) fe_sq(>z2=t0,>z2=t0); */
53
+ fe_sq(t0,z); for (i = 1;i < 1;++i) fe_sq(t0,t0);
54
+
55
+ /* qhasm: z8 = z2^2^2 */
56
+ /* asm 1: fe_sq(>z8=fe#2,<z2=fe#1); for (i = 1;i < 2;++i) fe_sq(>z8=fe#2,>z8=fe#2); */
57
+ /* asm 2: fe_sq(>z8=t1,<z2=t0); for (i = 1;i < 2;++i) fe_sq(>z8=t1,>z8=t1); */
58
+ fe_sq(t1,t0); for (i = 1;i < 2;++i) fe_sq(t1,t1);
59
+
60
+ /* qhasm: z9 = z1*z8 */
61
+ /* asm 1: fe_mul(>z9=fe#2,<z1=fe#11,<z8=fe#2); */
62
+ /* asm 2: fe_mul(>z9=t1,<z1=z,<z8=t1); */
63
+ fe_mul(t1,z,t1);
64
+
65
+ /* qhasm: z11 = z2*z9 */
66
+ /* asm 1: fe_mul(>z11=fe#1,<z2=fe#1,<z9=fe#2); */
67
+ /* asm 2: fe_mul(>z11=t0,<z2=t0,<z9=t1); */
68
+ fe_mul(t0,t0,t1);
69
+
70
+ /* qhasm: z22 = z11^2^1 */
71
+ /* asm 1: fe_sq(>z22=fe#3,<z11=fe#1); for (i = 1;i < 1;++i) fe_sq(>z22=fe#3,>z22=fe#3); */
72
+ /* asm 2: fe_sq(>z22=t2,<z11=t0); for (i = 1;i < 1;++i) fe_sq(>z22=t2,>z22=t2); */
73
+ fe_sq(t2,t0); for (i = 1;i < 1;++i) fe_sq(t2,t2);
74
+
75
+ /* qhasm: z_5_0 = z9*z22 */
76
+ /* asm 1: fe_mul(>z_5_0=fe#2,<z9=fe#2,<z22=fe#3); */
77
+ /* asm 2: fe_mul(>z_5_0=t1,<z9=t1,<z22=t2); */
78
+ fe_mul(t1,t1,t2);
79
+
80
+ /* qhasm: z_10_5 = z_5_0^2^5 */
81
+ /* asm 1: fe_sq(>z_10_5=fe#3,<z_5_0=fe#2); for (i = 1;i < 5;++i) fe_sq(>z_10_5=fe#3,>z_10_5=fe#3); */
82
+ /* asm 2: fe_sq(>z_10_5=t2,<z_5_0=t1); for (i = 1;i < 5;++i) fe_sq(>z_10_5=t2,>z_10_5=t2); */
83
+ fe_sq(t2,t1); for (i = 1;i < 5;++i) fe_sq(t2,t2);
84
+
85
+ /* qhasm: z_10_0 = z_10_5*z_5_0 */
86
+ /* asm 1: fe_mul(>z_10_0=fe#2,<z_10_5=fe#3,<z_5_0=fe#2); */
87
+ /* asm 2: fe_mul(>z_10_0=t1,<z_10_5=t2,<z_5_0=t1); */
88
+ fe_mul(t1,t2,t1);
89
+
90
+ /* qhasm: z_20_10 = z_10_0^2^10 */
91
+ /* asm 1: fe_sq(>z_20_10=fe#3,<z_10_0=fe#2); for (i = 1;i < 10;++i) fe_sq(>z_20_10=fe#3,>z_20_10=fe#3); */
92
+ /* asm 2: fe_sq(>z_20_10=t2,<z_10_0=t1); for (i = 1;i < 10;++i) fe_sq(>z_20_10=t2,>z_20_10=t2); */
93
+ fe_sq(t2,t1); for (i = 1;i < 10;++i) fe_sq(t2,t2);
94
+
95
+ /* qhasm: z_20_0 = z_20_10*z_10_0 */
96
+ /* asm 1: fe_mul(>z_20_0=fe#3,<z_20_10=fe#3,<z_10_0=fe#2); */
97
+ /* asm 2: fe_mul(>z_20_0=t2,<z_20_10=t2,<z_10_0=t1); */
98
+ fe_mul(t2,t2,t1);
99
+
100
+ /* qhasm: z_40_20 = z_20_0^2^20 */
101
+ /* asm 1: fe_sq(>z_40_20=fe#4,<z_20_0=fe#3); for (i = 1;i < 20;++i) fe_sq(>z_40_20=fe#4,>z_40_20=fe#4); */
102
+ /* asm 2: fe_sq(>z_40_20=t3,<z_20_0=t2); for (i = 1;i < 20;++i) fe_sq(>z_40_20=t3,>z_40_20=t3); */
103
+ fe_sq(t3,t2); for (i = 1;i < 20;++i) fe_sq(t3,t3);
104
+
105
+ /* qhasm: z_40_0 = z_40_20*z_20_0 */
106
+ /* asm 1: fe_mul(>z_40_0=fe#3,<z_40_20=fe#4,<z_20_0=fe#3); */
107
+ /* asm 2: fe_mul(>z_40_0=t2,<z_40_20=t3,<z_20_0=t2); */
108
+ fe_mul(t2,t3,t2);
109
+
110
+ /* qhasm: z_50_10 = z_40_0^2^10 */
111
+ /* asm 1: fe_sq(>z_50_10=fe#3,<z_40_0=fe#3); for (i = 1;i < 10;++i) fe_sq(>z_50_10=fe#3,>z_50_10=fe#3); */
112
+ /* asm 2: fe_sq(>z_50_10=t2,<z_40_0=t2); for (i = 1;i < 10;++i) fe_sq(>z_50_10=t2,>z_50_10=t2); */
113
+ fe_sq(t2,t2); for (i = 1;i < 10;++i) fe_sq(t2,t2);
114
+
115
+ /* qhasm: z_50_0 = z_50_10*z_10_0 */
116
+ /* asm 1: fe_mul(>z_50_0=fe#2,<z_50_10=fe#3,<z_10_0=fe#2); */
117
+ /* asm 2: fe_mul(>z_50_0=t1,<z_50_10=t2,<z_10_0=t1); */
118
+ fe_mul(t1,t2,t1);
119
+
120
+ /* qhasm: z_100_50 = z_50_0^2^50 */
121
+ /* asm 1: fe_sq(>z_100_50=fe#3,<z_50_0=fe#2); for (i = 1;i < 50;++i) fe_sq(>z_100_50=fe#3,>z_100_50=fe#3); */
122
+ /* asm 2: fe_sq(>z_100_50=t2,<z_50_0=t1); for (i = 1;i < 50;++i) fe_sq(>z_100_50=t2,>z_100_50=t2); */
123
+ fe_sq(t2,t1); for (i = 1;i < 50;++i) fe_sq(t2,t2);
124
+
125
+ /* qhasm: z_100_0 = z_100_50*z_50_0 */
126
+ /* asm 1: fe_mul(>z_100_0=fe#3,<z_100_50=fe#3,<z_50_0=fe#2); */
127
+ /* asm 2: fe_mul(>z_100_0=t2,<z_100_50=t2,<z_50_0=t1); */
128
+ fe_mul(t2,t2,t1);
129
+
130
+ /* qhasm: z_200_100 = z_100_0^2^100 */
131
+ /* asm 1: fe_sq(>z_200_100=fe#4,<z_100_0=fe#3); for (i = 1;i < 100;++i) fe_sq(>z_200_100=fe#4,>z_200_100=fe#4); */
132
+ /* asm 2: fe_sq(>z_200_100=t3,<z_100_0=t2); for (i = 1;i < 100;++i) fe_sq(>z_200_100=t3,>z_200_100=t3); */
133
+ fe_sq(t3,t2); for (i = 1;i < 100;++i) fe_sq(t3,t3);
134
+
135
+ /* qhasm: z_200_0 = z_200_100*z_100_0 */
136
+ /* asm 1: fe_mul(>z_200_0=fe#3,<z_200_100=fe#4,<z_100_0=fe#3); */
137
+ /* asm 2: fe_mul(>z_200_0=t2,<z_200_100=t3,<z_100_0=t2); */
138
+ fe_mul(t2,t3,t2);
139
+
140
+ /* qhasm: z_250_50 = z_200_0^2^50 */
141
+ /* asm 1: fe_sq(>z_250_50=fe#3,<z_200_0=fe#3); for (i = 1;i < 50;++i) fe_sq(>z_250_50=fe#3,>z_250_50=fe#3); */
142
+ /* asm 2: fe_sq(>z_250_50=t2,<z_200_0=t2); for (i = 1;i < 50;++i) fe_sq(>z_250_50=t2,>z_250_50=t2); */
143
+ fe_sq(t2,t2); for (i = 1;i < 50;++i) fe_sq(t2,t2);
144
+
145
+ /* qhasm: z_250_0 = z_250_50*z_50_0 */
146
+ /* asm 1: fe_mul(>z_250_0=fe#2,<z_250_50=fe#3,<z_50_0=fe#2); */
147
+ /* asm 2: fe_mul(>z_250_0=t1,<z_250_50=t2,<z_50_0=t1); */
148
+ fe_mul(t1,t2,t1);
149
+
150
+ /* qhasm: z_255_5 = z_250_0^2^5 */
151
+ /* asm 1: fe_sq(>z_255_5=fe#2,<z_250_0=fe#2); for (i = 1;i < 5;++i) fe_sq(>z_255_5=fe#2,>z_255_5=fe#2); */
152
+ /* asm 2: fe_sq(>z_255_5=t1,<z_250_0=t1); for (i = 1;i < 5;++i) fe_sq(>z_255_5=t1,>z_255_5=t1); */
153
+ fe_sq(t1,t1); for (i = 1;i < 5;++i) fe_sq(t1,t1);
154
+
155
+ /* qhasm: z_255_21 = z_255_5*z11 */
156
+ /* asm 1: fe_mul(>z_255_21=fe#12,<z_255_5=fe#2,<z11=fe#1); */
157
+ /* asm 2: fe_mul(>z_255_21=out,<z_255_5=t1,<z11=t0); */
158
+ fe_mul(out,t1,t0);
159
+
160
+ /* qhasm: return */
@@ -0,0 +1,15 @@
1
+ #ifndef SC_H
2
+ #define SC_H
3
+
4
+ /*
5
+ The set of scalars is \Z/l
6
+ where l = 2^252 + 27742317777372353535851937790883648493.
7
+ */
8
+
9
+ #define sc_reduce crypto_sign_ed25519_ref10_sc_reduce
10
+ #define sc_muladd crypto_sign_ed25519_ref10_sc_muladd
11
+
12
+ extern void sc_reduce(unsigned char *);
13
+ extern void sc_muladd(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *);
14
+
15
+ #endif
@@ -0,0 +1,368 @@
1
+ #include "sc.h"
2
+ #include "crypto_int64.h"
3
+ #include "crypto_uint32.h"
4
+ #include "crypto_uint64.h"
5
+
6
+ static crypto_uint64 load_3(const unsigned char *in)
7
+ {
8
+ crypto_uint64 result;
9
+ result = (crypto_uint64) in[0];
10
+ result |= ((crypto_uint64) in[1]) << 8;
11
+ result |= ((crypto_uint64) in[2]) << 16;
12
+ return result;
13
+ }
14
+
15
+ static crypto_uint64 load_4(const unsigned char *in)
16
+ {
17
+ crypto_uint64 result;
18
+ result = (crypto_uint64) in[0];
19
+ result |= ((crypto_uint64) in[1]) << 8;
20
+ result |= ((crypto_uint64) in[2]) << 16;
21
+ result |= ((crypto_uint64) in[3]) << 24;
22
+ return result;
23
+ }
24
+
25
+ /*
26
+ Input:
27
+ a[0]+256*a[1]+...+256^31*a[31] = a
28
+ b[0]+256*b[1]+...+256^31*b[31] = b
29
+ c[0]+256*c[1]+...+256^31*c[31] = c
30
+
31
+ Output:
32
+ s[0]+256*s[1]+...+256^31*s[31] = (ab+c) mod l
33
+ where l = 2^252 + 27742317777372353535851937790883648493.
34
+ */
35
+
36
+ void sc_muladd(unsigned char *s,const unsigned char *a,const unsigned char *b,const unsigned char *c)
37
+ {
38
+ crypto_int64 a0 = 2097151 & load_3(a);
39
+ crypto_int64 a1 = 2097151 & (load_4(a + 2) >> 5);
40
+ crypto_int64 a2 = 2097151 & (load_3(a + 5) >> 2);
41
+ crypto_int64 a3 = 2097151 & (load_4(a + 7) >> 7);
42
+ crypto_int64 a4 = 2097151 & (load_4(a + 10) >> 4);
43
+ crypto_int64 a5 = 2097151 & (load_3(a + 13) >> 1);
44
+ crypto_int64 a6 = 2097151 & (load_4(a + 15) >> 6);
45
+ crypto_int64 a7 = 2097151 & (load_3(a + 18) >> 3);
46
+ crypto_int64 a8 = 2097151 & load_3(a + 21);
47
+ crypto_int64 a9 = 2097151 & (load_4(a + 23) >> 5);
48
+ crypto_int64 a10 = 2097151 & (load_3(a + 26) >> 2);
49
+ crypto_int64 a11 = (load_4(a + 28) >> 7);
50
+ crypto_int64 b0 = 2097151 & load_3(b);
51
+ crypto_int64 b1 = 2097151 & (load_4(b + 2) >> 5);
52
+ crypto_int64 b2 = 2097151 & (load_3(b + 5) >> 2);
53
+ crypto_int64 b3 = 2097151 & (load_4(b + 7) >> 7);
54
+ crypto_int64 b4 = 2097151 & (load_4(b + 10) >> 4);
55
+ crypto_int64 b5 = 2097151 & (load_3(b + 13) >> 1);
56
+ crypto_int64 b6 = 2097151 & (load_4(b + 15) >> 6);
57
+ crypto_int64 b7 = 2097151 & (load_3(b + 18) >> 3);
58
+ crypto_int64 b8 = 2097151 & load_3(b + 21);
59
+ crypto_int64 b9 = 2097151 & (load_4(b + 23) >> 5);
60
+ crypto_int64 b10 = 2097151 & (load_3(b + 26) >> 2);
61
+ crypto_int64 b11 = (load_4(b + 28) >> 7);
62
+ crypto_int64 c0 = 2097151 & load_3(c);
63
+ crypto_int64 c1 = 2097151 & (load_4(c + 2) >> 5);
64
+ crypto_int64 c2 = 2097151 & (load_3(c + 5) >> 2);
65
+ crypto_int64 c3 = 2097151 & (load_4(c + 7) >> 7);
66
+ crypto_int64 c4 = 2097151 & (load_4(c + 10) >> 4);
67
+ crypto_int64 c5 = 2097151 & (load_3(c + 13) >> 1);
68
+ crypto_int64 c6 = 2097151 & (load_4(c + 15) >> 6);
69
+ crypto_int64 c7 = 2097151 & (load_3(c + 18) >> 3);
70
+ crypto_int64 c8 = 2097151 & load_3(c + 21);
71
+ crypto_int64 c9 = 2097151 & (load_4(c + 23) >> 5);
72
+ crypto_int64 c10 = 2097151 & (load_3(c + 26) >> 2);
73
+ crypto_int64 c11 = (load_4(c + 28) >> 7);
74
+ crypto_int64 s0;
75
+ crypto_int64 s1;
76
+ crypto_int64 s2;
77
+ crypto_int64 s3;
78
+ crypto_int64 s4;
79
+ crypto_int64 s5;
80
+ crypto_int64 s6;
81
+ crypto_int64 s7;
82
+ crypto_int64 s8;
83
+ crypto_int64 s9;
84
+ crypto_int64 s10;
85
+ crypto_int64 s11;
86
+ crypto_int64 s12;
87
+ crypto_int64 s13;
88
+ crypto_int64 s14;
89
+ crypto_int64 s15;
90
+ crypto_int64 s16;
91
+ crypto_int64 s17;
92
+ crypto_int64 s18;
93
+ crypto_int64 s19;
94
+ crypto_int64 s20;
95
+ crypto_int64 s21;
96
+ crypto_int64 s22;
97
+ crypto_int64 s23;
98
+ crypto_int64 carry0;
99
+ crypto_int64 carry1;
100
+ crypto_int64 carry2;
101
+ crypto_int64 carry3;
102
+ crypto_int64 carry4;
103
+ crypto_int64 carry5;
104
+ crypto_int64 carry6;
105
+ crypto_int64 carry7;
106
+ crypto_int64 carry8;
107
+ crypto_int64 carry9;
108
+ crypto_int64 carry10;
109
+ crypto_int64 carry11;
110
+ crypto_int64 carry12;
111
+ crypto_int64 carry13;
112
+ crypto_int64 carry14;
113
+ crypto_int64 carry15;
114
+ crypto_int64 carry16;
115
+ crypto_int64 carry17;
116
+ crypto_int64 carry18;
117
+ crypto_int64 carry19;
118
+ crypto_int64 carry20;
119
+ crypto_int64 carry21;
120
+ crypto_int64 carry22;
121
+
122
+ s0 = c0 + a0*b0;
123
+ s1 = c1 + a0*b1 + a1*b0;
124
+ s2 = c2 + a0*b2 + a1*b1 + a2*b0;
125
+ s3 = c3 + a0*b3 + a1*b2 + a2*b1 + a3*b0;
126
+ s4 = c4 + a0*b4 + a1*b3 + a2*b2 + a3*b1 + a4*b0;
127
+ s5 = c5 + a0*b5 + a1*b4 + a2*b3 + a3*b2 + a4*b1 + a5*b0;
128
+ s6 = c6 + a0*b6 + a1*b5 + a2*b4 + a3*b3 + a4*b2 + a5*b1 + a6*b0;
129
+ s7 = c7 + a0*b7 + a1*b6 + a2*b5 + a3*b4 + a4*b3 + a5*b2 + a6*b1 + a7*b0;
130
+ s8 = c8 + a0*b8 + a1*b7 + a2*b6 + a3*b5 + a4*b4 + a5*b3 + a6*b2 + a7*b1 + a8*b0;
131
+ s9 = c9 + a0*b9 + a1*b8 + a2*b7 + a3*b6 + a4*b5 + a5*b4 + a6*b3 + a7*b2 + a8*b1 + a9*b0;
132
+ s10 = c10 + a0*b10 + a1*b9 + a2*b8 + a3*b7 + a4*b6 + a5*b5 + a6*b4 + a7*b3 + a8*b2 + a9*b1 + a10*b0;
133
+ s11 = c11 + a0*b11 + a1*b10 + a2*b9 + a3*b8 + a4*b7 + a5*b6 + a6*b5 + a7*b4 + a8*b3 + a9*b2 + a10*b1 + a11*b0;
134
+ s12 = a1*b11 + a2*b10 + a3*b9 + a4*b8 + a5*b7 + a6*b6 + a7*b5 + a8*b4 + a9*b3 + a10*b2 + a11*b1;
135
+ s13 = a2*b11 + a3*b10 + a4*b9 + a5*b8 + a6*b7 + a7*b6 + a8*b5 + a9*b4 + a10*b3 + a11*b2;
136
+ s14 = a3*b11 + a4*b10 + a5*b9 + a6*b8 + a7*b7 + a8*b6 + a9*b5 + a10*b4 + a11*b3;
137
+ s15 = a4*b11 + a5*b10 + a6*b9 + a7*b8 + a8*b7 + a9*b6 + a10*b5 + a11*b4;
138
+ s16 = a5*b11 + a6*b10 + a7*b9 + a8*b8 + a9*b7 + a10*b6 + a11*b5;
139
+ s17 = a6*b11 + a7*b10 + a8*b9 + a9*b8 + a10*b7 + a11*b6;
140
+ s18 = a7*b11 + a8*b10 + a9*b9 + a10*b8 + a11*b7;
141
+ s19 = a8*b11 + a9*b10 + a10*b9 + a11*b8;
142
+ s20 = a9*b11 + a10*b10 + a11*b9;
143
+ s21 = a10*b11 + a11*b10;
144
+ s22 = a11*b11;
145
+ s23 = 0;
146
+
147
+ carry0 = (s0 + (1<<20)) >> 21; s1 += carry0; s0 -= carry0 << 21;
148
+ carry2 = (s2 + (1<<20)) >> 21; s3 += carry2; s2 -= carry2 << 21;
149
+ carry4 = (s4 + (1<<20)) >> 21; s5 += carry4; s4 -= carry4 << 21;
150
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
151
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
152
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
153
+ carry12 = (s12 + (1<<20)) >> 21; s13 += carry12; s12 -= carry12 << 21;
154
+ carry14 = (s14 + (1<<20)) >> 21; s15 += carry14; s14 -= carry14 << 21;
155
+ carry16 = (s16 + (1<<20)) >> 21; s17 += carry16; s16 -= carry16 << 21;
156
+ carry18 = (s18 + (1<<20)) >> 21; s19 += carry18; s18 -= carry18 << 21;
157
+ carry20 = (s20 + (1<<20)) >> 21; s21 += carry20; s20 -= carry20 << 21;
158
+ carry22 = (s22 + (1<<20)) >> 21; s23 += carry22; s22 -= carry22 << 21;
159
+
160
+ carry1 = (s1 + (1<<20)) >> 21; s2 += carry1; s1 -= carry1 << 21;
161
+ carry3 = (s3 + (1<<20)) >> 21; s4 += carry3; s3 -= carry3 << 21;
162
+ carry5 = (s5 + (1<<20)) >> 21; s6 += carry5; s5 -= carry5 << 21;
163
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
164
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
165
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
166
+ carry13 = (s13 + (1<<20)) >> 21; s14 += carry13; s13 -= carry13 << 21;
167
+ carry15 = (s15 + (1<<20)) >> 21; s16 += carry15; s15 -= carry15 << 21;
168
+ carry17 = (s17 + (1<<20)) >> 21; s18 += carry17; s17 -= carry17 << 21;
169
+ carry19 = (s19 + (1<<20)) >> 21; s20 += carry19; s19 -= carry19 << 21;
170
+ carry21 = (s21 + (1<<20)) >> 21; s22 += carry21; s21 -= carry21 << 21;
171
+
172
+ s11 += s23 * 666643;
173
+ s12 += s23 * 470296;
174
+ s13 += s23 * 654183;
175
+ s14 -= s23 * 997805;
176
+ s15 += s23 * 136657;
177
+ s16 -= s23 * 683901;
178
+
179
+
180
+ s10 += s22 * 666643;
181
+ s11 += s22 * 470296;
182
+ s12 += s22 * 654183;
183
+ s13 -= s22 * 997805;
184
+ s14 += s22 * 136657;
185
+ s15 -= s22 * 683901;
186
+
187
+
188
+ s9 += s21 * 666643;
189
+ s10 += s21 * 470296;
190
+ s11 += s21 * 654183;
191
+ s12 -= s21 * 997805;
192
+ s13 += s21 * 136657;
193
+ s14 -= s21 * 683901;
194
+
195
+
196
+ s8 += s20 * 666643;
197
+ s9 += s20 * 470296;
198
+ s10 += s20 * 654183;
199
+ s11 -= s20 * 997805;
200
+ s12 += s20 * 136657;
201
+ s13 -= s20 * 683901;
202
+
203
+
204
+ s7 += s19 * 666643;
205
+ s8 += s19 * 470296;
206
+ s9 += s19 * 654183;
207
+ s10 -= s19 * 997805;
208
+ s11 += s19 * 136657;
209
+ s12 -= s19 * 683901;
210
+
211
+
212
+ s6 += s18 * 666643;
213
+ s7 += s18 * 470296;
214
+ s8 += s18 * 654183;
215
+ s9 -= s18 * 997805;
216
+ s10 += s18 * 136657;
217
+ s11 -= s18 * 683901;
218
+
219
+
220
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
221
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
222
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
223
+ carry12 = (s12 + (1<<20)) >> 21; s13 += carry12; s12 -= carry12 << 21;
224
+ carry14 = (s14 + (1<<20)) >> 21; s15 += carry14; s14 -= carry14 << 21;
225
+ carry16 = (s16 + (1<<20)) >> 21; s17 += carry16; s16 -= carry16 << 21;
226
+
227
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
228
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
229
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
230
+ carry13 = (s13 + (1<<20)) >> 21; s14 += carry13; s13 -= carry13 << 21;
231
+ carry15 = (s15 + (1<<20)) >> 21; s16 += carry15; s15 -= carry15 << 21;
232
+
233
+ s5 += s17 * 666643;
234
+ s6 += s17 * 470296;
235
+ s7 += s17 * 654183;
236
+ s8 -= s17 * 997805;
237
+ s9 += s17 * 136657;
238
+ s10 -= s17 * 683901;
239
+
240
+
241
+ s4 += s16 * 666643;
242
+ s5 += s16 * 470296;
243
+ s6 += s16 * 654183;
244
+ s7 -= s16 * 997805;
245
+ s8 += s16 * 136657;
246
+ s9 -= s16 * 683901;
247
+
248
+
249
+ s3 += s15 * 666643;
250
+ s4 += s15 * 470296;
251
+ s5 += s15 * 654183;
252
+ s6 -= s15 * 997805;
253
+ s7 += s15 * 136657;
254
+ s8 -= s15 * 683901;
255
+
256
+
257
+ s2 += s14 * 666643;
258
+ s3 += s14 * 470296;
259
+ s4 += s14 * 654183;
260
+ s5 -= s14 * 997805;
261
+ s6 += s14 * 136657;
262
+ s7 -= s14 * 683901;
263
+
264
+
265
+ s1 += s13 * 666643;
266
+ s2 += s13 * 470296;
267
+ s3 += s13 * 654183;
268
+ s4 -= s13 * 997805;
269
+ s5 += s13 * 136657;
270
+ s6 -= s13 * 683901;
271
+
272
+
273
+ s0 += s12 * 666643;
274
+ s1 += s12 * 470296;
275
+ s2 += s12 * 654183;
276
+ s3 -= s12 * 997805;
277
+ s4 += s12 * 136657;
278
+ s5 -= s12 * 683901;
279
+ s12 = 0;
280
+
281
+ carry0 = (s0 + (1<<20)) >> 21; s1 += carry0; s0 -= carry0 << 21;
282
+ carry2 = (s2 + (1<<20)) >> 21; s3 += carry2; s2 -= carry2 << 21;
283
+ carry4 = (s4 + (1<<20)) >> 21; s5 += carry4; s4 -= carry4 << 21;
284
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
285
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
286
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
287
+
288
+ carry1 = (s1 + (1<<20)) >> 21; s2 += carry1; s1 -= carry1 << 21;
289
+ carry3 = (s3 + (1<<20)) >> 21; s4 += carry3; s3 -= carry3 << 21;
290
+ carry5 = (s5 + (1<<20)) >> 21; s6 += carry5; s5 -= carry5 << 21;
291
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
292
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
293
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
294
+
295
+ s0 += s12 * 666643;
296
+ s1 += s12 * 470296;
297
+ s2 += s12 * 654183;
298
+ s3 -= s12 * 997805;
299
+ s4 += s12 * 136657;
300
+ s5 -= s12 * 683901;
301
+ s12 = 0;
302
+
303
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
304
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
305
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
306
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
307
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
308
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
309
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
310
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
311
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
312
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
313
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
314
+ carry11 = s11 >> 21; s12 += carry11; s11 -= carry11 << 21;
315
+
316
+ s0 += s12 * 666643;
317
+ s1 += s12 * 470296;
318
+ s2 += s12 * 654183;
319
+ s3 -= s12 * 997805;
320
+ s4 += s12 * 136657;
321
+ s5 -= s12 * 683901;
322
+
323
+
324
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
325
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
326
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
327
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
328
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
329
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
330
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
331
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
332
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
333
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
334
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
335
+
336
+ s[0] = s0 >> 0;
337
+ s[1] = s0 >> 8;
338
+ s[2] = (s0 >> 16) | (s1 << 5);
339
+ s[3] = s1 >> 3;
340
+ s[4] = s1 >> 11;
341
+ s[5] = (s1 >> 19) | (s2 << 2);
342
+ s[6] = s2 >> 6;
343
+ s[7] = (s2 >> 14) | (s3 << 7);
344
+ s[8] = s3 >> 1;
345
+ s[9] = s3 >> 9;
346
+ s[10] = (s3 >> 17) | (s4 << 4);
347
+ s[11] = s4 >> 4;
348
+ s[12] = s4 >> 12;
349
+ s[13] = (s4 >> 20) | (s5 << 1);
350
+ s[14] = s5 >> 7;
351
+ s[15] = (s5 >> 15) | (s6 << 6);
352
+ s[16] = s6 >> 2;
353
+ s[17] = s6 >> 10;
354
+ s[18] = (s6 >> 18) | (s7 << 3);
355
+ s[19] = s7 >> 5;
356
+ s[20] = s7 >> 13;
357
+ s[21] = s8 >> 0;
358
+ s[22] = s8 >> 8;
359
+ s[23] = (s8 >> 16) | (s9 << 5);
360
+ s[24] = s9 >> 3;
361
+ s[25] = s9 >> 11;
362
+ s[26] = (s9 >> 19) | (s10 << 2);
363
+ s[27] = s10 >> 6;
364
+ s[28] = (s10 >> 14) | (s11 << 7);
365
+ s[29] = s11 >> 1;
366
+ s[30] = s11 >> 9;
367
+ s[31] = s11 >> 17;
368
+ }