diff --git a/ge25519.c.bak b/ge25519.c
index 7bc6c48..0ea7f15 100644
a
|
b
|
static void setneutral(ge25519 *r) |
185 | 185 | /* return 0 on success, -1 otherwise */ |
186 | 186 | int ge25519_unpackneg_vartime(ge25519_p3 *r, const unsigned char p[32]) |
187 | 187 | { |
| 188 | unsigned char par; |
188 | 189 | fe25519 t, chk, num, den, den2, den4, den6; |
189 | 190 | fe25519_setone(&r->z); |
190 | | unsigned char par = p[31] >> 7; |
| 191 | par = p[31] >> 7; |
191 | 192 | fe25519_unpack(&r->y, p); |
192 | 193 | fe25519_square(&num, &r->y); /* x = y^2 */ |
193 | 194 | fe25519_mul(&den, &num, &ge25519_ecd); /* den = dy^2 */ |
… |
… |
void ge25519_double_scalarmult_vartime(ge25519_p3 *r, const ge25519_p3 *p1, cons |
253 | 254 | ge25519_p1p1 tp1p1; |
254 | 255 | ge25519_p3 pre[16]; |
255 | 256 | unsigned char b[127]; |
| 257 | int i; |
256 | 258 | |
257 | 259 | /* precomputation s2 s1 */ |
258 | 260 | setneutral(pre); /* 00 00 */ |
… |
… |
void ge25519_double_scalarmult_vartime(ge25519_p3 *r, const ge25519_p3 *p1, cons |
276 | 278 | |
277 | 279 | /* scalar multiplication */ |
278 | 280 | *r = pre[b[126]]; |
279 | | int i; |
280 | 281 | for(i=125;i>=0;i--) |
281 | 282 | { |
282 | 283 | dbl_p1p1(&tp1p1, (ge25519_p2 *)r); |
diff --git a/fe25519.c.bak b/fe25519.c
index b9a1884..b96764c 100644
a
|
b
|
void fe25519_pack(unsigned char r[32], const fe25519 *x) |
106 | 106 | |
107 | 107 | int fe25519_iszero(const fe25519 *x) |
108 | 108 | { |
109 | | int i; |
| 109 | int i, r; |
110 | 110 | fe25519 t = *x; |
111 | 111 | fe25519_freeze(&t); |
112 | | int r = equal(t.v[0],0); |
| 112 | r = equal(t.v[0],0); |
113 | 113 | for(i=1;i<32;i++) |
114 | 114 | r &= equal(t.v[i],0); |
115 | 115 | return r; |
… |
… |
int fe25519_iszero(const fe25519 *x) |
117 | 117 | |
118 | 118 | int fe25519_iseq_vartime(const fe25519 *x, const fe25519 *y) |
119 | 119 | { |
| 120 | int i; |
120 | 121 | fe25519 t1 = *x; |
121 | 122 | fe25519 t2 = *y; |
122 | 123 | fe25519_freeze(&t1); |
123 | 124 | fe25519_freeze(&t2); |
124 | | int i; |
125 | 125 | for(i=0;i<32;i++) |
126 | 126 | if(t1.v[i] != t2.v[i]) return 0; |
127 | 127 | return 1; |