In [prvAddObjectToList](https://github.com/FreeRTOS/corePKCS11/blob/6ddc35ebdcd97a74d39a9c00e9bfa9a6b0febe4e/source/portable/mbedtls/core_pkcs11_mbedtls.c#L1183), pxAppHandle is only modified when the object is not already in the list. I found this calling C_GenerateKeyPair to replace an existing key that I had previously looked up. The returned handle was not set properly.