summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorNicola Tuveri <nic.tuv@gmail.com>2016-10-07 16:24:22 +0300
committerRich Salz <rsalz@openssl.org>2016-11-17 00:36:23 -0500
commitb756d694b6edb97a2827d97591e486f4096f0cd3 (patch)
treec0b22dc72a16bd587bd51800401da0a0051fa886 /apps
parent79438087fe48a72f8b62a77956436fd0c4c3d8e4 (diff)
Do not handle R_EC_X25519 as a special case
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1658)
Diffstat (limited to 'apps')
-rw-r--r--apps/speed.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/speed.c b/apps/speed.c
index 68e232a94c..c3614800c5 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -2578,9 +2578,14 @@ int speed_main(int argc, char **argv)
size_t outlen;
size_t test_outlen;
- if (testnum == R_EC_X25519) {
- kctx = EVP_PKEY_CTX_new_id(test_curves[testnum], NULL); /* keygen ctx from NID */
- } else {
+ /* Let's try to create a ctx directly from the NID: this works for
+ * curves like Curve25519 that are not implemented through the low
+ * level EC interface.
+ * If this fails we try creating a EVP_PKEY_EC generic param ctx,
+ * then we set the curve by NID before deriving the actual keygen
+ * ctx for that specific curve. */
+ kctx = EVP_PKEY_CTX_new_id(test_curves[testnum], NULL); /* keygen ctx from NID */
+ if (!kctx) {
EVP_PKEY_CTX *pctx = NULL;
EVP_PKEY *params = NULL;
@@ -2595,7 +2600,7 @@ int speed_main(int argc, char **argv)
/* Create the parameter object params */
!EVP_PKEY_paramgen(pctx, &params)) {
ecdh_checks = 0;
- BIO_printf(bio_err, "ECDH init failure.\n");
+ BIO_printf(bio_err, "ECDH EC params init failure.\n");
ERR_print_errors(bio_err);
rsa_count = 1;
break;