summaryrefslogtreecommitdiffstats
path: root/src/method_xsalsa20_poly1305.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-08-20 06:52:03 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-08-20 06:52:03 +0200
commitf6640a80f4be19e988fd7426c3f897f4d3f614e4 (patch)
tree3b6764fc547ee9ea1559ed1fb2c9b4fd4eb0726a /src/method_xsalsa20_poly1305.c
parentd9dc87d8409ddf8361b7fcb311ae97088ed1d984 (diff)
downloadfastd-f6640a80f4be19e988fd7426c3f897f4d3f614e4.tar
fastd-f6640a80f4be19e988fd7426c3f897f4d3f614e4.zip
Prevent zero-before-free operations from being optimized out
Diffstat (limited to 'src/method_xsalsa20_poly1305.c')
-rw-r--r--src/method_xsalsa20_poly1305.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/method_xsalsa20_poly1305.c b/src/method_xsalsa20_poly1305.c
index 1e26247..9bcf5ed 100644
--- a/src/method_xsalsa20_poly1305.c
+++ b/src/method_xsalsa20_poly1305.c
@@ -131,7 +131,7 @@ static bool method_session_want_refresh(fastd_context_t *ctx, fastd_method_sessi
static void method_session_free(fastd_context_t *ctx UNUSED, fastd_method_session_state_t *session) {
if(session) {
- memset(session, 0, sizeof(fastd_method_session_state_t));
+ secure_memzero(session, sizeof(fastd_method_session_state_t));
free(session);
}
}
@@ -180,7 +180,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
if (age > ctx->conf->reorder_count)
return false;
}
-
+
fastd_buffer_pull_head(ctx, &in, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES-NONCEBYTES);
memset(in.data, 0, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES);