Add PIN processing to tokens.

This commit is contained in:
Milan Broz
2019-07-07 10:50:30 +02:00
parent f6706ce124
commit 2ce8573f04
6 changed files with 93 additions and 17 deletions

View File

@@ -1495,6 +1495,18 @@ static int action_open_luks(void)
} else {
r = crypt_activate_by_token(cd, activated_name, opt_token, NULL, activate_flags);
tools_keyslot_msg(r, UNLOCKED);
/* Token requires PIN, but ask only there will be no password query later */
if (opt_token_only && r == -EAGAIN) {
r = tools_get_key(_("Enter token PIN:"), &password, &passwordLen, 0, 0, NULL,
opt_timeout, _verify_passphrase(0), 0, cd);
if (r < 0)
goto out;
r = crypt_activate_by_pin_token(cd, activated_name, opt_token,
password, NULL, activate_flags);
tools_keyslot_msg(r, UNLOCKED);
}
if (r >= 0 || opt_token_only)
goto out;