[PATCH v3 07/23] lib: sha512: prepare for CONFIG_IS_ENABLED changes

Troy Kisky troykiskyboundary at gmail.com
Mon Mar 13 22:31:29 CET 2023


We need to include <linux/kconfig.h> in order to include
files that use CONFIG_IS_ENABLED. TO prepare for that
don't pet the watchdog when USE_HOSTCC is defined.

Signed-off-by: Troy Kisky <troykiskyboundary at gmail.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
---

(no changes since v2)

Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon

 lib/sha512.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/sha512.c b/lib/sha512.c
index fbe8d5f5bfe..a504281bf93 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -13,6 +13,9 @@
 #ifndef USE_HOSTCC
 #include <common.h>
 #include <linux/string.h>
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#define PET_WDG
+#endif
 #else
 #include <string.h>
 #endif /* USE_HOSTCC */
@@ -292,7 +295,7 @@ void sha384_csum_wd(const unsigned char *input, unsigned int ilen,
 		unsigned char *output, unsigned int chunk_sz)
 {
 	sha512_context ctx;
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	const unsigned char *end;
 	unsigned char *curr;
 	int chunk;
@@ -300,7 +303,7 @@ void sha384_csum_wd(const unsigned char *input, unsigned int ilen,
 
 	sha384_starts(&ctx);
 
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	curr = (unsigned char *)input;
 	end = input + ilen;
 	while (curr < end) {
@@ -355,7 +358,7 @@ void sha512_csum_wd(const unsigned char *input, unsigned int ilen,
 		unsigned char *output, unsigned int chunk_sz)
 {
 	sha512_context ctx;
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	const unsigned char *end;
 	unsigned char *curr;
 	int chunk;
@@ -363,7 +366,7 @@ void sha512_csum_wd(const unsigned char *input, unsigned int ilen,
 
 	sha512_starts(&ctx);
 
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	curr = (unsigned char *)input;
 	end = input + ilen;
 	while (curr < end) {
-- 
2.34.1



More information about the U-Boot mailing list