changeset 21069:d6ef8ebd03b5

lib: Move sha context and result size to new header This is to prepare for SHA3 inclusion
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Sat, 05 Nov 2016 11:47:40 +0200
parents e2a6c85daaf0
children c50031ebc182
files src/lib/Makefile.am src/lib/sha-common.h src/lib/sha2.h
diffstat 3 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/Makefile.am	Fri Nov 04 12:18:47 2016 +0200
+++ b/src/lib/Makefile.am	Sat Nov 05 11:47:40 2016 +0200
@@ -266,6 +266,7 @@
 	safe-mkstemp.h \
 	sendfile-util.h \
 	seq-range-array.h \
+	sha-common.h \
 	sha1.h \
 	sha2.h \
 	sort.h \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib/sha-common.h	Sat Nov 05 11:47:40 2016 +0200
@@ -0,0 +1,9 @@
+#ifndef SHA_COMMON
+
+#define SHA256_RESULTLEN (256 / 8)
+#define SHA256_BLOCK_SIZE (512 / 8)
+
+#define SHA512_RESULTLEN (512 / 8)
+#define SHA512_BLOCK_SIZE (1024 / 8)
+
+#endif
--- a/src/lib/sha2.h	Fri Nov 04 12:18:47 2016 +0200
+++ b/src/lib/sha2.h	Sat Nov 05 11:47:40 2016 +0200
@@ -35,12 +35,7 @@
 #define SHA2_H
 
 #include "hash-method.h"
-
-#define SHA256_RESULTLEN (256 / 8)
-#define SHA256_BLOCK_SIZE (512 / 8)
-
-#define SHA512_RESULTLEN (512 / 8)
-#define SHA512_BLOCK_SIZE (1024 / 8)
+#include "sha-common.h"
 
 struct sha256_ctx {
 	size_t tot_len;