#if HAVE_GCRYPT
static void *gcrypt_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "gcrypt",
- "Support for journald forward-sealing",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libgcrypt.so.20");
+ GCRYPT_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
return dlopen_many_sym_or_warn(
&gcrypt_dl,
#pragma once
+#include "sd-dlopen.h"
+
#include "basic-forward.h"
int dlopen_gcrypt(int log_level);
int initialize_libgcrypt(bool secmem);
#if HAVE_GCRYPT
+#define GCRYPT_NOTE(priority) \
+ SD_ELF_NOTE_DLOPEN("gcrypt", \
+ "Support for journald forward-sealing", \
+ priority, \
+ "libgcrypt.so.20")
+
+#define DLOPEN_GCRYPT(log_level, priority) \
+ ({ \
+ GCRYPT_NOTE(priority); \
+ dlopen_gcrypt(log_level); \
+ })
+
#include <gcrypt.h> /* IWYU pragma: export */
#include "dlfcn-util.h"
(h__)->buf[(h__)->bufpos++] = (c) & 0xff; \
} while(false)
#else
+#define DLOPEN_GCRYPT(log_level, priority) dlopen_gcrypt(log_level)
+
typedef struct gcry_md_handle *gcry_md_hd_t;
static inline void sym_gcry_md_close(gcry_md_hd_t h) {
#include "fd-util.h"
#include "fs-util.h"
#include "fsprg.h"
+#include "gcrypt-util.h"
#include "hostname-setup.h"
#include "hostname-util.h"
#include "io-util.h"
assert(arg_action == ACTION_SETUP_KEYS);
+ r = DLOPEN_GCRYPT(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ if (r < 0)
+ return r;
+
r = is_dir("/var/log/journal/", /* follow= */ false);
if (r == 0)
return log_error_errno(SYNTHETIC_ERRNO(ENOTDIR),