cancel
Showing results for 
Search instead for 
Did you mean: 

Suggestion to use CRYP_AES_GCM

MauFanGilaMedical
Associate III

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

MauFanGilaMedical_0-1776150563313.png

The IOC build this file for me

MauFanGilaMedical_1-1776150637781.png

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

 

MauFanGilaMedical_2-1776151142769.png

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

 

 

0 REPLIES 0