diff --git a/applications/u2f/u2f.c b/applications/u2f/u2f.c index 94fd9f2dad8..767733ce65b 100644 --- a/applications/u2f/u2f.c +++ b/applications/u2f/u2f.c @@ -277,8 +277,8 @@ static uint16_t u2f_authenticate(U2fData* U2F, uint8_t* buf) { } U2F->user_present = false; - // The 4 byte counter is represented in big endian - be_u2f_counter = lfs_tobe32(U2F->counter); + // The 4 byte counter is represented in big endian. Increment it before use + be_u2f_counter = lfs_tobe32(U2F->counter + 1); // Generate hash sha256_start(&sha_ctx); @@ -318,8 +318,8 @@ static uint16_t u2f_authenticate(U2fData* U2F, uint8_t* buf) { uint8_t signature_len = u2f_der_encode_signature(resp->signature, signature); memcpy(resp->signature + signature_len, state_no_error, 2); - FURI_LOG_D(TAG, "Counter: %lu", U2F->counter); U2F->counter++; + FURI_LOG_D(TAG, "Counter: %lu", U2F->counter); u2f_data_cnt_write(U2F->counter); if(U2F->callback != NULL) U2F->callback(U2fNotifyAuthSuccess, U2F->context);