summaryrefslogtreecommitdiffstats
path: root/util/secmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/secmem.c')
-rw-r--r--util/secmem.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/util/secmem.c b/util/secmem.c
index bb39ade05..b1d86ebf1 100644
--- a/util/secmem.c
+++ b/util/secmem.c
@@ -219,6 +219,25 @@ secmem_malloc( size_t size )
}
+void *
+secmem_realloc( void *p, size_t newsize )
+{
+ MEMBLOCK *mb;
+ size_t size;
+ void *a;
+
+ mb = (MEMBLOCK*)((char*)p - ((size_t) &((MEMBLOCK*)0)->u.d));
+ size = mb->size;
+ if( newsize < size )
+ return p; /* it is easier not to shrink the memory */
+ a = secmem_malloc( newsize );
+ memcpy(a, p, size);
+ memset(a+size, 0, newsize-size);
+ secmem_free(p);
+ return a;
+}
+
+
void
secmem_free( void *a )
{
@@ -241,6 +260,12 @@ secmem_free( void *a )
cur_alloced -= size;
}
+int
+m_is_secure( const void *p )
+{
+ return p >= pool && p < (pool+poolsize);
+}
+
void
secmem_term()
{