Skip to content

Commit

Permalink
Merge bitcoin#882: Use bit ops instead of int mult for constant-time …
Browse files Browse the repository at this point in the history
…logic in gej_add_ge

e491d06 Use bit ops instead of int mult for constant-time logic in gej_add_ge (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    utACK e491d06. Seems obviously better.
  elichai:
    ACK e491d06
  jonasnick:
    ACK e491d06

Tree-SHA512: 65977d3405e3b6c184c736d46898b615689b56f7562165114429dea49c0f9feb81d021cbe196c8a813b6239254b394cc24ac8d278dab37e521843a1bb0f70c47
  • Loading branch information
jonasnick committed Feb 1, 2021
2 parents f8c0b57 + e491d06 commit 24d1656
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/group_impl.h
Expand Up @@ -591,7 +591,7 @@ static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const
secp256k1_fe_cmov(&n, &m, degenerate); /* n = M^3 * Malt (2) */
secp256k1_fe_sqr(&t, &rr_alt); /* t = Ralt^2 (1) */
secp256k1_fe_mul(&r->z, &a->z, &m_alt); /* r->z = Malt*Z (1) */
infinity = secp256k1_fe_normalizes_to_zero(&r->z) * (1 - a->infinity);
infinity = secp256k1_fe_normalizes_to_zero(&r->z) & ~a->infinity;
secp256k1_fe_mul_int(&r->z, 2); /* r->z = Z3 = 2*Malt*Z (2) */
secp256k1_fe_negate(&q, &q, 1); /* q = -Q (2) */
secp256k1_fe_add(&t, &q); /* t = Ralt^2-Q (3) */
Expand Down

0 comments on commit 24d1656

Please sign in to comment.