r/crypto • • 8d ago

Zeroization, part 1: Wiping can make things worse

https://00f.net/2026/10/06/zeroization-1/
36 Upvotes

7 comments sorted by

7

u/newpavlov 7d ago

Issues like this is one of the reasons why we decided to not zeroize stack-based temporaries in RustCrypto. Instead we recommend to zeroize stack after a sensitive computation is completed.

2

u/Natanael_L Trusted third party 8d ago

The method hardware wallets use when resetting is overwrite all available memory with randomness and then computing eg. a hash of it. This works if you know exactly how much memory is available and can force the controller to perform the hashing with zero spare room for secrets. In theory you can replicate it in code with restricted memory assignment for sensitive functions. This does assume no cache hijinks or register shenanigans...

2

u/Youknowimtheman 7d ago

Whoops it went to virtual memory and now we have to deal with TRIM. yay!

1

u/ddddavidee 8d ago

Looking forward for part 2 !

6

u/jedisct1 6d ago

1

u/ddddavidee 6d ago

Yes!

I got it in my RSS feed reader!

And now, looking forward for part 3 😂

1

u/Shoddy-Childhood-511 6d ago

Interesting, we'll need special support from compilers then, which gets complex and brings a long delays.

Is there a way to tell the kernel that if it context switches you then it needs to zero those saved registers afterwards? Or should it always be doing this?