Skip to content

Commit

Permalink
Merge bitcoin#551: secp256k1_fe_sqrt: Verify that the arguments don't…
Browse files Browse the repository at this point in the history
… alias.

bf8b86c secp256k1_fe_sqrt: Verify that the arguments don't alias. (Russell O'Connor)

Pull request description:

Tree-SHA512: 4e9128625817be83a1259e7dbdb82c4be8ee0174af7d5e76eeac3245d23d6bf01378d9697dcb870eb61577afd7c0556cb3c6633e3b27504add14c10b18f7c607
  • Loading branch information
gmaxwell committed Feb 21, 2019
2 parents ba698f8 + bf8b86c commit 1c131af
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/field_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ static int secp256k1_fe_sqrt(secp256k1_fe *r, const secp256k1_fe *a) {
secp256k1_fe x2, x3, x6, x9, x11, x22, x44, x88, x176, x220, x223, t1;
int j;

VERIFY_CHECK(r != a);

/** The binary representation of (p + 1)/4 has 3 blocks of 1s, with lengths in
* { 2, 22, 223 }. Use an addition chain to calculate 2^n - 1 for each block:
* 1, [2], 3, 6, 9, 11, [22], 44, 88, 176, 220, [223]
Expand Down

0 comments on commit 1c131af

Please sign in to comment.