kopia lustrzana https://github.com/solokeys/solo1
add temporary command to force flash locking
rodzic
b78f2cd2e7
commit
e713daba26
|
@ -542,6 +542,9 @@ extern void _check_ret(CborError ret, int line, const char * filename);
|
|||
|
||||
uint8_t ctaphid_custom_command(int len, CTAP_RESPONSE * ctap_resp, CTAPHID_WRITE_BUFFER * wb);
|
||||
|
||||
|
||||
extern void solo_lock_if_not_already();
|
||||
|
||||
uint8_t ctaphid_handle_packet(uint8_t * pkt_raw)
|
||||
{
|
||||
uint8_t cmd = 0;
|
||||
|
@ -762,6 +765,16 @@ uint8_t ctaphid_custom_command(int len, CTAP_RESPONSE * ctap_resp, CTAPHID_WRITE
|
|||
return 1;
|
||||
break;
|
||||
|
||||
// Remove on next release
|
||||
#if !defined(IS_BOOTLOADER) && defined(SOLO)
|
||||
case 0x99:
|
||||
solo_lock_if_not_already();
|
||||
wb->bcnt = 0;
|
||||
ctaphid_write(wb, NULL, 0);
|
||||
return 1;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(IS_BOOTLOADER) && (defined(SOLO_EXPERIMENTAL))
|
||||
case CTAPHID_LOADKEY:
|
||||
/**
|
||||
|
|
|
@ -199,6 +199,20 @@ int solo_is_locked(){
|
|||
return tag == ATTESTATION_CONFIGURED_TAG && (device_settings & SOLO_FLAG_LOCKED) != 0;
|
||||
}
|
||||
|
||||
// Locks solo flash from debugging. Locks on next reboot.
|
||||
// This should be removed in next Solo release.
|
||||
void solo_lock_if_not_already() {
|
||||
uint8_t buf[2048];
|
||||
|
||||
memmove(buf, (uint8_t*)ATTESTATION_PAGE_ADDR, 2048);
|
||||
|
||||
((flash_attestation_page *)buf)->device_settings |= SOLO_FLAG_LOCKED;
|
||||
|
||||
flash_erase_page(ATTESTATION_PAGE);
|
||||
|
||||
flash_write(ATTESTATION_PAGE_ADDR, buf, 2048);
|
||||
}
|
||||
|
||||
/** device_migrate
|
||||
* Depending on version of device, migrates:
|
||||
* * Moves attestation certificate to data segment.
|
||||
|
|
Ładowanie…
Reference in New Issue