[U-Boot] [RFC PATCH 1/3] u-boot/sha256.h: add SHA256_INIT macro

Rasmus Villemoes rasmus.villemoes at prevas.dk
Wed Sep 18 22:01:52 UTC 2019


To be used for statically initializing a sha256 context.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
---
 include/u-boot/sha256.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/u-boot/sha256.h b/include/u-boot/sha256.h
index 9aa1251789..10f42091ee 100644
--- a/include/u-boot/sha256.h
+++ b/include/u-boot/sha256.h
@@ -22,4 +22,15 @@ void sha256_finish(sha256_context * ctx, uint8_t digest[SHA256_SUM_LEN]);
 void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
 		unsigned char *output, unsigned int chunk_sz);
 
+#define SHA256_INIT {				\
+		.state[0] = 0x6A09E667,		\
+		.state[1] = 0xBB67AE85,		\
+		.state[2] = 0x3C6EF372,		\
+		.state[3] = 0xA54FF53A,		\
+		.state[4] = 0x510E527F,		\
+		.state[5] = 0x9B05688C,		\
+		.state[6] = 0x1F83D9AB,		\
+		.state[7] = 0x5BE0CD19,		\
+	}
+
 #endif /* _SHA256_H */
-- 
2.20.1



More information about the U-Boot mailing list