diff options
author | ljuzwiuk <lukasz.a.juzwiuk@intel.com> | 2023-07-13 09:11:28 +0000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-07-17 08:15:06 +1000 |
commit | 64b1d2fb06c9a5233dcabfe130036ff95c3fdaae (patch) | |
tree | 9a783735cabfc452b18e60dac866e4b857382536 /crypto/evp | |
parent | f1b7243cda208d8bd74f75c95990f8205e977ae4 (diff) |
Fix RSA OAEP set/get label for legacy engine
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21401)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/ctrl_params_translate.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c index 480d48429b..a7677e943e 100644 --- a/crypto/evp/ctrl_params_translate.c +++ b/crypto/evp/ctrl_params_translate.c @@ -634,8 +634,8 @@ static int default_fixup_args(enum state state, ctx->p2, ctx->sz); case OSSL_PARAM_OCTET_STRING: return OSSL_PARAM_get_octet_string(ctx->params, - ctx->p2, ctx->sz, - &ctx->sz); + &ctx->p2, ctx->sz, + (size_t *)&ctx->p1); case OSSL_PARAM_OCTET_PTR: return OSSL_PARAM_get_octet_ptr(ctx->params, ctx->p2, &ctx->sz); @@ -683,7 +683,7 @@ static int default_fixup_args(enum state state, return OSSL_PARAM_set_octet_string(ctx->params, ctx->p2, size); case OSSL_PARAM_OCTET_PTR: - return OSSL_PARAM_set_octet_ptr(ctx->params, ctx->p2, + return OSSL_PARAM_set_octet_ptr(ctx->params, *(void **)ctx->p2, size); default: ERR_raise_data(ERR_LIB_EVP, ERR_R_UNSUPPORTED, @@ -693,6 +693,9 @@ static int default_fixup_args(enum state state, translation->param_data_type); return 0; } + } else if (state == PRE_PARAMS_TO_CTRL && ctx->action_type == GET) { + if (translation->param_data_type == OSSL_PARAM_OCTET_PTR) + ctx->p2 = &ctx->bufp; } } /* Any other combination is simply pass-through */ @@ -2310,7 +2313,7 @@ static const struct translation_st evp_pkey_ctx_translations[] = { OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL, OSSL_PARAM_OCTET_STRING, NULL }, { GET, EVP_PKEY_RSA, 0, EVP_PKEY_OP_TYPE_CRYPT, EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, NULL, NULL, - OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL, OSSL_PARAM_OCTET_STRING, NULL }, + OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL, OSSL_PARAM_OCTET_PTR, NULL }, { SET, EVP_PKEY_RSA, 0, EVP_PKEY_OP_TYPE_CRYPT, EVP_PKEY_CTRL_RSA_IMPLICIT_REJECTION, NULL, |