summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-08-17 10:22:15 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-08-17 10:22:15 +0200
commit49cb21b22d72169517c8a2137db8bcac883ad2cc (patch)
treebd6461616c4290fbe55e5d45ae70b31efc93b9d6 /src
parent00d7406fe26bbcbad2945a0b4e3666dd991daac4 (diff)
downloadfastd-49cb21b22d72169517c8a2137db8bcac883ad2cc.tar
fastd-49cb21b22d72169517c8a2137db8bcac883ad2cc.zip
Make handshake records const uint8_t* instead of void*
This enforces explicit casting and thus avoids alignment problems.
Diffstat (limited to 'src')
-rw-r--r--src/handshake.c6
-rw-r--r--src/handshake.h2
-rw-r--r--src/protocol_ec25519_fhmqvc.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/handshake.c b/src/handshake.c
index b58745c..d74436f 100644
--- a/src/handshake.c
+++ b/src/handshake.c
@@ -164,8 +164,8 @@ fastd_buffer_t fastd_handshake_new_reply(fastd_context_t *ctx, const fastd_hands
return buffer;
}
-static fastd_string_stack_t* parse_string_list(uint8_t *data, size_t len) {
- uint8_t *end = data+len;
+static fastd_string_stack_t* parse_string_list(const uint8_t *data, size_t len) {
+ const uint8_t *end = data+len;
fastd_string_stack_t *ret = NULL;
while (data < end) {
@@ -320,7 +320,7 @@ void fastd_handshake_handle(fastd_context_t *ctx, fastd_socket_t *sock, const fa
const fastd_method_t *method = ctx->conf->method_default;
if (handshake.records[RECORD_METHOD_NAME].data) {
- method = method_from_name(ctx, handshake.records[RECORD_METHOD_NAME].data, handshake.records[RECORD_METHOD_NAME].length);
+ method = method_from_name(ctx, (const char*)handshake.records[RECORD_METHOD_NAME].data, handshake.records[RECORD_METHOD_NAME].length);
}
/*
diff --git a/src/handshake.h b/src/handshake.h
index 1c349da..70a1c6c 100644
--- a/src/handshake.h
+++ b/src/handshake.h
@@ -59,7 +59,7 @@ typedef enum fastd_reply_code {
typedef struct fastd_handshake_record {
size_t length;
- void *data;
+ const uint8_t *data;
} fastd_handshake_record_t;
struct fastd_handshake {
diff --git a/src/protocol_ec25519_fhmqvc.c b/src/protocol_ec25519_fhmqvc.c
index f96e8c4..cd4eb30 100644
--- a/src/protocol_ec25519_fhmqvc.c
+++ b/src/protocol_ec25519_fhmqvc.c
@@ -707,7 +707,7 @@ static void protocol_handshake_handle(fastd_context_t *ctx, fastd_socket_t *sock
}
if (handshake->records[RECORD_VERSION_NAME].data)
- peer_version_name = strndup(handshake->records[RECORD_VERSION_NAME].data, handshake->records[RECORD_VERSION_NAME].length);
+ peer_version_name = strndup((const char*)handshake->records[RECORD_VERSION_NAME].data, handshake->records[RECORD_VERSION_NAME].length);
pr_verbose(ctx, "received handshake from %P[%I] using fastd %s", peer, remote_addr, peer_version_name);
free(peer_version_name);
@@ -730,7 +730,7 @@ static void protocol_handshake_handle(fastd_context_t *ctx, fastd_socket_t *sock
}
if (handshake->records[RECORD_VERSION_NAME].data)
- peer_version_name = strndup(handshake->records[RECORD_VERSION_NAME].data, handshake->records[RECORD_VERSION_NAME].length);
+ peer_version_name = strndup((const char*)handshake->records[RECORD_VERSION_NAME].data, handshake->records[RECORD_VERSION_NAME].length);
pr_verbose(ctx, "received handshake response from %P[%I] using fastd %s", peer, remote_addr, peer_version_name);
free(peer_version_name);