SIGSEGV from EVP_MAC_CTX_get_mac_size()

Hal Murray halmurray+openssl at sonic.net
Tue Nov 28 04:18:00 UTC 2023


Thanks for the quick response.

james at openssl.org said:
> Would you be able to open an issue for this? 

SIGSEGV from EVP_MAC_CTX_get_mac_size() #22842
  https://github.com/openssl/openssl/issues/22842

> It is unusual to call EVP_MAC_CTX_get_mac_size() without first calling
> EVP_MAC_init(), but the code should handle that (and return 0, as per  the
> documentation). 

The context is setting up a shared key for NTP.  I'm trying to do some sanity 
checking when reading the keys file -- long before they get used.

--------

>From your previous message:
> Note that EVP_MAC_CTX_get_mac_size() does not seem to be called in the
> back-trace you listed. 

Here is the code from crypto/evp/mac_lib.c
size_t EVP_MAC_CTX_get_mac_size(EVP_MAC_CTX *ctx)
{
    return get_size_t_ctx_param(ctx, OSSL_MAC_PARAM_SIZE);
}

I'm not a compiler wizard.  I think that pattern is a special case.  It's returning the result of a procedure call so it can throw away the current frame, setup the return address and jump to the target routine which will return directly to the caller.  That saves a stack frame which can be a huge win with retursive code.  It probably saves a few cycles and helps the working set.



-- 
These are my opinions.  I hate spam.





More information about the openssl-users mailing list