summaryrefslogtreecommitdiffstats
path: root/src/methods
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-03-10 18:04:14 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-03-10 18:04:14 +0100
commit45da9c9f296215a4d9ff77db0e6d48bda105ddee (patch)
treecdf816d309a228d7f3f47370b9f6776b514816d1 /src/methods
parent519972c9c18a103a7689844150c75e939c642115 (diff)
downloadfastd-45da9c9f296215a4d9ff77db0e6d48bda105ddee.tar
fastd-45da9c9f296215a4d9ff77db0e6d48bda105ddee.zip
Remove aligned data_t type again
Diffstat (limited to 'src/methods')
-rw-r--r--src/methods/cipher_test/cipher_test.c4
-rw-r--r--src/methods/common.h2
-rw-r--r--src/methods/composed_gmac/composed_gmac.c10
-rw-r--r--src/methods/generic_gmac/generic_gmac.c6
-rw-r--r--src/methods/generic_poly1305/generic_poly1305.c8
-rw-r--r--src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c6
6 files changed, 18 insertions, 18 deletions
diff --git a/src/methods/cipher_test/cipher_test.c b/src/methods/cipher_test/cipher_test.c
index f6e01d0..a033e40 100644
--- a/src/methods/cipher_test/cipher_test.c
+++ b/src/methods/cipher_test/cipher_test.c
@@ -117,7 +117,7 @@ static bool method_encrypt(fastd_context_t *ctx, fastd_peer_t *peer UNUSED, fast
if (tail_len)
memset(in.data+in.len, 0, tail_len);
- data_t nonce[session->method->cipher_info->iv_length];
+ uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
fastd_method_expand_nonce(nonce, session->common.send_nonce, sizeof(nonce));
int n_blocks = block_count(in.len, sizeof(fastd_block128_t));
@@ -156,7 +156,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
if (flags)
return false;
- data_t nonce[session->method->cipher_info->iv_length];
+ uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
fastd_method_expand_nonce(nonce, in_nonce, sizeof(nonce));
size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len;
diff --git a/src/methods/common.h b/src/methods/common.h
index 76fcb75..b01401b 100644
--- a/src/methods/common.h
+++ b/src/methods/common.h
@@ -108,7 +108,7 @@ static inline bool fastd_method_handle_common_header(fastd_context_t *ctx, const
}
-static inline void fastd_method_expand_nonce(data_t *buf, const uint8_t nonce[COMMON_NONCEBYTES], size_t len) {
+static inline void fastd_method_expand_nonce(uint8_t *buf, const uint8_t nonce[COMMON_NONCEBYTES], size_t len) {
if (!len)
return;
diff --git a/src/methods/composed_gmac/composed_gmac.c b/src/methods/composed_gmac/composed_gmac.c
index 823939c..512cba0 100644
--- a/src/methods/composed_gmac/composed_gmac.c
+++ b/src/methods/composed_gmac/composed_gmac.c
@@ -131,7 +131,7 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, c
fastd_block128_t H;
size_t gmac_iv_length = method->gmac_cipher_info->iv_length;
- data_t zeroiv[gmac_iv_length];
+ uint8_t zeroiv[gmac_iv_length] __attribute__((aligned(8)));
memset(zeroiv, 0, gmac_iv_length);
if (!session->gmac_cipher->crypt(session->gmac_cipher_state, &H, &ZERO_BLOCK, sizeof(fastd_block128_t), zeroiv)) {
@@ -196,13 +196,13 @@ static bool method_encrypt(fastd_context_t *ctx, fastd_peer_t *peer UNUSED, fast
fastd_block128_t *outblocks = out->data;
fastd_block128_t tag;
- data_t gmac_nonce[session->method->gmac_cipher_info->iv_length];
+ uint8_t gmac_nonce[session->method->gmac_cipher_info->iv_length] __attribute__((aligned(8)));
fastd_method_expand_nonce(gmac_nonce, session->common.send_nonce, sizeof(gmac_nonce));
bool ok = session->gmac_cipher->crypt(session->gmac_cipher_state, outblocks, &ZERO_BLOCK, sizeof(fastd_block128_t), gmac_nonce);
if (ok) {
- data_t nonce[session->method->cipher_info->iv_length];
+ uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
fastd_method_expand_nonce(nonce, session->common.send_nonce, sizeof(nonce));
ok = session->cipher->crypt(session->cipher_state, outblocks+1, inblocks, n_blocks*sizeof(fastd_block128_t), nonce);
@@ -248,10 +248,10 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
if (flags)
return false;
- data_t nonce[session->method->cipher_info->iv_length];
+ uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
fastd_method_expand_nonce(nonce, in_nonce, sizeof(nonce));
- data_t gmac_nonce[session->method->gmac_cipher_info->iv_length];
+ uint8_t gmac_nonce[session->method->gmac_cipher_info->iv_length] __attribute__((aligned(8)));
fastd_method_expand_nonce(gmac_nonce, in_nonce, sizeof(gmac_nonce));
size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len;
diff --git a/src/methods/generic_gmac/generic_gmac.c b/src/methods/generic_gmac/generic_gmac.c
index a93dcb4..add663a 100644
--- a/src/methods/generic_gmac/generic_gmac.c
+++ b/src/methods/generic_gmac/generic_gmac.c
@@ -106,7 +106,7 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, c
fastd_block128_t H;
size_t iv_length = method->cipher_info->iv_length;
- data_t zeroiv[iv_length];
+ uint8_t zeroiv[iv_length] __attribute__((aligned(8)));
memset(zeroiv, 0, iv_length);
if (!session->cipher->crypt(session->cipher_state, &H, &zeroblock, sizeof(fastd_block128_t), zeroiv)) {
@@ -164,7 +164,7 @@ static bool method_encrypt(fastd_context_t *ctx, fastd_peer_t *peer UNUSED, fast
if (tail_len)
memset(in.data+in.len, 0, tail_len);
- data_t nonce[session->method->cipher_info->iv_length];
+ uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
fastd_method_expand_nonce(nonce, session->common.send_nonce, sizeof(nonce));
int n_blocks = block_count(in.len, sizeof(fastd_block128_t));
@@ -215,7 +215,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
if (flags)
return false;
- data_t nonce[session->method->cipher_info->iv_length];
+ uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
fastd_method_expand_nonce(nonce, in_nonce, sizeof(nonce));
size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len;
diff --git a/src/methods/generic_poly1305/generic_poly1305.c b/src/methods/generic_poly1305/generic_poly1305.c
index b65f35b..318e640 100644
--- a/src/methods/generic_poly1305/generic_poly1305.c
+++ b/src/methods/generic_poly1305/generic_poly1305.c
@@ -126,14 +126,14 @@ static bool method_encrypt(fastd_context_t *ctx, fastd_peer_t *peer UNUSED, fast
if (tail_len)
memset(in.data+in.len, 0, tail_len);
- data_t nonce[session->method->cipher_info->iv_length];
+ uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
fastd_method_expand_nonce(nonce, session->common.send_nonce, sizeof(nonce));
int n_blocks = block_count(in.len, sizeof(fastd_block128_t));
fastd_block128_t *inblocks = in.data;
fastd_block128_t *outblocks = out->data;
- data_t tag[TAGBYTES];
+ uint8_t tag[TAGBYTES] __attribute__((aligned(8)));
bool ok = session->cipher->crypt(session->cipher_state, outblocks, inblocks, n_blocks*sizeof(fastd_block128_t), nonce);
@@ -171,10 +171,10 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
if (flags)
return false;
- data_t nonce[session->method->cipher_info->iv_length];
+ uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
fastd_method_expand_nonce(nonce, in_nonce, sizeof(nonce));
- data_t tag[TAGBYTES];
+ uint8_t tag[TAGBYTES] __attribute__((aligned(8)));
fastd_buffer_push_head_to(ctx, &in, tag, TAGBYTES);
fastd_buffer_pull_head_zero(ctx, &in, KEYBYTES);
diff --git a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
index 5e0c7b2..cb01e0f 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;
- data_t key[crypto_secretbox_xsalsa20poly1305_KEYBYTES];
+ uint8_t key[crypto_secretbox_xsalsa20poly1305_KEYBYTES] __attribute__((aligned(8)));
};
@@ -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);
- data_t nonce[crypto_secretbox_xsalsa20poly1305_NONCEBYTES] = {};
+ uint8_t nonce[crypto_secretbox_xsalsa20poly1305_NONCEBYTES] __attribute__((aligned(8))) = {};
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;
- data_t nonce[crypto_secretbox_xsalsa20poly1305_NONCEBYTES] = {};
+ uint8_t nonce[crypto_secretbox_xsalsa20poly1305_NONCEBYTES] __attribute__((aligned(8))) = {};
memcpy_nonce(nonce, in_nonce);
fastd_buffer_pull_head_zero(ctx, &in, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES);