mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
ECC point double: when z ordinate is 0 point is infinity
Recognize z == 0 as infinity in result of double.
This commit is contained in:
@ -7801,6 +7801,13 @@ int ecc_projective_dbl_point_safe(ecc_point *P, ecc_point *R, mp_int* a,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
err = _ecc_projective_dbl_point(P, R, a, modulus, mp);
|
err = _ecc_projective_dbl_point(P, R, a, modulus, mp);
|
||||||
|
if ((err == MP_OKAY) && mp_iszero(R->z)) {
|
||||||
|
err = mp_set(R->x, 0);
|
||||||
|
if (err == MP_OKAY)
|
||||||
|
err = mp_set(R->y, 0);
|
||||||
|
if (err == MP_OKAY)
|
||||||
|
err = mp_set(R->z, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
Reference in New Issue
Block a user