Skip to content

Commit

Permalink
Fix user presence test when pinAuth is empty
Browse files Browse the repository at this point in the history
The check_retr macro is evaluating its argument twice, so when we do:

    check_retr( ctap2_user_presence_test(...) )

the user presence function is called twice and the user has to press the
button twice. This is regression introduced with commit 3b53537.
  • Loading branch information
Radoslav Gerganov authored and conorpp committed Mar 21, 2020
1 parent 79b43a9 commit 7112633
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fido2/ctap.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,8 @@ uint8_t ctap_make_credential(CborEncoder * encoder, uint8_t * request, int lengt
}
if (MC.pinAuthEmpty)
{
check_retr( ctap2_user_presence_test(CTAP2_UP_DELAY_MS) );
ret = ctap2_user_presence_test(CTAP2_UP_DELAY_MS);
check_retr(ret);
return ctap_is_pin_set() == 1 ? CTAP2_ERR_PIN_AUTH_INVALID : CTAP2_ERR_PIN_NOT_SET;
}
if ((MC.paramsParsed & MC_requiredMask) != MC_requiredMask)
Expand Down Expand Up @@ -1464,7 +1465,8 @@ uint8_t ctap_get_assertion(CborEncoder * encoder, uint8_t * request, int length)

if (GA.pinAuthEmpty)
{
check_retr( ctap2_user_presence_test(CTAP2_UP_DELAY_MS) );
ret = ctap2_user_presence_test(CTAP2_UP_DELAY_MS);
check_retr(ret);
return ctap_is_pin_set() == 1 ? CTAP2_ERR_PIN_AUTH_INVALID : CTAP2_ERR_PIN_NOT_SET;
}
if (GA.pinAuthPresent)
Expand Down

0 comments on commit 7112633

Please sign in to comment.