summaryrefslogtreecommitdiff
path: root/src/stdmem.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2002-05-02 14:07:31 +0000
committerWerner Koch <wk@gnupg.org>2002-05-02 14:07:31 +0000
commit519eb448cacaed994f3af515f1348d8065a96c6b (patch)
treed16ff7f6d3d037342fc4b9e7aa1363970498e2e3 /src/stdmem.c
parent08762fdd090c5bff0265b947e71465b9dbda0051 (diff)
downloadlibgcrypt-519eb448cacaed994f3af515f1348d8065a96c6b.tar.gz
* gcrypt.h (GCRYCTL_DISABLE_INTERNAL_LOCKING): New.
* global.c (gcry_control): Implement it. (_gcry_no_internal_locking): New. * mutex.h: Prefixed all fucntions with _gcry_. Bypass all functions when desired. * gcrypt.h (GCRYCTL_DISABLE_SECMEM): New. * global.c (gcry_control,gcry_malloc_secure,gcry_is_secure): Implement it here. * secmem.c (_gcry_private_is_secure): Return false if the pool is not initialized. * gcrypt.h (GCRYCTL_INITIALIZATION_FINISHED): New. * gcrypt.h (gcry_cipher_algos): Replaced RINDAEL by AES and change the macros to expand from rijdael to aes. * stdmem.c (_gcry_private_malloc): Return NULL for 0 byte allocation. (_gcry_private_malloc_secure): Ditto. * g10lib.h: Copied the JNLIB_GCC macros from ../jnlib/mischelp.h and removed the inclusion of that file.
Diffstat (limited to 'src/stdmem.c')
-rw-r--r--src/stdmem.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/stdmem.c b/src/stdmem.c
index 1cfe62ff..1b22994b 100644
--- a/src/stdmem.c
+++ b/src/stdmem.c
@@ -1,5 +1,5 @@
/* stdmem.c - private memory allocator
- * Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
*
* This file is part of Libgcrypt.
*
@@ -59,6 +59,9 @@ _gcry_private_enable_m_guard(void)
void *
_gcry_private_malloc( size_t n)
{
+ if(!n)
+ return NULL; /* allocating 0 bytes is undefined - better return
+ an error */
if( use_m_guard ) {
char *p;
@@ -83,6 +86,9 @@ _gcry_private_malloc( size_t n)
void *
_gcry_private_malloc_secure( size_t n)
{
+ if(!n)
+ return NULL; /* allocating 0 bytes is undefined - better return
+ an error */
if( use_m_guard ) {
char *p;