From 4b9ffde5b87ce7886a84a0b29f751688a6eeab2e Mon Sep 17 00:00:00 2001
From: Nikos Mavrogiannopoulos <nmav@redhat.com>
Date: Thu, 26 Jun 2014 16:56:08 +0200
Subject: [PATCH] hogweed-benchmark: do not abort() if an openssl algorithm
 isn't available

---
 examples/hogweed-benchmark.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

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");
-- 
GitLab