tech-security archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: crypto_memset (was: Re: Zero it if you're going to copy it out.)
On 22.07.2012 18:01, Alan Barrett wrote:
> I have an implementation of memset_s. It's fairly intrusive, in that
> several header files need extra declarations for strange types, and I
> haven't implemented the constraint handler callbacks.
Strange types?
> It's easy to usae volatile pointers to define functions that will not be
> optinmised away. For example (from a message I sent in Febroary 2012):
>
> /*
> * memset_volatile is a volatile pointer to the memset function.
> * You can call (*memset_volatile)(buf, val, len) or even
> * memset_volatile(buf, val, len) just as you would call
> * memset(buf, val, len), but the use of a volatile pointer
> * guarantees that the compiler will not optimise the call away.
> */
> void * (* volatile memset_volatile)(void *, int, size_t) = memset;
>
> I think I like "explicit_memset" better than "memset_volatile" as the
> function name.
Describes function's usage better, yes.
--
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost
Home |
Main Index |
Thread Index |
Old Index