AnsweredAssumed Answered

STM32F4 and crypto question

Question asked by hakobyan.davit on Oct 14, 2016
Latest reply on Oct 19, 2016 by hakobyan.davit
Dear All,

I successfully could integrate the AES GCM algorithms (firmware variant, no hardware acceleration) of STM32 cryptographic library v2.0.6 into the project. It encrypts and decrypts the plaintext correctly without any error.

Simultaneously, there is another crypto project in the PC side using the Crypto++ library with the same AES GCM encrypt/decrypt parts. Here, too, everything works.

However, the problem is that when using the same AES256 key, IV array (size 12), plaintext, header (AAD), the STM32F4 and the PC generates different ciphers and tags. Their lengths are the same across the platforms but the content is totally different.

So it becomes impossible to encrypt in PC and try to decrypt the cipher in STM32F4. I have tried to supply the cipher and the tag generated in STM32F4 to the PC decrypted but it breaks with the error:
Caught HashVerificationFailed...
HashVerificationFilter: message hash or MAC not valid

So my question what might be the problem that they generate different ciphers?

Thanks a lot for any suggestion.

Outcomes