cancel
Showing results for 
Search instead for 
Did you mean: 

After calling AES_GCM_Encrypt_Finish, how do I obtain the correct Initialization vector for the next encrypted message?

Kabajan
Associate

I would like to extend the GCM example in STM32CubeExpansion_Crypto_V3.1.0 to be able to encrypt messages over a wired bus. Every message should contain an authentication. So the encryption of every message begins with AES_GCM_Encrypt_Init, and ends with AES_GCM_Encrypt_Finish.

My problem is: Using the same initialization vector for every message would degrade security. So I need to obtain the the correct IV (according to the standard) to be used for the next call of AES_GCM_Encrypt_Init.

There is no method in the API to retrieve the current vector value. I guess it is stored inside AESGCMctx_stt.amIv, but as an uint32_t-array (AES_GCM_Encrypt_Init needs an uint8_t-array as IV-parameter). Of course I could convert this, but is this really the meaning?

0 REPLIES 0