What is maximum length of plain text in AES-GCM and AES-CCM?

Hello,

I am using mbed TLS on silicon lab microcontroller. I want to use AES-GCM and AES-CCM mode of encryption.

I have created unit tests for AES-GCM , AES-CCM modes and it seems like some time AES-GCM gets fail to encrypt data more than ~200 Bytes.

But sometimes it encrypts the data successfully with some specific plain text length e.g 256 Bytes.

1- Why AES-GCM is not consistent with plain Text length in above-mentioned ranges?

2- Does the encryption/decryption really depends upon the Text length?

3- Can you please clarify what maximum length of plain Text for AES-GCM and AES-CCM mbed TLS supports?

Hi @mingele
200 bytes should not cause an encryption error. There is probably some other issue that cause the error you received. What was the error?

As you can see from the code, the total length cannot exceed 2^39 - 256 bits, ie 2^36 - 2^5 bytes, but this is much more than 200 bytes.

Where does the debugger return the error?

Regards,
Mbed TLS Support
Ron