ed25519 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES.md +51 -17
  3. data/LICENSE +1 -1
  4. data/README.md +29 -14
  5. data/ed25519.png +0 -0
  6. data/ext/ed25519_jruby/org/{cryptosphere → cryptorb}/Ed25519Provider.java +1 -1
  7. data/ext/ed25519_ref10/extconf.rb +2 -2
  8. data/ext/ed25519_ref10/fe.c +1085 -0
  9. data/ext/ed25519_ref10/ge.c +407 -0
  10. data/lib/ed25519/verify_key.rb +2 -1
  11. data/lib/ed25519/version.rb +1 -1
  12. data/lib/ed25519.rb +8 -8
  13. data/lib/ed25519_jruby.jar +0 -0
  14. metadata +23 -60
  15. data/.gitignore +0 -16
  16. data/.rspec +0 -5
  17. data/.rubocop.yml +0 -35
  18. data/.travis.yml +0 -15
  19. data/CODE_OF_CONDUCT.md +0 -74
  20. data/Gemfile +0 -12
  21. data/Rakefile +0 -27
  22. data/ed25519.gemspec +0 -32
  23. data/ext/ed25519_ref10/fe_0.c +0 -19
  24. data/ext/ed25519_ref10/fe_1.c +0 -19
  25. data/ext/ed25519_ref10/fe_add.c +0 -57
  26. data/ext/ed25519_ref10/fe_cmov.c +0 -63
  27. data/ext/ed25519_ref10/fe_copy.c +0 -29
  28. data/ext/ed25519_ref10/fe_frombytes.c +0 -71
  29. data/ext/ed25519_ref10/fe_invert.c +0 -14
  30. data/ext/ed25519_ref10/fe_isnegative.c +0 -16
  31. data/ext/ed25519_ref10/fe_isnonzero.c +0 -19
  32. data/ext/ed25519_ref10/fe_mul.c +0 -252
  33. data/ext/ed25519_ref10/fe_neg.c +0 -45
  34. data/ext/ed25519_ref10/fe_pow22523.c +0 -13
  35. data/ext/ed25519_ref10/fe_sq.c +0 -148
  36. data/ext/ed25519_ref10/fe_sq2.c +0 -159
  37. data/ext/ed25519_ref10/fe_sub.c +0 -57
  38. data/ext/ed25519_ref10/fe_tobytes.c +0 -119
  39. data/ext/ed25519_ref10/ge_add.c +0 -11
  40. data/ext/ed25519_ref10/ge_double_scalarmult.c +0 -96
  41. data/ext/ed25519_ref10/ge_frombytes.c +0 -50
  42. data/ext/ed25519_ref10/ge_madd.c +0 -11
  43. data/ext/ed25519_ref10/ge_msub.c +0 -11
  44. data/ext/ed25519_ref10/ge_p1p1_to_p2.c +0 -12
  45. data/ext/ed25519_ref10/ge_p1p1_to_p3.c +0 -13
  46. data/ext/ed25519_ref10/ge_p2_0.c +0 -8
  47. data/ext/ed25519_ref10/ge_p2_dbl.c +0 -11
  48. data/ext/ed25519_ref10/ge_p3_0.c +0 -9
  49. data/ext/ed25519_ref10/ge_p3_dbl.c +0 -12
  50. data/ext/ed25519_ref10/ge_p3_to_cached.c +0 -17
  51. data/ext/ed25519_ref10/ge_p3_to_p2.c +0 -12
  52. data/ext/ed25519_ref10/ge_p3_tobytes.c +0 -14
  53. data/ext/ed25519_ref10/ge_precomp_0.c +0 -8
  54. data/ext/ed25519_ref10/ge_scalarmult_base.c +0 -104
  55. data/ext/ed25519_ref10/ge_sub.c +0 -11
  56. data/ext/ed25519_ref10/ge_tobytes.c +0 -14
@@ -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
- int32_t h0 = h[0];
31
- int32_t h1 = h[1];
32
- int32_t h2 = h[2];
33
- int32_t h3 = h[3];
34
- int32_t h4 = h[4];
35
- int32_t h5 = h[5];
36
- int32_t h6 = h[6];
37
- int32_t h7 = h[7];
38
- int32_t h8 = h[8];
39
- int32_t h9 = h[9];
40
- int32_t q;
41
- int32_t carry0;
42
- int32_t carry1;
43
- int32_t carry2;
44
- int32_t carry3;
45
- int32_t carry4;
46
- int32_t carry5;
47
- int32_t carry6;
48
- int32_t carry7;
49
- int32_t carry8;
50
- int32_t carry9;
51
-
52
- q = (19 * h9 + (((int32_t) 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,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,96 +0,0 @@
1
- #include "ge.h"
2
-
3
- static void slide(signed char *r,const unsigned char *a)
4
- {
5
- int i;
6
- int b;
7
- int k;
8
-
9
- for (i = 0;i < 256;++i)
10
- r[i] = 1 & (a[i >> 3] >> (i & 7));
11
-
12
- for (i = 0;i < 256;++i)
13
- if (r[i]) {
14
- for (b = 1;b <= 6 && i + b < 256;++b) {
15
- if (r[i + b]) {
16
- if (r[i] + (r[i + b] << b) <= 15) {
17
- r[i] += r[i + b] << b; r[i + b] = 0;
18
- } else if (r[i] - (r[i + b] << b) >= -15) {
19
- r[i] -= r[i + b] << b;
20
- for (k = i + b;k < 256;++k) {
21
- if (!r[k]) {
22
- r[k] = 1;
23
- break;
24
- }
25
- r[k] = 0;
26
- }
27
- } else
28
- break;
29
- }
30
- }
31
- }
32
-
33
- }
34
-
35
- static ge_precomp Bi[8] = {
36
- #include "base2.h"
37
- } ;
38
-
39
- /*
40
- r = a * A + b * B
41
- where a = a[0]+256*a[1]+...+256^31 a[31].
42
- and b = b[0]+256*b[1]+...+256^31 b[31].
43
- B is the Ed25519 base point (x,4/5) with x positive.
44
- */
45
-
46
- void ge_double_scalarmult_vartime(ge_p2 *r,const unsigned char *a,const ge_p3 *A,const unsigned char *b)
47
- {
48
- signed char aslide[256];
49
- signed char bslide[256];
50
- ge_cached Ai[8]; /* A,3A,5A,7A,9A,11A,13A,15A */
51
- ge_p1p1 t;
52
- ge_p3 u;
53
- ge_p3 A2;
54
- int i;
55
-
56
- slide(aslide,a);
57
- slide(bslide,b);
58
-
59
- ge_p3_to_cached(&Ai[0],A);
60
- ge_p3_dbl(&t,A); ge_p1p1_to_p3(&A2,&t);
61
- ge_add(&t,&A2,&Ai[0]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[1],&u);
62
- ge_add(&t,&A2,&Ai[1]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[2],&u);
63
- ge_add(&t,&A2,&Ai[2]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[3],&u);
64
- ge_add(&t,&A2,&Ai[3]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[4],&u);
65
- ge_add(&t,&A2,&Ai[4]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[5],&u);
66
- ge_add(&t,&A2,&Ai[5]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[6],&u);
67
- ge_add(&t,&A2,&Ai[6]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[7],&u);
68
-
69
- ge_p2_0(r);
70
-
71
- for (i = 255;i >= 0;--i) {
72
- if (aslide[i] || bslide[i]) break;
73
- }
74
-
75
- for (;i >= 0;--i) {
76
- ge_p2_dbl(&t,r);
77
-
78
- if (aslide[i] > 0) {
79
- ge_p1p1_to_p3(&u,&t);
80
- ge_add(&t,&u,&Ai[aslide[i]/2]);
81
- } else if (aslide[i] < 0) {
82
- ge_p1p1_to_p3(&u,&t);
83
- ge_sub(&t,&u,&Ai[(-aslide[i])/2]);
84
- }
85
-
86
- if (bslide[i] > 0) {
87
- ge_p1p1_to_p3(&u,&t);
88
- ge_madd(&t,&u,&Bi[bslide[i]/2]);
89
- } else if (bslide[i] < 0) {
90
- ge_p1p1_to_p3(&u,&t);
91
- ge_msub(&t,&u,&Bi[(-bslide[i])/2]);
92
- }
93
-
94
- ge_p1p1_to_p2(r,&t);
95
- }
96
- }
@@ -1,50 +0,0 @@
1
- #include "ge.h"
2
-
3
- static const fe d = {
4
- #include "d.h"
5
- } ;
6
-
7
- static const fe sqrtm1 = {
8
- #include "sqrtm1.h"
9
- } ;
10
-
11
- int ge_frombytes_negate_vartime(ge_p3 *h,const unsigned char *s)
12
- {
13
- fe u;
14
- fe v;
15
- fe v3;
16
- fe vxx;
17
- fe check;
18
-
19
- fe_frombytes(h->Y,s);
20
- fe_1(h->Z);
21
- fe_sq(u,h->Y);
22
- fe_mul(v,u,d);
23
- fe_sub(u,u,h->Z); /* u = y^2-1 */
24
- fe_add(v,v,h->Z); /* v = dy^2+1 */
25
-
26
- fe_sq(v3,v);
27
- fe_mul(v3,v3,v); /* v3 = v^3 */
28
- fe_sq(h->X,v3);
29
- fe_mul(h->X,h->X,v);
30
- fe_mul(h->X,h->X,u); /* x = uv^7 */
31
-
32
- fe_pow22523(h->X,h->X); /* x = (uv^7)^((q-5)/8) */
33
- fe_mul(h->X,h->X,v3);
34
- fe_mul(h->X,h->X,u); /* x = uv^3(uv^7)^((q-5)/8) */
35
-
36
- fe_sq(vxx,h->X);
37
- fe_mul(vxx,vxx,v);
38
- fe_sub(check,vxx,u); /* vx^2-u */
39
- if (fe_isnonzero(check)) {
40
- fe_add(check,vxx,u); /* vx^2+u */
41
- if (fe_isnonzero(check)) return -1;
42
- fe_mul(h->X,h->X,sqrtm1);
43
- }
44
-
45
- if (fe_isnegative(h->X) == (s[31] >> 7))
46
- fe_neg(h->X,h->X);
47
-
48
- fe_mul(h->T,h->X,h->Y);
49
- return 0;
50
- }
@@ -1,11 +0,0 @@
1
- #include "ge.h"
2
-
3
- /*
4
- r = p + q
5
- */
6
-
7
- void ge_madd(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q)
8
- {
9
- fe t0;
10
- #include "ge_madd.h"
11
- }
@@ -1,11 +0,0 @@
1
- #include "ge.h"
2
-
3
- /*
4
- r = p - q
5
- */
6
-
7
- void ge_msub(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q)
8
- {
9
- fe t0;
10
- #include "ge_msub.h"
11
- }
@@ -1,12 +0,0 @@
1
- #include "ge.h"
2
-
3
- /*
4
- r = p
5
- */
6
-
7
- extern void ge_p1p1_to_p2(ge_p2 *r,const ge_p1p1 *p)
8
- {
9
- fe_mul(r->X,p->X,p->T);
10
- fe_mul(r->Y,p->Y,p->Z);
11
- fe_mul(r->Z,p->Z,p->T);
12
- }
@@ -1,13 +0,0 @@
1
- #include "ge.h"
2
-
3
- /*
4
- r = p
5
- */
6
-
7
- extern void ge_p1p1_to_p3(ge_p3 *r,const ge_p1p1 *p)
8
- {
9
- fe_mul(r->X,p->X,p->T);
10
- fe_mul(r->Y,p->Y,p->Z);
11
- fe_mul(r->Z,p->Z,p->T);
12
- fe_mul(r->T,p->X,p->Y);
13
- }
@@ -1,8 +0,0 @@
1
- #include "ge.h"
2
-
3
- void ge_p2_0(ge_p2 *h)
4
- {
5
- fe_0(h->X);
6
- fe_1(h->Y);
7
- fe_1(h->Z);
8
- }
@@ -1,11 +0,0 @@
1
- #include "ge.h"
2
-
3
- /*
4
- r = 2 * p
5
- */
6
-
7
- void ge_p2_dbl(ge_p1p1 *r,const ge_p2 *p)
8
- {
9
- fe t0;
10
- #include "ge_p2_dbl.h"
11
- }
@@ -1,9 +0,0 @@
1
- #include "ge.h"
2
-
3
- void ge_p3_0(ge_p3 *h)
4
- {
5
- fe_0(h->X);
6
- fe_1(h->Y);
7
- fe_1(h->Z);
8
- fe_0(h->T);
9
- }
@@ -1,12 +0,0 @@
1
- #include "ge.h"
2
-
3
- /*
4
- r = 2 * p
5
- */
6
-
7
- void ge_p3_dbl(ge_p1p1 *r,const ge_p3 *p)
8
- {
9
- ge_p2 q;
10
- ge_p3_to_p2(&q,p);
11
- ge_p2_dbl(r,&q);
12
- }
@@ -1,17 +0,0 @@
1
- #include "ge.h"
2
-
3
- /*
4
- r = p
5
- */
6
-
7
- static const fe d2 = {
8
- #include "d2.h"
9
- } ;
10
-
11
- extern void ge_p3_to_cached(ge_cached *r,const ge_p3 *p)
12
- {
13
- fe_add(r->YplusX,p->Y,p->X);
14
- fe_sub(r->YminusX,p->Y,p->X);
15
- fe_copy(r->Z,p->Z);
16
- fe_mul(r->T2d,p->T,d2);
17
- }
@@ -1,12 +0,0 @@
1
- #include "ge.h"
2
-
3
- /*
4
- r = p
5
- */
6
-
7
- extern void ge_p3_to_p2(ge_p2 *r,const ge_p3 *p)
8
- {
9
- fe_copy(r->X,p->X);
10
- fe_copy(r->Y,p->Y);
11
- fe_copy(r->Z,p->Z);
12
- }
@@ -1,14 +0,0 @@
1
- #include "ge.h"
2
-
3
- void ge_p3_tobytes(unsigned char *s,const ge_p3 *h)
4
- {
5
- fe recip;
6
- fe x;
7
- fe y;
8
-
9
- fe_invert(recip,h->Z);
10
- fe_mul(x,h->X,recip);
11
- fe_mul(y,h->Y,recip);
12
- fe_tobytes(s,y);
13
- s[31] ^= fe_isnegative(x) << 7;
14
- }
@@ -1,8 +0,0 @@
1
- #include "ge.h"
2
-
3
- void ge_precomp_0(ge_precomp *h)
4
- {
5
- fe_1(h->yplusx);
6
- fe_1(h->yminusx);
7
- fe_0(h->xy2d);
8
- }
@@ -1,104 +0,0 @@
1
- #include "ge.h"
2
-
3
- static uint8_t equal(int8_t b,int8_t c)
4
- {
5
- uint8_t ub = b;
6
- uint8_t uc = c;
7
- uint8_t x = ub ^ uc; /* 0: yes; 1..255: no */
8
- uint32_t y = x; /* 0: yes; 1..255: no */
9
- y -= 1; /* 4294967295: yes; 0..254: no */
10
- y >>= 31; /* 1: yes; 0: no */
11
- return y;
12
- }
13
-
14
- static uint8_t negative(int8_t b)
15
- {
16
- unsigned long long x = b; /* 18446744073709551361..18446744073709551615: yes; 0..255: no */
17
- x >>= 63; /* 1: yes; 0: no */
18
- return x;
19
- }
20
-
21
- static void cmov(ge_precomp *t,ge_precomp *u,int8_t b)
22
- {
23
- fe_cmov(t->yplusx,u->yplusx,b);
24
- fe_cmov(t->yminusx,u->yminusx,b);
25
- fe_cmov(t->xy2d,u->xy2d,b);
26
- }
27
-
28
- /* base[i][j] = (j+1)*256^i*B */
29
- static ge_precomp base[32][8] = {
30
- #include "base.h"
31
- } ;
32
-
33
- static void select(ge_precomp *t,int pos,int8_t b)
34
- {
35
- ge_precomp minust;
36
- uint8_t bnegative = negative(b);
37
- uint8_t babs = b - (((-bnegative) & b) << 1);
38
-
39
- ge_precomp_0(t);
40
- cmov(t,&base[pos][0],equal(babs,1));
41
- cmov(t,&base[pos][1],equal(babs,2));
42
- cmov(t,&base[pos][2],equal(babs,3));
43
- cmov(t,&base[pos][3],equal(babs,4));
44
- cmov(t,&base[pos][4],equal(babs,5));
45
- cmov(t,&base[pos][5],equal(babs,6));
46
- cmov(t,&base[pos][6],equal(babs,7));
47
- cmov(t,&base[pos][7],equal(babs,8));
48
- fe_copy(minust.yplusx,t->yminusx);
49
- fe_copy(minust.yminusx,t->yplusx);
50
- fe_neg(minust.xy2d,t->xy2d);
51
- cmov(t,&minust,bnegative);
52
- }
53
-
54
- /*
55
- h = a * B
56
- where a = a[0]+256*a[1]+...+256^31 a[31]
57
- B is the Ed25519 base point (x,4/5) with x positive.
58
-
59
- Preconditions:
60
- a[31] <= 127
61
- */
62
-
63
- void ge_scalarmult_base(ge_p3 *h,const uint8_t *a)
64
- {
65
- int8_t e[64];
66
- int8_t carry;
67
- ge_p1p1 r;
68
- ge_p2 s;
69
- ge_precomp t;
70
- int i;
71
-
72
- for (i = 0;i < 32;++i) {
73
- e[2 * i + 0] = (a[i] >> 0) & 15;
74
- e[2 * i + 1] = (a[i] >> 4) & 15;
75
- }
76
- /* each e[i] is between 0 and 15 */
77
- /* e[63] is between 0 and 7 */
78
-
79
- carry = 0;
80
- for (i = 0;i < 63;++i) {
81
- e[i] += carry;
82
- carry = e[i] + 8;
83
- carry >>= 4;
84
- e[i] -= carry << 4;
85
- }
86
- e[63] += carry;
87
- /* each e[i] is between -8 and 8 */
88
-
89
- ge_p3_0(h);
90
- for (i = 1;i < 64;i += 2) {
91
- select(&t,i / 2,e[i]);
92
- ge_madd(&r,h,&t); ge_p1p1_to_p3(h,&r);
93
- }
94
-
95
- ge_p3_dbl(&r,h); ge_p1p1_to_p2(&s,&r);
96
- ge_p2_dbl(&r,&s); ge_p1p1_to_p2(&s,&r);
97
- ge_p2_dbl(&r,&s); ge_p1p1_to_p2(&s,&r);
98
- ge_p2_dbl(&r,&s); ge_p1p1_to_p3(h,&r);
99
-
100
- for (i = 0;i < 64;i += 2) {
101
- select(&t,i / 2,e[i]);
102
- ge_madd(&r,h,&t); ge_p1p1_to_p3(h,&r);
103
- }
104
- }
@@ -1,11 +0,0 @@
1
- #include "ge.h"
2
-
3
- /*
4
- r = p - q
5
- */
6
-
7
- void ge_sub(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q)
8
- {
9
- fe t0;
10
- #include "ge_sub.h"
11
- }
@@ -1,14 +0,0 @@
1
- #include "ge.h"
2
-
3
- void ge_tobytes(unsigned char *s,const ge_p2 *h)
4
- {
5
- fe recip;
6
- fe x;
7
- fe y;
8
-
9
- fe_invert(recip,h->Z);
10
- fe_mul(x,h->X,recip);
11
- fe_mul(y,h->Y,recip);
12
- fe_tobytes(s,y);
13
- s[31] ^= fe_isnegative(x) << 7;
14
- }