summaryrefslogtreecommitdiffstats
path: root/g10/gpg.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-03-31 20:06:54 +0200
committerWerner Koch <wk@gnupg.org>2017-03-31 20:07:33 +0200
commit52ba5e67cad4311d0ddbc4f2979e20afd0161d1f (patch)
tree0d959d3440502898ba87c75fc8ca97daab2cf49f /g10/gpg.h
parentgpg: Pass CTRL to many more functions. (diff)
downloadgnupg2-52ba5e67cad4311d0ddbc4f2979e20afd0161d1f.tar.xz
gnupg2-52ba5e67cad4311d0ddbc4f2979e20afd0161d1f.zip
gpg: Assert that an opaque parameter is really what we expect.
* g10/gpg.h (SERVER_CONTROL_MAGIC): New const. (server_control_s): Add field 'magic'. * g10/gpg.c (gpg_init_default_ctrl): Init MAGIC. * g10/import.c (impex_filter_getval): Assert MAGIC. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/gpg.h')
-rw-r--r--g10/gpg.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/g10/gpg.h b/g10/gpg.h
index 3bf023be6..c66358570 100644
--- a/g10/gpg.h
+++ b/g10/gpg.h
@@ -68,11 +68,20 @@ struct tofu_dbs_s;
typedef struct tofu_dbs_s *tofu_dbs_t;
+#if SIZEOF_UNSIGNED_LONG == 8
+# define SERVER_CONTROL_MAGIC 0x53616c696e676572
+#else
+# define SERVER_CONTROL_MAGIC 0x53616c69
+#endif
+
/* Session control object. This object is passed to most functions to
convey the status of a session. Note that the defaults are set by
gpg_init_default_ctrl(). */
struct server_control_s
{
+ /* Always has the value SERVER_CONTROL_MAGIC. */
+ unsigned long magic;
+
/* Local data for server.c */
struct server_local_s *server_local;