summaryrefslogtreecommitdiffstats
path: root/src/sha256.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-08-15 02:44:26 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-08-15 02:44:26 +0200
commit1bb34487bfe7ecd074b42bafca055adfe89d14df (patch)
tree31eb030c11fa2d7c1422503e481bfb4b8d426d0c /src/sha256.h
parent6ecf69b6e67ff552aaf2ab8062be072aba062e0e (diff)
downloadfastd-1bb34487bfe7ecd074b42bafca055adfe89d14df.tar
fastd-1bb34487bfe7ecd074b42bafca055adfe89d14df.zip
Replace NaCl's HMAC implementation
Diffstat (limited to 'src/sha256.h')
-rw-r--r--src/sha256.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/sha256.h b/src/sha256.h
index c6acadb..acafe7e 100644
--- a/src/sha256.h
+++ b/src/sha256.h
@@ -27,13 +27,23 @@
#ifndef _FASTD_SHA256_H_
#define _FASTD_SHA256_H_
+#include <stdbool.h>
#include <stdint.h>
-#define FASTD_SHA256_HASH_BYTES 32
-#define FASTD_SHA256_HASH_BLOCK_BYTES 32
+#define FASTD_SHA256_HASH_WORDS 8
+#define FASTD_SHA256_BLOCK_WORDS 8
+#define FASTD_HMACSHA256_KEY_WORDS 8
-void fastd_sha256_blocks(uint8_t out[FASTD_SHA256_HASH_BYTES], ...);
+#define FASTD_SHA256_HASH_BYTES (4*FASTD_SHA256_HASH_WORDS)
+#define FASTD_SHA256_BLOCK_BYTES (4*FASTD_SHA256_BLOCK_WORDS)
+
+#define FASTD_HMACSHA256_KEY_BYTES (4*FASTD_HMACSHA256_KEY_WORDS)
+
+
+void fastd_sha256_blocks(uint32_t out[FASTD_SHA256_HASH_WORDS], ...);
+void fastd_hmacsha256_blocks(uint32_t out[FASTD_SHA256_HASH_WORDS], const uint32_t key[FASTD_HMACSHA256_KEY_WORDS], ...);
+bool fastd_hmacsha256_blocks_verify(const uint8_t mac[FASTD_SHA256_HASH_BYTES], const uint32_t key[FASTD_HMACSHA256_KEY_WORDS], ...);
#endif /* _FASTD_SHA256_H_ */