From 71412d723161d14f887e548aca42c51d144e3489 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Cl=C3=A9ment=20P=C3=A9ron?= <peron.clem@gmail.com>
Date: Mon, 30 Apr 2018 11:06:40 +0200
Subject: [PATCH] image: fit: Show signatures and hashes for configurations
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

The signature/hash information are displayed for images but nor for
configurations.

Add subnodes printing in fit_conf_print() like it's done in fit_image_print()

Signed-off-by: Clément Péron <peron.clem@gmail.com>
[trini: Add guards around fit_conf_print to avoid warnings]
Signed-off-by: Tom Rini <trini@konsulko.com>
---
 common/image-fit.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/common/image-fit.c b/common/image-fit.c
index 9798fcd130..5b93dceae1 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1571,6 +1571,7 @@ int fit_conf_get_prop_node(const void *fit, int noffset,
 	return fit_conf_get_prop_node_index(fit, noffset, prop_name, 0);
 }
 
+#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_FIT_SPL_PRINT)
 /**
  * fit_conf_print - prints out the FIT configuration details
  * @fit: pointer to the FIT format image header
@@ -1589,6 +1590,7 @@ void fit_conf_print(const void *fit, int noffset, const char *p)
 	const char *uname;
 	int ret;
 	int fdt_index, loadables_index;
+	int ndepth;
 
 	/* Mandatory properties */
 	ret = fit_get_desc(fit, noffset, &desc);
@@ -1642,7 +1644,18 @@ void fit_conf_print(const void *fit, int noffset, const char *p)
 		}
 		printf("%s\n", uname);
 	}
+
+	/* Process all hash subnodes of the component configuration node */
+	for (ndepth = 0, noffset = fdt_next_node(fit, noffset, &ndepth);
+	     (noffset >= 0) && (ndepth > 0);
+	     noffset = fdt_next_node(fit, noffset, &ndepth)) {
+		if (ndepth == 1) {
+			/* Direct child node of the component configuration node */
+			fit_image_print_verification_data(fit, noffset, p);
+		}
+	}
 }
+#endif /* !defined(CONFIG_SPL_BUILD) || defined(CONFIG_FIT_SPL_PRINT) */
 
 static int fit_image_select(const void *fit, int rd_noffset, int verify)
 {
-- 
2.39.5