Skip to content

Commit da8b101

Browse files
committed
fix: u2f should require fresh button press
1 parent b1ad5c5 commit da8b101

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/firmware/u2f.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,13 @@ void u2fhid_read_start(const U2FHID_FRAME *f) {
257257
// wait for next commmand/ button press
258258
reader->cmd = 0;
259259
reader->seq = 255;
260+
bool saw_button_up_at_least_once = false;
260261
while (dialog_timeout > 0 && reader->cmd == 0) {
261262
dialog_timeout--;
263+
saw_button_up_at_least_once = saw_button_up_at_least_once || keepkey_button_up();
262264
usbPoll(); // may trigger new request
263265
// buttonUpdate();
264-
if (keepkey_button_down() &&
266+
if (saw_button_up_at_least_once && keepkey_button_down() &&
265267
(last_req_state == AUTH || last_req_state == REG)) {
266268
last_req_state++;
267269
// standard requires to remember button press for 10 seconds.

0 commit comments

Comments
 (0)