[openssl] master update

Richard Levitte levitte at openssl.org
Tue Dec 17 07:16:56 UTC 2019


The branch master has been updated
       via  982efd7765f42ba0329e5db6e3434b072d90842c (commit)
      from  19f909856d5cd955493978f1bfaf79c107c20201 (commit)


- Log -----------------------------------------------------------------
commit 982efd7765f42ba0329e5db6e3434b072d90842c
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Dec 2 12:00:58 2019 +0100

    EVP: make it possible to init EVP_PKEY_CTX with provided EVP_PKEY
    
    The case when EVP_PKEY_CTX_new() is called with a provided EVP_PKEY
    (no legacy data) wasn't handled properly.
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/10618)

-----------------------------------------------------------------------

Summary of changes:
 crypto/evp/pmeth_lib.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
index 7563c800f7..b1bbb9c57e 100644
--- a/crypto/evp/pmeth_lib.c
+++ b/crypto/evp/pmeth_lib.c
@@ -127,11 +127,28 @@ static EVP_PKEY_CTX *int_ctx_new(OPENSSL_CTX *libctx,
     if (pkey == NULL && e == NULL && id == -1)
         goto common;
 
+    /*
+     * If the key doesn't contain anything legacy, then it must be provided,
+     * so we extract the necessary information and use that.
+     */
+    if (pkey != NULL && pkey->pkey.ptr == NULL) {
+        /* If we have an engine, something went wrong somewhere... */
+        if (!ossl_assert(e == NULL))
+            return NULL;
+        name = evp_first_name(pkey->pkeys[0].keymgmt->prov,
+                              pkey->pkeys[0].keymgmt->name_id);
+        /*
+         * TODO: I wonder if the EVP_PKEY should have the name and propquery
+         * that were used when building it....  /RL
+         */
+        goto common;
+    }
+
     /* TODO(3.0) Legacy code should be removed when all is provider based */
     /* BEGIN legacy */
     if (id == -1) {
         if (pkey == NULL)
-            return 0;
+            return NULL;
         id = pkey->type;
     }
 


More information about the openssl-commits mailing list