PEM: Always use PEM_def_callback() when cb == NULL in pem_read_bio_key()
authorRichard Levitte <levitte@openssl.org>
Sun, 8 Nov 2020 09:25:47 +0000 (10:25 +0100)
committerRichard Levitte <levitte@openssl.org>
Tue, 10 Nov 2020 09:57:16 +0000 (10:57 +0100)
Too many other functions depend on this being done.

Fixes #13340

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13346)

crypto/pem/pem_pkey.c

index 214fd1267ca5d2c2c4d456cfc0921dd9fe631824..91f6f30cf61cb121e51e1219c4b5bbd628420fee 100644 (file)
@@ -48,12 +48,9 @@ static EVP_PKEY *pem_read_bio_key(BIO *bp, EVP_PKEY **x,
         return NULL;
     }
 
-    if (u != NULL && cb == NULL)
-        cb = PEM_def_callback;
     if (cb == NULL)
-        ui_method = UI_null();
-    else
-        ui_method = allocated_ui_method = UI_UTIL_wrap_read_pem_callback(cb, 0);
+        cb = PEM_def_callback;
+    ui_method = allocated_ui_method = UI_UTIL_wrap_read_pem_callback(cb, 0);
     if (ui_method == NULL)
         return NULL;