trustcrypto / OnlyKey-Firmware

The OnlyKey Firmware runs on the OnlyKey itself and provides the core functionality of OnlyKey.
https://docs.crp.to/firmware.html
219 stars 40 forks source link

Tapping button for some wiped slots produces strange output and causes OnlyKey to freeze #9

Closed rodgolpe closed 8 years ago

rodgolpe commented 8 years ago

After wiping a slot, serial monitor output shows:

Wiping Slot #5
Value #0
000000000000000000000000000000000000000000000000000000000Overwriting slot with 0s
Wiping Label Value...
Wiping Username Value...
Wiping Additional Character1 Value...
Writing Delay1 to EEPROM...
Wiping Password Value...
Wiping Additional Character2 Value...
Wiping Delay2 Value...
Wiping 2FA Type Value...
Writing TOTP Key to EEPROM...Data to write = 0
Writing to Sector 0x20324, value 0x0 Data to write = 0
Writing to Sector 0x20324, value 0x0 Data to write = 0
Writing to Sector 0x20324, value 0x0 Data to write = 0
Writing to Sector 0x20324, value 0x0 Data to write = 0
Writing to Sector 0x20324, value 0x0 
Wiping onlykey AES Key, Priviate ID, and Public ID...

Then, after pressing the wiped slot's key, the OnlyKey LED shuts off and it stops responding to key presses (or any programming) until being removed and reinserted. The last serial monitor entry shows:

Displaying Full Keybuffer
�a�r!���-hHcG�*����xD8�����a=�0l"F%�R��z:�a���ABY=�6L���

UPDATE: After a factory reset, I set slot 1a's label and username. The OnlyKey output correctly when tapping button 1a. Then, I wiped slot 1a. The OKWIPESLOT output looked fine (like pasted above). After pressing the key 1a, the same device freeze happened as above, but the serial monitor output showed the following:

Slot Number 1
Reading Username from EEPROM...
Username Length = 32
Encrypted
00000000000000000000000000000000
 0x20004
 0x41 0x67 0x76 0x59 0x20004
 0x47 0xC2 0x5A 0xC1 0x20004
 0x39 0x59 0xE5 0x76Unencrypted
C2F66B1C343ECCBB4E10FC4339C7DC1E0D11184E33D5F2E44E41A738E4B999F
Reading Password from EEPROM...
Password Length = 32
Encrypted
00000000000000000000000000000000
 0x20004
 0x41 0x67 0x76 0x59 0x20004
 0x47 0xC2 0x5A 0xC1 0x20004
 0x39 0x59 0xE5 0x76Unencrypted
C2F66B1C343ECCBB4E10FC4339C7DC1E0D11184E33D5F2E44E41A738E4B999F
Displaying Full Keybuffer
��k4>̻N�C�}�����=_.D�s�K����k4>̻N�C�}�����=_.D�s�K��
onlykey commented 8 years ago

Issue addressed with flash sector update