summaryrefslogtreecommitdiffstats
path: root/providers/implementations/encode_decode/encode_key2any.c
diff options
context:
space:
mode:
authorJon Spillett <jon.spillett@oracle.com>2021-03-15 14:26:09 +1000
committerTomas Mraz <tomas@openssl.org>2021-06-01 12:16:27 +0200
commit169eca602c67f37abf0a44e1605998d5e7f04fa6 (patch)
tree221d3097ca04a1549d0cb93442c1c2d00f954928 /providers/implementations/encode_decode/encode_key2any.c
parent8ee66a092c07e618191ef49c8912f8235b08bb95 (diff)
Enhance the encoder/decoder tests to allow testing with a non-default library context and configurable providers
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)
Diffstat (limited to 'providers/implementations/encode_decode/encode_key2any.c')
-rw-r--r--providers/implementations/encode_decode/encode_key2any.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/providers/implementations/encode_decode/encode_key2any.c b/providers/implementations/encode_decode/encode_key2any.c
index 93f725d906..cd2c3f8daa 100644
--- a/providers/implementations/encode_decode/encode_key2any.c
+++ b/providers/implementations/encode_decode/encode_key2any.c
@@ -106,6 +106,7 @@ static X509_SIG *p8info_to_encp8(PKCS8_PRIV_KEY_INFO *p8info,
X509_SIG *p8 = NULL;
char kstr[PEM_BUFSIZE];
size_t klen = 0;
+ OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
if (ctx->cipher == NULL)
return NULL;
@@ -116,7 +117,8 @@ static X509_SIG *p8info_to_encp8(PKCS8_PRIV_KEY_INFO *p8info,
return NULL;
}
/* First argument == -1 means "standard" */
- p8 = PKCS8_encrypt(-1, ctx->cipher, kstr, klen, NULL, 0, 0, p8info);
+ p8 = PKCS8_encrypt_ex(-1, ctx->cipher, kstr, klen, NULL, 0, 0, p8info,
+ libctx, NULL);
OPENSSL_cleanse(kstr, klen);
return p8;
}