aboutsummaryrefslogtreecommitdiffstats
path: root/util/secmem.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-02-11 23:22:09 +0000
committerWerner Koch <[email protected]>1998-02-11 23:22:09 +0000
commitbc5789665ae8c9f8fc3d02841cd6c9ade447a12a (patch)
treea98aa9fdf58eaffecb38ce481606ee8536280fc8 /util/secmem.c
parenta couple of changes; but some parts are now broken (diff)
downloadgnupg-bc5789665ae8c9f8fc3d02841cd6c9ade447a12a.tar.gz
gnupg-bc5789665ae8c9f8fc3d02841cd6c9ade447a12a.zip
bug fixes
Diffstat (limited to 'util/secmem.c')
-rw-r--r--util/secmem.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/util/secmem.c b/util/secmem.c
index 2777ca8ca..a54848d54 100644
--- a/util/secmem.c
+++ b/util/secmem.c
@@ -61,6 +61,8 @@ static unsigned cur_alloced;
static unsigned max_blocks;
static unsigned cur_blocks;
static int disable_secmem;
+static int show_warning;
+static int no_warning;
static void
lock_pool( void *p, size_t n )
@@ -82,7 +84,7 @@ lock_pool( void *p, size_t n )
if( err ) {
if( errno != EPERM )
log_error("can�t lock memory: %s\n", strerror(err));
- log_info(_("Warning: using insecure memory!\n"));
+ show_warning = 1;
}
#else
@@ -132,6 +134,17 @@ compress_pool(void)
}
+void
+secmem_set_flags( unsigned flags )
+{
+ no_warning = flags & 1;
+}
+
+unsigned
+secmem_get_flags(void)
+{
+ return no_warning ? 1:0;
+}
void
secmem_init( size_t n )
@@ -156,7 +169,12 @@ secmem_malloc( size_t size )
int compressed=0;
if( !pool_okay )
- init_pool(DEFAULT_POOLSIZE);
+ log_bug("secmem not initialized\n");
+ if( show_warning ) {
+ show_warning = 0;
+ if( !no_warning )
+ log_info(_("Warning: using insecure memory!\n"));
+ }
/* blocks are always a multiple of 32 */
size += sizeof(MEMBLOCK);