summaryrefslogtreecommitdiffstats
path: root/src/crypto/mac/ghash/builtin
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-08-25 00:09:19 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-08-25 00:09:19 +0200
commitf2d84afd9d8373bf2778d1a1635384000c03f887 (patch)
tree42af8a7430278871e3a1b1e14006099aa50eae80 /src/crypto/mac/ghash/builtin
parent9855a34f48acf6ae3aaeba9ec37756da41507e64 (diff)
downloadfastd-f2d84afd9d8373bf2778d1a1635384000c03f887.tar
fastd-f2d84afd9d8373bf2778d1a1635384000c03f887.zip
MAC: rename hash() to digest() and change length unit from blocks to bytes
Diffstat (limited to 'src/crypto/mac/ghash/builtin')
-rw-r--r--src/crypto/mac/ghash/builtin/ghash_builtin.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/crypto/mac/ghash/builtin/ghash_builtin.c b/src/crypto/mac/ghash/builtin/ghash_builtin.c
index 981b588..32ed5e7 100644
--- a/src/crypto/mac/ghash/builtin/ghash_builtin.c
+++ b/src/crypto/mac/ghash/builtin/ghash_builtin.c
@@ -31,6 +31,7 @@
#include "../../../../crypto.h"
+#include "../../../../log.h"
/** MAC state used by this GHASH implmentation */
@@ -119,7 +120,12 @@ static fastd_mac_state_t * ghash_init(const uint8_t *key) {
}
/** Calculates the GHASH of the supplied blocks */
-static bool ghash_hash(const fastd_mac_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t n_blocks) {
+static bool ghash_digest(const fastd_mac_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t length) {
+ if (length % sizeof(fastd_block128_t))
+ exit_bug("ghash_digest (builtin): invalid length");
+
+ size_t n_blocks = length / sizeof(fastd_block128_t);
+
memset(out, 0, sizeof(fastd_block128_t));
size_t i;
@@ -142,6 +148,6 @@ static void ghash_free(fastd_mac_state_t *state) {
/** The builtin GHASH implementation */
const fastd_mac_t fastd_mac_ghash_builtin = {
.init = ghash_init,
- .hash = ghash_hash,
+ .digest = ghash_digest,
.free = ghash_free,
};