Compare commits

...

7 Commits

Author SHA1 Message Date
Conor Patrick
6a18037911
remove SOLO_EXPERIMENTAL default 2020-02-18 11:10:46 -05:00
Conor Patrick
dcda21c096 fix error return 2019-10-29 09:09:53 -04:00
Conor Patrick
68d9fe6fb7 overwrite if >256 is more clear 2019-10-29 08:58:57 -04:00
Conor Patrick
bba3a30e3b fix offset 2019-10-29 08:47:14 -04:00
Conor Patrick
be99caf2a2 replace counter instead of increment for large increment 2019-10-29 08:25:58 -04:00
Conor Patrick
3af4830725 add version check 2019-10-29 08:22:11 -04:00
Conor Patrick
5c84c4d8bb subsequent button presses do not need to wait long 2019-10-29 08:16:04 -04:00
2 changed files with 22 additions and 11 deletions

View File

@ -760,30 +760,37 @@ uint8_t ctaphid_custom_command(int len, CTAP_RESPONSE * ctap_resp, CTAPHID_WRITE
case CTAPHID_LOADKEY:
/**
* Load external key. Useful for enabling backups.
* bytes: 4 96
* payload: | counter_increase (BE) | master_key |
* bytes: 4 4 96
* payload: version [maj rev patch RFU]| counter_replacement (BE) | master_key |
*
* Counter should be increased by a large amount, e.g. (0x10000000)
* to outdo any previously lost/broken keys.
*/
printf1(TAG_HID,"CTAPHID_LOADKEY\n");
if (len != 100)
if (len != 104)
{
printf2(TAG_ERR,"Error, invalid length.\n");
ctaphid_send_error(wb->cid, CTAP1_ERR_INVALID_LENGTH);
return 1;
}
param = ctap_buffer[0] << 16;
param |= ctap_buffer[1] << 8;
param |= ctap_buffer[2] << 0;
if (param != 0){
ctaphid_send_error(wb->cid, CTAP2_ERR_UNSUPPORTED_OPTION);
return 1;
}
// Ask for THREE button presses
if (ctap_user_presence_test(8000) > 0)
if (ctap_user_presence_test(8000) > 0)
if (ctap_user_presence_test(8000) > 0)
if (ctap_user_presence_test(2000) > 0)
if (ctap_user_presence_test(2000) > 0)
{
ctap_load_external_keys(ctap_buffer + 4);
param = ctap_buffer[3];
param |= ctap_buffer[2] << 8;
param |= ctap_buffer[1] << 16;
param |= ctap_buffer[0] << 24;
ctap_load_external_keys(ctap_buffer + 8);
param = ctap_buffer[7];
param |= ctap_buffer[6] << 8;
param |= ctap_buffer[5] << 16;
param |= ctap_buffer[4] << 24;
ctap_atomic_count(param);
wb->bcnt = 0;

View File

@ -560,7 +560,11 @@ uint32_t ctap_atomic_count(uint32_t amount)
return lastc;
}
lastc += amount;
if (amount > 256){
lastc = amount;
} else {
lastc += amount;
}
if (lastc/256 > erases)
{