Re: Importance of memory hygiene

"Robert J. Hansen via Gnupg-users" <[email protected]> Tue, 31 Mar 2026 01:00:13 -0400
Newsgroups gmane.comp.encryption.gpg.user
Message-ID <[email protected]>
> This actually leads to *another* possible problem that Claude seems to 
> have missed:  what precautions are you taking to ensure that the 
> generator state and/or generated passwords do not appear in a core dump?

Internally, a 16384-glyph Vec::<char> buffer is maintained, and when a 
password is generated the characters are pulled from the buffer. When 
the buffer empties the contents are zeroized, a 12288-byte Vec::<u8> is 
populated from the CSPRNG, base64ed to become the new buffer, and the u8 
vector is zeroized. The glyph buffer is RAIIed to zeroize on a panic.

The CSPRNG is just Rust's ChaCha20 CSPRNG. I haven't dived into the 
details of its implementation, but I do take the Rust Crypto team at 
their word when they say it is a CSPRNG meant for security-sensitive 
applications.

If you could force a core dump during the particular nanosecond there's 
sensitive data in memory then it's possible you could recover sensitive 
data. I begin to think even at my level of paranoia that it's a bit 
excessive, though. :)

_______________________________________________
Gnupg-users mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gnupg-users
OpenPGP_signature.asc (application/pgp-signature, 236 B)
-----BEGIN PGP SIGNATURE-----

wnsEABYIACMWIQR9jsS4W2/t1sENPHkeepTU6H+R1QUCactU3QUDAAAAAAAKCRAeepTU6H+R1Xiy
AP45jRmwcINorBmt0+BXrUaO3jUsGC1gZe/kBrT06z4zUwEAqf0uLdlPcO1w85DWLIOZYNA7FXNe
Gwxc/EEIz7EanAE=
=RoXN
-----END PGP SIGNATURE-----