Compare commits
2 Commits
max_enumer
...
reset-time
Author | SHA1 | Date | |
---|---|---|---|
c555e4ce46 | |||
299e91b91b |
23
fido2/ctap.c
23
fido2/ctap.c
@ -31,6 +31,7 @@ uint8_t PIN_TOKEN[PIN_TOKEN_SIZE];
|
|||||||
uint8_t KEY_AGREEMENT_PUB[64];
|
uint8_t KEY_AGREEMENT_PUB[64];
|
||||||
static uint8_t KEY_AGREEMENT_PRIV[32];
|
static uint8_t KEY_AGREEMENT_PRIV[32];
|
||||||
static int8_t PIN_BOOT_ATTEMPTS_LEFT = PIN_BOOT_ATTEMPTS;
|
static int8_t PIN_BOOT_ATTEMPTS_LEFT = PIN_BOOT_ATTEMPTS;
|
||||||
|
static uint32_t BOOT_TIME = 0;
|
||||||
|
|
||||||
AuthenticatorState STATE;
|
AuthenticatorState STATE;
|
||||||
|
|
||||||
@ -1587,18 +1588,15 @@ static int scan_for_next_rk(int index, uint8_t * initialRpIdHash){
|
|||||||
|
|
||||||
if (initialRpIdHash != NULL) {
|
if (initialRpIdHash != NULL) {
|
||||||
memmove(lastRpIdHash, initialRpIdHash, 32);
|
memmove(lastRpIdHash, initialRpIdHash, 32);
|
||||||
index = 0;
|
index = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ctap_load_rk(index, &rk);
|
ctap_load_rk(index, &rk);
|
||||||
memmove(lastRpIdHash, rk.id.rpIdHash, 32);
|
memmove(lastRpIdHash, rk.id.rpIdHash, 32);
|
||||||
index++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctap_load_rk(index, &rk);
|
do
|
||||||
|
|
||||||
while ( memcmp( rk.id.rpIdHash, lastRpIdHash, 32 ) != 0 )
|
|
||||||
{
|
{
|
||||||
index++;
|
index++;
|
||||||
if ((unsigned int)index >= ctap_rk_size())
|
if ((unsigned int)index >= ctap_rk_size())
|
||||||
@ -1607,6 +1605,7 @@ static int scan_for_next_rk(int index, uint8_t * initialRpIdHash){
|
|||||||
}
|
}
|
||||||
ctap_load_rk(index, &rk);
|
ctap_load_rk(index, &rk);
|
||||||
}
|
}
|
||||||
|
while ( memcmp( rk.id.rpIdHash, lastRpIdHash, 32 ) != 0 );
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
@ -2287,10 +2286,17 @@ uint8_t ctap_request(uint8_t * pkt_raw, int length, CTAP_RESPONSE * resp)
|
|||||||
break;
|
break;
|
||||||
case CTAP_RESET:
|
case CTAP_RESET:
|
||||||
printf1(TAG_CTAP,"CTAP_RESET\n");
|
printf1(TAG_CTAP,"CTAP_RESET\n");
|
||||||
status = ctap2_user_presence_test();
|
if ((millis() - BOOT_TIME) > 10 * 1000)
|
||||||
if (status == CTAP1_ERR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
ctap_reset();
|
status = CTAP2_ERR_NOT_ALLOWED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = ctap2_user_presence_test();
|
||||||
|
if (status == CTAP1_ERR_SUCCESS)
|
||||||
|
{
|
||||||
|
ctap_reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GET_NEXT_ASSERTION:
|
case GET_NEXT_ASSERTION:
|
||||||
@ -2384,6 +2390,7 @@ void ctap_init()
|
|||||||
firmware_version.major, firmware_version.minor, firmware_version.patch, firmware_version.reserved,
|
firmware_version.major, firmware_version.minor, firmware_version.patch, firmware_version.reserved,
|
||||||
firmware_version.major, firmware_version.minor, firmware_version.patch, firmware_version.reserved
|
firmware_version.major, firmware_version.minor, firmware_version.patch, firmware_version.reserved
|
||||||
);
|
);
|
||||||
|
BOOT_TIME = millis();
|
||||||
crypto_ecc256_init();
|
crypto_ecc256_init();
|
||||||
|
|
||||||
int is_init = authenticator_read_state(&STATE);
|
int is_init = authenticator_read_state(&STATE);
|
||||||
|
Reference in New Issue
Block a user