diff options
author | Pauli <ppzgs1@gmail.com> | 2024-07-15 13:26:50 +1000 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2024-07-17 14:16:08 +1000 |
commit | 5a0b25e795ad50b86e5417162bae73abefbae663 (patch) | |
tree | e7c9e619c7d9fa9cc13641f82ca8f096f6df0017 | |
parent | c11b83eddf7ac7550a54afb9eebaf735b3e31061 (diff) | |
download | openssl-5a0b25e795ad50b86e5417162bae73abefbae663.zip openssl-5a0b25e795ad50b86e5417162bae73abefbae663.tar.gz openssl-5a0b25e795ad50b86e5417162bae73abefbae663.tar.bz2 |
Fix kbkdf bug if MAC is set to KMAC and then something else
A context that is set to KMAC sets the is_kmac flag and this cannot be reset.
So a user that does kbkdf using KMAC and then wants to use HMAC or CMAC will
experience a failure.
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24883)
(cherry picked from commit f35fc4f184fa8a2088cd16648c4017fa321d6712)
-rw-r--r-- | providers/implementations/kdfs/kbkdf.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/providers/implementations/kdfs/kbkdf.c b/providers/implementations/kdfs/kbkdf.c index aa3df15..b99541d 100644 --- a/providers/implementations/kdfs/kbkdf.c +++ b/providers/implementations/kdfs/kbkdf.c @@ -366,7 +366,8 @@ static int kbkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) if (!ossl_prov_macctx_load_from_params(&ctx->ctx_init, params, NULL, NULL, NULL, libctx)) return 0; - else if (ctx->ctx_init != NULL) { + if (ctx->ctx_init != NULL) { + ctx->is_kmac = 0; if (EVP_MAC_is_a(EVP_MAC_CTX_get0_mac(ctx->ctx_init), OSSL_MAC_NAME_KMAC128) || EVP_MAC_is_a(EVP_MAC_CTX_get0_mac(ctx->ctx_init), |