[PATCH v2 30/50] image: Drop IMAGE_ENABLE_MD5

Simon Glass sjg at chromium.org
Thu May 6 16:24:18 CEST 2021


Add a host Kconfig for MD5. With this we can use CONFIG_IS_ENABLED(MD5)
directly in the host build, so drop the unnecessary indirection.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 common/image-fit.c | 2 +-
 include/image.h    | 8 --------
 tools/Kconfig      | 5 +++++
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index 1ce46a5c72d..19a2d3c91df 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1234,7 +1234,7 @@ int calculate_hash(const void *data, int data_len, const char *algo,
 		sha512_csum_wd((unsigned char *)data, data_len,
 			       (unsigned char *)value, CHUNKSZ_SHA512);
 		*value_len = SHA512_SUM_LEN;
-	} else if (IMAGE_ENABLE_MD5 && strcmp(algo, "md5") == 0) {
+	} else if (CONFIG_IS_ENABLED(MD5) && strcmp(algo, "md5") == 0) {
 		md5_wd((unsigned char *)data, data_len, value, CHUNKSZ_MD5);
 		*value_len = 16;
 	} else {
diff --git a/include/image.h b/include/image.h
index e1e4bf6806f..9f665a597b0 100644
--- a/include/image.h
+++ b/include/image.h
@@ -47,21 +47,13 @@ struct fdt_region;
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 # ifdef CONFIG_SPL_BUILD
-#  ifdef CONFIG_SPL_MD5
-#   define IMAGE_ENABLE_MD5	1
-#  endif
 #  ifdef CONFIG_SPL_FIT_SHA1
 #   define IMAGE_ENABLE_SHA1	1
 #  endif
 # else
-#  define IMAGE_ENABLE_MD5	1
 #  define IMAGE_ENABLE_SHA1	1
 # endif
 
-#ifndef IMAGE_ENABLE_MD5
-#define IMAGE_ENABLE_MD5	0
-#endif
-
 #ifndef IMAGE_ENABLE_SHA1
 #define IMAGE_ENABLE_SHA1	0
 #endif
diff --git a/tools/Kconfig b/tools/Kconfig
index e27826fae9f..bbd6e8b9d79 100644
--- a/tools/Kconfig
+++ b/tools/Kconfig
@@ -69,6 +69,11 @@ config HOST_FIT_VERBOSE
 	help
 	  Support verbose FIT output in the host build
 
+config HOST_MD5
+	def_bool y
+	help
+	  Enable MD5 support in the host build
+
 config HOST_OF_LIBFDT
 	def_bool y
 	help
-- 
2.31.1.607.g51e8a6a459-goog



More information about the U-Boot mailing list