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.
This commit is contained in:
committed by
Daan De Meyer
parent
4114bf7e70
commit
43dab5ea87
@@ -21,7 +21,9 @@ static void *cryptsetup_dl = NULL;
|
||||
|
||||
DLSYM_PROTOTYPE(crypt_activate_by_passphrase) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_activate_by_signed_key) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_activate_by_token_pin) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_activate_by_volume_key) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_deactivate) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_deactivate_by_name) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_format) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_free) = NULL;
|
||||
@@ -37,9 +39,11 @@ DLSYM_PROTOTYPE(crypt_get_volume_key_size) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_header_restore) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_init) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_init_by_name) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_init_data_device) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_keyslot_add_by_volume_key) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_keyslot_destroy) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_keyslot_max) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_keyslot_status) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_load) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_metadata_locking) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_persistent_flags_get) = NULL;
|
||||
@@ -51,10 +55,15 @@ DLSYM_PROTOTYPE(crypt_resume_by_volume_key) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_set_data_device) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_set_data_offset) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_set_debug_level) = NULL;
|
||||
#if HAVE_CRYPT_SET_KEYRING_TO_LINK
|
||||
DLSYM_PROTOTYPE(crypt_set_keyring_to_link) = NULL;
|
||||
#endif
|
||||
DLSYM_PROTOTYPE(crypt_set_log_callback) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_set_metadata_size) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_set_pbkdf_type) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_status) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_suspend) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_token_external_path) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_token_json_get) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_token_json_set) = NULL;
|
||||
DLSYM_PROTOTYPE(crypt_token_max) = NULL;
|
||||
@@ -287,7 +296,9 @@ int dlopen_cryptsetup(int log_level) {
|
||||
&cryptsetup_dl, "libcryptsetup.so.12", log_level,
|
||||
DLSYM_ARG(crypt_activate_by_passphrase),
|
||||
DLSYM_ARG(crypt_activate_by_signed_key),
|
||||
DLSYM_ARG(crypt_activate_by_token_pin),
|
||||
DLSYM_ARG(crypt_activate_by_volume_key),
|
||||
DLSYM_ARG(crypt_deactivate),
|
||||
DLSYM_ARG(crypt_deactivate_by_name),
|
||||
DLSYM_ARG(crypt_format),
|
||||
DLSYM_ARG(crypt_free),
|
||||
@@ -303,9 +314,11 @@ int dlopen_cryptsetup(int log_level) {
|
||||
DLSYM_ARG(crypt_header_restore),
|
||||
DLSYM_ARG(crypt_init),
|
||||
DLSYM_ARG(crypt_init_by_name),
|
||||
DLSYM_ARG(crypt_init_data_device),
|
||||
DLSYM_ARG(crypt_keyslot_add_by_volume_key),
|
||||
DLSYM_ARG(crypt_keyslot_destroy),
|
||||
DLSYM_ARG(crypt_keyslot_max),
|
||||
DLSYM_ARG(crypt_keyslot_status),
|
||||
DLSYM_ARG(crypt_load),
|
||||
DLSYM_ARG(crypt_metadata_locking),
|
||||
DLSYM_ARG(crypt_persistent_flags_get),
|
||||
@@ -317,10 +330,15 @@ int dlopen_cryptsetup(int log_level) {
|
||||
DLSYM_ARG(crypt_set_data_device),
|
||||
DLSYM_ARG(crypt_set_data_offset),
|
||||
DLSYM_ARG(crypt_set_debug_level),
|
||||
#if HAVE_CRYPT_SET_KEYRING_TO_LINK
|
||||
DLSYM_ARG(crypt_set_keyring_to_link),
|
||||
#endif
|
||||
DLSYM_ARG(crypt_set_log_callback),
|
||||
DLSYM_ARG(crypt_set_metadata_size),
|
||||
DLSYM_ARG(crypt_set_pbkdf_type),
|
||||
DLSYM_ARG(crypt_status),
|
||||
DLSYM_ARG(crypt_suspend),
|
||||
DLSYM_ARG(crypt_token_external_path),
|
||||
DLSYM_ARG(crypt_token_json_get),
|
||||
DLSYM_ARG(crypt_token_json_set),
|
||||
DLSYM_ARG(crypt_token_max),
|
||||
|
||||
Reference in New Issue
Block a user