Post
Topic
Board Development & Technical Discussion
Re: Is bitcoin v0.10's new libsecp256k1 safe & without mathematical backdoors?
by
gmaxwell
on 05/02/2015, 07:44:07 UTC
I guess we are just setting returns to negatives to represent errors?
This is clearly documented in the interface for the function:

Code:
*  Returns: 1: correct signature
 *           0: incorrect signature
 *          -1: invalid public key
 *          -2: invalid signature

Quote
Code:
void bench_scalar_sqr(void* arg) {
    int i;
    bench_inv_t *data = (bench_inv_t*)arg;

    for (i = 0; i < 200000; i++) {
        secp256k1_scalar_sqr(&data->scalar_x, &data->scalar_x);
    }
}
Why 200,000?
Sorry, just trying to understand the code better.
It's a benchmark. Not part of the library itself. As typical for benchmarks, it runs enough times to make the measurements have reasonable resolution.