summaryrefslogtreecommitdiff
path: root/gpgscm
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2019-01-04 13:13:53 +0100
committerWerner Koch <wk@gnupg.org>2019-01-04 13:13:53 +0100
commit933bfd7b652a907c0d8dd5337c6b5b9cb82ce7b7 (patch)
tree2c3d78726642c6ccad34296082d5c85e3189a51c /gpgscm
parent12349de46d241cfbadbdf99773d6cabfcbc97578 (diff)
downloadlibgpg-error-933bfd7b652a907c0d8dd5337c6b5b9cb82ce7b7.tar.gz
core: New functions gpgrt_abort and gpgrt_add_emergency_cleanup.
* src/init.c (emergency_cleanup_list): New gloabl var. (_gpgrt_add_emergency_cleanup): New. (_gpgrt_abort): New. Repalce all calls to abort by this. Also replace all assert by either log_assert or a stderr output followed by a _gpgrt_abort. (run_emergency_cleanup): New. * src/visibility.c (gpgrt_add_emergency_cleanup): New public API. (gpgrt_abort): New public API. -- Libgcrypt uses its own assert function which makes sure to terminate the secure memory. This is safe as log as an assert is triggered internally in Libgcrypt. GnuPG runs emergency cleanup handlers right before log_fatal etc to tell Libgcrypt to terminate the secure memory. With the move of the logging function to gpgrt in gnupg 2.3 this did not anymore. Thus we now provide a mechanism in gpgrt to do right that. Eventually Libgcrypt can also make use of this. What this does not handle are calls to abort or failed asserts in external libraries or in libc. We can't do anything about it in a library because a library may not setup signal handlers. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'gpgscm')
-rw-r--r--gpgscm/ffi.c1
-rw-r--r--gpgscm/main.c1
-rw-r--r--gpgscm/scheme.c3
3 files changed, 1 insertions, 4 deletions
diff --git a/gpgscm/ffi.c b/gpgscm/ffi.c
index 578c68d..2067b0d 100644
--- a/gpgscm/ffi.c
+++ b/gpgscm/ffi.c
@@ -19,7 +19,6 @@
#include <config.h>
-#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
diff --git a/gpgscm/main.c b/gpgscm/main.c
index 22c7c98..07d8e07 100644
--- a/gpgscm/main.c
+++ b/gpgscm/main.c
@@ -19,7 +19,6 @@
#include <config.h>
-#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/gpgscm/scheme.c b/gpgscm/scheme.c
index 906e563..1b489e4 100644
--- a/gpgscm/scheme.c
+++ b/gpgscm/scheme.c
@@ -33,7 +33,6 @@
# include <math.h>
#endif
-#include <assert.h>
#include <limits.h>
#include <stdint.h>
#include <float.h>
@@ -881,7 +880,7 @@ gc_reservation_failure(struct scheme *sc)
sc->frame_freelist == sc->NIL ? "frame" : "cell",
sc->reserved_lineno);
#endif
- abort();
+ _gpgrt_abort();
}
/* Disable the garbage collection and reserve the given number of