From d65a8d0b7e4b95e79c65972eaa05ba776c5af462 Mon Sep 17 00:00:00 2001 From: Mouse Date: Fri, 1 Jan 2016 23:27:49 -0500 Subject: [PATCH] Fixed a bug preventing pkeyutl from accessing keys directly on the token via engine_pkcs11 Reviewed-by: Rich Salz Reviewed-by: Richard Levitte --- apps/pkeyutl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/pkeyutl.c b/apps/pkeyutl.c index aaa90740ad..014738862c 100644 --- a/apps/pkeyutl.c +++ b/apps/pkeyutl.c @@ -419,8 +419,13 @@ static EVP_PKEY_CTX *init_ctx(int *pkeysize, if (!pkey) goto end; - ctx = EVP_PKEY_CTX_new(pkey, e); - + if ((keyform == FORMAT_ENGINE) && (strncmp(ENGINE_get_name(e),"pkcs11 engine", strlen("pkcs11 engine"))==0)) { + fprintf(stderr, "engine name = \"%s\"\n", ENGINE_get_name(e)); + ctx = EVP_PKEY_CTX_new(pkey, NULL); + } else { + ctx = EVP_PKEY_CTX_new(pkey, e); + } + EVP_PKEY_free(pkey); if (!ctx) -- 2.25.1