]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
build-sys: fix build with libgrcypt disabled 2905/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 27 Mar 2016 21:33:54 +0000 (17:33 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 28 Mar 2016 01:51:44 +0000 (21:51 -0400)
- Move gcrypt.h include inside grcrypt-util.h.
- Allow gcrypt-util.[ch] to be compiled even without gcrypt.
This allows the logic in files using gcrypt to be simplified.

- Fix compilation of systemd-resolve without gcrypt.
systemd-resolved already supported that.

Fixes #2711.

Makefile.am
src/resolve/resolve-tool.c
src/shared/gcrypt-util.c
src/shared/gcrypt-util.h

index 2b72a53ecd13aeff5eaf7ec1ecc97b383937aa25..95eaa9af1a3d0ca229f121b52ddc9a1724b6c699 100644 (file)
@@ -4262,7 +4262,9 @@ libsystemd_journal_internal_la_SOURCES = \
        src/journal/mmap-cache.h \
        src/journal/compress.c \
        src/journal/audit-type.h \
-       src/journal/audit-type.c
+       src/journal/audit-type.c \
+       src/shared/gcrypt-util.h \
+       src/shared/gcrypt-util.c
 
 nodist_libsystemd_journal_internal_la_SOURCES = \
        src/journal/audit_type-to-name.h
@@ -4294,9 +4296,7 @@ libsystemd_journal_internal_la_SOURCES += \
        src/journal/journal-authenticate.c \
        src/journal/journal-authenticate.h \
        src/journal/fsprg.c \
-       src/journal/fsprg.h \
-       src/shared/gcrypt-util.c \
-       src/shared/gcrypt-util.h
+       src/journal/fsprg.h
 
 libsystemd_journal_internal_la_LIBADD += \
        $(GCRYPT_LIBS)
index 009cc73aec8caac89517240e4c97dd372b61b961..14ee01c49db7f64061dd1bca7bf141f28d7afd66 100644 (file)
@@ -17,7 +17,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <gcrypt.h>
 #include <getopt.h>
 #include <net/if.h>
 
@@ -863,7 +862,7 @@ static int resolve_openpgp(sd_bus *bus, const char *address) {
         }
         domain++;
 
-        r = string_hashsum(address, domain - 1 - address, GCRY_MD_SHA224, &hashed);
+        r = string_hashsum_sha224(address, domain - 1 - address, &hashed);
         if (r < 0)
                 return log_error_errno(r, "Hashing failed: %m");
 
index 4ff94520c357ea582b1d90ce2e69669f4552170a..39b544b6f0919d00b604548295d476ca45a47e5b 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#ifdef HAVE_GCRYPT
 #include <gcrypt.h>
 
-#include "hexdecoct.h"
 #include "gcrypt-util.h"
+#include "hexdecoct.h"
 
 void initialize_libgcrypt(bool secmem) {
         const char *p;
@@ -67,3 +68,4 @@ int string_hashsum(const char *s, size_t len, int md_algorithm, char **out) {
         *out = enc;
         return 0;
 }
+#endif
index c7652c22d18968154637d1b415340dc5d2e4a791..cf33b3c59c0eaaf086a1e6ef415f9fb63f8f5b79 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#include <errno.h>
 #include <stdbool.h>
+#include <stddef.h>
+
+#ifdef HAVE_GCRYPT
+#include <gcrypt.h>
 
 void initialize_libgcrypt(bool secmem);
 int string_hashsum(const char *s, size_t len, int md_algorithm, char **out);
+#endif
+
+static inline int string_hashsum_sha224(const char *s, size_t len, char **out) {
+#ifdef HAVE_GCRYPT
+        return string_hashsum(s, len, GCRY_MD_SHA224, out);
+#else
+        return -EOPNOTSUPP;
+#endif
+}