summaryrefslogtreecommitdiff
path: root/fw/src/noise.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/src/noise.c')
-rw-r--r--fw/src/noise.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/fw/src/noise.c b/fw/src/noise.c
index 90aaf36..6405d49 100644
--- a/fw/src/noise.c
+++ b/fw/src/noise.c
@@ -188,7 +188,7 @@ void uninit_handshake(struct NoiseState *st, enum handshake_state new_state) {
noise_handshakestate_free(st->handshake);
st->handshake_state = new_state;
st->handshake = NULL;
- arm_key_scrubber();
+ //arm_key_scrubber(); FIXME DEBUG
}
/*@
@@ -291,9 +291,19 @@ int handshake_phase2(struct NoiseState * const st, uint8_t *buf, size_t len) {
BLAKE2s_update(&bc, st->remote_key, sizeof(st->remote_key));
BLAKE2s_finish(&bc, remote_fp);
+ LOG_PRINTF("Key in memory: ");
+ for (int i=0; i<BLAKE2S_HASH_SIZE; i++)
+ LOG_PRINTF("%02x ", remote_fp[i]);
+ LOG_PRINTF("\n");
+ LOG_PRINTF("Key in storage: ");
+ for (int i=0; i<BLAKE2S_HASH_SIZE; i++)
+ LOG_PRINTF("%02x ", st->remote_key_reference[i]);
+ LOG_PRINTF("\n");
+
//@ ghost key_checked_trace = 1;
if (!fc_memcmp_uint8(remote_fp, st->remote_key_reference, sizeof(remote_fp))) { /* keys match */
//@ ghost key_match_trace = 1;
+ LOG_PRINTF("Keys match, accepting peer.\n");
uint8_t response = REPORT_PAIRING_SUCCESS;
if (send_encrypted_message(st, &response, sizeof(response)))
LOG_PRINTF("Error sending pairing response packet\n");
@@ -303,6 +313,7 @@ int handshake_phase2(struct NoiseState * const st, uint8_t *buf, size_t len) {
return 1;
} else { /* keys don't match */
+ LOG_PRINTF("Keys don't match, requiring pairing.\n");
uint8_t response = REPORT_PAIRING_START;
if (send_encrypted_message(st, &response, sizeof(response)))
LOG_PRINTF("Error sending pairing response packet\n");
@@ -403,6 +414,11 @@ void persist_remote_key(struct NoiseState *st) {
BLAKE2s_update(&bc, st->remote_key, sizeof(st->remote_key));
BLAKE2s_finish(&bc, st->remote_key_reference);
st->handshake_state = HANDSHAKE_DONE_KNOWN_HOST;
+
+ LOG_PRINTF("Key in memory: ");
+ for (int i=0; i<BLAKE2S_HASH_SIZE; i++)
+ LOG_PRINTF("%02x ", st->remote_key_reference[i]);
+ LOG_PRINTF("\n");
}
/*@