@@ -432,6 +432,12 @@ static unsigned int get_credential_id_size(CTAP_credentialDescriptor * cred)
432
432
return sizeof (CredentialId );
433
433
}
434
434
435
+ static int ctap2_user_presence_test ()
436
+ {
437
+ device_set_status (CTAPHID_STATUS_UPNEEDED );
438
+ return ctap_user_presence_test (CTAP2_UP_DELAY_MS );
439
+ }
440
+
435
441
static int ctap_make_auth_data (struct rpId * rp , CborEncoder * map , uint8_t * auth_data_buf , uint32_t * len , CTAP_credInfo * credInfo )
436
442
{
437
443
CborEncoder cose_key ;
@@ -459,11 +465,9 @@ static int ctap_make_auth_data(struct rpId * rp, CborEncoder * map, uint8_t * au
459
465
460
466
count = auth_data_update_count (& authData -> head );
461
467
462
- device_set_status (CTAPHID_STATUS_UPNEEDED );
463
-
464
468
int but ;
465
469
466
- but = ctap_user_presence_test (CTAP2_UP_DELAY_MS );
470
+ but = ctap2_user_presence_test (CTAP2_UP_DELAY_MS );
467
471
468
472
if (!but )
469
473
{
@@ -473,6 +477,7 @@ static int ctap_make_auth_data(struct rpId * rp, CborEncoder * map, uint8_t * au
473
477
{
474
478
return CTAP2_ERR_KEEPALIVE_CANCEL ;
475
479
}
480
+
476
481
device_set_status (CTAPHID_STATUS_PROCESSING );
477
482
478
483
authData -> head .flags = (but << 0 );
@@ -700,11 +705,11 @@ uint8_t ctap_make_credential(CborEncoder * encoder, uint8_t * request, int lengt
700
705
}
701
706
if (MC .pinAuthEmpty )
702
707
{
703
- if (!ctap_user_presence_test (CTAP2_UP_DELAY_MS ))
708
+ if (!ctap2_user_presence_test (CTAP2_UP_DELAY_MS ))
704
709
{
705
710
return CTAP2_ERR_OPERATION_DENIED ;
706
711
}
707
- return ctap_is_pin_set () == 1 ? CTAP2_ERR_PIN_INVALID : CTAP2_ERR_PIN_NOT_SET ;
712
+ return ctap_is_pin_set () == 1 ? CTAP2_ERR_PIN_AUTH_INVALID : CTAP2_ERR_PIN_NOT_SET ;
708
713
}
709
714
if ((MC .paramsParsed & MC_requiredMask ) != MC_requiredMask )
710
715
{
@@ -1136,11 +1141,11 @@ uint8_t ctap_get_assertion(CborEncoder * encoder, uint8_t * request, int length)
1136
1141
1137
1142
if (GA .pinAuthEmpty )
1138
1143
{
1139
- if (!ctap_user_presence_test (CTAP2_UP_DELAY_MS ))
1144
+ if (!ctap2_user_presence_test (CTAP2_UP_DELAY_MS ))
1140
1145
{
1141
1146
return CTAP2_ERR_OPERATION_DENIED ;
1142
1147
}
1143
- return ctap_is_pin_set () == 1 ? CTAP2_ERR_PIN_INVALID : CTAP2_ERR_PIN_NOT_SET ;
1148
+ return ctap_is_pin_set () == 1 ? CTAP2_ERR_PIN_AUTH_INVALID : CTAP2_ERR_PIN_NOT_SET ;
1144
1149
}
1145
1150
if (GA .pinAuthPresent )
1146
1151
{
@@ -1603,7 +1608,6 @@ uint8_t ctap_request(uint8_t * pkt_raw, int length, CTAP_RESPONSE * resp)
1603
1608
switch (cmd )
1604
1609
{
1605
1610
case CTAP_MAKE_CREDENTIAL :
1606
- device_set_status (CTAPHID_STATUS_PROCESSING );
1607
1611
printf1 (TAG_CTAP ,"CTAP_MAKE_CREDENTIAL\n" );
1608
1612
timestamp ();
1609
1613
status = ctap_make_credential (& encoder , pkt_raw , length );
@@ -1614,7 +1618,6 @@ uint8_t ctap_request(uint8_t * pkt_raw, int length, CTAP_RESPONSE * resp)
1614
1618
1615
1619
break ;
1616
1620
case CTAP_GET_ASSERTION :
1617
- device_set_status (CTAPHID_STATUS_PROCESSING );
1618
1621
printf1 (TAG_CTAP ,"CTAP_GET_ASSERTION\n" );
1619
1622
timestamp ();
1620
1623
status = ctap_get_assertion (& encoder , pkt_raw , length );
@@ -1646,7 +1649,7 @@ uint8_t ctap_request(uint8_t * pkt_raw, int length, CTAP_RESPONSE * resp)
1646
1649
break ;
1647
1650
case CTAP_RESET :
1648
1651
printf1 (TAG_CTAP ,"CTAP_RESET\n" );
1649
- if (ctap_user_presence_test (CTAP2_UP_DELAY_MS ))
1652
+ if (ctap2_user_presence_test (CTAP2_UP_DELAY_MS ))
1650
1653
{
1651
1654
ctap_reset ();
1652
1655
}
0 commit comments