summaryrefslogtreecommitdiffstats
path: root/src/crypto/cipher/aes128_ctr
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-09-01 22:03:43 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-09-01 22:03:43 +0200
commit181715c5bc6e74f87fe284b063ca301a300ad098 (patch)
treed8fd0089df6521cb69d12971efba5d8e90c611cf /src/crypto/cipher/aes128_ctr
parent1a30018711528fe51fb17c70b8c1d9300c925c1c (diff)
downloadfastd-181715c5bc6e74f87fe284b063ca301a300ad098.tar
fastd-181715c5bc6e74f87fe284b063ca301a300ad098.zip
Add alloc helpers for aligned allocations
Diffstat (limited to 'src/crypto/cipher/aes128_ctr')
-rw-r--r--src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c b/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c
index c9adfcd..9611b11 100644
--- a/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c
+++ b/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c
@@ -31,6 +31,7 @@
#include "../../../../crypto.h"
+#include "../../../../alloc.h"
#include <crypto_stream_aes128ctr.h>
@@ -46,10 +47,7 @@ static fastd_cipher_state_t * aes128_ctr_init(const uint8_t *key) {
fastd_block128_t k;
memcpy(k.b, key, sizeof(fastd_block128_t));
- fastd_cipher_state_t *state;
- if (posix_memalign((void **)&state, 16, sizeof(fastd_cipher_state_t)))
- abort();
-
+ fastd_cipher_state_t *state = fastd_new_aligned(fastd_cipher_state_t, 16);
crypto_stream_aes128ctr_beforenm(state->d, k.b);
return state;