summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-10-31 01:28:22 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-10-31 01:28:22 +0100
commit58ec26f6b7a0400c8fa05263be9b19bb179495fd (patch)
treeb424d715e38e29c3579e0e52cfa7f22dfa242b1e
parent763401c89d4f1dd328a5b4b3efae91f076043549 (diff)
downloadfastd-58ec26f6b7a0400c8fa05263be9b19bb179495fd.tar
fastd-58ec26f6b7a0400c8fa05263be9b19bb179495fd.zip
Rename session_init to session_init_compat to prepare for the upcoming new key derivation scheme
-rw-r--r--src/fastd.h2
-rw-r--r--src/methods/aes128_gcm/aes128_gcm.c8
-rw-r--r--src/methods/null/null.c2
-rw-r--r--src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c4
-rw-r--r--src/protocols/ec25519_fhmqvc/handshake.c2
5 files changed, 8 insertions, 10 deletions
diff --git a/src/fastd.h b/src/fastd.h
index f3d67ca..c24781f 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -87,7 +87,7 @@ struct fastd_method {
size_t (*min_encrypt_tail_space)(fastd_context_t *ctx);
size_t (*min_decrypt_tail_space)(fastd_context_t *ctx);
- fastd_method_session_state_t* (*session_init)(fastd_context_t *ctx, uint8_t *secret, size_t length, bool initiator);
+ fastd_method_session_state_t* (*session_init_compat)(fastd_context_t *ctx, uint8_t *secret, size_t length, bool initiator);
bool (*session_is_valid)(fastd_context_t *ctx, fastd_method_session_state_t *session);
bool (*session_is_initiator)(fastd_context_t *ctx, fastd_method_session_state_t *session);
bool (*session_want_refresh)(fastd_context_t *ctx, fastd_method_session_state_t *session);
diff --git a/src/methods/aes128_gcm/aes128_gcm.c b/src/methods/aes128_gcm/aes128_gcm.c
index 0b0ad56..6608618 100644
--- a/src/methods/aes128_gcm/aes128_gcm.c
+++ b/src/methods/aes128_gcm/aes128_gcm.c
@@ -29,8 +29,6 @@
#include "../common.h"
-#define KEYBYTES 16
-
struct fastd_method_session_state {
fastd_method_common_t common;
@@ -61,8 +59,8 @@ static size_t method_min_decrypt_tail_space(fastd_context_t *ctx UNUSED) {
}
-static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, uint8_t *secret, size_t length, bool initiator) {
- if (length < KEYBYTES)
+static fastd_method_session_state_t* method_session_init_key(fastd_context_t *ctx, uint8_t *secret, size_t length, bool initiator) {
+ if (length < sizeof(fastd_block128_t))
exit_bug(ctx, "aes128-gcm: tried to init with short secret");
fastd_method_session_state_t *session = malloc(sizeof(fastd_method_session_state_t));
@@ -232,7 +230,7 @@ const fastd_method_t fastd_method_aes128_gcm = {
.min_encrypt_tail_space = method_min_encrypt_tail_space,
.min_decrypt_tail_space = method_min_decrypt_tail_space,
- .session_init = method_session_init,
+ .session_init_compat = method_session_init_key,
.session_is_valid = method_session_is_valid,
.session_is_initiator = method_session_is_initiator,
.session_want_refresh = method_session_want_refresh,
diff --git a/src/methods/null/null.c b/src/methods/null/null.c
index 720cb79..004bb43 100644
--- a/src/methods/null/null.c
+++ b/src/methods/null/null.c
@@ -84,7 +84,7 @@ const fastd_method_t fastd_method_null = {
.min_encrypt_tail_space = method_min_head_tail_space,
.min_decrypt_tail_space = method_min_head_tail_space,
- .session_init = method_session_init,
+ .session_init_compat = method_session_init,
.session_is_valid = method_session_is_valid,
.session_is_initiator = method_session_is_initiator,
.session_want_refresh = method_session_want_refresh,
diff --git a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
index 825a4b8..964f004 100644
--- a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
+++ b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
@@ -53,7 +53,7 @@ static size_t method_min_tail_space(fastd_context_t *ctx UNUSED) {
return 0;
}
-static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, uint8_t *secret, size_t length, bool initiator) {
+static fastd_method_session_state_t* method_session_init_key(fastd_context_t *ctx, uint8_t *secret, size_t length, bool initiator) {
if (length < crypto_secretbox_xsalsa20poly1305_KEYBYTES)
exit_bug(ctx, "xsalsa20-poly1305: tried to init with short secret");
@@ -161,7 +161,7 @@ const fastd_method_t fastd_method_xsalsa20_poly1305 = {
.min_encrypt_tail_space = method_min_tail_space,
.min_decrypt_tail_space = method_min_tail_space,
- .session_init = method_session_init,
+ .session_init_compat = method_session_init_key,
.session_is_valid = method_session_is_valid,
.session_is_initiator = method_session_is_initiator,
.session_want_refresh = method_session_want_refresh,
diff --git a/src/protocols/ec25519_fhmqvc/handshake.c b/src/protocols/ec25519_fhmqvc/handshake.c
index 75cca96..d1c0bf9 100644
--- a/src/protocols/ec25519_fhmqvc/handshake.c
+++ b/src/protocols/ec25519_fhmqvc/handshake.c
@@ -230,7 +230,7 @@ static bool establish(fastd_context_t *ctx, fastd_peer_t *peer, const char *meth
peer->protocol_state->session.handshakes_cleaned = false;
peer->protocol_state->session.refreshing = false;
peer->protocol_state->session.method = method;
- peer->protocol_state->session.method_state = method->session_init(ctx, hash.b, HASHBYTES, initiator);
+ peer->protocol_state->session.method_state = method->session_init_compat(ctx, hash.b, HASHBYTES, initiator);
peer->protocol_state->last_serial = serial;
fastd_peer_seen(ctx, peer);