summaryrefslogtreecommitdiffstats
path: root/providers/implementations
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
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')
-rw-r--r--providers/implementations/encode_decode/encode_key2any.c4
-rw-r--r--providers/implementations/encode_decode/encode_key2ms.c5
2 files changed, 6 insertions, 3 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;
}
diff --git a/providers/implementations/encode_decode/encode_key2ms.c b/providers/implementations/encode_decode/encode_key2ms.c
index 81dfcd0ecc..79012e673e 100644
--- a/providers/implementations/encode_decode/encode_key2ms.c
+++ b/providers/implementations/encode_decode/encode_key2ms.c
@@ -52,10 +52,11 @@ static int write_pvk(struct key2ms_ctx_st *ctx, OSSL_CORE_BIO *cout,
{
BIO *out = NULL;
int ret = 0;
+ OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
out = ossl_bio_new_from_core_bio(ctx->provctx, cout);
- ret = i2b_PVK_bio(out, pkey, ctx->pvk_encr_level,
- ossl_pw_pem_password, &ctx->pwdata);
+ ret = i2b_PVK_bio_ex(out, pkey, ctx->pvk_encr_level,
+ ossl_pw_pem_password, &ctx->pwdata, libctx, NULL);
BIO_free(out);
return ret;