From: Nikos Mavrogiannopoulos Date: Thu, 26 Jun 2014 14:56:08 +0000 (+0200) Subject: hogweed-benchmark: do not abort() if an openssl algorithm isn't available X-Git-Tag: nettle_3.1rc1~169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b9ffde5b87ce7886a84a0b29f751688a6eeab2e;p=thirdparty%2Fnettle.git hogweed-benchmark: do not abort() if an openssl algorithm isn't available --- diff --git a/examples/hogweed-benchmark.c b/examples/hogweed-benchmark.c index 311fa2d6..b9dca3d9 100644 --- a/examples/hogweed-benchmark.c +++ b/examples/hogweed-benchmark.c @@ -146,6 +146,11 @@ bench_alg (const struct alg *alg) void *ctx; ctx = alg->init(alg->size); + if (ctx == NULL) + { + printf("%15s %4d N/A\n", alg->name, alg->size); + return; + } sign = time_function (alg->sign, ctx); verify = time_function (alg->verify, ctx); @@ -604,7 +609,10 @@ bench_openssl_ecdsa_init (unsigned size) default: die ("Internal error.\n"); } - assert (ctx->key); + + /* This curve isn't supported in this build of openssl */ + if (ctx->key == NULL) + return NULL; if (!EC_KEY_generate_key( ctx->key)) die ("Openssl EC_KEY_generate_key failed.\n");