On 2025/3/29 23:06, Jonas Karlman wrote:
Use of SHA256 checksum validation on ARMv7 SoCs can be very time
consuming compared to ARMv8 SoCs with Crypto Extensions.

Add support for use of the crc32 hash algo when SHA256 is not supported.
Also use a HAS_HASH to simplify the ifdefs when no known hash algo is
compiled.

Signed-off-by: Jonas Karlman <jo...@kwiboo.se>
Reviewed-by: Kever Yang <kever.y...@rock-chips.com>

Thanks,
- Kever
---
Changes in v4:
- New patch
---
  arch/arm/dts/rockchip-u-boot.dtsi | 30 ++++++++++++++++++++----------
  1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/arch/arm/dts/rockchip-u-boot.dtsi 
b/arch/arm/dts/rockchip-u-boot.dtsi
index 65b81bf58626..0dfd45bb9bed 100644
--- a/arch/arm/dts/rockchip-u-boot.dtsi
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -19,10 +19,20 @@
  #define COMP  "none"
  #endif
+#if defined(CONFIG_SPL_SHA256)
+#define HASH   "sha256"
+#elif defined(CONFIG_SPL_CRC32)
+#define HASH   "crc32"
+#endif
+
  #if defined(CONFIG_SPL_FIT) && (defined(CONFIG_ARM64) || 
defined(CONFIG_SPL_OPTEE_IMAGE))
  #define HAS_FIT
  #endif
+#if defined(CONFIG_SPL_FIT_SIGNATURE) && defined(HASH)
+#define HAS_HASH
+#endif
+
  / {
        binman: binman {
                multiple-images;
@@ -55,9 +65,9 @@
                                u-boot-nodtb {
                                        compress = COMP;
                                };
-#ifdef CONFIG_SPL_FIT_SIGNATURE
+#ifdef HAS_HASH
                                hash {
-                                       algo = "sha256";
+                                       algo = HASH;
                                };
  #endif
                        };
@@ -76,9 +86,9 @@
atf-bl31 {
                                };
-#ifdef CONFIG_SPL_FIT_SIGNATURE
+#ifdef HAS_HASH
                                hash {
-                                       algo = "sha256";
+                                       algo = HASH;
                                };
  #endif
                        };
@@ -96,9 +106,9 @@
                                tee-os {
                                        optional;
                                };
-#ifdef CONFIG_SPL_FIT_SIGNATURE
+#ifdef HAS_HASH
                                hash {
-                                       algo = "sha256";
+                                       algo = HASH;
                                };
  #endif
                        };
@@ -114,9 +124,9 @@
tee-os {
                                };
-#ifdef CONFIG_SPL_FIT_SIGNATURE
+#ifdef HAS_HASH
                                hash {
-                                       algo = "sha256";
+                                       algo = HASH;
                                };
  #endif
                        };
@@ -126,9 +136,9 @@
                                description = "fdt-NAME";
                                compression = "none";
                                type = "flat_dt";
-#ifdef CONFIG_SPL_FIT_SIGNATURE
+#ifdef HAS_HASH
                                hash {
-                                       algo = "sha256";
+                                       algo = HASH;
                                };
  #endif
                        };

Reply via email to