summaryrefslogtreecommitdiffstats
path: root/src/method_xsalsa20_poly1305.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-03-02 14:25:06 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-03-02 14:25:06 +0100
commit84413b1fe3811b2d07e0be4602c817580a3e4e92 (patch)
tree2595bff6fce049b6c54792be8fc094c3d1ea0e33 /src/method_xsalsa20_poly1305.c
parent65af86308981328697bbf06b0818dd4e4f8dfc58 (diff)
downloadfastd-84413b1fe3811b2d07e0be4602c817580a3e4e92.tar
fastd-84413b1fe3811b2d07e0be4602c817580a3e4e92.zip
Print error message on aborts due to buffer push/pull errors
Diffstat (limited to 'src/method_xsalsa20_poly1305.c')
-rw-r--r--src/method_xsalsa20_poly1305.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/method_xsalsa20_poly1305.c b/src/method_xsalsa20_poly1305.c
index 4cadca9..2de5c2b 100644
--- a/src/method_xsalsa20_poly1305.c
+++ b/src/method_xsalsa20_poly1305.c
@@ -137,7 +137,7 @@ static void method_session_free(fastd_context_t *ctx, fastd_method_session_state
}
static bool method_encrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
- fastd_buffer_pull_head(&in, crypto_secretbox_xsalsa20poly1305_ZEROBYTES);
+ fastd_buffer_pull_head(ctx, &in, crypto_secretbox_xsalsa20poly1305_ZEROBYTES);
memset(in.data, 0, crypto_secretbox_xsalsa20poly1305_ZEROBYTES);
*out = fastd_buffer_alloc(ctx, in.len, 0, 0);
@@ -150,7 +150,7 @@ static bool method_encrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
fastd_buffer_free(in);
- fastd_buffer_push_head(out, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES-NONCEBYTES);
+ fastd_buffer_push_head(ctx, out, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES-NONCEBYTES);
memcpy(out->data, session->send_nonce, NONCEBYTES);
increment_nonce(session->send_nonce);
@@ -181,7 +181,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
return false;
}
- fastd_buffer_pull_head(&in, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES-NONCEBYTES);
+ fastd_buffer_pull_head(ctx, &in, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES-NONCEBYTES);
memset(in.data, 0, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES);
*out = fastd_buffer_alloc(ctx, in.len, 0, 0);
@@ -190,7 +190,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
fastd_buffer_free(*out);
/* restore input buffer */
- fastd_buffer_push_head(&in, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES-NONCEBYTES);
+ fastd_buffer_push_head(ctx, &in, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES-NONCEBYTES);
memcpy(in.data, nonce, NONCEBYTES);
return false;
}
@@ -213,7 +213,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
session->receive_reorder_seen |= (1 << (age-1));
}
- fastd_buffer_push_head(out, crypto_secretbox_xsalsa20poly1305_ZEROBYTES);
+ fastd_buffer_push_head(ctx, out, crypto_secretbox_xsalsa20poly1305_ZEROBYTES);
return true;
}