Fixed a bug preventing pkeyutl from accessing keys directly on the token via engine_p...
authorMouse <mouse008@gmail.com>
Sat, 2 Jan 2016 04:27:49 +0000 (23:27 -0500)
committerRichard Levitte <levitte@openssl.org>
Wed, 13 Jan 2016 00:23:34 +0000 (01:23 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
apps/pkeyutl.c

index aaa9074..0147388 100644 (file)
@@ -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)