shared: drop redundant dlopen_cryptsetup() calls from cryptsetup_* helpers

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.
This commit is contained in:
Daan De Meyer
2026-04-23 08:10:24 +00:00
parent 724e5b51e7
commit 240b26503b
-12
View 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");