Skip to content

Commit

Permalink
Merge bitcoin#509: Fix algorithm selection in bench_ecmult
Browse files Browse the repository at this point in the history
0f05173 Fix algorithm selection in bench_ecmult (Jonas Nick)

Pull request description:

  Without this commit using an unknown argument results in a segmentation fault.

Tree-SHA512: 85b8f977e62fa360ff6dc923bd86f08725c30e178d58f43d33cbd8eb69e54fa4ec76e4407624611a80554cf9961689bce6b216da735ac95b256d0d2f60fe3328
  • Loading branch information
gmaxwell committed Feb 21, 2019
2 parents 6492bf8 + 0f05173 commit c71dd2c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bench_ecmult.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,19 @@ int main(int argc, char **argv) {
secp256k1_gej* pubkeys_gej;
size_t scratch_size;

data.ecmult_multi = secp256k1_ecmult_multi_var;
if (argc > 1) {
if(have_flag(argc, argv, "pippenger_wnaf")) {
printf("Using pippenger_wnaf:\n");
data.ecmult_multi = secp256k1_ecmult_pippenger_batch_single;
} else if(have_flag(argc, argv, "strauss_wnaf")) {
printf("Using strauss_wnaf:\n");
data.ecmult_multi = secp256k1_ecmult_strauss_batch_single;
} else {
fprintf(stderr, "%s: unrecognized argument '%s'.\n", argv[0], argv[1]);
fprintf(stderr, "Use 'pippenger_wnaf', 'strauss_wnaf' or no argument to benchmark a combined algorithm.\n");
return 1;
}
} else {
data.ecmult_multi = secp256k1_ecmult_multi_var;
}

/* Allocate stuff */
Expand Down

0 comments on commit c71dd2c

Please sign in to comment.