add crypto_printkey() for debug

This commit is contained in:
hathach committed 2018-02-05 13:30:20 +07:00
1 parent 7487320265
commit 56f63234f0
2 files changed
+15

No files matched your search

+13
View File
@@ -54,6 +54,19 @@ typedef struct
uint8_t __padding__[1];
} crypto_persistent_keys_t;
void crypto_printkey(void)
{
crypto_persistent_keys_t keys = {};
uint32_t keylen = sizeof(keys);
fsutil_read_file(CRYPTO_KEYFILE, 0, keylen, &keys, &keylen);
if (keys.valid0 == 0x55 && keys.valid1 == 0xAA && keys.instance == CRYPTO_INSTANCE)
{
dbgDumpMemoryCFormat("uint8_t keys[] = ", &keys, sizeof(keys));
}
}
void crypto_init(void)
{
// uint32_t err_code;
+2
View File
@@ -61,6 +61,8 @@ extern void crypto_transportEncrypt(uint8_t* key, uint8_t* nonce, uint8_t* plain
extern uint8_t crypto_transportDecrypt(uint8_t* key, uint8_t* nonce, uint8_t* ciphertext, uint16_t clength, uint8_t* plaintext, uint16_t* plength);
extern uint8_t crypto_advertise(void);
void crypto_printkey(void);
#ifdef __cplusplus
}
#endif