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,160 +0,0 @@
1
- #include "fe.h"
2
- #include "crypto_int64.h"
3
-
4
- /*
5
- h = 2 * 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_sq2(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
- h0 += h0;
121
- h1 += h1;
122
- h2 += h2;
123
- h3 += h3;
124
- h4 += h4;
125
- h5 += h5;
126
- h6 += h6;
127
- h7 += h7;
128
- h8 += h8;
129
- h9 += h9;
130
-
131
- carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
132
- carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
133
-
134
- carry1 = (h1 + (crypto_int64) (1L << 24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
135
- carry5 = (h5 + (crypto_int64) (1L << 24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
136
-
137
- carry2 = (h2 + (crypto_int64) (1L << 25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
138
- carry6 = (h6 + (crypto_int64) (1L << 25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
139
-
140
- carry3 = (h3 + (crypto_int64) (1L << 24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
141
- carry7 = (h7 + (crypto_int64) (1L << 24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
142
-
143
- carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
144
- carry8 = (h8 + (crypto_int64) (1L << 25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
145
-
146
- carry9 = (h9 + (crypto_int64) (1L << 24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
147
-
148
- carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
149
-
150
- h[0] = (crypto_int32) h0;
151
- h[1] = (crypto_int32) h1;
152
- h[2] = (crypto_int32) h2;
153
- h[3] = (crypto_int32) h3;
154
- h[4] = (crypto_int32) h4;
155
- h[5] = (crypto_int32) h5;
156
- h[6] = (crypto_int32) h6;
157
- h[7] = (crypto_int32) h7;
158
- h[8] = (crypto_int32) h8;
159
- h[9] = (crypto_int32) h9;
160
- }
@@ -1,57 +0,0 @@
1
- #include "fe.h"
2
-
3
- /*
4
- h = f - g
5
- Can overlap h with f or g.
6
-
7
- Preconditions:
8
- |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
9
- |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
10
-
11
- Postconditions:
12
- |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
13
- */
14
-
15
- void fe_sub(fe h,const fe f,const fe g)
16
- {
17
- crypto_int32 f0 = f[0];
18
- crypto_int32 f1 = f[1];
19
- crypto_int32 f2 = f[2];
20
- crypto_int32 f3 = f[3];
21
- crypto_int32 f4 = f[4];
22
- crypto_int32 f5 = f[5];
23
- crypto_int32 f6 = f[6];
24
- crypto_int32 f7 = f[7];
25
- crypto_int32 f8 = f[8];
26
- crypto_int32 f9 = f[9];
27
- crypto_int32 g0 = g[0];
28
- crypto_int32 g1 = g[1];
29
- crypto_int32 g2 = g[2];
30
- crypto_int32 g3 = g[3];
31
- crypto_int32 g4 = g[4];
32
- crypto_int32 g5 = g[5];
33
- crypto_int32 g6 = g[6];
34
- crypto_int32 g7 = g[7];
35
- crypto_int32 g8 = g[8];
36
- crypto_int32 g9 = g[9];
37
- crypto_int32 h0 = f0 - g0;
38
- crypto_int32 h1 = f1 - g1;
39
- crypto_int32 h2 = f2 - g2;
40
- crypto_int32 h3 = f3 - g3;
41
- crypto_int32 h4 = f4 - g4;
42
- crypto_int32 h5 = f5 - g5;
43
- crypto_int32 h6 = f6 - g6;
44
- crypto_int32 h7 = f7 - g7;
45
- crypto_int32 h8 = f8 - g8;
46
- crypto_int32 h9 = f9 - g9;
47
- h[0] = h0;
48
- h[1] = h1;
49
- h[2] = h2;
50
- h[3] = h3;
51
- h[4] = h4;
52
- h[5] = h5;
53
- h[6] = h6;
54
- h[7] = h7;
55
- h[8] = h8;
56
- h[9] = h9;
57
- }
@@ -1,119 +0,0 @@
1
- #include "fe.h"
2
-
3
- /*
4
- Preconditions:
5
- |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
6
-
7
- Write p=2^255-19; q=floor(h/p).
8
- Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))).
9
-
10
- Proof:
11
- Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4.
12
- Also have |h-2^230 h9|<2^231 so |19 2^(-255)(h-2^230 h9)|<1/4.
13
-
14
- Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9).
15
- Then 0<y<1.
16
-
17
- Write r=h-pq.
18
- Have 0<=r<=p-1=2^255-20.
19
- Thus 0<=r+19(2^-255)r<r+19(2^-255)2^255<=2^255-1.
20
-
21
- Write x=r+19(2^-255)r+y.
22
- Then 0<x<2^255 so floor(2^(-255)x) = 0 so floor(q+2^(-255)x) = q.
23
-
24
- Have q+2^(-255)x = 2^(-255)(h + 19 2^(-25) h9 + 2^(-1))
25
- so floor(2^(-255)(h + 19 2^(-25) h9 + 2^(-1))) = q.
26
- */
27
-
28
- void fe_tobytes(unsigned char *s,const fe h)
29
- {
30
- crypto_int32 h0 = h[0];
31
- crypto_int32 h1 = h[1];
32
- crypto_int32 h2 = h[2];
33
- crypto_int32 h3 = h[3];
34
- crypto_int32 h4 = h[4];
35
- crypto_int32 h5 = h[5];
36
- crypto_int32 h6 = h[6];
37
- crypto_int32 h7 = h[7];
38
- crypto_int32 h8 = h[8];
39
- crypto_int32 h9 = h[9];
40
- crypto_int32 q;
41
- crypto_int32 carry0;
42
- crypto_int32 carry1;
43
- crypto_int32 carry2;
44
- crypto_int32 carry3;
45
- crypto_int32 carry4;
46
- crypto_int32 carry5;
47
- crypto_int32 carry6;
48
- crypto_int32 carry7;
49
- crypto_int32 carry8;
50
- crypto_int32 carry9;
51
-
52
- q = (19 * h9 + (((crypto_int32) 1) << 24)) >> 25;
53
- q = (h0 + q) >> 26;
54
- q = (h1 + q) >> 25;
55
- q = (h2 + q) >> 26;
56
- q = (h3 + q) >> 25;
57
- q = (h4 + q) >> 26;
58
- q = (h5 + q) >> 25;
59
- q = (h6 + q) >> 26;
60
- q = (h7 + q) >> 25;
61
- q = (h8 + q) >> 26;
62
- q = (h9 + q) >> 25;
63
-
64
- /* Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20. */
65
- h0 += 19 * q;
66
- /* Goal: Output h-2^255 q, which is between 0 and 2^255-20. */
67
-
68
- carry0 = h0 >> 26; h1 += carry0; h0 -= carry0 << 26;
69
- carry1 = h1 >> 25; h2 += carry1; h1 -= carry1 << 25;
70
- carry2 = h2 >> 26; h3 += carry2; h2 -= carry2 << 26;
71
- carry3 = h3 >> 25; h4 += carry3; h3 -= carry3 << 25;
72
- carry4 = h4 >> 26; h5 += carry4; h4 -= carry4 << 26;
73
- carry5 = h5 >> 25; h6 += carry5; h5 -= carry5 << 25;
74
- carry6 = h6 >> 26; h7 += carry6; h6 -= carry6 << 26;
75
- carry7 = h7 >> 25; h8 += carry7; h7 -= carry7 << 25;
76
- carry8 = h8 >> 26; h9 += carry8; h8 -= carry8 << 26;
77
- carry9 = h9 >> 25; h9 -= carry9 << 25;
78
- /* h10 = carry9 */
79
-
80
- /*
81
- Goal: Output h0+...+2^255 h10-2^255 q, which is between 0 and 2^255-20.
82
- Have h0+...+2^230 h9 between 0 and 2^255-1;
83
- evidently 2^255 h10-2^255 q = 0.
84
- Goal: Output h0+...+2^230 h9.
85
- */
86
-
87
- s[0] = h0 >> 0;
88
- s[1] = h0 >> 8;
89
- s[2] = h0 >> 16;
90
- s[3] = (h0 >> 24) | (h1 << 2);
91
- s[4] = h1 >> 6;
92
- s[5] = h1 >> 14;
93
- s[6] = (h1 >> 22) | (h2 << 3);
94
- s[7] = h2 >> 5;
95
- s[8] = h2 >> 13;
96
- s[9] = (h2 >> 21) | (h3 << 5);
97
- s[10] = h3 >> 3;
98
- s[11] = h3 >> 11;
99
- s[12] = (h3 >> 19) | (h4 << 6);
100
- s[13] = h4 >> 2;
101
- s[14] = h4 >> 10;
102
- s[15] = h4 >> 18;
103
- s[16] = h5 >> 0;
104
- s[17] = h5 >> 8;
105
- s[18] = h5 >> 16;
106
- s[19] = (h5 >> 24) | (h6 << 1);
107
- s[20] = h6 >> 7;
108
- s[21] = h6 >> 15;
109
- s[22] = (h6 >> 23) | (h7 << 3);
110
- s[23] = h7 >> 5;
111
- s[24] = h7 >> 13;
112
- s[25] = (h7 >> 21) | (h8 << 4);
113
- s[26] = h8 >> 4;
114
- s[27] = h8 >> 12;
115
- s[28] = (h8 >> 20) | (h9 << 6);
116
- s[29] = h9 >> 2;
117
- s[30] = h9 >> 10;
118
- s[31] = h9 >> 18;
119
- }
@@ -1,97 +0,0 @@
1
- #ifndef GE_H
2
- #define GE_H
3
-
4
- /*
5
- ge means group element.
6
-
7
- Here the group is the set of pairs (x,y) of field elements (see fe.h)
8
- satisfying -x^2 + y^2 = 1 + d x^2y^2
9
- where d = -121665/121666.
10
-
11
- Representations:
12
- ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z
13
- ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
14
- ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
15
- ge_precomp (Duif): (y+x,y-x,2dxy)
16
- */
17
-
18
- #include "fe.h"
19
-
20
- typedef struct {
21
- fe X;
22
- fe Y;
23
- fe Z;
24
- } ge_p2;
25
-
26
- typedef struct {
27
- fe X;
28
- fe Y;
29
- fe Z;
30
- fe T;
31
- } ge_p3;
32
-
33
- typedef struct {
34
- fe X;
35
- fe Y;
36
- fe Z;
37
- fe T;
38
- } ge_p1p1;
39
-
40
- typedef struct {
41
- fe yplusx;
42
- fe yminusx;
43
- fe xy2d;
44
- } ge_precomp;
45
-
46
- typedef struct {
47
- fe YplusX;
48
- fe YminusX;
49
- fe Z;
50
- fe T2d;
51
- } ge_cached;
52
-
53
- #define ge_frombytes_negate_vartime crypto_sign_ed25519_ref10_ge_frombytes_negate_vartime
54
- #define ge_tobytes crypto_sign_ed25519_ref10_ge_tobytes
55
- #define ge_p3_tobytes crypto_sign_ed25519_ref10_ge_p3_tobytes
56
-
57
- #define ge_p2_0 crypto_sign_ed25519_ref10_ge_p2_0
58
- #define ge_p3_0 crypto_sign_ed25519_ref10_ge_p3_0
59
- #define ge_precomp_0 crypto_sign_ed25519_ref10_ge_precomp_0
60
- #define ge_p3_to_p2 crypto_sign_ed25519_ref10_ge_p3_to_p2
61
- #define ge_p3_to_cached crypto_sign_ed25519_ref10_ge_p3_to_cached
62
- #define ge_p1p1_to_p2 crypto_sign_ed25519_ref10_ge_p1p1_to_p2
63
- #define ge_p1p1_to_p3 crypto_sign_ed25519_ref10_ge_p1p1_to_p3
64
- #define ge_p2_dbl crypto_sign_ed25519_ref10_ge_p2_dbl
65
- #define ge_p3_dbl crypto_sign_ed25519_ref10_ge_p3_dbl
66
-
67
- #define ge_madd crypto_sign_ed25519_ref10_ge_madd
68
- #define ge_msub crypto_sign_ed25519_ref10_ge_msub
69
- #define ge_add crypto_sign_ed25519_ref10_ge_add
70
- #define ge_sub crypto_sign_ed25519_ref10_ge_sub
71
- #define ge_scalarmult_base crypto_sign_ed25519_ref10_ge_scalarmult_base
72
- #define ge_double_scalarmult_vartime crypto_sign_ed25519_ref10_ge_double_scalarmult_vartime
73
- #define ge_scalarmult_vartime crypto_sign_ed25519_ref10_ge_scalarmult_vartime
74
-
75
- extern void ge_tobytes(unsigned char *,const ge_p2 *);
76
- extern void ge_p3_tobytes(unsigned char *,const ge_p3 *);
77
- extern int ge_frombytes_negate_vartime(ge_p3 *,const unsigned char *);
78
-
79
- extern void ge_p2_0(ge_p2 *);
80
- extern void ge_p3_0(ge_p3 *);
81
- extern void ge_precomp_0(ge_precomp *);
82
- extern void ge_p3_to_p2(ge_p2 *,const ge_p3 *);
83
- extern void ge_p3_to_cached(ge_cached *,const ge_p3 *);
84
- extern void ge_p1p1_to_p2(ge_p2 *,const ge_p1p1 *);
85
- extern void ge_p1p1_to_p3(ge_p3 *,const ge_p1p1 *);
86
- extern void ge_p2_dbl(ge_p1p1 *,const ge_p2 *);
87
- extern void ge_p3_dbl(ge_p1p1 *,const ge_p3 *);
88
-
89
- extern void ge_madd(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
90
- extern void ge_msub(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
91
- extern void ge_add(ge_p1p1 *,const ge_p3 *,const ge_cached *);
92
- extern void ge_sub(ge_p1p1 *,const ge_p3 *,const ge_cached *);
93
- extern void ge_scalarmult_base(ge_p3 *,const unsigned char *);
94
- extern void ge_double_scalarmult_vartime(ge_p2 *,const unsigned char *,const ge_p3 *,const unsigned char *);
95
- extern void ge_scalarmult_vartime(ge_p3 *,const unsigned char *,const ge_p3 *);
96
-
97
- #endif
@@ -1,11 +0,0 @@
1
- #include "ge.h"
2
-
3
- /*
4
- r = p + q
5
- */
6
-
7
- void ge_add(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q)
8
- {
9
- fe t0;
10
- #include "ge_add.h"
11
- }
@@ -1,97 +0,0 @@
1
-
2
- /* qhasm: enter ge_add */
3
-
4
- /* qhasm: fe X1 */
5
-
6
- /* qhasm: fe Y1 */
7
-
8
- /* qhasm: fe Z1 */
9
-
10
- /* qhasm: fe Z2 */
11
-
12
- /* qhasm: fe T1 */
13
-
14
- /* qhasm: fe ZZ */
15
-
16
- /* qhasm: fe YpX2 */
17
-
18
- /* qhasm: fe YmX2 */
19
-
20
- /* qhasm: fe T2d2 */
21
-
22
- /* qhasm: fe X3 */
23
-
24
- /* qhasm: fe Y3 */
25
-
26
- /* qhasm: fe Z3 */
27
-
28
- /* qhasm: fe T3 */
29
-
30
- /* qhasm: fe YpX1 */
31
-
32
- /* qhasm: fe YmX1 */
33
-
34
- /* qhasm: fe A */
35
-
36
- /* qhasm: fe B */
37
-
38
- /* qhasm: fe C */
39
-
40
- /* qhasm: fe D */
41
-
42
- /* qhasm: YpX1 = Y1+X1 */
43
- /* asm 1: fe_add(>YpX1=fe#1,<Y1=fe#12,<X1=fe#11); */
44
- /* asm 2: fe_add(>YpX1=r->X,<Y1=p->Y,<X1=p->X); */
45
- fe_add(r->X,p->Y,p->X);
46
-
47
- /* qhasm: YmX1 = Y1-X1 */
48
- /* asm 1: fe_sub(>YmX1=fe#2,<Y1=fe#12,<X1=fe#11); */
49
- /* asm 2: fe_sub(>YmX1=r->Y,<Y1=p->Y,<X1=p->X); */
50
- fe_sub(r->Y,p->Y,p->X);
51
-
52
- /* qhasm: A = YpX1*YpX2 */
53
- /* asm 1: fe_mul(>A=fe#3,<YpX1=fe#1,<YpX2=fe#15); */
54
- /* asm 2: fe_mul(>A=r->Z,<YpX1=r->X,<YpX2=q->YplusX); */
55
- fe_mul(r->Z,r->X,q->YplusX);
56
-
57
- /* qhasm: B = YmX1*YmX2 */
58
- /* asm 1: fe_mul(>B=fe#2,<YmX1=fe#2,<YmX2=fe#16); */
59
- /* asm 2: fe_mul(>B=r->Y,<YmX1=r->Y,<YmX2=q->YminusX); */
60
- fe_mul(r->Y,r->Y,q->YminusX);
61
-
62
- /* qhasm: C = T2d2*T1 */
63
- /* asm 1: fe_mul(>C=fe#4,<T2d2=fe#18,<T1=fe#14); */
64
- /* asm 2: fe_mul(>C=r->T,<T2d2=q->T2d,<T1=p->T); */
65
- fe_mul(r->T,q->T2d,p->T);
66
-
67
- /* qhasm: ZZ = Z1*Z2 */
68
- /* asm 1: fe_mul(>ZZ=fe#1,<Z1=fe#13,<Z2=fe#17); */
69
- /* asm 2: fe_mul(>ZZ=r->X,<Z1=p->Z,<Z2=q->Z); */
70
- fe_mul(r->X,p->Z,q->Z);
71
-
72
- /* qhasm: D = 2*ZZ */
73
- /* asm 1: fe_add(>D=fe#5,<ZZ=fe#1,<ZZ=fe#1); */
74
- /* asm 2: fe_add(>D=t0,<ZZ=r->X,<ZZ=r->X); */
75
- fe_add(t0,r->X,r->X);
76
-
77
- /* qhasm: X3 = A-B */
78
- /* asm 1: fe_sub(>X3=fe#1,<A=fe#3,<B=fe#2); */
79
- /* asm 2: fe_sub(>X3=r->X,<A=r->Z,<B=r->Y); */
80
- fe_sub(r->X,r->Z,r->Y);
81
-
82
- /* qhasm: Y3 = A+B */
83
- /* asm 1: fe_add(>Y3=fe#2,<A=fe#3,<B=fe#2); */
84
- /* asm 2: fe_add(>Y3=r->Y,<A=r->Z,<B=r->Y); */
85
- fe_add(r->Y,r->Z,r->Y);
86
-
87
- /* qhasm: Z3 = D+C */
88
- /* asm 1: fe_add(>Z3=fe#3,<D=fe#5,<C=fe#4); */
89
- /* asm 2: fe_add(>Z3=r->Z,<D=t0,<C=r->T); */
90
- fe_add(r->Z,t0,r->T);
91
-
92
- /* qhasm: T3 = D-C */
93
- /* asm 1: fe_sub(>T3=fe#4,<D=fe#5,<C=fe#4); */
94
- /* asm 2: fe_sub(>T3=r->T,<D=t0,<C=r->T); */
95
- fe_sub(r->T,t0,r->T);
96
-
97
- /* qhasm: return */