Skip to content

Commit

Permalink
Fix up encoder/decoder issues caused by not passing a library context…
Browse files Browse the repository at this point in the history
… to the PKCS8 encrypt/decrypt

Reviewed-by: Shane Lontis <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#14587)
  • Loading branch information
jon-oracle authored and t8m committed Jun 1, 2021
1 parent 169eca6 commit e3c7595
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion providers/implementations/encode_decode/decode_der2key.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions providers/implementations/encode_decode/encode_key2any.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e3c7595

Please sign in to comment.