diff options
Diffstat (limited to 'jnlib/mischelp.h')
-rw-r--r-- | jnlib/mischelp.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/jnlib/mischelp.h b/jnlib/mischelp.h index 58c9250e2..54da4cc1f 100644 --- a/jnlib/mischelp.h +++ b/jnlib/mischelp.h @@ -1,5 +1,5 @@ /* mischelp.h - * Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -39,5 +39,16 @@ #endif +/* To avoid that a compiler optimizes certain memset calls away, these + macros may be used instead. */ +#define wipememory2(_ptr,_set,_len) do { \ + volatile char *_vptr=(volatile char *)(_ptr); \ + size_t _vlen=(_len); \ + while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } \ + } while(0) +#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len) + + + #endif /*LIBJNLIB_MISCHELP_H*/ |