[Cryptography] Making sure memory erasure is not optimized away

Peter Gutmann pgut001 at cs.auckland.ac.nz
Sat Aug 27 05:03:09 EDT 2022


Phillip Hallam-Baker <phill at hallambaker.com> writes:

>Has anyone got pointers to ways to make sure this is done right?

It's a solved problem, just Google it, e.g. Windows has SecureZeroMemory(),
glibc has explicit_bzero(), and so on.  There are also plenty of ad hoc
solutions using pointers to volatile and similar.

With C# (which you mentioned) and similar languages, a bigger concern is that
you're giving the compiler, and in some cases the engine/interpreter/VM
fairly complete control over your memory, so you can't really tell where
copies of sensitive data are ending up.

Peter.



More information about the cryptography mailing list