Make bench_internal obey secp256k1_fe_sqrt's contract wrt aliasing.

Bench_internal was previously incorrect but wasn't detected by
 -DVERIFY until PR #551.
This commit is contained in:
Gregory Maxwell 2019-02-21 05:58:33 +00:00
parent 870a977644
commit b76e45d5d6
1 changed files with 3 additions and 1 deletions

View File

@ -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);
}
}