]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix up encoder/decoder issues caused by not passing a library context to the PKCS8...
authorJon Spillett <jon.spillett@oracle.com>
Thu, 6 May 2021 01:55:42 +0000 (11:55 +1000)
committerTomas Mraz <tomas@openssl.org>
Tue, 1 Jun 2021 10:16:27 +0000 (12:16 +0200)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14587)

providers/implementations/encode_decode/decode_der2key.c
providers/implementations/encode_decode/encode_key2any.c

index 01c050ccb05521087a3e0d330d70910b94024dd8..b3fd87ca05b0f3c53969180d03c6e79c15416ef6 100644 (file)
@@ -134,7 +134,7 @@ static void *der2key_decode_p8(const unsigned char **input_der,
         if (!pw_cb(pbuf, sizeof(pbuf), &plen, NULL, pw_cbarg))
             ERR_raise(ERR_LIB_PROV, PROV_R_UNABLE_TO_GET_PASSPHRASE);
         else
-            p8inf = PKCS8_decrypt(p8, pbuf, plen);
+            p8inf = PKCS8_decrypt_ex(p8, pbuf, plen, PROV_LIBCTX_OF(ctx->provctx), NULL);
         if (p8inf == NULL)
             ctx->flag_fatal = 1;
         X509_SIG_free(p8);
index cd2c3f8daaeabb7ab6ba1ca285ea134a752e0c76..f95c785522302b39afba0e6162c05a17c89cd59b 100644 (file)
@@ -117,8 +117,7 @@ static X509_SIG *p8info_to_encp8(PKCS8_PRIV_KEY_INFO *p8info,
         return NULL;
     }
     /* First argument == -1 means "standard" */
-    p8 = PKCS8_encrypt_ex(-1, ctx->cipher, kstr, klen, NULL, 0, 0, p8info,
-                          libctx, NULL);
+    p8 = PKCS8_encrypt_ex(-1, ctx->cipher, kstr, klen, NULL, 0, 0, p8info, libctx, NULL);
     OPENSSL_cleanse(kstr, klen);
     return p8;
 }