aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2025-02-06 14:46:15 +0000
committerWerner Koch <[email protected]>2025-02-06 14:46:15 +0000
commitda9fb6bd163d3fe75e0f6761539f27c28cfd0e04 (patch)
treec8a2b39cc0ad4fcb5f4b91a3c841bf058d52c4e5
parentgpgscm: Fix possible segv in the process functions. (diff)
downloadgnupg-da9fb6bd163d3fe75e0f6761539f27c28cfd0e04.tar.gz
gnupg-da9fb6bd163d3fe75e0f6761539f27c28cfd0e04.zip
kbx: Fix for building without keyboxd.
* kbx/keybox-fwddecl.h: New. * kbx/keybox.h: Replace typedef for KEYBOX_HANDLE by including the new file. * g10/keydb-private.h: Ditto. -- The duplicated typedef was a bit ugly and will fail, depending on compiler, iof for example building without keyboxd. Fix only tested in the standard case but the fix is obvious.
-rw-r--r--g10/keydb-private.h8
-rw-r--r--kbx/Makefile.am2
-rw-r--r--kbx/keybox-fwddecl.h30
-rw-r--r--kbx/keybox.h3
4 files changed, 33 insertions, 10 deletions
diff --git a/g10/keydb-private.h b/g10/keydb-private.h
index 1b661a423..dae05d658 100644
--- a/g10/keydb-private.h
+++ b/g10/keydb-private.h
@@ -23,13 +23,7 @@
#include <assuan.h>
#include "../common/membuf.h"
-
-
-/* Ugly forward declarations. */
-struct keyring_handle;
-typedef struct keyring_handle *KEYRING_HANDLE;
-struct keybox_handle;
-typedef struct keybox_handle *KEYBOX_HANDLE;
+#include "../kbx/keybox-fwddecl.h"
/* This is for keydb.c and only used in non-keyboxd mode. */
diff --git a/kbx/Makefile.am b/kbx/Makefile.am
index 19bdb1061..596a89b8e 100644
--- a/kbx/Makefile.am
+++ b/kbx/Makefile.am
@@ -44,7 +44,7 @@ common_libs = $(libcommon)
commonpth_libs = $(libcommonpth)
common_sources = \
- keybox.h keybox-defs.h keybox-search-desc.h \
+ keybox.h keybox-defs.h keybox-search-desc.h keybox-fwddecl.h \
keybox-util.c \
keybox-init.c \
keybox-blob.c \
diff --git a/kbx/keybox-fwddecl.h b/kbx/keybox-fwddecl.h
new file mode 100644
index 000000000..3ae1c2c31
--- /dev/null
+++ b/kbx/keybox-fwddecl.h
@@ -0,0 +1,30 @@
+/* keybox-fwddecl.h - Keybox specific forward declarations and definitions.
+ * Copyright (C) 2025 g10 Code GmbH
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#ifndef KEYBOX_FWDDECL_H
+#define KEYBOX_FWDDECL_H 1
+
+struct keyring_handle;
+typedef struct keyring_handle *KEYRING_HANDLE;
+
+struct keybox_handle;
+typedef struct keybox_handle *KEYBOX_HANDLE;
+
+#endif /*KEYBOX_FWDDECL_H*/
diff --git a/kbx/keybox.h b/kbx/keybox.h
index 1146eca31..5aa0de57d 100644
--- a/kbx/keybox.h
+++ b/kbx/keybox.h
@@ -28,13 +28,12 @@ extern "C" {
#include "../common/iobuf.h"
#include "keybox-search-desc.h"
+#include "keybox-fwddecl.h"
#ifdef KEYBOX_WITH_X509
# include <ksba.h>
#endif
-typedef struct keybox_handle *KEYBOX_HANDLE;
-
typedef enum
{