summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2013-06-26 11:09:42 +0200
committerWerner Koch <wk@gnupg.org>2013-06-26 11:11:32 +0200
commit6540b84a6e9113813e7e49e3ad2024d4a0073300 (patch)
treef0938b97cba75ba9a34c3eec6bf149abaa383992 /src
parent3544fa8aa63bef9a35abf236e9376191b5ec206b (diff)
downloadlibgcrypt-6540b84a6e9113813e7e49e3ad2024d4a0073300.tar.gz
Make gpg-error replacement defines more robust.
* configure.ac (AH_BOTTOM): Move GPG_ERR_ replacement defines to ... * src/gcrypt-int.h: new file. * src/visibility.h, src/cipher.h: Replace gcrypt.h by gcrypt-int.h. * tests/: Ditto for all test files. -- Defining newer gpg-error codes in config.h was not a good idea, because config.h is usually included before gpg-error.h and thus gpg-error.h would be double defines to lead to faulty code there like typedef enum { [...] 191 = 191, [...] };
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/cipher.h2
-rw-r--r--src/gcrypt-int.h40
-rw-r--r--src/visibility.h4
4 files changed, 45 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 22263d9e..8eb46e6e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -54,7 +54,8 @@ else
endif
libgcrypt_la_CFLAGS = $(GPG_ERROR_CFLAGS)
-libgcrypt_la_SOURCES = g10lib.h visibility.c visibility.h types.h \
+libgcrypt_la_SOURCES = \
+ gcrypt-int.h g10lib.h visibility.c visibility.h types.h \
cipher.h cipher-proto.h gcrypt-module.h \
misc.c global.c sexp.c hwfeatures.c hwf-common.h \
stdmem.c stdmem.h secmem.c secmem.h \
diff --git a/src/cipher.h b/src/cipher.h
index 80c88392..26206135 100644
--- a/src/cipher.h
+++ b/src/cipher.h
@@ -20,7 +20,7 @@
#ifndef G10_CIPHER_H
#define G10_CIPHER_H
-#include <gcrypt.h>
+#include "gcrypt-int.h"
#define DBG_CIPHER _gcry_get_debug_flag( 1 )
diff --git a/src/gcrypt-int.h b/src/gcrypt-int.h
new file mode 100644
index 00000000..33969fe0
--- /dev/null
+++ b/src/gcrypt-int.h
@@ -0,0 +1,40 @@
+/* gcrypt-int.h - Internal version of gcrypt.h
+ * Copyright (C) 2013 g10 Code GmbH
+ *
+ * This file is part of Libgcrypt.
+ *
+ * Libgcrypt is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * Libgcrypt 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GCRY_GCRYPT_INT_H
+#define GCRY_GCRYPT_INT_H
+
+#ifdef _GCRYPT_H
+#error gcrypt.h already included
+#endif
+
+#include "gcrypt.h"
+
+/* These error codes are used but not defined in the required
+ libgpg-error 1.11. Define them here. */
+#ifndef GPG_ERR_NO_CRYPT_CTX
+# define GPG_ERR_NO_CRYPT_CTX 191
+# define GPG_ERR_WRONG_CRYPT_CTX 192
+# define GPG_ERR_BAD_CRYPT_CTX 193
+# define GPG_ERR_CRYPT_CTX_CONFLICT 194
+# define GPG_ERR_BROKEN_PUBKEY 195
+# define GPG_ERR_BROKEN_SECKEY 196
+#endif
+
+#endif /*GCRY_GCRYPT_INT_H*/
diff --git a/src/visibility.h b/src/visibility.h
index 6887f37b..4837ed65 100644
--- a/src/visibility.h
+++ b/src/visibility.h
@@ -201,10 +201,10 @@
/* We need to redeclare the deprecated functions without the
deprecated attribute. */
# define GCRYPT_NO_DEPRECATED
-# include "gcrypt.h"
+# include "gcrypt-int.h"
/* None in this version. */
#else
-# include "gcrypt.h"
+# include "gcrypt-int.h"
#endif
#include "gcrypt-module.h"