Skip to main content
JimEno
Associate III
May 26, 2023
Question

Can I set the AES output buffer the same as the input?

  • May 26, 2023
  • 4 replies
  • 1511 views

I have a large block of data to encrypt (about 200 Kbytes). I don't care about preserving the input data and I'd like to save memory.

Can t I set the output buffer pointer to the same value as the input buffer pointer using the HAL AES encrypt function?

I couldn't find any information on this. Am I the only one to have ever asked this?

This topic has been closed for replies.

4 replies

Jocelyn RICARD
ST Employee
June 6, 2023

Hello @JimEno​ ,

as the input data is provided to the hardware accelerator by chunks of 16 bytes and result read later, I don't see any issue writing result at the same place.

Best regards

Jocelyn

Tesla DeLorean
Guru
June 6, 2023

>>Am I the only one to have ever asked this?

Perhaps the only one who didn't at least try it..

Plus the OfficeSpace Forum search engine isn't known for it's ability to find any salient information or posts.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
JimEno
JimEnoAuthor
Associate III
June 6, 2023

To Jocelyn,.

Thank you for your kind and informative response.

To Tesla,

Point taken. I did eventually try it (before your response) with a 48 byte buffer of pseudo random data and it did seem to work. I should have reported back as it would have improved the 'saliency' of the forum. Didn't try it with my 140Kbyte real data, but I expect it will work. And, in general, you're right about forum posts. Kind regards.

Strooom
Senior
June 6, 2023

Good to know that it works.

In LoRaWAN you would encrypt the msg and no longer need the cleartext, so it’s certainly a useful idea. Thanks.