[svn] gcry - r1186 - trunk/src
svn author wk
cvs at cvs.gnupg.org
Thu Oct 19 12:34:46 CEST 2006
Author: wk
Date: 2006-10-19 12:34:46 +0200 (Thu, 19 Oct 2006)
New Revision: 1186
Modified:
trunk/src/ChangeLog
trunk/src/global.c
trunk/src/secmem.c
trunk/src/secmem.h
Log:
Let secmem init return an error if the memeory could not be locked.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2006-10-17 17:44:49 UTC (rev 1185)
+++ trunk/src/ChangeLog 2006-10-19 10:34:46 UTC (rev 1186)
@@ -1,3 +1,11 @@
+2006-10-19 Werner Koch <wk at g10code.com>
+
+ * global.c (gcry_control) <GCRYCTL_INIT_SECMEM>: Return an error
+ if the memory could not be locked.
+ * secmem.c (not_locked): New.
+ (_gcry_secmem_get_flags): Return that flag.
+ * secmem.h (GCRY_SECMEM_FLAG_NOT_LOCKED): New.
+
2006-10-05 Werner Koch <wk at g10code.com>
* module.c (_gcry_module_id_new): Don't assign modules in the range
Modified: trunk/src/global.c
===================================================================
--- trunk/src/global.c 2006-10-17 17:44:49 UTC (rev 1185)
+++ trunk/src/global.c 2006-10-19 10:34:46 UTC (rev 1186)
@@ -251,6 +251,8 @@
case GCRYCTL_INIT_SECMEM:
global_init ();
_gcry_secmem_init (va_arg (arg_ptr, unsigned int));
+ if ((_gcry_secmem_get_flags () & GCRY_SECMEM_FLAG_NOT_LOCKED))
+ err = GPG_ERR_GENERAL;
break;
case GCRYCTL_TERM_SECMEM:
Modified: trunk/src/secmem.c
===================================================================
--- trunk/src/secmem.c 2006-10-17 17:44:49 UTC (rev 1185)
+++ trunk/src/secmem.c 2006-10-19 10:34:46 UTC (rev 1186)
@@ -75,6 +75,7 @@
/* FIXME? */
static int disable_secmem;
static int show_warning;
+static int not_locked;
static int no_warning;
static int suspend_warning;
@@ -246,6 +247,7 @@
)
log_error ("can't lock memory: %s\n", strerror (err));
show_warning = 1;
+ not_locked = 1;
}
#elif defined(HAVE_MLOCK)
@@ -299,6 +301,7 @@
)
log_error ("can't lock memory: %s\n", strerror (err));
show_warning = 1;
+ not_locked = 1;
}
#elif defined ( __QNX__ )
@@ -417,6 +420,7 @@
flags = no_warning ? GCRY_SECMEM_FLAG_NO_WARNING : 0;
flags |= suspend_warning ? GCRY_SECMEM_FLAG_SUSPEND_WARNING : 0;
+ flags |= not_locked ? GCRY_SECMEM_FLAG_NOT_LOCKED : 0;
SECMEM_UNLOCK;
Modified: trunk/src/secmem.h
===================================================================
--- trunk/src/secmem.h 2006-10-17 17:44:49 UTC (rev 1185)
+++ trunk/src/secmem.h 2006-10-19 10:34:46 UTC (rev 1186)
@@ -34,5 +34,6 @@
/* Flags for _gcry_secmem_{set,get}_flags. */
#define GCRY_SECMEM_FLAG_NO_WARNING (1 << 0)
#define GCRY_SECMEM_FLAG_SUSPEND_WARNING (1 << 1)
+#define GCRY_SECMEM_FLAG_NOT_LOCKED (1 << 2)
#endif /* G10_SECMEM_H */
More information about the Gnupg-commits
mailing list