Skip to content

Commit 407599a

Browse files
committed
fe_isnonzero_vartime is not constant-time fn
Signed-off-by: tison <[email protected]>
1 parent 8aba2ef commit 407599a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crypto/curve25519/curve25519.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static void fe_invert(fe *out, const fe *z) {
395395

396396
// return 0 if f == 0
397397
// return 1 if f != 0
398-
static int fe_isnonzero(const fe_loose *f) {
398+
static int fe_isnonzero_vartime(const fe_loose *f) {
399399
fe tight;
400400
fe_carry(&tight, f);
401401
uint8_t s[32];
@@ -510,9 +510,9 @@ int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t s[32]) {
510510
fe_sq_tt(&vxx, &h->X);
511511
fe_mul_ttl(&vxx, &vxx, &v);
512512
fe_sub(&check, &vxx, &u);
513-
if (fe_isnonzero(&check)) {
513+
if (fe_isnonzero_vartime(&check)) {
514514
fe_add(&check, &vxx, &u);
515-
if (fe_isnonzero(&check)) {
515+
if (fe_isnonzero_vartime(&check)) {
516516
return 0;
517517
}
518518
fe_mul_ttt(&h->X, &h->X, &sqrtm1);

0 commit comments

Comments
 (0)