How to use STM32F437/STM32F439 hardware cryptoengine with mbed TLS

Hello,

I studied this little further. For now it seems that there’s problem with context store/restore: just started with first selftest (AES-ECB) and got it working somehow, but I think that my current solution doesn’t work properly, if some other encryption/decryption is done between successive calls.

Similar issue appears with the next AES test (AES CBC). I assume that all AES accelerations are affected.

E.g.: HAL_CRYP_AESECB_Decrypt @ stm32f4xx_hal_cryp.c:

/* Check if initialization phase has already been performed */
if(hcryp->Phase == HAL_CRYP_PHASE_READY)
Just skipping this after first round, fixes this selftest with AES-ECB, but in general correct context must be saved and restored.

So does someone already have corrected implementation for this?