summaryrefslogtreecommitdiffstats
path: root/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-01-27 16:50:00 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-01-27 16:50:00 +0100
commit04beb6dc3ca878aab48f283c1dc6699ca6a8a27b (patch)
tree0a20683c76645e69b7236355df634fdd32842766 /src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
parentbb0235f7d8db0c0ea814118593da973609352089 (diff)
downloadfastd-04beb6dc3ca878aab48f283c1dc6699ca6a8a27b.tar
fastd-04beb6dc3ca878aab48f283c1dc6699ca6a8a27b.zip
Add an aligned uint8_t type data_t and use it to ensure the alignment of various buffers on the stack
Diffstat (limited to 'src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c')
-rw-r--r--src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
index 365f435..5e0c7b2 100644
--- a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
+++ b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
@@ -34,7 +34,7 @@
struct fastd_method_session_state {
fastd_method_common_t common;
- uint8_t key[crypto_secretbox_xsalsa20poly1305_KEYBYTES];
+ data_t key[crypto_secretbox_xsalsa20poly1305_KEYBYTES];
};
@@ -121,7 +121,7 @@ static bool method_encrypt(fastd_context_t *ctx, fastd_peer_t *peer UNUSED, fast
*out = fastd_buffer_alloc(ctx, in.len, 0, 0);
- uint8_t nonce[crypto_secretbox_xsalsa20poly1305_NONCEBYTES] = {};
+ data_t nonce[crypto_secretbox_xsalsa20poly1305_NONCEBYTES] = {};
memcpy_nonce(nonce, session->common.send_nonce);
crypto_secretbox_xsalsa20poly1305(out->data, in.data, in.len, nonce, session->key);
@@ -151,7 +151,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
if (flags)
return false;
- uint8_t nonce[crypto_secretbox_xsalsa20poly1305_NONCEBYTES] = {};
+ data_t nonce[crypto_secretbox_xsalsa20poly1305_NONCEBYTES] = {};
memcpy_nonce(nonce, in_nonce);
fastd_buffer_pull_head_zero(ctx, &in, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES);