diff options
author | Ingo Franzki <ifranzki@linux.ibm.com> | 2023-08-23 09:45:45 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-08-24 16:12:32 +0200 |
commit | bf7021dc5b79e961ee6ca4048f25faceb4aacd59 (patch) | |
tree | 5944540aa95ce4a17702676e92626dbedc57254a /crypto | |
parent | 53dca2ff8a09e3279d12d34fe445dd937423cb32 (diff) |
ctrl_params_translate: Allow get_rsa_payload_x() also for RSA-PSS
The get_rsa_payload_x() functions should also allow to get the payload
for RSA-PSS keys.
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21818)
(cherry picked from commit cf712830b7b5a20a768a1fc5f78dc48841b7617f)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/evp/ctrl_params_translate.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c index 65cd8bcf19..dcd53b43f9 100644 --- a/crypto/evp/ctrl_params_translate.c +++ b/crypto/evp/ctrl_params_translate.c @@ -1786,7 +1786,8 @@ static int get_rsa_payload_n(enum state state, { const BIGNUM *bn = NULL; - if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA + && EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA_PSS) return 0; bn = RSA_get0_n(EVP_PKEY_get0_RSA(ctx->p2)); @@ -1799,7 +1800,8 @@ static int get_rsa_payload_e(enum state state, { const BIGNUM *bn = NULL; - if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA + && EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA_PSS) return 0; bn = RSA_get0_e(EVP_PKEY_get0_RSA(ctx->p2)); @@ -1812,7 +1814,8 @@ static int get_rsa_payload_d(enum state state, { const BIGNUM *bn = NULL; - if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA + && EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA_PSS) return 0; bn = RSA_get0_d(EVP_PKEY_get0_RSA(ctx->p2)); @@ -1912,7 +1915,8 @@ static int get_rsa_payload_coefficient(enum state state, const struct translation_st *translation, \ struct translation_ctx_st *ctx) \ { \ - if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) \ + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA \ + && EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA_PSS) \ return 0; \ return get_rsa_payload_factor(state, translation, ctx, n - 1); \ } @@ -1923,7 +1927,8 @@ static int get_rsa_payload_coefficient(enum state state, const struct translation_st *translation, \ struct translation_ctx_st *ctx) \ { \ - if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) \ + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA \ + && EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA_PSS) \ return 0; \ return get_rsa_payload_exponent(state, translation, ctx, \ n - 1); \ @@ -1935,7 +1940,8 @@ static int get_rsa_payload_coefficient(enum state state, const struct translation_st *translation, \ struct translation_ctx_st *ctx) \ { \ - if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) \ + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA \ + && EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA_PSS) \ return 0; \ return get_rsa_payload_coefficient(state, translation, ctx, \ n - 1); \ |