cancel
Showing results for 
Search instead for 
Did you mean: 

buggy STM32H7S CRYP HAL

alessandro.breuza
Associate III

Hello,

HAL driver for CRYP peripheral of STM32H7RSxx series generates invalid AES GCM TAG.

According specs, header should be 0-padded to 16 bytes, but in the function CRYP_GCMCCM_SetHeaderPhase() the HeaderSize field is assumed to be expressed in words.

This leads to errors when header is, for example, 5 bytes long (as in TLS handshake).

 

cfr. STM32H7xx series implementation

 

STM32Cube FW_H7RS V1.2.0

 

Alessandro

2 REPLIES 2
TDK
Super User

The code appears to be doing the padding here. Does it not?

stm32h7xx-hal-driver/Src/stm32h7xx_hal_cryp.c at 85d65b023f9621e417177a87553d25b7b387239f · STMicroelectronics/stm32h7xx-hal-driver

If you feel a post has answered your question, please click "Accept as Solution".

Yes, it does, but the corresponding code in STM32H7RSxx library is not working.

https://github.com/STMicroelectronics/stm32h7rsxx-hal-driver/blob/68e6cb59339fec2b0dd1c90f1492c39d18e69af7/Src/stm32h7rsxx_hal_cryp.c#L6925

 

Assuming hcryp->Init.HeaderSize = 4 (bytes), the code will input 16 bytes to CRYP module.