[12024] in cryptography@c2.net mail archive

home help back first fref pref prev next nref lref last post

Re: Did you *really* zeroize that key?

daemon@ATHENA.MIT.EDU (Bill Sommerfeld)
Fri Nov 8 11:06:11 2002

From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
To: Patrick Chkoreff <patrick@loom.cc>
Cc: cryptography@wasabisystems.com
In-Reply-To: Message from Patrick Chkoreff <patrick@loom.cc> 
   of "Thu, 07 Nov 2002 19:36:41 EST." <5.1.1.6.0.20021107192236.04242008@loom.cc> 
Reply-To: sommerfeld@orchard.arlington.ma.us
Date: Fri, 08 Nov 2002 10:19:39 -0500

[cc's pruned]

> static void
> burn_stack (int bytes)
> {
>      char buf[64];
> 
>      memset (buf, 0, sizeof buf);
>      bytes -= sizeof buf;
>      if (bytes > 0)
>          burn_stack (bytes);
> }

This may also not quite do what you think:

 1) burn_stack() may reasonably be made tail-recursive by a
sufficiently agressive compiler, if the memset is inlined and is then
recognized as a bunch of dead stores.

 2) even if it doesn't get tail-call treatment, some ABI's require
largeish alignment for stack frames or define a fixed component to the
stack frame and then don't fill in the unused stack slots; either of
these may leave a good size chunk of the stack unwritten.

						- Bill

---------------------------------------------------------------------
The Cryptography Mailing List
Unsubscribe by sending "unsubscribe cryptography" to majordomo@wasabisystems.com

home help back first fref pref prev next nref lref last post