diff options
author | Matt Caswell <matt@openssl.org> | 2020-01-17 14:47:18 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-02-13 14:14:30 +0000 |
commit | afb638f137958205b6b089da8967f4775b4c9bb6 (patch) | |
tree | b11c87c306131476dfad7eb0444d291e42713893 /providers/implementations/asymciphers | |
parent | 1b72105076bb2e73f3c8461f9c0ca5ecefe007c8 (diff) |
Make the RSA ASYM_CIPHER implementation available inside the FIPS module
RSA ASYM_CIPHER was already available within the default provider. We
now make it also available from inside the FIPS module.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10881)
Diffstat (limited to 'providers/implementations/asymciphers')
-rw-r--r-- | providers/implementations/asymciphers/build.info | 6 | ||||
-rw-r--r-- | providers/implementations/asymciphers/rsa_enc.c | 12 |
2 files changed, 16 insertions, 2 deletions
diff --git a/providers/implementations/asymciphers/build.info b/providers/implementations/asymciphers/build.info index aa050803d4..b4033d8a7d 100644 --- a/providers/implementations/asymciphers/build.info +++ b/providers/implementations/asymciphers/build.info @@ -1,4 +1,6 @@ -LIBS=../../../libcrypto -SOURCE[../../../libcrypto]=rsa_enc.c +# We make separate GOAL variables for each algorithm, to make it easy to +# switch each to the Legacy provider when needed. +$RSA_GOAL=../../libimplementations.a +SOURCE[$RSA_GOAL]=rsa_enc.c diff --git a/providers/implementations/asymciphers/rsa_enc.c b/providers/implementations/asymciphers/rsa_enc.c index c72571d6bb..2cce8474cd 100644 --- a/providers/implementations/asymciphers/rsa_enc.c +++ b/providers/implementations/asymciphers/rsa_enc.c @@ -118,6 +118,11 @@ static int rsa_encrypt(void *vprsactx, unsigned char *out, size_t *outlen, PROVerr(0, ERR_R_MALLOC_FAILURE); return 0; } + if (prsactx->oaep_md == NULL) { + prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA-1", NULL); + PROVerr(0, ERR_R_INTERNAL_ERROR); + return 0; + } ret = RSA_padding_add_PKCS1_OAEP_mgf1(tbuf, rsasize, in, inlen, prsactx->oaep_label, prsactx->oaep_labellen, @@ -194,6 +199,13 @@ static int rsa_decrypt(void *vprsactx, unsigned char *out, size_t *outlen, return 0; } if (prsactx->pad_mode == RSA_PKCS1_OAEP_PADDING) { + if (prsactx->oaep_md == NULL) { + prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA-1", NULL); + if (prsactx->oaep_md == NULL) { + PROVerr(0, ERR_R_INTERNAL_ERROR); + return 0; + } + } ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, outsize, tbuf, len, len, prsactx->oaep_label, |