Explain why no y=0 check is necessary for doubling
Explanation suggested by Greg Maxwell.
This commit is contained in:
parent
f7dc1c6513
commit
e3d692ff75
|
@ -208,6 +208,9 @@ static int secp256k1_ge_is_valid(const secp256k1_ge_t *a) {
|
|||
}
|
||||
|
||||
static void secp256k1_gej_double_var(secp256k1_gej_t *r, const secp256k1_gej_t *a) {
|
||||
// For secp256k1, 2Q is infinity if and only if Q is infinity. This is because if 2Q = infinity,
|
||||
// Q must equal -Q, or that Q.y == -(Q.y), or Q.y is 0. For a point on y^2 = x^3 + 7 to have
|
||||
// y=0, x^3 must be -7 mod p. However, -7 has no cube root mod p.
|
||||
r->infinity = a->infinity;
|
||||
if (r->infinity) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue