[Cryptography] [Crypto-practicum] Secure erasure in C.

Ron Garret ron at flownet.com
Wed Sep 7 20:27:52 EDT 2016


On Sep 7, 2016, at 5:08 PM, Ray Dillinger <bear at sonic.net> wrote:

> 
> 
> On 09/07/2016 04:23 PM, Ron Garret wrote:
>> 
> 
>> But why not simply:
>> 
>> void erase(volatile char *buf, size_t len) {
> ....
> 
> everything that starts with this line doesn't work, because
> passing a (non-volatile) 'char *' to a 'volatile char *' is
> an error.  Something can't be made volatile by a cast; it
> can only be done when declaring the variable (or buffer).

OK, so then why not:

void erase_non_volatile(char* buf, size_t len) {
  volatile char* buf1 = buf;
  erase(buf1, len);
}

or:

void erase_non_volatile(char* buf, size_t len) {
  volatile char* volatile buf1 = buf;
  erase(buf1, len);
}

rg



More information about the cryptography mailing list