summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorIngo Franzki <ifranzki@linux.ibm.com>2023-08-23 09:45:45 +0200
committerTomas Mraz <tomas@openssl.org>2023-08-24 16:12:21 +0200
commit313fdbb7aa785215f72af803c571e85f409efb41 (patch)
treecfd3dbba3b2d90a478dabefe93b007a869d01b9d /crypto
parentcb462f926094b98b33b9dd28bcaa75ca134d7d77 (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.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c
index f46fba3175..80947b0932 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); \