mirror of
https://github.com/status-im/secp256k1.git
synced 2025-02-23 03:08:10 +00:00
benchmarks: fix bench_scalar_split
scalar_split_lambda requires that the input pointer is different to both output pointers. Without this fix, the internal benchmarks crash when compiled with -DVERIFY. This was introduced in commit 362bb25608dbcd724a07dd5170c4ebe081c3dd84 (which requires configuring with --enable-endomorphism to exhibit the crash).
This commit is contained in:
parent
5fbff5d348
commit
620ba3d74b
@ -110,10 +110,11 @@ static void bench_scalar_mul(void* arg, int iters) {
|
||||
static void bench_scalar_split(void* arg, int iters) {
|
||||
int i, j = 0;
|
||||
bench_inv *data = (bench_inv*)arg;
|
||||
secp256k1_scalar tmp;
|
||||
|
||||
for (i = 0; i < iters; i++) {
|
||||
secp256k1_scalar_split_lambda(&data->scalar[0], &data->scalar[1], &data->scalar[0]);
|
||||
j += secp256k1_scalar_add(&data->scalar[0], &data->scalar[0], &data->scalar[1]);
|
||||
secp256k1_scalar_split_lambda(&tmp, &data->scalar[1], &data->scalar[0]);
|
||||
j += secp256k1_scalar_add(&data->scalar[0], &tmp, &data->scalar[1]);
|
||||
}
|
||||
CHECK(j <= iters);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user