cancel
Showing results for 
Search instead for 
Did you mean: 

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

JimEno
Associate II

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?

4 REPLIES 4
Jocelyn RICARD
ST Employee

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

>>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 Venmo
Up vote any posts that you find helpful, it shows what's working..
JimEno
Associate II

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
Associate III

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.