Check passphrase for user selected keyslot only.

When adding new keyslot we check if provided existing
passphrase is correct first.

Since user may now select specific existing keyslot
(to extract volume key) it's no use to check any
matching keyslot. Test passphrase only for user
specified keyslot.
This commit is contained in:
Ondrej Kozina
2023-10-06 15:37:39 +02:00
committed by Milan Broz
parent 717bd0665d
commit 15c3a2a2a9

View File

@@ -2216,7 +2216,7 @@ static int action_luksAddKey(void)
goto out;
/* Check password before asking for new one */
r = crypt_activate_by_passphrase(cd, NULL, CRYPT_ANY_SLOT,
r = crypt_activate_by_passphrase(cd, NULL, keyslot_old,
password, password_size, 0);
check_signal(&r);
tools_passphrase_msg(r);