]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared: drop redundant dlopen_cryptsetup() calls from cryptsetup_* helpers 41785/head
authorDaan De Meyer <daan@amutable.com>
Thu, 23 Apr 2026 08:10:24 +0000 (08:10 +0000)
committerDaan De Meyer <daan@amutable.com>
Thu, 23 Apr 2026 08:10:24 +0000 (08:10 +0000)
cryptsetup_set_minimal_pbkdf(), cryptsetup_get_token_as_json() and
cryptsetup_add_token_json() each take a struct crypt_device *cd, which
can only be obtained by first calling sym_crypt_init*() — and that
already requires dlopen_cryptsetup() to have succeeded. The internal
calls here were only implicitly re-loading a library the caller is
guaranteed to have already loaded.

src/shared/cryptsetup-util.c

index 0d96d82c621bae6601e5ab95faca954b28502dd7..47a148459d95f8338bc05c7ac4919bba3da1d7cd 100644 (file)
@@ -133,10 +133,6 @@ int cryptsetup_set_minimal_pbkdf(struct crypt_device *cd) {
 
         /* Sets a minimal PKBDF in case we already have a high entropy key. */
 
-        r = dlopen_cryptsetup(LOG_DEBUG);
-        if (r < 0)
-                return r;
-
         r = sym_crypt_set_pbkdf_type(cd, &minimal_pbkdf);
         if (r < 0)
                 return r;
@@ -164,10 +160,6 @@ int cryptsetup_get_token_as_json(
          * -EMEDIUMTYPE → "verify_type" specified and doesn't match token's type
          */
 
-        r = dlopen_cryptsetup(LOG_DEBUG);
-        if (r < 0)
-                return r;
-
         r = sym_crypt_token_json_get(cd, idx, &text);
         if (r < 0)
                 return r;
@@ -197,10 +189,6 @@ int cryptsetup_add_token_json(struct crypt_device *cd, sd_json_variant *v) {
         _cleanup_free_ char *text = NULL;
         int r;
 
-        r = dlopen_cryptsetup(LOG_DEBUG);
-        if (r < 0)
-                return r;
-
         r = sd_json_variant_format(v, 0, &text);
         if (r < 0)
                 return log_debug_errno(r, "Failed to format token data for LUKS: %m");