Skip to content

Commit d4e6142

Browse files
authored
Merge pull request #232 from solokeys/windows_hello_error_codes
Windows hello response codes
2 parents 2af747d + 690d7c7 commit d4e6142

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

fido2/ctap.c

+13-10
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,12 @@ static unsigned int get_credential_id_size(CTAP_credentialDescriptor * cred)
432432
return sizeof(CredentialId);
433433
}
434434

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+
435441
static int ctap_make_auth_data(struct rpId * rp, CborEncoder * map, uint8_t * auth_data_buf, uint32_t * len, CTAP_credInfo * credInfo)
436442
{
437443
CborEncoder cose_key;
@@ -459,11 +465,9 @@ static int ctap_make_auth_data(struct rpId * rp, CborEncoder * map, uint8_t * au
459465

460466
count = auth_data_update_count(&authData->head);
461467

462-
device_set_status(CTAPHID_STATUS_UPNEEDED);
463-
464468
int but;
465469

466-
but = ctap_user_presence_test(CTAP2_UP_DELAY_MS);
470+
but = ctap2_user_presence_test(CTAP2_UP_DELAY_MS);
467471

468472
if (!but)
469473
{
@@ -473,6 +477,7 @@ static int ctap_make_auth_data(struct rpId * rp, CborEncoder * map, uint8_t * au
473477
{
474478
return CTAP2_ERR_KEEPALIVE_CANCEL;
475479
}
480+
476481
device_set_status(CTAPHID_STATUS_PROCESSING);
477482

478483
authData->head.flags = (but << 0);
@@ -700,11 +705,11 @@ uint8_t ctap_make_credential(CborEncoder * encoder, uint8_t * request, int lengt
700705
}
701706
if (MC.pinAuthEmpty)
702707
{
703-
if (!ctap_user_presence_test(CTAP2_UP_DELAY_MS))
708+
if (!ctap2_user_presence_test(CTAP2_UP_DELAY_MS))
704709
{
705710
return CTAP2_ERR_OPERATION_DENIED;
706711
}
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;
708713
}
709714
if ((MC.paramsParsed & MC_requiredMask) != MC_requiredMask)
710715
{
@@ -1136,11 +1141,11 @@ uint8_t ctap_get_assertion(CborEncoder * encoder, uint8_t * request, int length)
11361141

11371142
if (GA.pinAuthEmpty)
11381143
{
1139-
if (!ctap_user_presence_test(CTAP2_UP_DELAY_MS))
1144+
if (!ctap2_user_presence_test(CTAP2_UP_DELAY_MS))
11401145
{
11411146
return CTAP2_ERR_OPERATION_DENIED;
11421147
}
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;
11441149
}
11451150
if (GA.pinAuthPresent)
11461151
{
@@ -1603,7 +1608,6 @@ uint8_t ctap_request(uint8_t * pkt_raw, int length, CTAP_RESPONSE * resp)
16031608
switch(cmd)
16041609
{
16051610
case CTAP_MAKE_CREDENTIAL:
1606-
device_set_status(CTAPHID_STATUS_PROCESSING);
16071611
printf1(TAG_CTAP,"CTAP_MAKE_CREDENTIAL\n");
16081612
timestamp();
16091613
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)
16141618

16151619
break;
16161620
case CTAP_GET_ASSERTION:
1617-
device_set_status(CTAPHID_STATUS_PROCESSING);
16181621
printf1(TAG_CTAP,"CTAP_GET_ASSERTION\n");
16191622
timestamp();
16201623
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)
16461649
break;
16471650
case CTAP_RESET:
16481651
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))
16501653
{
16511654
ctap_reset();
16521655
}

tools/testing/tests/fido2.py

+16-10
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,10 @@ def test_client_pin(self,):
11341134
rp["id"],
11351135
cdh,
11361136
other={"pin_auth": b"", "pin_protocol": pin_protocol},
1137-
expectedError=CtapError.ERR.PIN_NOT_SET,
1137+
expectedError=[
1138+
CtapError.ERR.PIN_AUTH_INVALID,
1139+
CtapError.ERR.NO_CREDENTIALS,
1140+
],
11381141
)
11391142

11401143
with Test("Setting pin code, expect SUCCESS"):
@@ -1148,14 +1151,17 @@ def test_client_pin(self,):
11481151
user,
11491152
key_params,
11501153
other={"pin_auth": b"", "pin_protocol": pin_protocol},
1151-
expectedError=CtapError.ERR.PIN_INVALID,
1154+
expectedError=CtapError.ERR.PIN_AUTH_INVALID,
11521155
)
11531156
self.testGA(
11541157
"Send MC request with new pin auth",
11551158
rp["id"],
11561159
cdh,
11571160
other={"pin_auth": b"", "pin_protocol": pin_protocol},
1158-
expectedError=CtapError.ERR.PIN_INVALID,
1161+
expectedError=[
1162+
CtapError.ERR.PIN_AUTH_INVALID,
1163+
CtapError.ERR.NO_CREDENTIALS,
1164+
],
11591165
)
11601166

11611167
self.testReset()
@@ -1311,13 +1317,13 @@ def test_fido2(self,):
13111317

13121318
self.testReset()
13131319

1314-
self.test_get_info()
1315-
1316-
self.test_get_assertion()
1317-
1318-
self.test_make_credential()
1319-
1320-
self.test_rk(None)
1320+
# self.test_get_info()
1321+
#
1322+
# self.test_get_assertion()
1323+
#
1324+
# self.test_make_credential()
1325+
#
1326+
# self.test_rk(None)
13211327

13221328
self.test_client_pin()
13231329

0 commit comments

Comments
 (0)