From 6868400686d0726ac2c08d67ed896f2c76e7b219 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Sat, 5 Nov 2016 11:47:40 +0200 Subject: [PATCH] lib: Move sha context and result size to new header This is to prepare for SHA3 inclusion --- src/lib/Makefile.am | 1 + src/lib/sha-common.h | 9 +++++++++ src/lib/sha2.h | 7 +------ 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 src/lib/sha-common.h diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 7d2047f516..b9ea209c0c 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -269,6 +269,7 @@ headers = \ safe-mkstemp.h \ sendfile-util.h \ seq-range-array.h \ + sha-common.h \ sha1.h \ sha2.h \ sort.h \ diff --git a/src/lib/sha-common.h b/src/lib/sha-common.h new file mode 100644 index 0000000000..47c58feac1 --- /dev/null +++ b/src/lib/sha-common.h @@ -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 diff --git a/src/lib/sha2.h b/src/lib/sha2.h index b04f93ae5a..5d9d2f0b04 100644 --- a/src/lib/sha2.h +++ b/src/lib/sha2.h @@ -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;