2026-04-13 11:48 PM
Hello everyone.
I'm novice in cryptografic,
I'm developing a project with STM32H7.
I have a file on uSD and I can read it using FatFs.
I have to crypto this file using CRYP_AES_GCM.
I setup IOC in this way
The IOC build this file for me
My file has 98MByte of size but I cannot fit the whole size in a Heap Buffer because free space in Heap is 60KByte but I can prefer to reserve at least 32KByte to have some space available for other c++ objects.
So I develop a code that reads 32KByte-chunks from the source file and crypto this chunk before to write in the crypted file.
But I have a dubt: to crypt this chunk of file I call
HAL_CRYP_Encrypt(&hcryp, (uint32_t*)ptr, (byteRead+3)/4, (uint32_t*)ptr, 1000UL);
But if I inspect this API I notice that it resets some sort o f counter
So I think that I'm wrong because probably I have to not reset this counter and, instead, put the next chunk to the crypt.
Is my doubt a certainty ?
And there is a way to check, once the file is crypted, to check if a KEY is right ?
I think to insert some kind of sign to check after decrypt
Thankyou in advance
Bye