On 2023-11-27 18:25, Hal Murray wrote:
I have a fresh ctx using cmac with AES-128-CBC all ready to go.
No key yet.
If I call EVP_MAC_CTX_get_mac_size(), I get a SIGSEGV.
If I call EVP_MAC_init() with a key first, it works.
Is this a bug? Is there a setup step I've missed?
Without seeing the rest of your code it is difficult to tell.
The documentation
https://www.openssl.org/docs/man3.1/man3/EVP_MAC_CTX_get_mac_size.html
says:
> EVP_MAC_CTX_get_mac_size() returns the expected output size, or 0 if
it isn't set. If it isn't set, a call to EVP_MAC_init() will set it.
Do you check the return value of EVP_MAC_CTX_get_mac_size()?
Note that EVP_MAC_CTX_get_mac_size() does not seem to be called in the
back-trace you listed.
-James M