rbnacl-libsodium 0.5.0.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) 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 +62 -81
  5. data/vendor/libsodium/ChangeLog +31 -1
  6. data/vendor/libsodium/README.markdown +15 -364
  7. data/vendor/libsodium/THANKS +6 -0
  8. data/vendor/libsodium/autom4te.cache/output.0 +67 -36
  9. data/vendor/libsodium/autom4te.cache/output.1 +67 -36
  10. data/vendor/libsodium/autom4te.cache/output.2 +67 -36
  11. data/vendor/libsodium/autom4te.cache/traces.0 +52 -51
  12. data/vendor/libsodium/autom4te.cache/traces.1 +137 -133
  13. data/vendor/libsodium/autom4te.cache/traces.2 +52 -51
  14. data/vendor/libsodium/builds/msvc/version.h +2 -2
  15. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +365 -345
  16. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +1114 -1037
  17. data/vendor/libsodium/builds/msvc/vs2010/test/test.props +8 -2
  18. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +364 -344
  19. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +1113 -1036
  20. data/vendor/libsodium/builds/msvc/vs2012/test/test.props +8 -2
  21. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +365 -345
  22. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +1114 -1037
  23. data/vendor/libsodium/builds/msvc/vs2013/test/test.props +8 -2
  24. data/vendor/libsodium/configure +66 -35
  25. data/vendor/libsodium/configure.ac +25 -14
  26. data/vendor/libsodium/dist-build/ios.sh +1 -1
  27. data/vendor/libsodium/dist-build/msys2-win64.sh +1 -1
  28. data/vendor/libsodium/libsodium.vcxproj +29 -14
  29. data/vendor/libsodium/libsodium.vcxproj.filters +77 -28
  30. data/vendor/libsodium/msvc-scripts/process.bat +3 -3
  31. data/vendor/libsodium/packaging/nuget/package.config +1 -1
  32. data/vendor/libsodium/packaging/nuget/package.gsl +6 -1
  33. data/vendor/libsodium/packaging/nuget/package.nuspec +1 -1
  34. data/vendor/libsodium/src/libsodium/Makefile.am +31 -13
  35. data/vendor/libsodium/src/libsodium/Makefile.in +406 -155
  36. data/vendor/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c +146 -0
  37. data/vendor/libsodium/src/libsodium/crypto_box/crypto_box.c +13 -0
  38. data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_easy.c +39 -73
  39. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c +5 -0
  40. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h +2 -0
  41. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c +15 -0
  42. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +6 -5
  43. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c +6 -5
  44. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c +25 -0
  45. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c +76 -47
  46. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h +30 -7
  47. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +3 -16
  48. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +3 -10
  49. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c +11 -6
  50. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c +23 -1
  51. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c +1 -1
  52. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/crypto_scrypt-common.c +7 -7
  53. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/crypto_scrypt.h +6 -20
  54. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256_nosse.c → scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c} +0 -0
  55. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/pbkdf2-sha256.c +1 -11
  56. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/pbkdf2-sha256.h +0 -0
  57. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256/pwhash_scryptxsalsa208sha256.c → scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c} +50 -25
  58. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/scrypt_platform.c +4 -0
  59. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256_sse.c → scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c} +0 -0
  60. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/sysendian.h +0 -0
  61. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c +1 -1
  62. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/{ref → ref10}/api.h +0 -3
  63. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/base_curve25519_ref10.c +14 -0
  64. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe.h +44 -0
  65. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_0_curve25519_ref10.c +23 -0
  66. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_1_curve25519_ref10.c +23 -0
  67. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_add_curve25519_ref10.c +61 -0
  68. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_copy_curve25519_ref10.c +33 -0
  69. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c +77 -0
  70. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_frombytes_curve25519_ref10.c +73 -0
  71. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_invert_curve25519_ref10.c +18 -0
  72. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul121666_curve25519_ref10.c +74 -0
  73. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul_curve25519_ref10.c +257 -0
  74. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sq_curve25519_ref10.c +153 -0
  75. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sub_curve25519_ref10.c +61 -0
  76. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_tobytes_curve25519_ref10.c +123 -0
  77. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/montgomery.h +140 -0
  78. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/pow225521.h +160 -0
  79. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/scalarmult_curve25519_ref10.c +54 -0
  80. data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +92 -61
  81. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c +3 -3
  82. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow22523.h +2 -2
  83. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow225521.h +2 -2
  84. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c +8 -4
  85. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c +3 -3
  86. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h +6 -3
  87. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c +23 -23
  88. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/api.h +12 -0
  89. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c +275 -0
  90. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20_api.c +36 -0
  91. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S +11 -10
  92. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +8 -3
  93. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c +8 -0
  94. data/vendor/libsodium/src/libsodium/include/Makefile.am +3 -2
  95. data/vendor/libsodium/src/libsodium/include/Makefile.in +3 -2
  96. data/vendor/libsodium/src/libsodium/include/sodium.h +3 -1
  97. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +55 -0
  98. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box.h +21 -0
  99. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +11 -1
  100. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash.h +7 -0
  101. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +7 -0
  102. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +7 -0
  103. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +15 -0
  104. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +25 -0
  105. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +80 -0
  106. data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +2 -2
  107. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +14 -0
  108. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +11 -0
  109. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes256estream.h +11 -6
  110. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h +49 -0
  111. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h +6 -0
  112. data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +7 -7
  113. data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +10 -14
  114. data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +10 -13
  115. data/vendor/libsodium/src/libsodium/sodium/compat.c +55 -4
  116. data/vendor/libsodium/src/libsodium/sodium/utils.c +18 -0
  117. data/vendor/libsodium/test/default/Makefile.am +24 -12
  118. data/vendor/libsodium/test/default/Makefile.in +116 -73
  119. data/vendor/libsodium/test/default/aead_chacha20poly1305.c +97 -0
  120. data/vendor/libsodium/test/default/aead_chacha20poly1305.exp +8 -0
  121. data/vendor/libsodium/test/default/box_easy.c +1 -1
  122. data/vendor/libsodium/test/default/box_seed.c +28 -0
  123. data/vendor/libsodium/test/default/box_seed.exp +8 -0
  124. data/vendor/libsodium/test/default/chacha20.c +45 -0
  125. data/vendor/libsodium/test/default/chacha20.exp +5 -0
  126. data/vendor/libsodium/test/default/pwhash.c +83 -15
  127. data/vendor/libsodium/test/default/pwhash.exp +10 -1
  128. data/vendor/libsodium/test/default/pwhash_scrypt_ll.c +67 -0
  129. data/vendor/libsodium/test/default/pwhash_scrypt_ll.exp +15 -0
  130. data/vendor/libsodium/test/default/secretbox_easy.c +13 -1
  131. data/vendor/libsodium/test/default/secretbox_easy.exp +19 -0
  132. data/vendor/libsodium/test/default/secretbox_easy2.c +5 -0
  133. data/vendor/libsodium/test/default/secretbox_easy2.exp +1 -0
  134. data/vendor/libsodium/test/default/sign.c +7 -3
  135. metadata +44 -21
  136. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/api.h +0 -8
  137. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/base_curve25519_ref.c +0 -20
  138. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/smult_curve25519_ref.c +0 -268
  139. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305_donna.h +0 -37
  140. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptxsalsa208sha256.h +0 -48
  141. data/vendor/libsodium/test/default/scalarmult7.c +0 -32
  142. data/vendor/libsodium/test/default/scalarmult7.exp +0 -1
  143. data/vendor/libsodium/test/default/scalarmult8.c +0 -32
  144. data/vendor/libsodium/test/default/scalarmult8.exp +0 -1
@@ -0,0 +1,73 @@
1
+ #include "fe.h"
2
+ #include "crypto_int64.h"
3
+ #include "crypto_uint64.h"
4
+
5
+ #ifndef HAVE_TI_MODE
6
+
7
+ static crypto_uint64 load_3(const unsigned char *in)
8
+ {
9
+ crypto_uint64 result;
10
+ result = (crypto_uint64) in[0];
11
+ result |= ((crypto_uint64) in[1]) << 8;
12
+ result |= ((crypto_uint64) in[2]) << 16;
13
+ return result;
14
+ }
15
+
16
+ static crypto_uint64 load_4(const unsigned char *in)
17
+ {
18
+ crypto_uint64 result;
19
+ result = (crypto_uint64) in[0];
20
+ result |= ((crypto_uint64) in[1]) << 8;
21
+ result |= ((crypto_uint64) in[2]) << 16;
22
+ result |= ((crypto_uint64) in[3]) << 24;
23
+ return result;
24
+ }
25
+
26
+ void fe_frombytes(fe h,const unsigned char *s)
27
+ {
28
+ crypto_int64 h0 = load_4(s);
29
+ crypto_int64 h1 = load_3(s + 4) << 6;
30
+ crypto_int64 h2 = load_3(s + 7) << 5;
31
+ crypto_int64 h3 = load_3(s + 10) << 3;
32
+ crypto_int64 h4 = load_3(s + 13) << 2;
33
+ crypto_int64 h5 = load_4(s + 16);
34
+ crypto_int64 h6 = load_3(s + 20) << 7;
35
+ crypto_int64 h7 = load_3(s + 23) << 5;
36
+ crypto_int64 h8 = load_3(s + 26) << 4;
37
+ crypto_int64 h9 = (load_3(s + 29) & 8388607) << 2;
38
+ crypto_int64 carry0;
39
+ crypto_int64 carry1;
40
+ crypto_int64 carry2;
41
+ crypto_int64 carry3;
42
+ crypto_int64 carry4;
43
+ crypto_int64 carry5;
44
+ crypto_int64 carry6;
45
+ crypto_int64 carry7;
46
+ crypto_int64 carry8;
47
+ crypto_int64 carry9;
48
+
49
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
50
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
51
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
52
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
53
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
54
+
55
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
56
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
57
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
58
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
59
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
60
+
61
+ h[0] = h0;
62
+ h[1] = h1;
63
+ h[2] = h2;
64
+ h[3] = h3;
65
+ h[4] = h4;
66
+ h[5] = h5;
67
+ h[6] = h6;
68
+ h[7] = h7;
69
+ h[8] = h8;
70
+ h[9] = h9;
71
+ }
72
+
73
+ #endif
@@ -0,0 +1,18 @@
1
+ #include "fe.h"
2
+
3
+ #ifndef HAVE_TI_MODE
4
+
5
+ void fe_invert(fe out,fe z)
6
+ {
7
+ fe t0;
8
+ fe t1;
9
+ fe t2;
10
+ fe t3;
11
+ int i;
12
+
13
+ #include "pow225521.h"
14
+
15
+ return;
16
+ }
17
+
18
+ #endif
@@ -0,0 +1,74 @@
1
+ #include "fe.h"
2
+ #include "crypto_int64.h"
3
+
4
+ #ifndef HAVE_TI_MODE
5
+
6
+ /*
7
+ h = f * 121666
8
+ Can overlap h with f.
9
+
10
+ Preconditions:
11
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
12
+
13
+ Postconditions:
14
+ |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
15
+ */
16
+
17
+ void fe_mul121666(fe h,fe f)
18
+ {
19
+ crypto_int32 f0 = f[0];
20
+ crypto_int32 f1 = f[1];
21
+ crypto_int32 f2 = f[2];
22
+ crypto_int32 f3 = f[3];
23
+ crypto_int32 f4 = f[4];
24
+ crypto_int32 f5 = f[5];
25
+ crypto_int32 f6 = f[6];
26
+ crypto_int32 f7 = f[7];
27
+ crypto_int32 f8 = f[8];
28
+ crypto_int32 f9 = f[9];
29
+ crypto_int64 h0 = f0 * (crypto_int64) 121666;
30
+ crypto_int64 h1 = f1 * (crypto_int64) 121666;
31
+ crypto_int64 h2 = f2 * (crypto_int64) 121666;
32
+ crypto_int64 h3 = f3 * (crypto_int64) 121666;
33
+ crypto_int64 h4 = f4 * (crypto_int64) 121666;
34
+ crypto_int64 h5 = f5 * (crypto_int64) 121666;
35
+ crypto_int64 h6 = f6 * (crypto_int64) 121666;
36
+ crypto_int64 h7 = f7 * (crypto_int64) 121666;
37
+ crypto_int64 h8 = f8 * (crypto_int64) 121666;
38
+ crypto_int64 h9 = f9 * (crypto_int64) 121666;
39
+ crypto_int64 carry0;
40
+ crypto_int64 carry1;
41
+ crypto_int64 carry2;
42
+ crypto_int64 carry3;
43
+ crypto_int64 carry4;
44
+ crypto_int64 carry5;
45
+ crypto_int64 carry6;
46
+ crypto_int64 carry7;
47
+ crypto_int64 carry8;
48
+ crypto_int64 carry9;
49
+
50
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
51
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
52
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
53
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
54
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
55
+
56
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
57
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
58
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
59
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
60
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
61
+
62
+ h[0] = h0;
63
+ h[1] = h1;
64
+ h[2] = h2;
65
+ h[3] = h3;
66
+ h[4] = h4;
67
+ h[5] = h5;
68
+ h[6] = h6;
69
+ h[7] = h7;
70
+ h[8] = h8;
71
+ h[9] = h9;
72
+ }
73
+
74
+ #endif
@@ -0,0 +1,257 @@
1
+ #include "fe.h"
2
+ #include "crypto_int64.h"
3
+
4
+ #ifndef HAVE_TI_MODE
5
+
6
+ /*
7
+ h = f * g
8
+ Can overlap h with f or g.
9
+
10
+ Preconditions:
11
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
12
+ |g| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
13
+
14
+ Postconditions:
15
+ |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
16
+ */
17
+
18
+ /*
19
+ Notes on implementation strategy:
20
+
21
+ Using schoolbook multiplication.
22
+ Karatsuba would save a little in some cost models.
23
+
24
+ Most multiplications by 2 and 19 are 32-bit precomputations;
25
+ cheaper than 64-bit postcomputations.
26
+
27
+ There is one remaining multiplication by 19 in the carry chain;
28
+ one *19 precomputation can be merged into this,
29
+ but the resulting data flow is considerably less clean.
30
+
31
+ There are 12 carries below.
32
+ 10 of them are 2-way parallelizable and vectorizable.
33
+ Can get away with 11 carries, but then data flow is much deeper.
34
+
35
+ With tighter constraints on inputs can squeeze carries into int32.
36
+ */
37
+
38
+ void fe_mul(fe h,fe f,fe g)
39
+ {
40
+ crypto_int32 f0 = f[0];
41
+ crypto_int32 f1 = f[1];
42
+ crypto_int32 f2 = f[2];
43
+ crypto_int32 f3 = f[3];
44
+ crypto_int32 f4 = f[4];
45
+ crypto_int32 f5 = f[5];
46
+ crypto_int32 f6 = f[6];
47
+ crypto_int32 f7 = f[7];
48
+ crypto_int32 f8 = f[8];
49
+ crypto_int32 f9 = f[9];
50
+ crypto_int32 g0 = g[0];
51
+ crypto_int32 g1 = g[1];
52
+ crypto_int32 g2 = g[2];
53
+ crypto_int32 g3 = g[3];
54
+ crypto_int32 g4 = g[4];
55
+ crypto_int32 g5 = g[5];
56
+ crypto_int32 g6 = g[6];
57
+ crypto_int32 g7 = g[7];
58
+ crypto_int32 g8 = g[8];
59
+ crypto_int32 g9 = g[9];
60
+ crypto_int32 g1_19 = 19 * g1; /* 1.4*2^29 */
61
+ crypto_int32 g2_19 = 19 * g2; /* 1.4*2^30; still ok */
62
+ crypto_int32 g3_19 = 19 * g3;
63
+ crypto_int32 g4_19 = 19 * g4;
64
+ crypto_int32 g5_19 = 19 * g5;
65
+ crypto_int32 g6_19 = 19 * g6;
66
+ crypto_int32 g7_19 = 19 * g7;
67
+ crypto_int32 g8_19 = 19 * g8;
68
+ crypto_int32 g9_19 = 19 * g9;
69
+ crypto_int32 f1_2 = 2 * f1;
70
+ crypto_int32 f3_2 = 2 * f3;
71
+ crypto_int32 f5_2 = 2 * f5;
72
+ crypto_int32 f7_2 = 2 * f7;
73
+ crypto_int32 f9_2 = 2 * f9;
74
+ crypto_int64 f0g0 = f0 * (crypto_int64) g0;
75
+ crypto_int64 f0g1 = f0 * (crypto_int64) g1;
76
+ crypto_int64 f0g2 = f0 * (crypto_int64) g2;
77
+ crypto_int64 f0g3 = f0 * (crypto_int64) g3;
78
+ crypto_int64 f0g4 = f0 * (crypto_int64) g4;
79
+ crypto_int64 f0g5 = f0 * (crypto_int64) g5;
80
+ crypto_int64 f0g6 = f0 * (crypto_int64) g6;
81
+ crypto_int64 f0g7 = f0 * (crypto_int64) g7;
82
+ crypto_int64 f0g8 = f0 * (crypto_int64) g8;
83
+ crypto_int64 f0g9 = f0 * (crypto_int64) g9;
84
+ crypto_int64 f1g0 = f1 * (crypto_int64) g0;
85
+ crypto_int64 f1g1_2 = f1_2 * (crypto_int64) g1;
86
+ crypto_int64 f1g2 = f1 * (crypto_int64) g2;
87
+ crypto_int64 f1g3_2 = f1_2 * (crypto_int64) g3;
88
+ crypto_int64 f1g4 = f1 * (crypto_int64) g4;
89
+ crypto_int64 f1g5_2 = f1_2 * (crypto_int64) g5;
90
+ crypto_int64 f1g6 = f1 * (crypto_int64) g6;
91
+ crypto_int64 f1g7_2 = f1_2 * (crypto_int64) g7;
92
+ crypto_int64 f1g8 = f1 * (crypto_int64) g8;
93
+ crypto_int64 f1g9_38 = f1_2 * (crypto_int64) g9_19;
94
+ crypto_int64 f2g0 = f2 * (crypto_int64) g0;
95
+ crypto_int64 f2g1 = f2 * (crypto_int64) g1;
96
+ crypto_int64 f2g2 = f2 * (crypto_int64) g2;
97
+ crypto_int64 f2g3 = f2 * (crypto_int64) g3;
98
+ crypto_int64 f2g4 = f2 * (crypto_int64) g4;
99
+ crypto_int64 f2g5 = f2 * (crypto_int64) g5;
100
+ crypto_int64 f2g6 = f2 * (crypto_int64) g6;
101
+ crypto_int64 f2g7 = f2 * (crypto_int64) g7;
102
+ crypto_int64 f2g8_19 = f2 * (crypto_int64) g8_19;
103
+ crypto_int64 f2g9_19 = f2 * (crypto_int64) g9_19;
104
+ crypto_int64 f3g0 = f3 * (crypto_int64) g0;
105
+ crypto_int64 f3g1_2 = f3_2 * (crypto_int64) g1;
106
+ crypto_int64 f3g2 = f3 * (crypto_int64) g2;
107
+ crypto_int64 f3g3_2 = f3_2 * (crypto_int64) g3;
108
+ crypto_int64 f3g4 = f3 * (crypto_int64) g4;
109
+ crypto_int64 f3g5_2 = f3_2 * (crypto_int64) g5;
110
+ crypto_int64 f3g6 = f3 * (crypto_int64) g6;
111
+ crypto_int64 f3g7_38 = f3_2 * (crypto_int64) g7_19;
112
+ crypto_int64 f3g8_19 = f3 * (crypto_int64) g8_19;
113
+ crypto_int64 f3g9_38 = f3_2 * (crypto_int64) g9_19;
114
+ crypto_int64 f4g0 = f4 * (crypto_int64) g0;
115
+ crypto_int64 f4g1 = f4 * (crypto_int64) g1;
116
+ crypto_int64 f4g2 = f4 * (crypto_int64) g2;
117
+ crypto_int64 f4g3 = f4 * (crypto_int64) g3;
118
+ crypto_int64 f4g4 = f4 * (crypto_int64) g4;
119
+ crypto_int64 f4g5 = f4 * (crypto_int64) g5;
120
+ crypto_int64 f4g6_19 = f4 * (crypto_int64) g6_19;
121
+ crypto_int64 f4g7_19 = f4 * (crypto_int64) g7_19;
122
+ crypto_int64 f4g8_19 = f4 * (crypto_int64) g8_19;
123
+ crypto_int64 f4g9_19 = f4 * (crypto_int64) g9_19;
124
+ crypto_int64 f5g0 = f5 * (crypto_int64) g0;
125
+ crypto_int64 f5g1_2 = f5_2 * (crypto_int64) g1;
126
+ crypto_int64 f5g2 = f5 * (crypto_int64) g2;
127
+ crypto_int64 f5g3_2 = f5_2 * (crypto_int64) g3;
128
+ crypto_int64 f5g4 = f5 * (crypto_int64) g4;
129
+ crypto_int64 f5g5_38 = f5_2 * (crypto_int64) g5_19;
130
+ crypto_int64 f5g6_19 = f5 * (crypto_int64) g6_19;
131
+ crypto_int64 f5g7_38 = f5_2 * (crypto_int64) g7_19;
132
+ crypto_int64 f5g8_19 = f5 * (crypto_int64) g8_19;
133
+ crypto_int64 f5g9_38 = f5_2 * (crypto_int64) g9_19;
134
+ crypto_int64 f6g0 = f6 * (crypto_int64) g0;
135
+ crypto_int64 f6g1 = f6 * (crypto_int64) g1;
136
+ crypto_int64 f6g2 = f6 * (crypto_int64) g2;
137
+ crypto_int64 f6g3 = f6 * (crypto_int64) g3;
138
+ crypto_int64 f6g4_19 = f6 * (crypto_int64) g4_19;
139
+ crypto_int64 f6g5_19 = f6 * (crypto_int64) g5_19;
140
+ crypto_int64 f6g6_19 = f6 * (crypto_int64) g6_19;
141
+ crypto_int64 f6g7_19 = f6 * (crypto_int64) g7_19;
142
+ crypto_int64 f6g8_19 = f6 * (crypto_int64) g8_19;
143
+ crypto_int64 f6g9_19 = f6 * (crypto_int64) g9_19;
144
+ crypto_int64 f7g0 = f7 * (crypto_int64) g0;
145
+ crypto_int64 f7g1_2 = f7_2 * (crypto_int64) g1;
146
+ crypto_int64 f7g2 = f7 * (crypto_int64) g2;
147
+ crypto_int64 f7g3_38 = f7_2 * (crypto_int64) g3_19;
148
+ crypto_int64 f7g4_19 = f7 * (crypto_int64) g4_19;
149
+ crypto_int64 f7g5_38 = f7_2 * (crypto_int64) g5_19;
150
+ crypto_int64 f7g6_19 = f7 * (crypto_int64) g6_19;
151
+ crypto_int64 f7g7_38 = f7_2 * (crypto_int64) g7_19;
152
+ crypto_int64 f7g8_19 = f7 * (crypto_int64) g8_19;
153
+ crypto_int64 f7g9_38 = f7_2 * (crypto_int64) g9_19;
154
+ crypto_int64 f8g0 = f8 * (crypto_int64) g0;
155
+ crypto_int64 f8g1 = f8 * (crypto_int64) g1;
156
+ crypto_int64 f8g2_19 = f8 * (crypto_int64) g2_19;
157
+ crypto_int64 f8g3_19 = f8 * (crypto_int64) g3_19;
158
+ crypto_int64 f8g4_19 = f8 * (crypto_int64) g4_19;
159
+ crypto_int64 f8g5_19 = f8 * (crypto_int64) g5_19;
160
+ crypto_int64 f8g6_19 = f8 * (crypto_int64) g6_19;
161
+ crypto_int64 f8g7_19 = f8 * (crypto_int64) g7_19;
162
+ crypto_int64 f8g8_19 = f8 * (crypto_int64) g8_19;
163
+ crypto_int64 f8g9_19 = f8 * (crypto_int64) g9_19;
164
+ crypto_int64 f9g0 = f9 * (crypto_int64) g0;
165
+ crypto_int64 f9g1_38 = f9_2 * (crypto_int64) g1_19;
166
+ crypto_int64 f9g2_19 = f9 * (crypto_int64) g2_19;
167
+ crypto_int64 f9g3_38 = f9_2 * (crypto_int64) g3_19;
168
+ crypto_int64 f9g4_19 = f9 * (crypto_int64) g4_19;
169
+ crypto_int64 f9g5_38 = f9_2 * (crypto_int64) g5_19;
170
+ crypto_int64 f9g6_19 = f9 * (crypto_int64) g6_19;
171
+ crypto_int64 f9g7_38 = f9_2 * (crypto_int64) g7_19;
172
+ crypto_int64 f9g8_19 = f9 * (crypto_int64) g8_19;
173
+ crypto_int64 f9g9_38 = f9_2 * (crypto_int64) g9_19;
174
+ crypto_int64 h0 = f0g0+f1g9_38+f2g8_19+f3g7_38+f4g6_19+f5g5_38+f6g4_19+f7g3_38+f8g2_19+f9g1_38;
175
+ crypto_int64 h1 = f0g1+f1g0 +f2g9_19+f3g8_19+f4g7_19+f5g6_19+f6g5_19+f7g4_19+f8g3_19+f9g2_19;
176
+ crypto_int64 h2 = f0g2+f1g1_2 +f2g0 +f3g9_38+f4g8_19+f5g7_38+f6g6_19+f7g5_38+f8g4_19+f9g3_38;
177
+ crypto_int64 h3 = f0g3+f1g2 +f2g1 +f3g0 +f4g9_19+f5g8_19+f6g7_19+f7g6_19+f8g5_19+f9g4_19;
178
+ crypto_int64 h4 = f0g4+f1g3_2 +f2g2 +f3g1_2 +f4g0 +f5g9_38+f6g8_19+f7g7_38+f8g6_19+f9g5_38;
179
+ crypto_int64 h5 = f0g5+f1g4 +f2g3 +f3g2 +f4g1 +f5g0 +f6g9_19+f7g8_19+f8g7_19+f9g6_19;
180
+ crypto_int64 h6 = f0g6+f1g5_2 +f2g4 +f3g3_2 +f4g2 +f5g1_2 +f6g0 +f7g9_38+f8g8_19+f9g7_38;
181
+ crypto_int64 h7 = f0g7+f1g6 +f2g5 +f3g4 +f4g3 +f5g2 +f6g1 +f7g0 +f8g9_19+f9g8_19;
182
+ crypto_int64 h8 = f0g8+f1g7_2 +f2g6 +f3g5_2 +f4g4 +f5g3_2 +f6g2 +f7g1_2 +f8g0 +f9g9_38;
183
+ crypto_int64 h9 = f0g9+f1g8 +f2g7 +f3g6 +f4g5 +f5g4 +f6g3 +f7g2 +f8g1 +f9g0 ;
184
+ crypto_int64 carry0;
185
+ crypto_int64 carry1;
186
+ crypto_int64 carry2;
187
+ crypto_int64 carry3;
188
+ crypto_int64 carry4;
189
+ crypto_int64 carry5;
190
+ crypto_int64 carry6;
191
+ crypto_int64 carry7;
192
+ crypto_int64 carry8;
193
+ crypto_int64 carry9;
194
+
195
+ /*
196
+ |h0| <= (1.1*1.1*2^52*(1+19+19+19+19)+1.1*1.1*2^50*(38+38+38+38+38))
197
+ i.e. |h0| <= 1.2*2^59; narrower ranges for h2, h4, h6, h8
198
+ |h1| <= (1.1*1.1*2^51*(1+1+19+19+19+19+19+19+19+19))
199
+ i.e. |h1| <= 1.5*2^58; narrower ranges for h3, h5, h7, h9
200
+ */
201
+
202
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
203
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
204
+ /* |h0| <= 2^25 */
205
+ /* |h4| <= 2^25 */
206
+ /* |h1| <= 1.51*2^58 */
207
+ /* |h5| <= 1.51*2^58 */
208
+
209
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
210
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
211
+ /* |h1| <= 2^24; from now on fits into int32 */
212
+ /* |h5| <= 2^24; from now on fits into int32 */
213
+ /* |h2| <= 1.21*2^59 */
214
+ /* |h6| <= 1.21*2^59 */
215
+
216
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
217
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
218
+ /* |h2| <= 2^25; from now on fits into int32 unchanged */
219
+ /* |h6| <= 2^25; from now on fits into int32 unchanged */
220
+ /* |h3| <= 1.51*2^58 */
221
+ /* |h7| <= 1.51*2^58 */
222
+
223
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
224
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
225
+ /* |h3| <= 2^24; from now on fits into int32 unchanged */
226
+ /* |h7| <= 2^24; from now on fits into int32 unchanged */
227
+ /* |h4| <= 1.52*2^33 */
228
+ /* |h8| <= 1.52*2^33 */
229
+
230
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
231
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
232
+ /* |h4| <= 2^25; from now on fits into int32 unchanged */
233
+ /* |h8| <= 2^25; from now on fits into int32 unchanged */
234
+ /* |h5| <= 1.01*2^24 */
235
+ /* |h9| <= 1.51*2^58 */
236
+
237
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
238
+ /* |h9| <= 2^24; from now on fits into int32 unchanged */
239
+ /* |h0| <= 1.8*2^37 */
240
+
241
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
242
+ /* |h0| <= 2^25; from now on fits into int32 unchanged */
243
+ /* |h1| <= 1.01*2^24 */
244
+
245
+ h[0] = h0;
246
+ h[1] = h1;
247
+ h[2] = h2;
248
+ h[3] = h3;
249
+ h[4] = h4;
250
+ h[5] = h5;
251
+ h[6] = h6;
252
+ h[7] = h7;
253
+ h[8] = h8;
254
+ h[9] = h9;
255
+ }
256
+
257
+ #endif
@@ -0,0 +1,153 @@
1
+ #include "fe.h"
2
+ #include "crypto_int64.h"
3
+
4
+ #ifndef HAVE_TI_MODE
5
+
6
+ /*
7
+ h = f * f
8
+ Can overlap h with f.
9
+
10
+ Preconditions:
11
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
12
+
13
+ Postconditions:
14
+ |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
15
+ */
16
+
17
+ /*
18
+ See fe_mul.c for discussion of implementation strategy.
19
+ */
20
+
21
+ void fe_sq(fe h,fe f)
22
+ {
23
+ crypto_int32 f0 = f[0];
24
+ crypto_int32 f1 = f[1];
25
+ crypto_int32 f2 = f[2];
26
+ crypto_int32 f3 = f[3];
27
+ crypto_int32 f4 = f[4];
28
+ crypto_int32 f5 = f[5];
29
+ crypto_int32 f6 = f[6];
30
+ crypto_int32 f7 = f[7];
31
+ crypto_int32 f8 = f[8];
32
+ crypto_int32 f9 = f[9];
33
+ crypto_int32 f0_2 = 2 * f0;
34
+ crypto_int32 f1_2 = 2 * f1;
35
+ crypto_int32 f2_2 = 2 * f2;
36
+ crypto_int32 f3_2 = 2 * f3;
37
+ crypto_int32 f4_2 = 2 * f4;
38
+ crypto_int32 f5_2 = 2 * f5;
39
+ crypto_int32 f6_2 = 2 * f6;
40
+ crypto_int32 f7_2 = 2 * f7;
41
+ crypto_int32 f5_38 = 38 * f5; /* 1.31*2^30 */
42
+ crypto_int32 f6_19 = 19 * f6; /* 1.31*2^30 */
43
+ crypto_int32 f7_38 = 38 * f7; /* 1.31*2^30 */
44
+ crypto_int32 f8_19 = 19 * f8; /* 1.31*2^30 */
45
+ crypto_int32 f9_38 = 38 * f9; /* 1.31*2^30 */
46
+ crypto_int64 f0f0 = f0 * (crypto_int64) f0;
47
+ crypto_int64 f0f1_2 = f0_2 * (crypto_int64) f1;
48
+ crypto_int64 f0f2_2 = f0_2 * (crypto_int64) f2;
49
+ crypto_int64 f0f3_2 = f0_2 * (crypto_int64) f3;
50
+ crypto_int64 f0f4_2 = f0_2 * (crypto_int64) f4;
51
+ crypto_int64 f0f5_2 = f0_2 * (crypto_int64) f5;
52
+ crypto_int64 f0f6_2 = f0_2 * (crypto_int64) f6;
53
+ crypto_int64 f0f7_2 = f0_2 * (crypto_int64) f7;
54
+ crypto_int64 f0f8_2 = f0_2 * (crypto_int64) f8;
55
+ crypto_int64 f0f9_2 = f0_2 * (crypto_int64) f9;
56
+ crypto_int64 f1f1_2 = f1_2 * (crypto_int64) f1;
57
+ crypto_int64 f1f2_2 = f1_2 * (crypto_int64) f2;
58
+ crypto_int64 f1f3_4 = f1_2 * (crypto_int64) f3_2;
59
+ crypto_int64 f1f4_2 = f1_2 * (crypto_int64) f4;
60
+ crypto_int64 f1f5_4 = f1_2 * (crypto_int64) f5_2;
61
+ crypto_int64 f1f6_2 = f1_2 * (crypto_int64) f6;
62
+ crypto_int64 f1f7_4 = f1_2 * (crypto_int64) f7_2;
63
+ crypto_int64 f1f8_2 = f1_2 * (crypto_int64) f8;
64
+ crypto_int64 f1f9_76 = f1_2 * (crypto_int64) f9_38;
65
+ crypto_int64 f2f2 = f2 * (crypto_int64) f2;
66
+ crypto_int64 f2f3_2 = f2_2 * (crypto_int64) f3;
67
+ crypto_int64 f2f4_2 = f2_2 * (crypto_int64) f4;
68
+ crypto_int64 f2f5_2 = f2_2 * (crypto_int64) f5;
69
+ crypto_int64 f2f6_2 = f2_2 * (crypto_int64) f6;
70
+ crypto_int64 f2f7_2 = f2_2 * (crypto_int64) f7;
71
+ crypto_int64 f2f8_38 = f2_2 * (crypto_int64) f8_19;
72
+ crypto_int64 f2f9_38 = f2 * (crypto_int64) f9_38;
73
+ crypto_int64 f3f3_2 = f3_2 * (crypto_int64) f3;
74
+ crypto_int64 f3f4_2 = f3_2 * (crypto_int64) f4;
75
+ crypto_int64 f3f5_4 = f3_2 * (crypto_int64) f5_2;
76
+ crypto_int64 f3f6_2 = f3_2 * (crypto_int64) f6;
77
+ crypto_int64 f3f7_76 = f3_2 * (crypto_int64) f7_38;
78
+ crypto_int64 f3f8_38 = f3_2 * (crypto_int64) f8_19;
79
+ crypto_int64 f3f9_76 = f3_2 * (crypto_int64) f9_38;
80
+ crypto_int64 f4f4 = f4 * (crypto_int64) f4;
81
+ crypto_int64 f4f5_2 = f4_2 * (crypto_int64) f5;
82
+ crypto_int64 f4f6_38 = f4_2 * (crypto_int64) f6_19;
83
+ crypto_int64 f4f7_38 = f4 * (crypto_int64) f7_38;
84
+ crypto_int64 f4f8_38 = f4_2 * (crypto_int64) f8_19;
85
+ crypto_int64 f4f9_38 = f4 * (crypto_int64) f9_38;
86
+ crypto_int64 f5f5_38 = f5 * (crypto_int64) f5_38;
87
+ crypto_int64 f5f6_38 = f5_2 * (crypto_int64) f6_19;
88
+ crypto_int64 f5f7_76 = f5_2 * (crypto_int64) f7_38;
89
+ crypto_int64 f5f8_38 = f5_2 * (crypto_int64) f8_19;
90
+ crypto_int64 f5f9_76 = f5_2 * (crypto_int64) f9_38;
91
+ crypto_int64 f6f6_19 = f6 * (crypto_int64) f6_19;
92
+ crypto_int64 f6f7_38 = f6 * (crypto_int64) f7_38;
93
+ crypto_int64 f6f8_38 = f6_2 * (crypto_int64) f8_19;
94
+ crypto_int64 f6f9_38 = f6 * (crypto_int64) f9_38;
95
+ crypto_int64 f7f7_38 = f7 * (crypto_int64) f7_38;
96
+ crypto_int64 f7f8_38 = f7_2 * (crypto_int64) f8_19;
97
+ crypto_int64 f7f9_76 = f7_2 * (crypto_int64) f9_38;
98
+ crypto_int64 f8f8_19 = f8 * (crypto_int64) f8_19;
99
+ crypto_int64 f8f9_38 = f8 * (crypto_int64) f9_38;
100
+ crypto_int64 f9f9_38 = f9 * (crypto_int64) f9_38;
101
+ crypto_int64 h0 = f0f0 +f1f9_76+f2f8_38+f3f7_76+f4f6_38+f5f5_38;
102
+ crypto_int64 h1 = f0f1_2+f2f9_38+f3f8_38+f4f7_38+f5f6_38;
103
+ crypto_int64 h2 = f0f2_2+f1f1_2 +f3f9_76+f4f8_38+f5f7_76+f6f6_19;
104
+ crypto_int64 h3 = f0f3_2+f1f2_2 +f4f9_38+f5f8_38+f6f7_38;
105
+ crypto_int64 h4 = f0f4_2+f1f3_4 +f2f2 +f5f9_76+f6f8_38+f7f7_38;
106
+ crypto_int64 h5 = f0f5_2+f1f4_2 +f2f3_2 +f6f9_38+f7f8_38;
107
+ crypto_int64 h6 = f0f6_2+f1f5_4 +f2f4_2 +f3f3_2 +f7f9_76+f8f8_19;
108
+ crypto_int64 h7 = f0f7_2+f1f6_2 +f2f5_2 +f3f4_2 +f8f9_38;
109
+ crypto_int64 h8 = f0f8_2+f1f7_4 +f2f6_2 +f3f5_4 +f4f4 +f9f9_38;
110
+ crypto_int64 h9 = f0f9_2+f1f8_2 +f2f7_2 +f3f6_2 +f4f5_2;
111
+ crypto_int64 carry0;
112
+ crypto_int64 carry1;
113
+ crypto_int64 carry2;
114
+ crypto_int64 carry3;
115
+ crypto_int64 carry4;
116
+ crypto_int64 carry5;
117
+ crypto_int64 carry6;
118
+ crypto_int64 carry7;
119
+ crypto_int64 carry8;
120
+ crypto_int64 carry9;
121
+
122
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
123
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
124
+
125
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
126
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
127
+
128
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
129
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
130
+
131
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
132
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
133
+
134
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
135
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
136
+
137
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
138
+
139
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
140
+
141
+ h[0] = h0;
142
+ h[1] = h1;
143
+ h[2] = h2;
144
+ h[3] = h3;
145
+ h[4] = h4;
146
+ h[5] = h5;
147
+ h[6] = h6;
148
+ h[7] = h7;
149
+ h[8] = h8;
150
+ h[9] = h9;
151
+ }
152
+
153
+ #endif