summaryrefslogtreecommitdiff
path: root/src/noise.c
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2018-11-14 09:39:43 +0900
committerjaseg <git@jaseg.net>2018-11-14 09:39:43 +0900
commit9249e792a1cc7ef6d04fa6a8eba6bd9bbc066915 (patch)
treecc85ad5f592b460f57471a3741d2ddeee6103912 /src/noise.c
parent370301e06da15aada3772461d9f96d50d87475ca (diff)
downloadsecure-hid-9249e792a1cc7ef6d04fa6a8eba6bd9bbc066915.tar.gz
secure-hid-9249e792a1cc7ef6d04fa6a8eba6bd9bbc066915.tar.bz2
secure-hid-9249e792a1cc7ef6d04fa6a8eba6bd9bbc066915.zip
GUI pairing working as it should
Diffstat (limited to 'src/noise.c')
-rw-r--r--src/noise.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/noise.c b/src/noise.c
index 9f898dd..a30d338 100644
--- a/src/noise.c
+++ b/src/noise.c
@@ -147,9 +147,18 @@ int try_continue_noise_handshake(struct NoiseState *st, uint8_t *buf, size_t len
HANDLE_NOISE_ERROR(noise_dhstate_get_public_key(remote_dh, st->remote_key, sizeof(st->remote_key)), "getting remote pubkey");
if (!memcmp(st->remote_key, st->remote_key_reference, sizeof(st->remote_key))) { /* keys match */
+ uint8_t response = REPORT_PAIRING_SUCCESS;
+ if (send_encrypted_message(st, &response, sizeof(response)))
+ LOG_PRINTF("Error sending pairing response packet\n");
+
uninit_handshake(st, HANDSHAKE_DONE_KNOWN_HOST);
st->failed_handshakes = 0;
+
} else { /* keys don't match */
+ uint8_t response = REPORT_PAIRING_START;
+ if (send_encrypted_message(st, &response, sizeof(response)))
+ LOG_PRINTF("Error sending pairing response packet\n");
+
uninit_handshake(st, HANDSHAKE_DONE_UNKNOWN_HOST);
st->failed_handshakes++;
}