From 6633fa626aa953d30d9ecbe67b2f9c88a2629ed0 Mon Sep 17 00:00:00 2001 From: Ondrej Kozina Date: Tue, 29 Jun 2021 11:16:49 +0200 Subject: [PATCH] Remove unused crypt_token_external_support. API can expose same information with crypt_token_external_path. Also add print out of external token in cryptsetup --help action (if enabled) --- lib/libcryptsetup.h | 7 ------- lib/libcryptsetup.sym | 1 - lib/luks2/luks2_token.c | 5 ----- src/cryptsetup.c | 10 ++++++++-- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/libcryptsetup.h b/lib/libcryptsetup.h index 413a99f2..7ece9599 100644 --- a/lib/libcryptsetup.h +++ b/lib/libcryptsetup.h @@ -2254,13 +2254,6 @@ typedef struct { */ int crypt_token_register(const crypt_token_handler *handler); -/** - * Report external token handlers (plugins) support - * - * @return @e 0 when enabled or negative errno value otherwise. - */ -int crypt_token_external_support(void); - /** * Report configured path where library searches for external token handlers * diff --git a/lib/libcryptsetup.sym b/lib/libcryptsetup.sym index 9cf570c5..d3b17ca1 100644 --- a/lib/libcryptsetup.sym +++ b/lib/libcryptsetup.sym @@ -141,7 +141,6 @@ CRYPTSETUP_2.4 { crypt_activate_by_token_pin; crypt_dump_json; crypt_format; - crypt_token_external_support; crypt_token_external_disable; crypt_token_external_path; } CRYPTSETUP_2.0; diff --git a/lib/luks2/luks2_token.c b/lib/luks2/luks2_token.c index efdd785b..35678df3 100644 --- a/lib/luks2/luks2_token.c +++ b/lib/luks2/luks2_token.c @@ -49,11 +49,6 @@ void crypt_token_external_disable(void) external_tokens_enabled = false; } -int crypt_token_external_support(void) -{ - return external_tokens_enabled ? 0 : -ENOTSUP; -} - const char *crypt_token_external_path(void) { return external_tokens_enabled ? EXTERNAL_LUKS2_TOKENS_PATH : NULL; diff --git a/src/cryptsetup.c b/src/cryptsetup.c index a797e907..55aa8196 100644 --- a/src/cryptsetup.c +++ b/src/cryptsetup.c @@ -3475,6 +3475,8 @@ static void help(poptContext popt_context, const char *arg __attribute__((unused)), void *data __attribute__((unused))) { + const char *path; + if (key->shortName == '?') { struct action_type *action; const struct crypt_pbkdf_type *pbkdf_luks1, *pbkdf_luks2; @@ -3503,8 +3505,12 @@ static void help(poptContext popt_context, log_std(_("\nDefault compiled-in metadata format is %s (for luksFormat action).\n"), crypt_get_default_type()); - log_std(_("\nLUKS2 external token plugin support is %s.\n"), - crypt_token_external_support() ? _("disabled") : _("compiled-in")); + path = crypt_token_external_path(); + if (path) { + log_std(_("\nLUKS2 external token plugin support is %s.\n"), _("compiled-in")); + log_std(_("LUKS2 external token plugin path: %s.\n"), path); + } else + log_std(_("\nLUKS2 external token plugin support is %s.\n"), _("disabled")); pbkdf_luks1 = crypt_get_pbkdf_default(CRYPT_LUKS1); pbkdf_luks2 = crypt_get_pbkdf_default(CRYPT_LUKS2);