STMicroelectronics / stm32u5xx_hal_driver

Provides the STM32Cube MCU Component "hal_driver" of the STM32U5 series.
BSD 3-Clause "New" or "Revised" License
7 stars 11 forks source link

CRYP_AES_Decrypt forces key mode as CRYP_KEYMODE_NORMAL #12

Open manisht-mwp opened 1 week ago

manisht-mwp commented 1 week ago

Hello, In stm32u5xx_hal_cryp.c, CRYP_AES_Decrypt() function, it sets the AES_CR_KMOD to be CRYP_KEYMODE_NORMAL. I've set the hcryp->Init.KeyMode = CRYP_KEYMODE_SHARED, but I believe it's not being used.

hal_issue

I believe it should be 'MODIFY_REG(hcryp->Instance->CR, AES_CR_KMOD, hcryp->Init.KeyMode);'

Thanks

ALABSTM commented 1 week ago

Hi @mtamang10,

You point has been forwarded to our development teams. Let's wait for their answer.

With regards,

ALABSTM commented 1 week ago

ST Internal Reference: 191244

ALABSTM commented 16 hours ago

Hi @manisht-mwp,

According to our development teams, this is coded this way on purpose. Indeed, as you can see from RM0456, revision 5, there are two cryptographic instances: AES (chapter 49) and SAES (chapter 50).

The first instance, AES, is not intended to share any key. Instead, it is the second instance, SAES, the secure one, that could. Once the SAES instance shared its key with the AES, this latter handles that key as a normal one.

From a functions point-of-view:

I hope this makes things clearer. Do not hesitate otherwise.

With regards,