Hello,
I am wondering if there are APIs for Hmac and Cmac verification?
from md.h and cmac.h, Hmac and Cmac generation functionalities are provided in a single and streaming approach. But is there a plan to add verification APIs for future releases maybe?
Kind regards, Ahmed Mohammed
Hello,
With the mbedtls_md and mbedtls_cmac APIs, there is no dedicated function for verification. Use the MAC calculation function, then use mbedtls_ct_memcmp() from mbedtls/constant_time.h to compare the expected MAC with the calculated MAC.
With the PSA API, there is a dedicated function psa_mac_verify(), and psa_mac_verify_finish() for a multipart calculation.
The classic (non-PSA) crypto APIs will not change much at this point, and will be removed from the public API in a future major release (probably the next one). We are not planning to add MAC verification functions to md.h or cmac.h.
Best regards,
mbed-tls@lists.trustedfirmware.org