Skip to content

Commit 26a9435

Browse files
committed
ECC point double: when z ordinate is 0 point is infinity
Recognize z == 0 as infinity in result of double.
1 parent 2213306 commit 26a9435

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

wolfcrypt/src/ecc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7801,6 +7801,13 @@ int ecc_projective_dbl_point_safe(ecc_point *P, ecc_point *R, mp_int* a,
78017801
}
78027802
else {
78037803
err = _ecc_projective_dbl_point(P, R, a, modulus, mp);
7804+
if ((err == MP_OKAY) && mp_iszero(R->z)) {
7805+
err = mp_set(R->x, 0);
7806+
if (err == MP_OKAY)
7807+
err = mp_set(R->y, 0);
7808+
if (err == MP_OKAY)
7809+
err = mp_set(R->z, 1);
7810+
}
78047811
}
78057812

78067813
return err;

0 commit comments

Comments
 (0)