summaryrefslogtreecommitdiffstats
path: root/src/crypto/mac/ghash/builtin/ghash_builtin.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-30 05:34:49 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-30 05:35:18 +0100
commitaa1d894e102e23d162b8e2bccd4b3bf1700de2f2 (patch)
tree3027bc84e829650a798071ad9e13f4391260328b /src/crypto/mac/ghash/builtin/ghash_builtin.c
parent5f7258ade2dd8bad076d17d3a85fb04d9bf71bda (diff)
downloadfastd-aa1d894e102e23d162b8e2bccd4b3bf1700de2f2.tar
fastd-aa1d894e102e23d162b8e2bccd4b3bf1700de2f2.zip
Make the crypto implementations independent of fastd.h (and fix more minor bugs)
Diffstat (limited to 'src/crypto/mac/ghash/builtin/ghash_builtin.c')
-rw-r--r--src/crypto/mac/ghash/builtin/ghash_builtin.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/crypto/mac/ghash/builtin/ghash_builtin.c b/src/crypto/mac/ghash/builtin/ghash_builtin.c
index 341408f..c518663 100644
--- a/src/crypto/mac/ghash/builtin/ghash_builtin.c
+++ b/src/crypto/mac/ghash/builtin/ghash_builtin.c
@@ -61,8 +61,10 @@ static inline void mulH_a(fastd_block128_t *x, const fastd_mac_state_t *cstate)
}
-static fastd_mac_state_t* ghash_init(fastd_context_t *ctx UNUSED, const uint8_t *key) {
- fastd_mac_state_t *state = malloc(sizeof(fastd_mac_state_t));
+static fastd_mac_state_t* ghash_init(const uint8_t *key) {
+ fastd_mac_state_t *state;
+ if (posix_memalign((void**)&state, 16, sizeof(fastd_mac_state_t)))
+ abort();
fastd_block128_t Hbase[4];
fastd_block128_t Rbase[4];
@@ -105,7 +107,7 @@ static fastd_mac_state_t* ghash_init(fastd_context_t *ctx UNUSED, const uint8_t
return state;
}
-static bool ghash_hash(fastd_context_t *ctx UNUSED, const fastd_mac_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t n_blocks) {
+static bool ghash_hash(const fastd_mac_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t n_blocks) {
memset(out, 0, sizeof(fastd_block128_t));
size_t i;
@@ -117,7 +119,7 @@ static bool ghash_hash(fastd_context_t *ctx UNUSED, const fastd_mac_state_t *sta
return true;
}
-static void ghash_free(fastd_context_t *ctx UNUSED, fastd_mac_state_t *state) {
+static void ghash_free(fastd_mac_state_t *state) {
if (state) {
secure_memzero(state, sizeof(*state));
free(state);