diff --git a/Control/keystore.c b/Control/keystore.c index 0f26e4314e1f0860e988c1a0115bf7f5a2269d1c..c7c55b02101148c1c89b732ba1c15f81cbe42bf6 100644 --- a/Control/keystore.c +++ b/Control/keystore.c @@ -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;