summaryrefslogtreecommitdiffstats
path: root/src/handshake.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-10-19 15:54:46 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-10-19 15:54:46 +0200
commit7982387d5fea3dbc4825e0b1eaccd0a2af0eb061 (patch)
treec2532e62aab0466626e8db7a4833e9a0ffe3815d /src/handshake.c
parent6d8aa57c0248d7da1cb2cf3fc3516d785bd4db54 (diff)
downloadfastd-7982387d5fea3dbc4825e0b1eaccd0a2af0eb061.tar
fastd-7982387d5fea3dbc4825e0b1eaccd0a2af0eb061.zip
Add a HMAC to authenticate all handshake TLV
Diffstat (limited to 'src/handshake.c')
-rw-r--r--src/handshake.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/handshake.c b/src/handshake.c
index 5400828..8447b3f 100644
--- a/src/handshake.c
+++ b/src/handshake.c
@@ -45,6 +45,7 @@ static const char *const RECORD_TYPES[RECORD_MAX] = {
"method name",
"version name",
"method list",
+ "handshake message authentication code",
};
static const char *const REPLY_TYPES[REPLY_MAX] = {
@@ -140,7 +141,7 @@ fastd_buffer_t fastd_handshake_new_reply(fastd_context_t *ctx, const fastd_hands
extra_size = 6 + /* MTU */
4+version_len; /* version name */
- fastd_buffer_t buffer = fastd_buffer_alloc(ctx, sizeof(fastd_packet_t), 0,
+ fastd_buffer_t buffer = fastd_buffer_alloc(ctx, sizeof(fastd_packet_t), 1,
2*5 + /* handshake type, reply code */
4+method_len + /* method name */
extra_size +
@@ -183,9 +184,7 @@ void fastd_handshake_handle(fastd_context_t *ctx, fastd_socket_t *sock, const fa
goto end_free;
}
- fastd_handshake_t handshake;
- memset(&handshake, 0, sizeof(handshake));
-
+ fastd_handshake_t handshake = { .buffer = buffer };
fastd_packet_t *packet = buffer.data;
uint8_t *ptr = packet->tlv_data;