From 9a4f479b649a611478ff1b983c9a30f9150a696b Mon Sep 17 00:00:00 2001
From: Dirk Eibach <dirk.eibach@gdsys.cc>
Date: Thu, 3 Jul 2014 09:28:26 +0200
Subject: [PATCH] fit: make sha256 support optional

sha256 has some beefy memory footprint.
Make it optional for constrained systems.

Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc>
---
 README                         | 5 +++++
 include/configs/dlvision-10g.h | 1 +
 include/configs/io.h           | 1 +
 include/configs/iocon.h        | 1 +
 include/configs/neo.h          | 1 +
 include/image.h                | 5 +++++
 6 files changed, 14 insertions(+)

diff --git a/README b/README
index 082bd2ab1c..4ac7399698 100644
--- a/README
+++ b/README
@@ -3269,6 +3269,11 @@ FIT uImage format:
 		disabled. If a board need legacy image format support
 		enable this through CONFIG_IMAGE_FORMAT_LEGACY
 
+		CONFIG_FIT_DISABLE_SHA256
+		Supporting SHA256 hashes has quite an impact on binary size.
+		For constrained systems sha256 hash support can be disabled
+		with this option.
+
 - Standalone program support:
 		CONFIG_STANDALONE_LOAD_ADDR
 
diff --git a/include/configs/dlvision-10g.h b/include/configs/dlvision-10g.h
index 2567a2221d..6153a40e06 100644
--- a/include/configs/dlvision-10g.h
+++ b/include/configs/dlvision-10g.h
@@ -40,6 +40,7 @@
 /* new uImage format support */
 #define CONFIG_FIT
 #define CONFIG_FIT_VERBOSE	/* enable fit_format_{error,warning}() */
+#define CONFIG_FIT_DISABLE_SHA256
 
 #define CONFIG_ENV_IS_IN_FLASH	/* use FLASH for environment vars */
 
diff --git a/include/configs/io.h b/include/configs/io.h
index 649c0fba13..8e32c25803 100644
--- a/include/configs/io.h
+++ b/include/configs/io.h
@@ -40,6 +40,7 @@
 /* new uImage format support */
 #define CONFIG_FIT
 #define CONFIG_FIT_VERBOSE	/* enable fit_format_{error,warning}() */
+#define CONFIG_FIT_DISABLE_SHA256
 
 #define CONFIG_ENV_IS_IN_FLASH	/* use FLASH for environment vars */
 
diff --git a/include/configs/iocon.h b/include/configs/iocon.h
index 35ba1bd248..ae05bcbfbf 100644
--- a/include/configs/iocon.h
+++ b/include/configs/iocon.h
@@ -39,6 +39,7 @@
 /* new uImage format support */
 #define CONFIG_FIT
 #define CONFIG_FIT_VERBOSE	/* enable fit_format_{error,warning}() */
+#define CONFIG_FIT_DISABLE_SHA256
 
 #define CONFIG_ENV_IS_IN_FLASH	/* use FLASH for environment vars */
 
diff --git a/include/configs/neo.h b/include/configs/neo.h
index 75dc862160..4937730ee3 100644
--- a/include/configs/neo.h
+++ b/include/configs/neo.h
@@ -37,6 +37,7 @@
 /* new uImage format support */
 #define CONFIG_FIT
 #define CONFIG_FIT_VERBOSE	/* enable fit_format_{error,warning}() */
+#define CONFIG_FIT_DISABLE_SHA256
 
 #define CONFIG_ENV_IS_IN_FLASH	/* use FLASH for environment vars */
 
diff --git a/include/image.h b/include/image.h
index 0a072f5336..3e8f78d583 100644
--- a/include/image.h
+++ b/include/image.h
@@ -72,6 +72,11 @@ struct lmb;
 #  define IMAGE_ENABLE_SHA256	1
 # endif
 
+#ifdef CONFIG_FIT_DISABLE_SHA256
+#undef CONFIG_SHA256
+#undef IMAGE_ENABLE_SHA256
+#endif
+
 #ifndef IMAGE_ENABLE_CRC32
 #define IMAGE_ENABLE_CRC32	0
 #endif
-- 
2.39.5