cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H753 hardware crypto CCM failure

AKali
Associate II

Hello, I've got STM32H53 MCU and trying to use hardware CCM accelerator as alternative CCM for mbedtls library.
I've took HAL implementation from the repository STM32Cube_FW_H7_V1.11.2/Projects/STM32H743I-EVAL/Applications/mbedTLS/Crypto_Selftest/Src/ccm_alt.c and it's not working as well as mbedtls software implementation.

I'll try to describe that behavior by the examples below.

Encryption by mbedtls_ccm_encrypt_and_tag():

size_t length = 62
size_t add_len = 35
size_t iv_len = 13
size_t tag_len = 8
Output buffer matched, output tag unmatched to mbedtld software encryption

size_t length = 112
size_t add_len = 36
size_t iv_len = 13
size_t tag_len = 8
Output buffer matched, output tag matched to mbedtld software encryption

size_t length = 119
size_t add_len = 42
size_t iv_len = 13
size_t tag_len = 8
Output buffer matched, output tag unmatched to mbedtld software encryption

size_t length = 0
size_t add_len = 36
size_t iv_len = 13
size_t tag_len = 8
Output buffer matched, output tag matched to mbedtld software encryption

size_t length = 1544
size_t add_len = 42
size_t iv_len = 13
size_t tag_len = 8
Output buffer matched, output tag unmatched to mbedtld software encryption


Decryption by mbedtls_ccm_auth_decrypt()
:

size_t length = 62
size_t add_len = 35
size_t iv_len = 13
size_t tag_len = 8
Output buffer matched, output tag matched to mbedtld software decryption

size_t length = 112
size_t add_len = 36
size_t iv_len = 13
size_t tag_len = 8
Output buffer matched, output tag matched to mbedtld software decryption

size_t length = 119
size_t add_len = 42
size_t iv_len = 13
size_t tag_len = 8
Output buffer matched, output tag matched to mbedtld software decryption

size_t length = 0
size_t add_len = 36
size_t iv_len = 13
size_t tag_len = 8
Output buffer matched, output tag matched to mbedtld software decryption

size_t length = 1544
size_t add_len = 42
size_t iv_len = 13
size_t tag_len = 8
Output buffer matched, output tag unmatched to mbedtld software decryption


Thanks in advance, I'll happy to see any tips or solutions.

1 REPLY 1
AKali
Associate II

UPD: Sorry, I've got some mistakes here, any Red word means "unmatched"