rbnacl-libsodium 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) 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/ChangeLog +5 -0
  5. data/vendor/libsodium/README.markdown +4 -1
  6. data/vendor/libsodium/autogen.sh +0 -5
  7. data/vendor/libsodium/autom4te.cache/output.1 +14 -14
  8. data/vendor/libsodium/autom4te.cache/output.5 +14 -14
  9. data/vendor/libsodium/autom4te.cache/requests +868 -868
  10. data/vendor/libsodium/autom4te.cache/traces.1 +1 -1
  11. data/vendor/libsodium/builds/msvc/version.h +2 -2
  12. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +10 -72
  13. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +36 -216
  14. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +10 -72
  15. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +34 -214
  16. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +10 -72
  17. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +34 -214
  18. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj +10 -72
  19. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +25 -205
  20. data/vendor/libsodium/configure +14 -14
  21. data/vendor/libsodium/configure.ac +5 -5
  22. data/vendor/libsodium/dist-build/msys2-win32.sh +3 -2
  23. data/vendor/libsodium/dist-build/msys2-win64.sh +3 -2
  24. data/vendor/libsodium/examples/sign.c +2 -2
  25. data/vendor/libsodium/examples/utils.h +3 -1
  26. data/vendor/libsodium/libsodium.vcxproj +7 -53
  27. data/vendor/libsodium/libsodium.vcxproj.filters +18 -152
  28. data/vendor/libsodium/msvc-scripts/process.bat +2 -2
  29. data/vendor/libsodium/src/libsodium/Makefile.am +6 -68
  30. data/vendor/libsodium/src/libsodium/Makefile.in +49 -724
  31. data/vendor/libsodium/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c +2 -2
  32. data/vendor/libsodium/src/libsodium/{crypto_sign/ed25519 → crypto_core/curve25519}/ref10/base.h +0 -0
  33. data/vendor/libsodium/src/libsodium/{crypto_sign/ed25519 → crypto_core/curve25519}/ref10/base2.h +0 -0
  34. data/vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c +2233 -0
  35. data/vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.h +160 -0
  36. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +2 -2
  37. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c +1 -1
  38. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c +1 -1
  39. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +1 -1
  40. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +2 -2
  41. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c +2 -2
  42. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c +1 -1
  43. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c +255 -0
  44. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/{curve25519_ref10.h → x25519_ref10.h} +0 -0
  45. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c +1 -1
  46. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +1 -2
  47. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c +2 -4
  48. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +1 -2
  49. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +1 -2
  50. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c +1 -1
  51. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/vec/stream_chacha20_vec.c +16 -9
  52. data/vendor/libsodium/src/libsodium/include/sodium/export.h +2 -2
  53. data/vendor/libsodium/src/libsodium/include/sodium/utils.h +6 -4
  54. data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +12 -8
  55. data/vendor/libsodium/src/libsodium/sodium/core.c +9 -0
  56. data/vendor/libsodium/src/libsodium/sodium/runtime.c +32 -10
  57. data/vendor/libsodium/src/libsodium/sodium/utils.c +8 -8
  58. data/vendor/libsodium/test/default/auth.c +1 -1
  59. data/vendor/libsodium/test/default/box.c +16 -4
  60. data/vendor/libsodium/test/default/box2.c +7 -0
  61. data/vendor/libsodium/test/default/box7.c +18 -10
  62. data/vendor/libsodium/test/default/box8.c +1 -1
  63. data/vendor/libsodium/test/default/box_easy2.c +13 -0
  64. data/vendor/libsodium/test/default/onetimeauth.c +1 -0
  65. data/vendor/libsodium/test/default/pwhash_scrypt_ll.c +2 -2
  66. data/vendor/libsodium/test/default/verify1.c +1 -1
  67. metadata +9 -71
  68. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/curve25519_ref10.c +0 -73
  69. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe.h +0 -44
  70. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_0_curve25519_ref10.c +0 -23
  71. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_1_curve25519_ref10.c +0 -23
  72. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_add_curve25519_ref10.c +0 -61
  73. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_copy_curve25519_ref10.c +0 -33
  74. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c +0 -77
  75. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_frombytes_curve25519_ref10.c +0 -74
  76. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_invert_curve25519_ref10.c +0 -18
  77. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul121666_curve25519_ref10.c +0 -74
  78. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul_curve25519_ref10.c +0 -257
  79. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sq_curve25519_ref10.c +0 -153
  80. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sub_curve25519_ref10.c +0 -61
  81. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_tobytes_curve25519_ref10.c +0 -123
  82. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/montgomery.h +0 -140
  83. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/pow225521.h +0 -160
  84. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d.h +0 -1
  85. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d2.h +0 -1
  86. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe.h +0 -56
  87. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_0.c +0 -19
  88. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_1.c +0 -19
  89. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_add.c +0 -57
  90. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c +0 -63
  91. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_copy.c +0 -29
  92. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_frombytes.c +0 -73
  93. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_invert.c +0 -14
  94. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnegative.c +0 -16
  95. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnonzero.c +0 -19
  96. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_mul.c +0 -253
  97. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_neg.c +0 -45
  98. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_pow22523.c +0 -13
  99. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq.c +0 -149
  100. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq2.c +0 -160
  101. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sub.c +0 -57
  102. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_tobytes.c +0 -119
  103. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge.h +0 -97
  104. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.c +0 -11
  105. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.h +0 -97
  106. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_double_scalarmult.c +0 -138
  107. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c +0 -50
  108. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.c +0 -11
  109. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.h +0 -88
  110. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.c +0 -11
  111. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.h +0 -88
  112. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p2.c +0 -12
  113. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p3.c +0 -13
  114. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_0.c +0 -8
  115. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.c +0 -11
  116. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.h +0 -73
  117. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_0.c +0 -9
  118. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_dbl.c +0 -12
  119. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_cached.c +0 -17
  120. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_p2.c +0 -12
  121. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c +0 -14
  122. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_precomp_0.c +0 -8
  123. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c +0 -111
  124. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.c +0 -11
  125. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.h +0 -97
  126. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_tobytes.c +0 -14
  127. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow22523.h +0 -160
  128. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow225521.h +0 -160
  129. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc.h +0 -15
  130. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_muladd.c +0 -368
  131. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_reduce.c +0 -275
  132. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sqrtm1.h +0 -1
@@ -1,14 +0,0 @@
1
- #include "fe.h"
2
-
3
- void fe_invert(fe out,const fe z)
4
- {
5
- fe t0;
6
- fe t1;
7
- fe t2;
8
- fe t3;
9
- int i;
10
-
11
- #include "pow225521.h"
12
-
13
- return;
14
- }
@@ -1,16 +0,0 @@
1
- #include "fe.h"
2
-
3
- /*
4
- return 1 if f is in {1,3,5,...,q-2}
5
- return 0 if f is in {0,2,4,...,q-1}
6
-
7
- Preconditions:
8
- |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
9
- */
10
-
11
- int fe_isnegative(const fe f)
12
- {
13
- unsigned char s[32];
14
- fe_tobytes(s,f);
15
- return s[0] & 1;
16
- }
@@ -1,19 +0,0 @@
1
- #include "fe.h"
2
- #include "crypto_verify_32.h"
3
-
4
- /*
5
- return 1 if f == 0
6
- return 0 if f != 0
7
-
8
- Preconditions:
9
- |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
10
- */
11
-
12
- static unsigned char zero[32];
13
-
14
- int fe_isnonzero(const fe f)
15
- {
16
- unsigned char s[32];
17
- fe_tobytes(s,f);
18
- return crypto_verify_32(s,zero);
19
- }
@@ -1,253 +0,0 @@
1
- #include "fe.h"
2
- #include "crypto_int64.h"
3
-
4
- /*
5
- h = f * g
6
- Can overlap h with f or g.
7
-
8
- Preconditions:
9
- |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
10
- |g| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
11
-
12
- Postconditions:
13
- |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
14
- */
15
-
16
- /*
17
- Notes on implementation strategy:
18
-
19
- Using schoolbook multiplication.
20
- Karatsuba would save a little in some cost models.
21
-
22
- Most multiplications by 2 and 19 are 32-bit precomputations;
23
- cheaper than 64-bit postcomputations.
24
-
25
- There is one remaining multiplication by 19 in the carry chain;
26
- one *19 precomputation can be merged into this,
27
- but the resulting data flow is considerably less clean.
28
-
29
- There are 12 carries below.
30
- 10 of them are 2-way parallelizable and vectorizable.
31
- Can get away with 11 carries, but then data flow is much deeper.
32
-
33
- With tighter constraints on inputs can squeeze carries into int32.
34
- */
35
-
36
- void fe_mul(fe h,const fe f,const fe g)
37
- {
38
- crypto_int32 f0 = f[0];
39
- crypto_int32 f1 = f[1];
40
- crypto_int32 f2 = f[2];
41
- crypto_int32 f3 = f[3];
42
- crypto_int32 f4 = f[4];
43
- crypto_int32 f5 = f[5];
44
- crypto_int32 f6 = f[6];
45
- crypto_int32 f7 = f[7];
46
- crypto_int32 f8 = f[8];
47
- crypto_int32 f9 = f[9];
48
- crypto_int32 g0 = g[0];
49
- crypto_int32 g1 = g[1];
50
- crypto_int32 g2 = g[2];
51
- crypto_int32 g3 = g[3];
52
- crypto_int32 g4 = g[4];
53
- crypto_int32 g5 = g[5];
54
- crypto_int32 g6 = g[6];
55
- crypto_int32 g7 = g[7];
56
- crypto_int32 g8 = g[8];
57
- crypto_int32 g9 = g[9];
58
- crypto_int32 g1_19 = 19 * g1; /* 1.959375*2^29 */
59
- crypto_int32 g2_19 = 19 * g2; /* 1.959375*2^30; still ok */
60
- crypto_int32 g3_19 = 19 * g3;
61
- crypto_int32 g4_19 = 19 * g4;
62
- crypto_int32 g5_19 = 19 * g5;
63
- crypto_int32 g6_19 = 19 * g6;
64
- crypto_int32 g7_19 = 19 * g7;
65
- crypto_int32 g8_19 = 19 * g8;
66
- crypto_int32 g9_19 = 19 * g9;
67
- crypto_int32 f1_2 = 2 * f1;
68
- crypto_int32 f3_2 = 2 * f3;
69
- crypto_int32 f5_2 = 2 * f5;
70
- crypto_int32 f7_2 = 2 * f7;
71
- crypto_int32 f9_2 = 2 * f9;
72
- crypto_int64 f0g0 = f0 * (crypto_int64) g0;
73
- crypto_int64 f0g1 = f0 * (crypto_int64) g1;
74
- crypto_int64 f0g2 = f0 * (crypto_int64) g2;
75
- crypto_int64 f0g3 = f0 * (crypto_int64) g3;
76
- crypto_int64 f0g4 = f0 * (crypto_int64) g4;
77
- crypto_int64 f0g5 = f0 * (crypto_int64) g5;
78
- crypto_int64 f0g6 = f0 * (crypto_int64) g6;
79
- crypto_int64 f0g7 = f0 * (crypto_int64) g7;
80
- crypto_int64 f0g8 = f0 * (crypto_int64) g8;
81
- crypto_int64 f0g9 = f0 * (crypto_int64) g9;
82
- crypto_int64 f1g0 = f1 * (crypto_int64) g0;
83
- crypto_int64 f1g1_2 = f1_2 * (crypto_int64) g1;
84
- crypto_int64 f1g2 = f1 * (crypto_int64) g2;
85
- crypto_int64 f1g3_2 = f1_2 * (crypto_int64) g3;
86
- crypto_int64 f1g4 = f1 * (crypto_int64) g4;
87
- crypto_int64 f1g5_2 = f1_2 * (crypto_int64) g5;
88
- crypto_int64 f1g6 = f1 * (crypto_int64) g6;
89
- crypto_int64 f1g7_2 = f1_2 * (crypto_int64) g7;
90
- crypto_int64 f1g8 = f1 * (crypto_int64) g8;
91
- crypto_int64 f1g9_38 = f1_2 * (crypto_int64) g9_19;
92
- crypto_int64 f2g0 = f2 * (crypto_int64) g0;
93
- crypto_int64 f2g1 = f2 * (crypto_int64) g1;
94
- crypto_int64 f2g2 = f2 * (crypto_int64) g2;
95
- crypto_int64 f2g3 = f2 * (crypto_int64) g3;
96
- crypto_int64 f2g4 = f2 * (crypto_int64) g4;
97
- crypto_int64 f2g5 = f2 * (crypto_int64) g5;
98
- crypto_int64 f2g6 = f2 * (crypto_int64) g6;
99
- crypto_int64 f2g7 = f2 * (crypto_int64) g7;
100
- crypto_int64 f2g8_19 = f2 * (crypto_int64) g8_19;
101
- crypto_int64 f2g9_19 = f2 * (crypto_int64) g9_19;
102
- crypto_int64 f3g0 = f3 * (crypto_int64) g0;
103
- crypto_int64 f3g1_2 = f3_2 * (crypto_int64) g1;
104
- crypto_int64 f3g2 = f3 * (crypto_int64) g2;
105
- crypto_int64 f3g3_2 = f3_2 * (crypto_int64) g3;
106
- crypto_int64 f3g4 = f3 * (crypto_int64) g4;
107
- crypto_int64 f3g5_2 = f3_2 * (crypto_int64) g5;
108
- crypto_int64 f3g6 = f3 * (crypto_int64) g6;
109
- crypto_int64 f3g7_38 = f3_2 * (crypto_int64) g7_19;
110
- crypto_int64 f3g8_19 = f3 * (crypto_int64) g8_19;
111
- crypto_int64 f3g9_38 = f3_2 * (crypto_int64) g9_19;
112
- crypto_int64 f4g0 = f4 * (crypto_int64) g0;
113
- crypto_int64 f4g1 = f4 * (crypto_int64) g1;
114
- crypto_int64 f4g2 = f4 * (crypto_int64) g2;
115
- crypto_int64 f4g3 = f4 * (crypto_int64) g3;
116
- crypto_int64 f4g4 = f4 * (crypto_int64) g4;
117
- crypto_int64 f4g5 = f4 * (crypto_int64) g5;
118
- crypto_int64 f4g6_19 = f4 * (crypto_int64) g6_19;
119
- crypto_int64 f4g7_19 = f4 * (crypto_int64) g7_19;
120
- crypto_int64 f4g8_19 = f4 * (crypto_int64) g8_19;
121
- crypto_int64 f4g9_19 = f4 * (crypto_int64) g9_19;
122
- crypto_int64 f5g0 = f5 * (crypto_int64) g0;
123
- crypto_int64 f5g1_2 = f5_2 * (crypto_int64) g1;
124
- crypto_int64 f5g2 = f5 * (crypto_int64) g2;
125
- crypto_int64 f5g3_2 = f5_2 * (crypto_int64) g3;
126
- crypto_int64 f5g4 = f5 * (crypto_int64) g4;
127
- crypto_int64 f5g5_38 = f5_2 * (crypto_int64) g5_19;
128
- crypto_int64 f5g6_19 = f5 * (crypto_int64) g6_19;
129
- crypto_int64 f5g7_38 = f5_2 * (crypto_int64) g7_19;
130
- crypto_int64 f5g8_19 = f5 * (crypto_int64) g8_19;
131
- crypto_int64 f5g9_38 = f5_2 * (crypto_int64) g9_19;
132
- crypto_int64 f6g0 = f6 * (crypto_int64) g0;
133
- crypto_int64 f6g1 = f6 * (crypto_int64) g1;
134
- crypto_int64 f6g2 = f6 * (crypto_int64) g2;
135
- crypto_int64 f6g3 = f6 * (crypto_int64) g3;
136
- crypto_int64 f6g4_19 = f6 * (crypto_int64) g4_19;
137
- crypto_int64 f6g5_19 = f6 * (crypto_int64) g5_19;
138
- crypto_int64 f6g6_19 = f6 * (crypto_int64) g6_19;
139
- crypto_int64 f6g7_19 = f6 * (crypto_int64) g7_19;
140
- crypto_int64 f6g8_19 = f6 * (crypto_int64) g8_19;
141
- crypto_int64 f6g9_19 = f6 * (crypto_int64) g9_19;
142
- crypto_int64 f7g0 = f7 * (crypto_int64) g0;
143
- crypto_int64 f7g1_2 = f7_2 * (crypto_int64) g1;
144
- crypto_int64 f7g2 = f7 * (crypto_int64) g2;
145
- crypto_int64 f7g3_38 = f7_2 * (crypto_int64) g3_19;
146
- crypto_int64 f7g4_19 = f7 * (crypto_int64) g4_19;
147
- crypto_int64 f7g5_38 = f7_2 * (crypto_int64) g5_19;
148
- crypto_int64 f7g6_19 = f7 * (crypto_int64) g6_19;
149
- crypto_int64 f7g7_38 = f7_2 * (crypto_int64) g7_19;
150
- crypto_int64 f7g8_19 = f7 * (crypto_int64) g8_19;
151
- crypto_int64 f7g9_38 = f7_2 * (crypto_int64) g9_19;
152
- crypto_int64 f8g0 = f8 * (crypto_int64) g0;
153
- crypto_int64 f8g1 = f8 * (crypto_int64) g1;
154
- crypto_int64 f8g2_19 = f8 * (crypto_int64) g2_19;
155
- crypto_int64 f8g3_19 = f8 * (crypto_int64) g3_19;
156
- crypto_int64 f8g4_19 = f8 * (crypto_int64) g4_19;
157
- crypto_int64 f8g5_19 = f8 * (crypto_int64) g5_19;
158
- crypto_int64 f8g6_19 = f8 * (crypto_int64) g6_19;
159
- crypto_int64 f8g7_19 = f8 * (crypto_int64) g7_19;
160
- crypto_int64 f8g8_19 = f8 * (crypto_int64) g8_19;
161
- crypto_int64 f8g9_19 = f8 * (crypto_int64) g9_19;
162
- crypto_int64 f9g0 = f9 * (crypto_int64) g0;
163
- crypto_int64 f9g1_38 = f9_2 * (crypto_int64) g1_19;
164
- crypto_int64 f9g2_19 = f9 * (crypto_int64) g2_19;
165
- crypto_int64 f9g3_38 = f9_2 * (crypto_int64) g3_19;
166
- crypto_int64 f9g4_19 = f9 * (crypto_int64) g4_19;
167
- crypto_int64 f9g5_38 = f9_2 * (crypto_int64) g5_19;
168
- crypto_int64 f9g6_19 = f9 * (crypto_int64) g6_19;
169
- crypto_int64 f9g7_38 = f9_2 * (crypto_int64) g7_19;
170
- crypto_int64 f9g8_19 = f9 * (crypto_int64) g8_19;
171
- crypto_int64 f9g9_38 = f9_2 * (crypto_int64) g9_19;
172
- crypto_int64 h0 = f0g0+f1g9_38+f2g8_19+f3g7_38+f4g6_19+f5g5_38+f6g4_19+f7g3_38+f8g2_19+f9g1_38;
173
- crypto_int64 h1 = f0g1+f1g0 +f2g9_19+f3g8_19+f4g7_19+f5g6_19+f6g5_19+f7g4_19+f8g3_19+f9g2_19;
174
- crypto_int64 h2 = f0g2+f1g1_2 +f2g0 +f3g9_38+f4g8_19+f5g7_38+f6g6_19+f7g5_38+f8g4_19+f9g3_38;
175
- crypto_int64 h3 = f0g3+f1g2 +f2g1 +f3g0 +f4g9_19+f5g8_19+f6g7_19+f7g6_19+f8g5_19+f9g4_19;
176
- crypto_int64 h4 = f0g4+f1g3_2 +f2g2 +f3g1_2 +f4g0 +f5g9_38+f6g8_19+f7g7_38+f8g6_19+f9g5_38;
177
- crypto_int64 h5 = f0g5+f1g4 +f2g3 +f3g2 +f4g1 +f5g0 +f6g9_19+f7g8_19+f8g7_19+f9g6_19;
178
- crypto_int64 h6 = f0g6+f1g5_2 +f2g4 +f3g3_2 +f4g2 +f5g1_2 +f6g0 +f7g9_38+f8g8_19+f9g7_38;
179
- crypto_int64 h7 = f0g7+f1g6 +f2g5 +f3g4 +f4g3 +f5g2 +f6g1 +f7g0 +f8g9_19+f9g8_19;
180
- crypto_int64 h8 = f0g8+f1g7_2 +f2g6 +f3g5_2 +f4g4 +f5g3_2 +f6g2 +f7g1_2 +f8g0 +f9g9_38;
181
- crypto_int64 h9 = f0g9+f1g8 +f2g7 +f3g6 +f4g5 +f5g4 +f6g3 +f7g2 +f8g1 +f9g0 ;
182
- crypto_int64 carry0;
183
- crypto_int64 carry1;
184
- crypto_int64 carry2;
185
- crypto_int64 carry3;
186
- crypto_int64 carry4;
187
- crypto_int64 carry5;
188
- crypto_int64 carry6;
189
- crypto_int64 carry7;
190
- crypto_int64 carry8;
191
- crypto_int64 carry9;
192
-
193
- /*
194
- |h0| <= (1.65*1.65*2^52*(1+19+19+19+19)+1.65*1.65*2^50*(38+38+38+38+38))
195
- i.e. |h0| <= 1.4*2^60; narrower ranges for h2, h4, h6, h8
196
- |h1| <= (1.65*1.65*2^51*(1+1+19+19+19+19+19+19+19+19))
197
- i.e. |h1| <= 1.7*2^59; narrower ranges for h3, h5, h7, h9
198
- */
199
-
200
- carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
201
- carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
202
- /* |h0| <= 2^25 */
203
- /* |h4| <= 2^25 */
204
- /* |h1| <= 1.71*2^59 */
205
- /* |h5| <= 1.71*2^59 */
206
-
207
- carry1 = (h1 + (crypto_int64) (1L << 24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
208
- carry5 = (h5 + (crypto_int64) (1L << 24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
209
- /* |h1| <= 2^24; from now on fits into int32 */
210
- /* |h5| <= 2^24; from now on fits into int32 */
211
- /* |h2| <= 1.41*2^60 */
212
- /* |h6| <= 1.41*2^60 */
213
-
214
- carry2 = (h2 + (crypto_int64) (1L << 25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
215
- carry6 = (h6 + (crypto_int64) (1L << 25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
216
- /* |h2| <= 2^25; from now on fits into int32 unchanged */
217
- /* |h6| <= 2^25; from now on fits into int32 unchanged */
218
- /* |h3| <= 1.71*2^59 */
219
- /* |h7| <= 1.71*2^59 */
220
-
221
- carry3 = (h3 + (crypto_int64) (1L << 24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
222
- carry7 = (h7 + (crypto_int64) (1L << 24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
223
- /* |h3| <= 2^24; from now on fits into int32 unchanged */
224
- /* |h7| <= 2^24; from now on fits into int32 unchanged */
225
- /* |h4| <= 1.72*2^34 */
226
- /* |h8| <= 1.41*2^60 */
227
-
228
- carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
229
- carry8 = (h8 + (crypto_int64) (1L << 25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
230
- /* |h4| <= 2^25; from now on fits into int32 unchanged */
231
- /* |h8| <= 2^25; from now on fits into int32 unchanged */
232
- /* |h5| <= 1.01*2^24 */
233
- /* |h9| <= 1.71*2^59 */
234
-
235
- carry9 = (h9 + (crypto_int64) (1L << 24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
236
- /* |h9| <= 2^24; from now on fits into int32 unchanged */
237
- /* |h0| <= 1.1*2^39 */
238
-
239
- carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
240
- /* |h0| <= 2^25; from now on fits into int32 unchanged */
241
- /* |h1| <= 1.01*2^24 */
242
-
243
- h[0] = (crypto_int32) h0;
244
- h[1] = (crypto_int32) h1;
245
- h[2] = (crypto_int32) h2;
246
- h[3] = (crypto_int32) h3;
247
- h[4] = (crypto_int32) h4;
248
- h[5] = (crypto_int32) h5;
249
- h[6] = (crypto_int32) h6;
250
- h[7] = (crypto_int32) h7;
251
- h[8] = (crypto_int32) h8;
252
- h[9] = (crypto_int32) h9;
253
- }
@@ -1,45 +0,0 @@
1
- #include "fe.h"
2
-
3
- /*
4
- h = -f
5
-
6
- Preconditions:
7
- |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
8
-
9
- Postconditions:
10
- |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
11
- */
12
-
13
- void fe_neg(fe h,const fe f)
14
- {
15
- crypto_int32 f0 = f[0];
16
- crypto_int32 f1 = f[1];
17
- crypto_int32 f2 = f[2];
18
- crypto_int32 f3 = f[3];
19
- crypto_int32 f4 = f[4];
20
- crypto_int32 f5 = f[5];
21
- crypto_int32 f6 = f[6];
22
- crypto_int32 f7 = f[7];
23
- crypto_int32 f8 = f[8];
24
- crypto_int32 f9 = f[9];
25
- crypto_int32 h0 = -f0;
26
- crypto_int32 h1 = -f1;
27
- crypto_int32 h2 = -f2;
28
- crypto_int32 h3 = -f3;
29
- crypto_int32 h4 = -f4;
30
- crypto_int32 h5 = -f5;
31
- crypto_int32 h6 = -f6;
32
- crypto_int32 h7 = -f7;
33
- crypto_int32 h8 = -f8;
34
- crypto_int32 h9 = -f9;
35
- h[0] = h0;
36
- h[1] = h1;
37
- h[2] = h2;
38
- h[3] = h3;
39
- h[4] = h4;
40
- h[5] = h5;
41
- h[6] = h6;
42
- h[7] = h7;
43
- h[8] = h8;
44
- h[9] = h9;
45
- }
@@ -1,13 +0,0 @@
1
- #include "fe.h"
2
-
3
- void fe_pow22523(fe out,const fe z)
4
- {
5
- fe t0;
6
- fe t1;
7
- fe t2;
8
- int i;
9
-
10
- #include "pow22523.h"
11
-
12
- return;
13
- }
@@ -1,149 +0,0 @@
1
- #include "fe.h"
2
- #include "crypto_int64.h"
3
-
4
- /*
5
- h = f * f
6
- Can overlap h with f.
7
-
8
- Preconditions:
9
- |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
10
-
11
- Postconditions:
12
- |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
13
- */
14
-
15
- /*
16
- See fe_mul.c for discussion of implementation strategy.
17
- */
18
-
19
- void fe_sq(fe h,const fe f)
20
- {
21
- crypto_int32 f0 = f[0];
22
- crypto_int32 f1 = f[1];
23
- crypto_int32 f2 = f[2];
24
- crypto_int32 f3 = f[3];
25
- crypto_int32 f4 = f[4];
26
- crypto_int32 f5 = f[5];
27
- crypto_int32 f6 = f[6];
28
- crypto_int32 f7 = f[7];
29
- crypto_int32 f8 = f[8];
30
- crypto_int32 f9 = f[9];
31
- crypto_int32 f0_2 = 2 * f0;
32
- crypto_int32 f1_2 = 2 * f1;
33
- crypto_int32 f2_2 = 2 * f2;
34
- crypto_int32 f3_2 = 2 * f3;
35
- crypto_int32 f4_2 = 2 * f4;
36
- crypto_int32 f5_2 = 2 * f5;
37
- crypto_int32 f6_2 = 2 * f6;
38
- crypto_int32 f7_2 = 2 * f7;
39
- crypto_int32 f5_38 = 38 * f5; /* 1.959375*2^30 */
40
- crypto_int32 f6_19 = 19 * f6; /* 1.959375*2^30 */
41
- crypto_int32 f7_38 = 38 * f7; /* 1.959375*2^30 */
42
- crypto_int32 f8_19 = 19 * f8; /* 1.959375*2^30 */
43
- crypto_int32 f9_38 = 38 * f9; /* 1.959375*2^30 */
44
- crypto_int64 f0f0 = f0 * (crypto_int64) f0;
45
- crypto_int64 f0f1_2 = f0_2 * (crypto_int64) f1;
46
- crypto_int64 f0f2_2 = f0_2 * (crypto_int64) f2;
47
- crypto_int64 f0f3_2 = f0_2 * (crypto_int64) f3;
48
- crypto_int64 f0f4_2 = f0_2 * (crypto_int64) f4;
49
- crypto_int64 f0f5_2 = f0_2 * (crypto_int64) f5;
50
- crypto_int64 f0f6_2 = f0_2 * (crypto_int64) f6;
51
- crypto_int64 f0f7_2 = f0_2 * (crypto_int64) f7;
52
- crypto_int64 f0f8_2 = f0_2 * (crypto_int64) f8;
53
- crypto_int64 f0f9_2 = f0_2 * (crypto_int64) f9;
54
- crypto_int64 f1f1_2 = f1_2 * (crypto_int64) f1;
55
- crypto_int64 f1f2_2 = f1_2 * (crypto_int64) f2;
56
- crypto_int64 f1f3_4 = f1_2 * (crypto_int64) f3_2;
57
- crypto_int64 f1f4_2 = f1_2 * (crypto_int64) f4;
58
- crypto_int64 f1f5_4 = f1_2 * (crypto_int64) f5_2;
59
- crypto_int64 f1f6_2 = f1_2 * (crypto_int64) f6;
60
- crypto_int64 f1f7_4 = f1_2 * (crypto_int64) f7_2;
61
- crypto_int64 f1f8_2 = f1_2 * (crypto_int64) f8;
62
- crypto_int64 f1f9_76 = f1_2 * (crypto_int64) f9_38;
63
- crypto_int64 f2f2 = f2 * (crypto_int64) f2;
64
- crypto_int64 f2f3_2 = f2_2 * (crypto_int64) f3;
65
- crypto_int64 f2f4_2 = f2_2 * (crypto_int64) f4;
66
- crypto_int64 f2f5_2 = f2_2 * (crypto_int64) f5;
67
- crypto_int64 f2f6_2 = f2_2 * (crypto_int64) f6;
68
- crypto_int64 f2f7_2 = f2_2 * (crypto_int64) f7;
69
- crypto_int64 f2f8_38 = f2_2 * (crypto_int64) f8_19;
70
- crypto_int64 f2f9_38 = f2 * (crypto_int64) f9_38;
71
- crypto_int64 f3f3_2 = f3_2 * (crypto_int64) f3;
72
- crypto_int64 f3f4_2 = f3_2 * (crypto_int64) f4;
73
- crypto_int64 f3f5_4 = f3_2 * (crypto_int64) f5_2;
74
- crypto_int64 f3f6_2 = f3_2 * (crypto_int64) f6;
75
- crypto_int64 f3f7_76 = f3_2 * (crypto_int64) f7_38;
76
- crypto_int64 f3f8_38 = f3_2 * (crypto_int64) f8_19;
77
- crypto_int64 f3f9_76 = f3_2 * (crypto_int64) f9_38;
78
- crypto_int64 f4f4 = f4 * (crypto_int64) f4;
79
- crypto_int64 f4f5_2 = f4_2 * (crypto_int64) f5;
80
- crypto_int64 f4f6_38 = f4_2 * (crypto_int64) f6_19;
81
- crypto_int64 f4f7_38 = f4 * (crypto_int64) f7_38;
82
- crypto_int64 f4f8_38 = f4_2 * (crypto_int64) f8_19;
83
- crypto_int64 f4f9_38 = f4 * (crypto_int64) f9_38;
84
- crypto_int64 f5f5_38 = f5 * (crypto_int64) f5_38;
85
- crypto_int64 f5f6_38 = f5_2 * (crypto_int64) f6_19;
86
- crypto_int64 f5f7_76 = f5_2 * (crypto_int64) f7_38;
87
- crypto_int64 f5f8_38 = f5_2 * (crypto_int64) f8_19;
88
- crypto_int64 f5f9_76 = f5_2 * (crypto_int64) f9_38;
89
- crypto_int64 f6f6_19 = f6 * (crypto_int64) f6_19;
90
- crypto_int64 f6f7_38 = f6 * (crypto_int64) f7_38;
91
- crypto_int64 f6f8_38 = f6_2 * (crypto_int64) f8_19;
92
- crypto_int64 f6f9_38 = f6 * (crypto_int64) f9_38;
93
- crypto_int64 f7f7_38 = f7 * (crypto_int64) f7_38;
94
- crypto_int64 f7f8_38 = f7_2 * (crypto_int64) f8_19;
95
- crypto_int64 f7f9_76 = f7_2 * (crypto_int64) f9_38;
96
- crypto_int64 f8f8_19 = f8 * (crypto_int64) f8_19;
97
- crypto_int64 f8f9_38 = f8 * (crypto_int64) f9_38;
98
- crypto_int64 f9f9_38 = f9 * (crypto_int64) f9_38;
99
- crypto_int64 h0 = f0f0 +f1f9_76+f2f8_38+f3f7_76+f4f6_38+f5f5_38;
100
- crypto_int64 h1 = f0f1_2+f2f9_38+f3f8_38+f4f7_38+f5f6_38;
101
- crypto_int64 h2 = f0f2_2+f1f1_2 +f3f9_76+f4f8_38+f5f7_76+f6f6_19;
102
- crypto_int64 h3 = f0f3_2+f1f2_2 +f4f9_38+f5f8_38+f6f7_38;
103
- crypto_int64 h4 = f0f4_2+f1f3_4 +f2f2 +f5f9_76+f6f8_38+f7f7_38;
104
- crypto_int64 h5 = f0f5_2+f1f4_2 +f2f3_2 +f6f9_38+f7f8_38;
105
- crypto_int64 h6 = f0f6_2+f1f5_4 +f2f4_2 +f3f3_2 +f7f9_76+f8f8_19;
106
- crypto_int64 h7 = f0f7_2+f1f6_2 +f2f5_2 +f3f4_2 +f8f9_38;
107
- crypto_int64 h8 = f0f8_2+f1f7_4 +f2f6_2 +f3f5_4 +f4f4 +f9f9_38;
108
- crypto_int64 h9 = f0f9_2+f1f8_2 +f2f7_2 +f3f6_2 +f4f5_2;
109
- crypto_int64 carry0;
110
- crypto_int64 carry1;
111
- crypto_int64 carry2;
112
- crypto_int64 carry3;
113
- crypto_int64 carry4;
114
- crypto_int64 carry5;
115
- crypto_int64 carry6;
116
- crypto_int64 carry7;
117
- crypto_int64 carry8;
118
- crypto_int64 carry9;
119
-
120
- carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
121
- carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
122
-
123
- carry1 = (h1 + (crypto_int64) (1L << 24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
124
- carry5 = (h5 + (crypto_int64) (1L << 24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
125
-
126
- carry2 = (h2 + (crypto_int64) (1L << 25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
127
- carry6 = (h6 + (crypto_int64) (1L << 25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
128
-
129
- carry3 = (h3 + (crypto_int64) (1L << 24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
130
- carry7 = (h7 + (crypto_int64) (1L << 24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
131
-
132
- carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
133
- carry8 = (h8 + (crypto_int64) (1L << 25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
134
-
135
- carry9 = (h9 + (crypto_int64) (1L << 24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
136
-
137
- carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
138
-
139
- h[0] = (crypto_int32) h0;
140
- h[1] = (crypto_int32) h1;
141
- h[2] = (crypto_int32) h2;
142
- h[3] = (crypto_int32) h3;
143
- h[4] = (crypto_int32) h4;
144
- h[5] = (crypto_int32) h5;
145
- h[6] = (crypto_int32) h6;
146
- h[7] = (crypto_int32) h7;
147
- h[8] = (crypto_int32) h8;
148
- h[9] = (crypto_int32) h9;
149
- }