cryptsetup: pass AskPasswordFlags down into pkcs11 module

The pkcs11 cryptsetup token module is a bit different from the tpm2 +
fido2 ones: it asks for the PIN itself, rather than bubbling up a
request to get a PIN. That's because it might need multiple, and because
we don't want to destroy a the pkcs11 session half-way and thus risk
increasing pin counters.

Hence, we sometimes ask for PINs from our code, rather than let the
libcryptsetup caller do that. So far we didn't pass the AskPasswordFlags
field down into the module though. Fix that.

Fixes: #28665
This commit is contained in:
Lennart Poettering
2023-11-03 09:51:53 +01:00
parent 00392b1437
commit a758a12870
4 changed files with 25 additions and 4 deletions
@@ -158,6 +158,7 @@ static int acquire_luks2_key_systemd(
data.friendly_name = params->friendly_name;
data.headless = params->headless;
data.askpw_flags = params->askpw_flags;
data.until = params->until;
/* The functions called here log about all errors, except for EAGAIN which means "token not found right now" */
+2 -1
View File
@@ -1399,7 +1399,8 @@ static int attach_luks2_by_pkcs11_via_plugin(
systemd_pkcs11_plugin_params params = {
.friendly_name = friendly_name,
.until = until,
.headless = headless
.headless = headless,
.askpw_flags = arg_ask_password_flags,
};
r = crypt_activate_by_token_pin(cd, name, "systemd-pkcs11", CRYPT_ANY_TOKEN, NULL, 0, &params, flags);