diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-09-22 15:43:32 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2020-09-23 17:31:40 +1000 |
commit | 719523c76df0850ba736ede48cc86d48eed9f725 (patch) | |
tree | 71e39a4626e1eaa575962d86563efdf53c15b01e /crypto | |
parent | 81777339e9ed62cd3b801bf225fa1f2aba4b30dd (diff) |
Change rsa gen so it can use the propq from OSSL_PKEY_PARAM_RSA_DIGEST
rsa_pss_params_30_fromdata() now uses the OSSL_PKEY_PARAM_RSA_DIGEST_PROPS parameter also.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12944)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/rsa/rsa_ameth.c | 2 | ||||
-rw-r--r-- | crypto/rsa/rsa_backend.c | 15 |
2 files changed, 12 insertions, 5 deletions
diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c index 6558e1c662..814452f27d 100644 --- a/crypto/rsa/rsa_ameth.c +++ b/crypto/rsa/rsa_ameth.c @@ -1239,7 +1239,7 @@ static int rsa_int_export_to(const EVP_PKEY *from, int rsa_type, || !rsa_pss_params_30_set_hashalg(&pss_params, md_nid) || !rsa_pss_params_30_set_maskgenhashalg(&pss_params, mgf1md_nid) || !rsa_pss_params_30_set_saltlen(&pss_params, saltlen) - || !rsa_pss_params_30_todata(&pss_params, propq, tmpl, NULL)) + || !rsa_pss_params_30_todata(&pss_params, tmpl, NULL)) goto err; selection |= OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS; } diff --git a/crypto/rsa/rsa_backend.c b/crypto/rsa/rsa_backend.c index 871aa17a22..fae09d7067 100644 --- a/crypto/rsa/rsa_backend.c +++ b/crypto/rsa/rsa_backend.c @@ -163,7 +163,7 @@ int rsa_todata(RSA *rsa, OSSL_PARAM_BLD *bld, OSSL_PARAM params[]) return ret; } -int rsa_pss_params_30_todata(const RSA_PSS_PARAMS_30 *pss, const char *propq, +int rsa_pss_params_30_todata(const RSA_PSS_PARAMS_30 *pss, OSSL_PARAM_BLD *bld, OSSL_PARAM params[]) { if (!rsa_pss_params_30_is_unrestricted(pss)) { @@ -211,13 +211,16 @@ int rsa_pss_params_30_fromdata(RSA_PSS_PARAMS_30 *pss_params, const OSSL_PARAM params[], OPENSSL_CTX *libctx) { const OSSL_PARAM *param_md, *param_mgf, *param_mgf1md, *param_saltlen; + const OSSL_PARAM *param_propq; + const char *propq = NULL; EVP_MD *md = NULL, *mgf1md = NULL; int saltlen; int ret = 0; if (pss_params == NULL) return 0; - + param_propq = + OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_RSA_DIGEST_PROPS); param_md = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_RSA_DIGEST); param_mgf = @@ -227,6 +230,10 @@ int rsa_pss_params_30_fromdata(RSA_PSS_PARAMS_30 *pss_params, param_saltlen = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_RSA_PSS_SALTLEN); + if (param_propq != NULL) { + if (param_propq->data_type == OSSL_PARAM_UTF8_STRING) + propq = param_propq->data; + } /* * If we get any of the parameters, we know we have at least some * restrictions, so we start by setting default values, and let each @@ -265,7 +272,7 @@ int rsa_pss_params_30_fromdata(RSA_PSS_PARAMS_30 *pss_params, else if (!OSSL_PARAM_get_utf8_ptr(param_mgf, &mdname)) goto err; - if ((md = EVP_MD_fetch(libctx, mdname, NULL)) == NULL + if ((md = EVP_MD_fetch(libctx, mdname, propq)) == NULL || !rsa_pss_params_30_set_hashalg(pss_params, rsa_oaeppss_md2nid(md))) goto err; @@ -279,7 +286,7 @@ int rsa_pss_params_30_fromdata(RSA_PSS_PARAMS_30 *pss_params, else if (!OSSL_PARAM_get_utf8_ptr(param_mgf, &mgf1mdname)) goto err; - if ((mgf1md = EVP_MD_fetch(libctx, mgf1mdname, NULL)) == NULL + if ((mgf1md = EVP_MD_fetch(libctx, mgf1mdname, propq)) == NULL || !rsa_pss_params_30_set_maskgenhashalg(pss_params, rsa_oaeppss_md2nid(mgf1md))) goto err; |