Skip to content

Commit

Permalink
Make bench_internal obey secp256k1_fe_sqrt's contract wrt aliasing.
Browse files Browse the repository at this point in the history
Bench_internal was previously incorrect but wasn't detected by
 -DVERIFY until PR bitcoin#551.
  • Loading branch information
gmaxwell committed Feb 21, 2019
1 parent 870a977 commit b76e45d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bench_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,11 @@ void bench_field_inverse_var(void* arg) {
void bench_field_sqrt(void* arg) {
int i;
bench_inv *data = (bench_inv*)arg;
secp256k1_fe t;

for (i = 0; i < 20000; i++) {
secp256k1_fe_sqrt(&data->fe_x, &data->fe_x);
t = data->fe_x;
secp256k1_fe_sqrt(&data->fe_x, &t);
secp256k1_fe_add(&data->fe_x, &data->fe_y);
}
}
Expand Down

0 comments on commit b76e45d

Please sign in to comment.