summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-05-06 21:52:12 +0200
committerRichard Levitte <levitte@openssl.org>2020-05-14 12:17:13 +0200
commit106ec30bc74d5cd3086a3b959a11d73e46d7b9d8 (patch)
tree11785996191973e462f891deec4359b2d0c856bd
parentEVP: Refactor the RSA-PSS key generation controls for providers (diff)
downloadopenssl-106ec30bc74d5cd3086a3b959a11d73e46d7b9d8.tar.xz
openssl-106ec30bc74d5cd3086a3b959a11d73e46d7b9d8.zip
PROV & ASYM_CIPHER: Adapt the RSA asymmetric cipher code for PSS-parameters
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11710)
-rw-r--r--providers/implementations/asymciphers/rsa_enc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/providers/implementations/asymciphers/rsa_enc.c b/providers/implementations/asymciphers/rsa_enc.c
index 0ca52ae743..f7e7b549f8 100644
--- a/providers/implementations/asymciphers/rsa_enc.c
+++ b/providers/implementations/asymciphers/rsa_enc.c
@@ -95,7 +95,16 @@ static int rsa_init(void *vprsactx, void *vrsa)
return 0;
RSA_free(prsactx->rsa);
prsactx->rsa = vrsa;
- prsactx->pad_mode = RSA_PKCS1_PADDING;
+
+ switch (RSA_test_flags(prsactx->rsa, RSA_FLAG_TYPE_MASK)) {
+ case RSA_FLAG_TYPE_RSA:
+ prsactx->pad_mode = RSA_PKCS1_PADDING;
+ break;
+ default:
+ ERR_raise(ERR_LIB_PROV, PROV_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return 0;
+ }
+
return 1;
}