2 AC_INIT([cryptsetup],[2.3.3])
4 dnl library version from <major>.<minor>.<release>[-<suffix>]
5 LIBCRYPTSETUP_VERSION=$(echo $PACKAGE_VERSION | cut -f1 -d-)
6 LIBCRYPTSETUP_VERSION_INFO=18:0:6
9 AC_CONFIG_SRCDIR(src/cryptsetup.c)
10 AC_CONFIG_MACRO_DIR([m4])
12 AC_CONFIG_HEADERS([config.h:config.h.in])
14 # We do not want to run test in parallel. Really.
15 # http://lists.gnu.org/archive/html/automake/2013-01/msg00060.html
17 # For old automake use this
18 #AM_INIT_AUTOMAKE(dist-xz subdir-objects)
19 AM_INIT_AUTOMAKE([dist-xz 1.12 serial-tests subdir-objects])
21 if test "x$prefix" = "xNONE"; then
24 AC_PREFIX_DEFAULT(/usr)
27 AC_USE_SYSTEM_EXTENSIONS
38 dnl ==========================================================================
39 dnl define PKG_CHECK_VAR for old pkg-config <= 0.28
40 m4_ifndef([AS_VAR_COPY],
41 [m4_define([AS_VAR_COPY],
42 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
44 m4_ifndef([PKG_CHECK_VAR], [
45 AC_DEFUN([PKG_CHECK_VAR],
46 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
47 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])
49 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
50 AS_VAR_COPY([$1], [pkg_cv_][$1])
52 AS_VAR_IF([$1], [""], [$5], [$4])
55 dnl ==========================================================================
61 AC_CHECK_HEADERS(fcntl.h malloc.h inttypes.h sys/ioctl.h sys/mman.h \
62 sys/sysmacros.h sys/statvfs.h ctype.h unistd.h locale.h byteswap.h endian.h stdint.h)
63 AC_CHECK_DECLS([O_CLOEXEC],,[AC_DEFINE([O_CLOEXEC],[0], [Defined to 0 if not provided])],
70 AC_CHECK_HEADERS(uuid/uuid.h,,[AC_MSG_ERROR([You need the uuid library.])])
71 AC_CHECK_HEADER(libdevmapper.h,,[AC_MSG_ERROR([You need the device-mapper library.])])
73 AC_ARG_ENABLE([keyring],
74 AS_HELP_STRING([--disable-keyring], [disable kernel keyring support and builtin kernel keyring token]),
75 [], [enable_keyring=yes])
76 if test "x$enable_keyring" = "xyes"; then
77 AC_CHECK_HEADERS(linux/keyctl.h,,[AC_MSG_ERROR([You need Linux kernel headers with kernel keyring service compiled.])])
79 dnl ==========================================================================
80 dnl check whether kernel is compiled with kernel keyring service syscalls
81 AC_CHECK_DECL(__NR_add_key,,[AC_MSG_ERROR([The kernel is missing add_key syscall.])], [#include <syscall.h>])
82 AC_CHECK_DECL(__NR_keyctl,,[AC_MSG_ERROR([The kernel is missing keyctl syscall.])], [#include <syscall.h>])
83 AC_CHECK_DECL(__NR_request_key,,[AC_MSG_ERROR([The kernel is missing request_key syscall.])], [#include <syscall.h>])
85 dnl ==========================================================================
86 dnl check that key_serial_t hasn't been adopted yet in stdlib
87 AC_CHECK_TYPES([key_serial_t], [], [], [
89 #ifdef HAVE_LINUX_KEYCTL_H
90 # include <linux/keyctl.h>
94 AC_DEFINE(KERNEL_KEYRING, 1, [Enable kernel keyring service support])
96 AM_CONDITIONAL(KERNEL_KEYRING, test "x$enable_keyring" = "xyes")
99 AC_CHECK_LIB(uuid, uuid_clear, ,[AC_MSG_ERROR([You need the uuid library.])])
100 AC_SUBST(UUID_LIBS, $LIBS)
103 AC_SEARCH_LIBS([clock_gettime],[rt posix4])
104 AC_CHECK_FUNCS([posix_memalign clock_gettime posix_fallocate explicit_bzero])
106 if test "x$enable_largefile" = "xno"; then
107 AC_MSG_ERROR([Building with --disable-largefile is not supported, it can cause data corruption.])
115 AC_PROG_GCC_TRADITIONAL
118 dnl ==========================================================================
120 AM_GNU_GETTEXT([external],[need-ngettext])
121 AM_GNU_GETTEXT_VERSION([0.18.3])
123 dnl ==========================================================================
126 AC_CHECK_LIB(popt, poptConfigFileToString,,
127 [AC_MSG_ERROR([You need popt 1.7 or newer to compile.])])
128 AC_SUBST(POPT_LIBS, $LIBS)
131 dnl ==========================================================================
133 AC_ARG_ENABLE([fips],
134 AS_HELP_STRING([--enable-fips], [enable FIPS mode restrictions]))
135 if test "x$enable_fips" = "xyes"; then
136 AC_DEFINE(ENABLE_FIPS, 1, [Enable FIPS mode restrictions])
138 if test "x$enable_static" = "xyes" -o "x$enable_static_cryptsetup" = "xyes" ; then
139 AC_MSG_ERROR([Static build is not compatible with FIPS.])
143 AC_DEFUN([NO_FIPS], [
144 if test "x$enable_fips" = "xyes"; then
145 AC_MSG_ERROR([This option is not compatible with FIPS.])
149 dnl ==========================================================================
150 dnl pwquality library (cryptsetup CLI only)
151 AC_ARG_ENABLE([pwquality],
152 AS_HELP_STRING([--enable-pwquality], [enable password quality checking using pwquality library]))
154 if test "x$enable_pwquality" = "xyes"; then
155 AC_DEFINE(ENABLE_PWQUALITY, 1, [Enable password quality checking using pwquality library])
156 PKG_CHECK_MODULES([PWQUALITY], [pwquality >= 1.0.0],,
157 AC_MSG_ERROR([You need pwquality library.]))
159 dnl FIXME: this is really hack for now
160 PWQUALITY_STATIC_LIBS="$PWQUALITY_LIBS -lcrack -lz"
163 dnl ==========================================================================
164 dnl passwdqc library (cryptsetup CLI only)
165 AC_ARG_ENABLE([passwdqc],
166 AS_HELP_STRING([--enable-passwdqc@<:@=CONFIG_PATH@:>@],
167 [enable password quality checking using passwdqc library (optionally with CONFIG_PATH)]))
169 case "$enable_passwdqc" in
170 ""|yes|no) use_passwdqc_config="" ;;
171 /*) use_passwdqc_config="$enable_passwdqc"; enable_passwdqc=yes ;;
172 *) AC_MSG_ERROR([Unrecognized --enable-passwdqc parameter.]) ;;
174 AC_DEFINE_UNQUOTED([PASSWDQC_CONFIG_FILE], ["$use_passwdqc_config"], [passwdqc library config file])
176 if test "x$enable_passwdqc" = "xyes"; then
177 AC_DEFINE(ENABLE_PASSWDQC, 1, [Enable password quality checking using passwdqc library])
179 PASSWDQC_LIBS="-lpasswdqc"
182 if test "x$enable_pwquality$enable_passwdqc" = "xyesyes"; then
183 AC_MSG_ERROR([--enable-pwquality and --enable-passwdqc are mutually incompatible.])
186 dnl ==========================================================================
187 dnl Crypto backend functions
189 AC_DEFUN([CONFIGURE_GCRYPT], [
190 if test "x$enable_fips" = "xyes"; then
191 GCRYPT_REQ_VERSION=1.4.5
193 GCRYPT_REQ_VERSION=1.1.42
196 dnl libgcrypt rejects to use pkgconfig, use AM_PATH_LIBGCRYPT from gcrypt-devel here.
197 dnl Do not require gcrypt-devel if other crypto backend is used.
198 m4_ifdef([AM_PATH_LIBGCRYPT],[
199 AC_ARG_ENABLE([gcrypt-pbkdf2],
200 dnl Check if we can use gcrypt PBKDF2 (1.6.0 supports empty password)
201 AS_HELP_STRING([--enable-gcrypt-pbkdf2], [force enable internal gcrypt PBKDF2]),
202 if test "x$enableval" = "xyes"; then
203 [use_internal_pbkdf2=0]
205 [use_internal_pbkdf2=1]
207 [AM_PATH_LIBGCRYPT([1.6.1], [use_internal_pbkdf2=0], [use_internal_pbkdf2=1])])
208 AM_PATH_LIBGCRYPT($GCRYPT_REQ_VERSION,,[AC_MSG_ERROR([You need the gcrypt library.])])],
209 AC_MSG_ERROR([Missing support for gcrypt: install gcrypt and regenerate configure.]))
211 AC_MSG_CHECKING([if internal cryptsetup PBKDF2 is compiled-in])
212 if test $use_internal_pbkdf2 = 0; then
219 AC_CHECK_DECLS([GCRY_CIPHER_MODE_XTS], [], [], [#include <gcrypt.h>])
221 if test "x$enable_static_cryptsetup" = "xyes"; then
223 LIBS="$saved_LIBS $LIBGCRYPT_LIBS -static"
224 AC_CHECK_LIB(gcrypt, gcry_check_version,,
225 AC_MSG_ERROR([Cannot find static gcrypt library.]),
227 LIBGCRYPT_STATIC_LIBS="$LIBGCRYPT_LIBS -lgpg-error"
231 CRYPTO_CFLAGS=$LIBGCRYPT_CFLAGS
232 CRYPTO_LIBS=$LIBGCRYPT_LIBS
233 CRYPTO_STATIC_LIBS=$LIBGCRYPT_STATIC_LIBS
235 AC_DEFINE_UNQUOTED(GCRYPT_REQ_VERSION, ["$GCRYPT_REQ_VERSION"], [Requested gcrypt version])
238 AC_DEFUN([CONFIGURE_OPENSSL], [
239 PKG_CHECK_MODULES([OPENSSL], [openssl >= 0.9.8],,
240 AC_MSG_ERROR([You need openssl library.]))
241 CRYPTO_CFLAGS=$OPENSSL_CFLAGS
242 CRYPTO_LIBS=$OPENSSL_LIBS
243 use_internal_pbkdf2=0
245 if test "x$enable_static_cryptsetup" = "xyes"; then
246 saved_PKG_CONFIG=$PKG_CONFIG
247 PKG_CONFIG="$PKG_CONFIG --static"
248 PKG_CHECK_MODULES([OPENSSL_STATIC], [openssl])
249 CRYPTO_STATIC_LIBS=$OPENSSL_STATIC_LIBS
250 PKG_CONFIG=$saved_PKG_CONFIG
254 AC_DEFUN([CONFIGURE_NSS], [
255 if test "x$enable_static_cryptsetup" = "xyes"; then
256 AC_MSG_ERROR([Static build of cryptsetup is not supported with NSS.])
259 AC_MSG_WARN([NSS backend does NOT provide backward compatibility (missing ripemd160 hash).])
261 PKG_CHECK_MODULES([NSS], [nss],,
262 AC_MSG_ERROR([You need nss library.]))
265 CFLAGS="$CFLAGS $NSS_CFLAGS"
266 AC_CHECK_DECLS([NSS_GetVersion], [], [], [#include <nss.h>])
269 CRYPTO_CFLAGS=$NSS_CFLAGS
270 CRYPTO_LIBS=$NSS_LIBS
271 use_internal_pbkdf2=1
275 AC_DEFUN([CONFIGURE_KERNEL], [
276 AC_CHECK_HEADERS(linux/if_alg.h,,
277 [AC_MSG_ERROR([You need Linux kernel headers with userspace crypto interface.])])
278 # AC_CHECK_DECLS([AF_ALG],,
279 # [AC_MSG_ERROR([You need Linux kernel with userspace crypto interface.])],
280 # [#include <sys/socket.h>])
281 use_internal_pbkdf2=1
285 AC_DEFUN([CONFIGURE_NETTLE], [
286 AC_CHECK_HEADERS(nettle/sha.h,,
287 [AC_MSG_ERROR([You need Nettle cryptographic library.])])
288 AC_CHECK_HEADERS(nettle/version.h)
291 AC_CHECK_LIB(nettle, nettle_pbkdf2_hmac_sha256,,
292 [AC_MSG_ERROR([You need Nettle library version 2.6 or more recent.])])
296 CRYPTO_STATIC_LIBS=$CRYPTO_LIBS
297 use_internal_pbkdf2=0
301 dnl ==========================================================================
304 AC_ARG_ENABLE([static-cryptsetup],
305 AS_HELP_STRING([--enable-static-cryptsetup], [enable build of static version of tools]))
306 if test "x$enable_static_cryptsetup" = "xyes"; then
307 if test "x$enable_static" = "xno"; then
308 AC_MSG_WARN([Requested static cryptsetup build, enabling static library.])
312 AM_CONDITIONAL(STATIC_TOOLS, test "x$enable_static_cryptsetup" = "xyes")
314 AC_ARG_ENABLE([cryptsetup],
315 AS_HELP_STRING([--disable-cryptsetup], [disable cryptsetup support]),
316 [], [enable_cryptsetup=yes])
317 AM_CONDITIONAL(CRYPTSETUP, test "x$enable_cryptsetup" = "xyes")
319 AC_ARG_ENABLE([veritysetup],
320 AS_HELP_STRING([--disable-veritysetup], [disable veritysetup support]),
321 [], [enable_veritysetup=yes])
322 AM_CONDITIONAL(VERITYSETUP, test "x$enable_veritysetup" = "xyes")
324 AC_ARG_ENABLE([cryptsetup-reencrypt],
325 AS_HELP_STRING([--disable-cryptsetup-reencrypt], [disable cryptsetup-reencrypt tool]),
326 [], [enable_cryptsetup_reencrypt=yes])
327 AM_CONDITIONAL(REENCRYPT, test "x$enable_cryptsetup_reencrypt" = "xyes")
329 AC_ARG_ENABLE([integritysetup],
330 AS_HELP_STRING([--disable-integritysetup], [disable integritysetup support]),
331 [], [enable_integritysetup=yes])
332 AM_CONDITIONAL(INTEGRITYSETUP, test "x$enable_integritysetup" = "xyes")
334 AC_ARG_ENABLE([selinux],
335 AS_HELP_STRING([--disable-selinux], [disable selinux support [default=auto]]),
336 [], [enable_selinux=yes])
338 AC_ARG_ENABLE([udev],
339 AS_HELP_STRING([--disable-udev], [disable udev support]),
340 [], [enable_udev=yes])
342 dnl Try to use pkg-config for devmapper, but fallback to old detection
343 PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= 1.02.03],, [
344 AC_CHECK_LIB(devmapper, dm_task_set_name,,
345 [AC_MSG_ERROR([You need the device-mapper library.])])
346 AC_CHECK_LIB(devmapper, dm_task_set_message,,
347 [AC_MSG_ERROR([The device-mapper library on your system is too old.])])
352 LIBS="$LIBS $DEVMAPPER_LIBS"
353 AC_CHECK_DECLS([dm_task_secure_data], [], [], [#include <libdevmapper.h>])
354 AC_CHECK_DECLS([dm_task_retry_remove], [], [], [#include <libdevmapper.h>])
355 AC_CHECK_DECLS([dm_task_deferred_remove], [], [], [#include <libdevmapper.h>])
356 AC_CHECK_DECLS([dm_device_has_mounted_fs], [], [], [#include <libdevmapper.h>])
357 AC_CHECK_DECLS([dm_device_has_holders], [], [], [#include <libdevmapper.h>])
358 AC_CHECK_DECLS([dm_device_get_name], [], [], [#include <libdevmapper.h>])
359 AC_CHECK_DECLS([DM_DEVICE_GET_TARGET_VERSION], [], [], [#include <libdevmapper.h>])
360 AC_CHECK_DECLS([DM_UDEV_DISABLE_DISK_RULES_FLAG], [have_cookie=yes], [have_cookie=no], [#include <libdevmapper.h>])
361 if test "x$enable_udev" = xyes; then
362 if test "x$have_cookie" = xno; then
363 AC_MSG_WARN([The device-mapper library on your system has no udev support, udev support disabled.])
365 AC_DEFINE(USE_UDEV, 1, [Try to use udev synchronisation?])
370 dnl Check for JSON-C used in LUKS2
371 PKG_CHECK_MODULES([JSON_C], [json-c])
372 AC_CHECK_DECLS([json_object_object_add_ex], [], [], [#include <json-c/json.h>])
373 AC_CHECK_DECLS([json_object_deep_copy], [], [], [#include <json-c/json.h>])
375 dnl Crypto backend configuration.
376 AC_ARG_WITH([crypto_backend],
377 AS_HELP_STRING([--with-crypto_backend=BACKEND], [crypto backend (gcrypt/openssl/nss/kernel/nettle) [openssl]]),
378 [], [with_crypto_backend=openssl])
380 dnl Kernel crypto API backend needed for benchmark and tcrypt
381 AC_ARG_ENABLE([kernel_crypto],
382 AS_HELP_STRING([--disable-kernel_crypto], [disable kernel userspace crypto (no benchmark and tcrypt)]),
383 [], [enable_kernel_crypto=yes])
385 if test "x$enable_kernel_crypto" = "xyes"; then
386 AC_CHECK_HEADERS(linux/if_alg.h,,
387 [AC_MSG_ERROR([You need Linux kernel headers with userspace crypto interface. (Or use --disable-kernel_crypto.)])])
388 AC_DEFINE(ENABLE_AF_ALG, 1, [Enable using of kernel userspace crypto])
391 case $with_crypto_backend in
392 gcrypt) CONFIGURE_GCRYPT([]) ;;
393 openssl) CONFIGURE_OPENSSL([]) ;;
394 nss) CONFIGURE_NSS([]) ;;
395 kernel) CONFIGURE_KERNEL([]) ;;
396 nettle) CONFIGURE_NETTLE([]) ;;
397 *) AC_MSG_ERROR([Unknown crypto backend.]) ;;
399 AM_CONDITIONAL(CRYPTO_BACKEND_GCRYPT, test "$with_crypto_backend" = "gcrypt")
400 AM_CONDITIONAL(CRYPTO_BACKEND_OPENSSL, test "$with_crypto_backend" = "openssl")
401 AM_CONDITIONAL(CRYPTO_BACKEND_NSS, test "$with_crypto_backend" = "nss")
402 AM_CONDITIONAL(CRYPTO_BACKEND_KERNEL, test "$with_crypto_backend" = "kernel")
403 AM_CONDITIONAL(CRYPTO_BACKEND_NETTLE, test "$with_crypto_backend" = "nettle")
405 AM_CONDITIONAL(CRYPTO_INTERNAL_PBKDF2, test $use_internal_pbkdf2 = 1)
406 AC_DEFINE_UNQUOTED(USE_INTERNAL_PBKDF2, [$use_internal_pbkdf2], [Use internal PBKDF2])
408 dnl Argon2 implementation
409 AC_ARG_ENABLE([internal-argon2],
410 AS_HELP_STRING([--disable-internal-argon2], [disable internal implementation of Argon2 PBKDF]),
411 [], [enable_internal_argon2=yes])
413 AC_ARG_ENABLE([libargon2],
414 AS_HELP_STRING([--enable-libargon2], [enable external libargon2 (PHC) library (disables internal bundled version)]))
416 if test "x$enable_libargon2" = "xyes" ; then
417 AC_CHECK_HEADERS(argon2.h,,
418 [AC_MSG_ERROR([You need libargon2 development library installed.])])
419 AC_CHECK_DECL(Argon2_id,,[AC_MSG_ERROR([You need more recent Argon2 library with support for Argon2id.])], [#include <argon2.h>])
420 PKG_CHECK_MODULES([LIBARGON2], [libargon2],,[LIBARGON2_LIBS="-largon2"])
421 enable_internal_argon2=no
423 AC_MSG_WARN([Argon2 bundled (slow) reference implementation will be used, please consider to use system library with --enable-libargon2.])
425 AC_ARG_ENABLE([internal-sse-argon2],
426 AS_HELP_STRING([--enable-internal-sse-argon2], [enable internal SSE implementation of Argon2 PBKDF]))
428 if test "x$enable_internal_sse_argon2" = "xyes"; then
429 AC_MSG_CHECKING(if Argon2 SSE optimization can be used)
430 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
431 #include <emmintrin.h>
432 __m128i testfunc(__m128i *a, __m128i *b) {
433 return _mm_xor_si128(_mm_loadu_si128(a), _mm_loadu_si128(b));
435 ]])],,[enable_internal_sse_argon2=no])
436 AC_MSG_RESULT($enable_internal_sse_argon2)
440 if test "x$enable_internal_argon2" = "xyes"; then
441 AC_DEFINE(USE_INTERNAL_ARGON2, 1, [Use internal Argon2])
443 AM_CONDITIONAL(CRYPTO_INTERNAL_ARGON2, test "x$enable_internal_argon2" = "xyes")
444 AM_CONDITIONAL(CRYPTO_INTERNAL_SSE_ARGON2, test "x$enable_internal_sse_argon2" = "xyes")
446 dnl Link with blkid to check for other device types
447 AC_ARG_ENABLE([blkid],
448 AS_HELP_STRING([--disable-blkid], [disable use of blkid for device signature detection and wiping]),
449 [], [enable_blkid=yes])
451 if test "x$enable_blkid" = "xyes"; then
452 PKG_CHECK_MODULES([BLKID], [blkid],[AC_DEFINE([HAVE_BLKID], 1, [Define to 1 to use blkid for detection of disk signatures.])],[LIBBLKID_LIBS="-lblkid"])
454 AC_CHECK_HEADERS(blkid/blkid.h,,[AC_MSG_ERROR([You need blkid development library installed.])])
455 AC_CHECK_DECL([blkid_do_wipe],
456 [ AC_DEFINE([HAVE_BLKID_WIPE], 1, [Define to 1 to use blkid_do_wipe.])
457 enable_blkid_wipe=yes
459 [#include <blkid/blkid.h>])
460 AC_CHECK_DECL([blkid_probe_step_back],
461 [ AC_DEFINE([HAVE_BLKID_STEP_BACK], 1, [Define to 1 to use blkid_probe_step_back.])
462 enable_blkid_step_back=yes
464 [#include <blkid/blkid.h>])
465 AC_CHECK_DECLS([ blkid_reset_probe,
466 blkid_probe_set_device,
467 blkid_probe_filter_superblocks_type,
470 blkid_probe_lookup_value
472 [AC_MSG_ERROR([Can not compile with blkid support, disable it by --disable-blkid.])],
473 [#include <blkid/blkid.h>])
475 AM_CONDITIONAL(HAVE_BLKID, test "x$enable_blkid" = "xyes")
476 AM_CONDITIONAL(HAVE_BLKID_WIPE, test "x$enable_blkid_wipe" = "xyes")
477 AM_CONDITIONAL(HAVE_BLKID_STEP_BACK, test "x$enable_blkid_step_back" = "xyes")
479 dnl Magic for cryptsetup.static build.
480 if test "x$enable_static_cryptsetup" = "xyes"; then
481 saved_PKG_CONFIG=$PKG_CONFIG
482 PKG_CONFIG="$PKG_CONFIG --static"
484 LIBS="$saved_LIBS -static"
485 AC_CHECK_LIB(popt, poptGetContext,,
486 AC_MSG_ERROR([Cannot find static popt library.]))
488 dnl Try to detect needed device-mapper static libraries, try pkg-config first.
489 LIBS="$saved_LIBS -static"
490 PKG_CHECK_MODULES([DEVMAPPER_STATIC], [devmapper >= 1.02.27],,[
491 DEVMAPPER_STATIC_LIBS=$DEVMAPPER_LIBS
492 if test "x$enable_selinux" = "xyes"; then
493 AC_CHECK_LIB(sepol, sepol_bool_set)
494 AC_CHECK_LIB(selinux, is_selinux_enabled)
495 DEVMAPPER_STATIC_LIBS="$DEVMAPPER_STATIC_LIBS $LIBS"
498 LIBS="$saved_LIBS $DEVMAPPER_STATIC_LIBS"
499 AC_CHECK_LIB(devmapper, dm_task_set_uuid,,
500 AC_MSG_ERROR([Cannot link with static device-mapper library.]))
502 dnl Try to detect uuid static library.
503 LIBS="$saved_LIBS -static"
504 AC_CHECK_LIB(uuid, uuid_generate,,
505 AC_MSG_ERROR([Cannot find static uuid library.]))
508 PKG_CONFIG=$saved_PKG_CONFIG
511 AC_MSG_CHECKING([for systemd tmpfiles config directory])
512 PKG_CHECK_VAR([systemd_tmpfilesdir], [systemd], [tmpfilesdir], [], [systemd_tmpfilesdir=no])
513 AC_MSG_RESULT([$systemd_tmpfilesdir])
515 AC_SUBST([DEVMAPPER_LIBS])
516 AC_SUBST([DEVMAPPER_STATIC_LIBS])
518 AC_SUBST([PWQUALITY_LIBS])
519 AC_SUBST([PWQUALITY_STATIC_LIBS])
521 AC_SUBST([PASSWDQC_LIBS])
523 AC_SUBST([CRYPTO_CFLAGS])
524 AC_SUBST([CRYPTO_LIBS])
525 AC_SUBST([CRYPTO_STATIC_LIBS])
527 AC_SUBST([JSON_C_LIBS])
528 AC_SUBST([LIBARGON2_LIBS])
529 AC_SUBST([BLKID_LIBS])
531 AC_SUBST([LIBCRYPTSETUP_VERSION])
532 AC_SUBST([LIBCRYPTSETUP_VERSION_INFO])
534 dnl ==========================================================================
535 AC_ARG_ENABLE([dev-random],
536 AS_HELP_STRING([--enable-dev-random], [use /dev/random by default for key generation (otherwise use /dev/urandom)]))
537 if test "x$enable_dev_random" = "xyes"; then
538 default_rng=/dev/random
540 default_rng=/dev/urandom
542 AC_DEFINE_UNQUOTED(DEFAULT_RNG, ["$default_rng"], [default RNG type for key generator])
544 dnl ==========================================================================
545 AC_DEFUN([CS_DEFINE],
546 [AC_DEFINE_UNQUOTED(DEFAULT_[]m4_translit([$1], [-a-z], [_A-Z]), [$2], [$3])
549 AC_DEFUN([CS_STR_WITH], [AC_ARG_WITH([$1],
550 [AS_HELP_STRING(--with-[$1], [default $2 [$3]])],
551 [CS_DEFINE([$1], ["$withval"], [$2])],
552 [CS_DEFINE([$1], ["$3"], [$2])]
555 AC_DEFUN([CS_NUM_WITH], [AC_ARG_WITH([$1],
556 [AS_HELP_STRING(--with-[$1], [default $2 [$3]])],
557 [CS_DEFINE([$1], [$withval], [$2])],
558 [CS_DEFINE([$1], [$3], [$2])]
561 AC_DEFUN([CS_ABSPATH], [
564 *) AC_MSG_ERROR([$2 argument must be an absolute path.]);;
568 dnl ==========================================================================
569 CS_STR_WITH([plain-hash], [password hashing function for plain mode], [ripemd160])
570 CS_STR_WITH([plain-cipher], [cipher for plain mode], [aes])
571 CS_STR_WITH([plain-mode], [cipher mode for plain mode], [cbc-essiv:sha256])
572 CS_NUM_WITH([plain-keybits],[key length in bits for plain mode], [256])
574 CS_STR_WITH([luks1-hash], [hash function for LUKS1 header], [sha256])
575 CS_STR_WITH([luks1-cipher], [cipher for LUKS1], [aes])
576 CS_STR_WITH([luks1-mode], [cipher mode for LUKS1], [xts-plain64])
577 CS_NUM_WITH([luks1-keybits],[key length in bits for LUKS1], [256])
579 AC_ARG_ENABLE([luks_adjust_xts_keysize], AS_HELP_STRING([--disable-luks-adjust-xts-keysize],
580 [XTS mode requires two keys, double default LUKS keysize if needed]),
581 [], [enable_luks_adjust_xts_keysize=yes])
582 if test "x$enable_luks_adjust_xts_keysize" = "xyes"; then
583 AC_DEFINE(ENABLE_LUKS_ADJUST_XTS_KEYSIZE, 1, [XTS mode - double default LUKS keysize if needed])
586 CS_STR_WITH([luks2-pbkdf], [Default PBKDF algorithm (pbkdf2 or argon2i/argon2id) for LUKS2], [argon2i])
587 CS_NUM_WITH([luks1-iter-time], [PBKDF2 iteration time for LUKS1 (in ms)], [2000])
588 CS_NUM_WITH([luks2-iter-time], [Argon2 PBKDF iteration time for LUKS2 (in ms)], [2000])
589 CS_NUM_WITH([luks2-memory-kb], [Argon2 PBKDF memory cost for LUKS2 (in kB)], [1048576])
590 CS_NUM_WITH([luks2-parallel-threads],[Argon2 PBKDF max parallel cost for LUKS2 (if CPUs available)], [4])
592 CS_STR_WITH([luks2-keyslot-cipher], [fallback cipher for LUKS2 keyslot (if data encryption is incompatible)], [aes-xts-plain64])
593 CS_NUM_WITH([luks2-keyslot-keybits],[fallback key size for LUKS2 keyslot (if data encryption is incompatible)], [512])
595 CS_STR_WITH([loopaes-cipher], [cipher for loop-AES mode], [aes])
596 CS_NUM_WITH([loopaes-keybits],[key length in bits for loop-AES mode], [256])
598 CS_NUM_WITH([keyfile-size-maxkb],[maximum keyfile size (in KiB)], [8192])
599 CS_NUM_WITH([passphrase-size-max],[maximum keyfile size (in characters)], [512])
601 CS_STR_WITH([verity-hash], [hash function for verity mode], [sha256])
602 CS_NUM_WITH([verity-data-block], [data block size for verity mode], [4096])
603 CS_NUM_WITH([verity-hash-block], [hash block size for verity mode], [4096])
604 CS_NUM_WITH([verity-salt-size], [salt size for verity mode], [32])
605 CS_NUM_WITH([verity-fec-roots], [parity bytes for verity FEC], [2])
607 CS_STR_WITH([tmpfilesdir], [override default path to directory with systemd temporary files], [])
608 test -z "$with_tmpfilesdir" && with_tmpfilesdir=$systemd_tmpfilesdir
609 test "x$with_tmpfilesdir" = "xno" || {
610 CS_ABSPATH([${with_tmpfilesdir}],[with-tmpfilesdir])
611 DEFAULT_TMPFILESDIR=$with_tmpfilesdir
612 AC_SUBST(DEFAULT_TMPFILESDIR)
614 AM_CONDITIONAL(CRYPTSETUP_TMPFILE, test -n "$DEFAULT_TMPFILESDIR")
616 CS_STR_WITH([luks2-lock-path], [path to directory for LUKSv2 locks], [/run/cryptsetup])
617 test -z "$with_luks2_lock_path" && with_luks2_lock_path=/run/cryptsetup
618 CS_ABSPATH([${with_luks2_lock_path}],[with-luks2-lock-path])
619 DEFAULT_LUKS2_LOCK_PATH=$with_luks2_lock_path
620 AC_SUBST(DEFAULT_LUKS2_LOCK_PATH)
622 CS_NUM_WITH([luks2-lock-dir-perms], [default luks2 locking directory permissions], [0700])
623 test -z "$with_luks2_lock_dir_perms" && with_luks2_lock_dir_perms=0700
624 DEFAULT_LUKS2_LOCK_DIR_PERMS=$with_luks2_lock_dir_perms
625 AC_SUBST(DEFAULT_LUKS2_LOCK_DIR_PERMS)
627 dnl Override default LUKS format version (for cryptsetup or cryptsetup-reencrypt format actions only).
628 AC_ARG_WITH([default_luks_format],
629 AS_HELP_STRING([--with-default-luks-format=FORMAT], [default LUKS format version (LUKS1/LUKS2) [LUKS2]]),
630 [], [with_default_luks_format=LUKS2])
632 case $with_default_luks_format in
633 LUKS1) default_luks=CRYPT_LUKS1 ;;
634 LUKS2) default_luks=CRYPT_LUKS2 ;;
635 *) AC_MSG_ERROR([Unknown default LUKS format. Use LUKS1 or LUKS2 only.]) ;;
637 AC_DEFINE_UNQUOTED([DEFAULT_LUKS_FORMAT], [$default_luks], [default LUKS format version])
639 dnl ==========================================================================
641 AC_CONFIG_FILES([ Makefile
644 scripts/cryptsetup.conf