]> git.ipfire.org Git - thirdparty/openssl.git/commit
evp-cmac: do not seg-fault when getting mac-size before init
authorJames Muir <james@openssl.org>
Wed, 29 Nov 2023 03:43:52 +0000 (22:43 -0500)
committerTomas Mraz <tomas@openssl.org>
Fri, 1 Dec 2023 10:54:51 +0000 (11:54 +0100)
commitff181969e28c1503b077b47a9ded3683524b3fd8
tree906297499c1eb664f865cc48984b9f61e4da2dc1
parentbed7a878107818c297301c6602013d364b266c67
evp-cmac: do not seg-fault when getting mac-size before init

Add null check to cmac_size().  This avoids a seg-fault encountered
with cmac when EVP_MAC_CTX_get_mac_size() is called before init.

Extend mac testing in evp_test.c to check that the sizes returned by
EVP_MAC_CTX_get_mac_size() before and after init make sense (this also
ensures that we no longer seg-fault).

Fixes #22842

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22858)
providers/implementations/macs/cmac_prov.c
test/evp_test.c