summaryrefslogtreecommitdiff
path: root/providers
diff options
context:
space:
mode:
authorJames Muir <muir.james.a@gmail.com>2022-10-04 10:48:43 -0400
committerTomas Mraz <tomas@openssl.org>2022-10-07 19:53:04 +0200
commite5a7536eaeaacd18d1aea59edeb295fb4eb2dfca (patch)
tree23747625e8b29979dd99fc5a08f551ad022bafd2 /providers
parent8377f26c2e6dadd9a1728805cd895fa94669f2d0 (diff)
downloadopenssl-new-e5a7536eaeaacd18d1aea59edeb295fb4eb2dfca.tar.gz
set MGF1 digest correctly
Fixes #19290 update rsa_set_ctx_params() so that the digest function used in the MGF1 construction is set correctly. Add a test for this to evp_extra_test.c based on the code scaro-axway provided in #19290. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19342)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/asymciphers/rsa_enc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/providers/implementations/asymciphers/rsa_enc.c b/providers/implementations/asymciphers/rsa_enc.c
index 36c03403fb..3d331ea8df 100644
--- a/providers/implementations/asymciphers/rsa_enc.c
+++ b/providers/implementations/asymciphers/rsa_enc.c
@@ -421,7 +421,7 @@ static int rsa_set_ctx_params(void *vprsactx, const OSSL_PARAM params[])
const OSSL_PARAM *p;
char mdname[OSSL_MAX_NAME_SIZE];
char mdprops[OSSL_MAX_PROPQUERY_SIZE] = { '\0' };
- char *str = mdname;
+ char *str = NULL;
if (prsactx == NULL)
return 0;
@@ -430,13 +430,14 @@ static int rsa_set_ctx_params(void *vprsactx, const OSSL_PARAM params[])
p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST);
if (p != NULL) {
+ str = mdname;
if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdname)))
return 0;
- str = mdprops;
p = OSSL_PARAM_locate_const(params,
OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS);
if (p != NULL) {
+ str = mdprops;
if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdprops)))
return 0;
}
@@ -492,13 +493,14 @@ static int rsa_set_ctx_params(void *vprsactx, const OSSL_PARAM params[])
p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST);
if (p != NULL) {
+ str = mdname;
if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdname)))
return 0;
- str = mdprops;
p = OSSL_PARAM_locate_const(params,
OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS);
if (p != NULL) {
+ str = mdprops;
if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdprops)))
return 0;
} else {