cryptoauthlib icon indicating copy to clipboard operation
cryptoauthlib copied to clipboard

g_mbedtls_slot_cb is not tested before being called

Open jd-imi opened this issue 4 months ago • 1 comments

I migrated from v3.5.1 to v3.7.9 and I fell calling a null function (I didn't call atca_register_ecdh_slot_cb before calling mbedtls_ecdh_gen_public). I assume that troubleshooting this issue could be easier.

Here is the call to the function: https://github.com/MicrochipTech/cryptoauthlib/blob/7f00156/lib/mbedtls/atca_mbedtls_ecdh.c#L69

In version 3.5.1, atca_mbedtls_ecdh_slot_cb was called instead of g_mbedtls_slot_cb which need to be registered.

jd-imi avatar Sep 23 '25 09:09 jd-imi

Hi @jd-imi , With v3.7.9 this approach is modifed. Yes, we have to register a callback and use it. https://github.com/MicrochipTech/cryptoauthlib/blob/main/test/integration/test_mbedtls.c#L284

Similarly, atca_unregister_ecdh_slot_cb() is added.

Srinivas-E avatar Sep 23 '25 10:09 Srinivas-E