diff options
author | James Muir <muir.james.a@gmail.com> | 2022-10-04 10:48:43 -0400 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-10-07 19:54:30 +0200 |
commit | 4c172a2da4c88f52d67113da2374e61812d43be5 (patch) | |
tree | 382ef4b23f487e945f46bd8b07baaef615bb82d7 /providers | |
parent | c95e2030c34646176b4843b5f0f48720d896f427 (diff) |
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)
(cherry picked from commit e5a7536eaeaacd18d1aea59edeb295fb4eb2dfca)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/asymciphers/rsa_enc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/providers/implementations/asymciphers/rsa_enc.c b/providers/implementations/asymciphers/rsa_enc.c index ce5ddff651..113c4cbfab 100644 --- a/providers/implementations/asymciphers/rsa_enc.c +++ b/providers/implementations/asymciphers/rsa_enc.c @@ -425,7 +425,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; @@ -434,13 +434,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; } @@ -496,13 +497,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 { |