summaryrefslogtreecommitdiffstats
path: root/src/handshake.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-10-19 17:57:23 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-10-19 17:57:23 +0200
commit18a3a6468ede6463a7ca2582ca1199af37099eb4 (patch)
tree16e3e9473d0f93ed8ad4649d85b04a7b4976a8c3 /src/handshake.c
parent0ce0b0449082d4ad54d1714d8683d7a9276b3b93 (diff)
downloadfastd-18a3a6468ede6463a7ca2582ca1199af37099eb4.tar
fastd-18a3a6468ede6463a7ca2582ca1199af37099eb4.zip
Authenticate the TLV records only
Diffstat (limited to 'src/handshake.c')
-rw-r--r--src/handshake.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/handshake.c b/src/handshake.c
index 82d47b8..962daa0 100644
--- a/src/handshake.c
+++ b/src/handshake.c
@@ -183,12 +183,11 @@ void fastd_handshake_handle(fastd_context_t *ctx, fastd_socket_t *sock, const fa
goto end_free;
}
- fastd_handshake_t handshake = { .buffer = buffer };
fastd_handshake_packet_t *packet = buffer.data;
size_t len = buffer.len - sizeof(fastd_handshake_packet_t);
if (packet->tlv_len) {
- size_t tlv_len = ntohs(packet->tlv_len);
+ size_t tlv_len = fastd_handshake_tlv_len(&buffer);
if (tlv_len > len) {
pr_warn(ctx, "received a short handshake from %I", remote_addr);
goto end_free;
@@ -198,6 +197,7 @@ void fastd_handshake_handle(fastd_context_t *ctx, fastd_socket_t *sock, const fa
}
uint8_t *ptr = packet->tlv_data, *end = packet->tlv_data + len;
+ fastd_handshake_t handshake = { .tlv_len = len, .tlv_data = packet->tlv_data };
while (true) {
if (ptr+4 > end)