summaryrefslogtreecommitdiffstats
path: root/src/method_xsalsa20_poly1305.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-06-15 03:28:42 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-06-15 03:28:42 +0200
commitbffe80f3d28356003c3ca24e3933910d5968697d (patch)
treeef7dd1949f6889f8b68243d66bbeebbdd6f8c1aa /src/method_xsalsa20_poly1305.c
parentb0a169a1465a75592f0083a3e4e17c307878fc73 (diff)
downloadfastd-bffe80f3d28356003c3ca24e3933910d5968697d.tar
fastd-bffe80f3d28356003c3ca24e3933910d5968697d.zip
Avoid using the same handshake key to establish more than one session
This fix prevents a potential attack using intentional packet reordering to initialize more than one session with using the same handshake keys, leading to more that one session to be initialized with the same key data altogether, allowing to decrypt some packets in the worst case.
Diffstat (limited to 'src/method_xsalsa20_poly1305.c')
-rw-r--r--src/method_xsalsa20_poly1305.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/method_xsalsa20_poly1305.c b/src/method_xsalsa20_poly1305.c
index ca928c5..c7fb040 100644
--- a/src/method_xsalsa20_poly1305.c
+++ b/src/method_xsalsa20_poly1305.c
@@ -86,15 +86,12 @@ static size_t method_min_decrypt_head_space(fastd_context *ctx) {
return (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES - NONCEBYTES);
}
-static fastd_method_session_state* method_session_init(fastd_context *ctx, uint8_t *secret, size_t length, bool initiator, fastd_method_session_state *old_session) {
+static fastd_method_session_state* method_session_init(fastd_context *ctx, uint8_t *secret, size_t length, bool initiator) {
int i;
if (length < crypto_secretbox_xsalsa20poly1305_KEYBYTES)
exit_bug(ctx, "xsalsa20-poly1305: tried to init with short secret");
- if (old_session && memcmp(secret, old_session->key, crypto_secretbox_xsalsa20poly1305_KEYBYTES) == 0)
- return NULL;
-
fastd_method_session_state *session = malloc(sizeof(fastd_method_session_state));
session->valid_till = ctx->now;