diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2019-03-31 13:56:23 +0200 |
---|---|---|
committer | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2019-04-10 20:21:57 +0200 |
commit | 491360e7ab2f09fdaadfcd9ff84c425c8f4e5b03 (patch) | |
tree | 6a5a1e6fc0fc1befdbf2d97260c18d68cee565cb /crypto/rsa/rsa_ameth.c | |
parent | Fix typos (diff) | |
download | openssl-491360e7ab2f09fdaadfcd9ff84c425c8f4e5b03.tar.xz openssl-491360e7ab2f09fdaadfcd9ff84c425c8f4e5b03.zip |
Avoid creating invalid rsa pss params
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8621)
Diffstat (limited to 'crypto/rsa/rsa_ameth.c')
-rw-r--r-- | crypto/rsa/rsa_ameth.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c index 139415e60e..82d1d56d0a 100644 --- a/crypto/rsa/rsa_ameth.c +++ b/crypto/rsa/rsa_ameth.c @@ -583,10 +583,12 @@ static RSA_PSS_PARAMS *rsa_ctx_to_pss(EVP_PKEY_CTX *pkctx) return NULL; if (saltlen == -1) { saltlen = EVP_MD_size(sigmd); - } else if (saltlen == -2) { + } else if (saltlen == -2 || saltlen == -3) { saltlen = EVP_PKEY_size(pk) - EVP_MD_size(sigmd) - 2; if ((EVP_PKEY_bits(pk) & 0x7) == 1) saltlen--; + if (saltlen < 0) + return NULL; } return rsa_pss_params_create(sigmd, mgf1md, saltlen); |