diff mbox series

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

Message ID 20190918220140.838-2-rasmus.villemoes@prevas.dk
State RFC
Delegated to: Tom Rini
Headers show
Series collect entropy, populate /chosen/rng-seed | expand

Commit Message

Rasmus Villemoes Sept. 18, 2019, 10:01 p.m. UTC
To be used for statically initializing a sha256 context.

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

Patch

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 */