Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ AS_IF([test "x$with_crypto" != "xno"],
],
[])

AS_IF([test "x$with_dm" != "xno" -o "x$with_lvm" != "xno" -o "x$with_lvm_dbus" != "xno" -o "x$with_mpath" != "xno"],
AS_IF([test "x$with_crypto" != "xno" -o "x$with_dm" != "xno" -o "x$with_lvm" != "xno" -o "x$with_lvm_dbus" != "xno" -o "x$with_mpath" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= 1.02.93])],
[])

Expand Down
10 changes: 5 additions & 5 deletions src/plugins/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ endif

if WITH_CRYPTO
if WITH_ESCROW
libbd_crypto_la_CFLAGS = $(GLIB_CFLAGS) $(GIO_CFLAGS) $(CRYPTSETUP_CFLAGS) $(BLKID_CFLAGS) $(NSS_CFLAGS) -Wall -Wextra -Werror
libbd_crypto_la_LIBADD = ${builddir}/../utils/libbd_utils.la $(GLIB_LIBS) $(GIO_LIBS) $(CRYPTSETUP_LIBS) $(NSS_LIBS) $(BLKID_LIBS) -lkeyutils -lvolume_key
libbd_crypto_la_CFLAGS = $(GLIB_CFLAGS) $(GIO_CFLAGS) $(CRYPTSETUP_CFLAGS) $(DEVMAPPER_CFLAGS) $(BLKID_CFLAGS) $(NSS_CFLAGS) -Wall -Wextra -Werror
libbd_crypto_la_LIBADD = ${builddir}/../utils/libbd_utils.la $(GLIB_LIBS) $(GIO_LIBS) $(CRYPTSETUP_LIBS) $(DEVMAPPER_LIBS) $(NSS_LIBS) $(BLKID_LIBS) -lkeyutils -lvolume_key
else
libbd_crypto_la_CFLAGS = $(GLIB_CFLAGS) $(GIO_CFLAGS) $(CRYPTSETUP_CFLAGS) $(BLKID_CFLAGS) -Wall -Wextra -Werror
libbd_crypto_la_LIBADD = ${builddir}/../utils/libbd_utils.la $(GLIB_LIBS) $(GIO_LIBS) $(CRYPTSETUP_LIBS) $(BLKID_LIBS) -lkeyutils
libbd_crypto_la_CFLAGS = $(GLIB_CFLAGS) $(GIO_CFLAGS) $(CRYPTSETUP_CFLAGS) $(DEVMAPPER_CFLAGS) $(BLKID_CFLAGS) -Wall -Wextra -Werror
libbd_crypto_la_LIBADD = ${builddir}/../utils/libbd_utils.la $(GLIB_LIBS) $(GIO_LIBS) $(CRYPTSETUP_LIBS) $(DEVMAPPER_LIBS) $(BLKID_LIBS) -lkeyutils
endif
libbd_crypto_la_LDFLAGS = -L${srcdir}/../utils/ -version-info 3:0:0 -Wl,--no-undefined -export-symbols-regex '^bd_.*'
libbd_crypto_la_CPPFLAGS = -I${builddir}/../../include/
libbd_crypto_la_SOURCES = crypto.c crypto.h
libbd_crypto_la_SOURCES = crypto.c crypto.h dm_logging.c dm_logging.h
endif

if WITH_DM
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <string.h>
#include <glib.h>
#include <libcryptsetup.h>
#include <libdevmapper.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/random.h>
Expand All @@ -30,6 +31,7 @@
#include <sys/types.h>
#include <keyutils.h>
#include <blockdev/utils.h>
#include <syslog.h>

#ifdef WITH_BD_ESCROW
#include <nss.h>
Expand All @@ -41,6 +43,7 @@
#endif

#include "crypto.h"
#include "dm_logging.h"

#ifdef __clang__
#define ZERO_INIT {}
Expand Down Expand Up @@ -344,6 +347,13 @@ static void crypto_log_redirect (gint level, const gchar *msg, void *usrptr G_GN
*
*/
gboolean bd_crypto_init (void) {
dm_log_with_errno_init ((dm_log_with_errno_fn) redirect_dm_log);
#ifdef DEBUG
dm_log_init_verbose (LOG_DEBUG);
#else
dm_log_init_verbose (LOG_INFO);
#endif

#ifdef DEBUG
crypt_set_debug_level (CRYPT_DEBUG_ALL);
#endif
Expand All @@ -364,6 +374,8 @@ void bd_crypto_close (void) {
c_locale = (locale_t) 0;
crypt_set_log_callback (NULL, NULL, NULL);
crypt_set_debug_level (CRYPT_DEBUG_NONE);
dm_log_with_errno_init (NULL);
dm_log_init_verbose (0);
}

/**
Expand Down
Loading