Do I have to call Cy_Crypto_Aes_Init every time I encrypt if I use Cy_Crypto_Crc_Run inbetween?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
user_1669321
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

Hi,

The PDL's documentation for Cy_Crypto_Aes_Init() states that "Call to initialize this encryption technique before using any associated functions. You must initialize this technique again after using any other encryption technique."

For me, that means that if I only use AES encryption, I only have to call this once at the beginning. However, I'm also toggling between computing CRCs and encrypting data with AES. CRC is not an encryption technique, so must I still call Cy_Crypto_Aes_Init() after using Cy_Crypto_Crc_Run()?

Thank you,

Fred

0 Likes
1 Solution

Hello Fred,

I checked with the internal team. The Init functions are only to intialize the different techniques offered by the respective crypto block. For example, Cy_Crypto_Crc_Init()is needed only for CRC operations and Cy_Crypto_Aes_Init() is needed for AES operations.

Whenever you want to use a different technique in CRC, you need to call the Cy_Crypto_Crc_Init(). If you want to use a different encryption scheme for AES, then you need to call the Cy_Crypto_Aes_Init(). So, your understanding and observations are completely right.

Regards,

Dheeraj

View solution in original post

0 Likes
4 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello Fred,

Yeah, the documentation needs to be corrected slightly. You must initialize again after using any other Crypto operations especially those functions that have init in them. To answer your question more specifically, yes, you need to call  Cy_Crypto_Aes_Init() after using Cy_Crypto_Crc_Run().

Regards,

Dheeraj

0 Likes

Can you double-check that?

I've been developing all day assuming that the description meant "any other AES encryption technique".

My code now toggles between CRC and AES without reinitializing, and I'm able to decrypt the encrypted buffers and validate the computed CRCs correctly. I only use Cy_Crypto_Aes_Init() once at initialization, as well as Cy_Crypto_Crc_Init().

0 Likes

Hello Fred,

I checked with the internal team. The Init functions are only to intialize the different techniques offered by the respective crypto block. For example, Cy_Crypto_Crc_Init()is needed only for CRC operations and Cy_Crypto_Aes_Init() is needed for AES operations.

Whenever you want to use a different technique in CRC, you need to call the Cy_Crypto_Crc_Init(). If you want to use a different encryption scheme for AES, then you need to call the Cy_Crypto_Aes_Init(). So, your understanding and observations are completely right.

Regards,

Dheeraj

0 Likes