Skip to content
Snippets Groups Projects
Commit 88ad3953 authored by da1l6's avatar da1l6
Browse files

Disable keystore content output in non-debug mode.

parent 0ca12760
No related branches found
No related tags found
No related merge requests found
......@@ -117,13 +117,15 @@ void keystore_update_hashes(SALT salt){
}
void keystore_list(void){
KEY key;
for (uint16_t index = 0; index < KEY_COUNT; index++){
wdt_reset(); //this may take a while, keep the Watchdog happy.
printf_P(PSTR("Slot %03i: "), index);
uint8_t slot_status = keystore_read_slot_status(index);
if (slot_status == KEYSLOT_USED || slot_status == KEYSLOT_DISABLED){
#ifdef KEYSTORE_DEBUG
KEY key;
keystore_read_key(index, key);
printf_P(PSTR("K:"));
......@@ -131,7 +133,9 @@ void keystore_list(void){
printf_P(PSTR(" H:"));
MGMT_transmit_buffer_hex(&(hashes[index]), sizeof(HASH_HEAD));
#else
printf_P(PSTR("Used"));
#endif
if (slot_status == KEYSLOT_DISABLED){
printf_P(PSTR(" (Disabled)"));
}
......@@ -158,7 +162,7 @@ uint8_t keystore_calc_keyhash(uint16_t index, SALT salt, HASH keyhash){
MGMT_transmit_buffer_hex(buffer, sizeof(SALT)+sizeof(KEY));
printf_P(PSTR(")\n"));
#endif
sha1(keyhash, buffer, (sizeof(SALT)+sizeof(KEY))*8);
sha1(keyhash, (uint8_t*)buffer, (sizeof(SALT)+sizeof(KEY))*8);
return 1;
}
......@@ -172,7 +176,7 @@ uint8_t keystore_restore_slot(uint16_t index){
if (!keystore_eeprom_write(KEY_MAIN_EEPROM, EEPROM_TABLE_OFFSET + index, &status, sizeof(uint8_t))) return 0;
if (status == KEYSLOT_USED || status == KEYSLOT_DISABLED){
keystore_calc_keyhash(index, salt, &hashes[index]);
keystore_calc_keyhash(index, salt, (uint8_t*)&hashes[index]);
}
return 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment