Skip to content

Commit bf8b86c

Browse files
secp256k1_fe_sqrt: Verify that the arguments don't alias.
1 parent 1e6f1f5 commit bf8b86c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/field_impl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ static int secp256k1_fe_sqrt(secp256k1_fe *r, const secp256k1_fe *a) {
4848
secp256k1_fe x2, x3, x6, x9, x11, x22, x44, x88, x176, x220, x223, t1;
4949
int j;
5050

51+
VERIFY_CHECK(r != a);
52+
5153
/** The binary representation of (p + 1)/4 has 3 blocks of 1s, with lengths in
5254
* { 2, 22, 223 }. Use an addition chain to calculate 2^n - 1 for each block:
5355
* 1, [2], 3, 6, 9, 11, [22], 44, 88, 176, 220, [223]

0 commit comments

Comments
 (0)