From 23ac2c1e0a75444ade94a7809613ed0c9f3a4d24 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Wed, 6 Nov 2002 15:43:38 +0000 Subject: [PATCH] * secmem.c (secmem_free, secmem_term): Use wipememory2() instead of memset() to overwrite secure memory. --- util/ChangeLog | 5 +++++ util/secmem.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/util/ChangeLog b/util/ChangeLog index adb380b60..59a76191c 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,8 @@ +2002-11-06 David Shaw + + * secmem.c (secmem_free, secmem_term): Use wipememory2() instead + of memset() to overwrite secure memory. + 2002-10-28 Werner Koch * w32reg.c (read_w32_registry_string): Fixed expanding of the diff --git a/util/secmem.c b/util/secmem.c index d4eecbb3e..48bcc7f44 100644 --- a/util/secmem.c +++ b/util/secmem.c @@ -406,10 +406,10 @@ secmem_free( void *a ) size = mb->size; /* This does not make much sense: probably this memory is held in the * cache. We do it anyway: */ - memset(mb, 0xff, size ); - memset(mb, 0xaa, size ); - memset(mb, 0x55, size ); - memset(mb, 0x00, size ); + wipememory2(mb, 0xff, size ); + wipememory2(mb, 0xaa, size ); + wipememory2(mb, 0x55, size ); + wipememory2(mb, 0x00, size ); mb->size = size; mb->u.next = unused_blocks; unused_blocks = mb; @@ -439,10 +439,10 @@ secmem_term() if( !pool_okay ) return; - memset( pool, 0xff, poolsize); - memset( pool, 0xaa, poolsize); - memset( pool, 0x55, poolsize); - memset( pool, 0x00, poolsize); + wipememory2( pool, 0xff, poolsize); + wipememory2( pool, 0xaa, poolsize); + wipememory2( pool, 0x55, poolsize); + wipememory2( pool, 0x00, poolsize); #ifdef HAVE_MMAP if( pool_is_mmapped ) munmap( pool, poolsize );