summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Schulte <mo@g10code.com>2005-10-16 08:46:06 +0000
committerMoritz Schulte <mo@g10code.com>2005-10-16 08:46:06 +0000
commite5410dcf22dffc7f2e725a0965842fae71ecdbcf (patch)
treee658f1cccc9ac7bf44cc4b974437c13501a61f20
parent66721a14e67327727531f62c2881529a0d4d8bbc (diff)
downloadlibgcrypt-e5410dcf22dffc7f2e725a0965842fae71ecdbcf.tar.gz
2005-10-16 Moritz Schulte <moritz@g10code.com>
* stdmem.c: Inserted description of the layered memory management in Libgcrypt.
-rw-r--r--src/ChangeLog12
-rw-r--r--src/stdmem.c30
2 files changed, 41 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d5c16001..bdecfc85 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,9 +1,21 @@
2005-10-16 Moritz Schulte <moritz@g10code.com>
+ * stdmem.c: Inserted description of the layered memory management
+ in Libgcrypt.
+
* g10lib.h: Removed G10_I18N_H related check; it seems to be a
GnuPG relict (Libgcrypt does not define this symbol anywhere).
(FLAG_MODULE_DISABLED): Don't forget parantheses around shifted
value.
+
+ Removed GCC_ATTR_PURE macro definitions, since gcrypt.h does
+ already contain such a macro named _GCRY_GCC_ATTR_PURE, which we
+ can use here as well.
+
+ Likewise for GCC_ATTR_MALLOC and _GCRY_GCC_ATTR_MALLOC.
+
+ * stdmem.h: Use _GCRY_GCC_ATTR_MALLOC instead of GCC_ATTR_MALLOC.
+ * secmem.h: Likewise.
2005-10-09 Moritz Schulte <moritz@g10code.com>
diff --git a/src/stdmem.c b/src/stdmem.c
index 4243af16..e5657987 100644
--- a/src/stdmem.c
+++ b/src/stdmem.c
@@ -1,5 +1,5 @@
/* stdmem.c - private memory allocator
- * Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 2000, 2002, 2005 Free Software Foundation, Inc.
*
* This file is part of Libgcrypt.
*
@@ -18,6 +18,33 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
+/*
+ * Description of the layered memory management in Libgcrypt:
+ *
+ * [User]
+ * |
+ * |
+ * \ /
+ * global.c: [MM entrance points] -----> [user callbacks]
+ * | |
+ * | |
+ * \ / \ /
+ *
+ * stdmem.c: [non-secure handlers] [secure handlers]
+ *
+ * | |
+ * | |
+ * \ / \ /
+ *
+ * stdmem.c: [ memory guard ]
+ *
+ * | |
+ * | |
+ * \ / \ /
+ *
+ * libc: [ MM functions ] secmem.c: [ secure MM functions]
+ */
+
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
@@ -28,6 +55,7 @@
#include "stdmem.h"
#include "secmem.h"
+
#define MAGIC_NOR_BYTE 0x55
#define MAGIC_SEC_BYTE 0xcc