]> git.ipfire.org Git - thirdparty/systemd.git/commit
cryptsetup: load libcryptsetup via dlopen in setup binaries
authorDaan De Meyer <daan@amutable.com>
Mon, 20 Apr 2026 20:04:21 +0000 (20:04 +0000)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 23 Apr 2026 04:42:24 +0000 (06:42 +0200)
commit43dab5ea8797e45e0702f8ee89cdf25e577a652b
treedfaa75a8b953e97215d142369616286a7dfcb747
parent4114bf7e700fa2c6877230ca1199056cfbafc4e7
cryptsetup: load libcryptsetup via dlopen in setup binaries

Convert systemd-cryptsetup, systemd-cryptenroll, systemd-veritysetup
and systemd-integritysetup to go through the existing dlopen wrapper
for libcryptsetup instead of linking the library directly. Each binary
calls dlopen_cryptsetup() at the start of its run() and uses the sym_*
variants for every libcryptsetup entry point.

Extend cryptsetup-util.{h,c} to cover the libcryptsetup symbols that
these binaries use and that the wrapper was missing:
crypt_activate_by_token_pin, crypt_deactivate, crypt_init_data_device,
crypt_keyslot_status, crypt_set_keyring_to_link (conditional on
HAVE_CRYPT_SET_KEYRING_TO_LINK), crypt_status and
crypt_token_external_path.

With no direct callers of crypt_free() left, drop the non-sym
crypt_freep cleanup variant and rename sym_crypt_freep back to
crypt_freep via DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME, matching the
naming convention used by other dlopen wrappers (acl_freep,
xkb_context_unrefp, ...). Update the remaining users in src/shared,
src/repart, src/home and src/growfs to the new name.

The four affected meson targets switch from libcryptsetup to
libcryptsetup_cflags so they no longer record a DT_NEEDED entry for
libcryptsetup.so.12.
21 files changed:
src/cryptenroll/cryptenroll-fido2.c
src/cryptenroll/cryptenroll-list.c
src/cryptenroll/cryptenroll-password.c
src/cryptenroll/cryptenroll-pkcs11.c
src/cryptenroll/cryptenroll-recovery.c
src/cryptenroll/cryptenroll-tpm2.c
src/cryptenroll/cryptenroll-wipe.c
src/cryptenroll/cryptenroll.c
src/cryptenroll/meson.build
src/cryptsetup/cryptsetup.c
src/cryptsetup/meson.build
src/growfs/growfs.c
src/home/homework-luks.c
src/integritysetup/integritysetup.c
src/integritysetup/meson.build
src/repart/repart.c
src/shared/cryptsetup-util.c
src/shared/cryptsetup-util.h
src/shared/dissect-image.c
src/veritysetup/meson.build
src/veritysetup/veritysetup.c