Yes, zero my secret key data. Yes I really, really mean it.
This commit is contained in:
parent
28646eee0a
commit
e8c5495b61
2 changed files with 19 additions and 11 deletions
|
@ -101,18 +101,10 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Securely zero memory
|
||||
*
|
||||
* This just uses volatile to ensure that it's never optimized out.
|
||||
* Securely zero memory, avoiding compiler optimizations and such
|
||||
*/
|
||||
static inline void burn(void *ptr,unsigned int len)
|
||||
throw()
|
||||
{
|
||||
volatile unsigned char *p = (unsigned char *)ptr;
|
||||
volatile unsigned char *e = p + len;
|
||||
while (p != e)
|
||||
*(p++) = (unsigned char)0;
|
||||
}
|
||||
static void burn(void *ptr,unsigned int len)
|
||||
throw();
|
||||
|
||||
/**
|
||||
* Delete a file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue