journal: Always compile journal authentication related files
Tooling such as clang-tidy is bad at dealing with condition compilation on the build system level instead of at the source file level. What happens? It still tries to analyze the file and fails horribly if the required headers aren't available. Let's work around the issue and make things more consistent at the same time by doing the necessary HAVE_GCRYPT checks inside of the source files instead of doing them at the build system level. We also add some typedefs to allow getting rid of various HAVE_GCRYPT checks.
This commit is contained in:
+10
-10
@@ -6,12 +6,13 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "memory-util.h"
|
||||
|
||||
#if HAVE_GCRYPT
|
||||
#include <gcrypt.h>
|
||||
|
||||
#include "dlfcn-util.h"
|
||||
#include "macro.h"
|
||||
#include "memory-util.h"
|
||||
|
||||
extern DLSYM_PROTOTYPE(gcry_md_close);
|
||||
extern DLSYM_PROTOTYPE(gcry_md_copy);
|
||||
@@ -46,15 +47,6 @@ extern DLSYM_PROTOTYPE(gcry_strerror);
|
||||
|
||||
int initialize_libgcrypt(bool secmem);
|
||||
|
||||
static inline gcry_md_hd_t* sym_gcry_md_closep(gcry_md_hd_t *md) {
|
||||
if (!md || !*md)
|
||||
return NULL;
|
||||
sym_gcry_md_close(*md);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(gcry_md_hd_t, gcry_md_close, NULL);
|
||||
|
||||
/* Copied from gcry_md_putc from gcrypt.h due to the need to call the sym_ variant */
|
||||
#define sym_gcry_md_putc(h,c) \
|
||||
do { \
|
||||
@@ -63,4 +55,12 @@ DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(gcry_md_hd_t, gcry_md_close, NULL);
|
||||
sym_gcry_md_write((h__), NULL, 0); \
|
||||
(h__)->buf[(h__)->bufpos++] = (c) & 0xff; \
|
||||
} while(false)
|
||||
#else
|
||||
typedef struct gcry_md_handle *gcry_md_hd_t;
|
||||
|
||||
static inline void sym_gcry_md_close(gcry_md_hd_t h) {
|
||||
assert(h == NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(gcry_md_hd_t, sym_gcry_md_close, NULL);
|
||||
|
||||
Reference in New Issue
Block a user