Using mbedtls with a HSM with different key slots


I try to get mbedtls working with a Hardware Security Module on the client side of a TLS connection.

I found already some _ALT functions which I replaced with the HSM calls (mbedtls_ecdh_gen_public, mbedtls_ecdh_compute_shared, mbedtls_ecdsa_verify, mbedtls_ecdsa_sign). My issue is now, that the HSM has four different slots to save private keys, and I need for some operations keys from two slots (For example for a TLS Handshake, I have functions to compute the diffie hellman shared secret on one slot, and sign the message with the certificate key from another slot). Is there somehow a way implemented to handover the slot position from the mbedtls interface to the alternative calls?

Thank you

Simone Esch