summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>2018-11-22 11:41:01 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-11-23 09:07:21 +0100
commit6bacf7bd8df889268b9641e27791399831f947d3 (patch)
tree7221336649818e7499d042ed9ab35cf4143257fd
parent999d91b86f2c716d7b625aa7408044b16322411b (diff)
downloadbarebox-6bacf7bd8df889268b9641e27791399831f947d3.tar.gz
barebox-6bacf7bd8df889268b9641e27791399831f947d3.tar.xz
FIT: support hash-1/signature-1 nodes in signature check
The examples in the U-boot docs use "hash-N" and "signature-N" as the names for hash/signature nodes. It seems "@N" was used instead at some point during the development of the FIT format and "-N" is more correct (in fact, dtc throws warnings when using "@N" without a reg attribute). Support for the "@N" node names is preserved for backward compatibility. Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/image-fit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/common/image-fit.c b/common/image-fit.c
index dfd1fa02c9..87a55b7e27 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -392,7 +392,9 @@ static int fit_verify_hash(struct fit_handle *handle, struct device_node *image,
ret = -EINVAL;
}
- hash = of_get_child_by_name(image, "hash@1");
+ hash = of_get_child_by_name(image, "hash-1");
+ if (!hash)
+ hash = of_get_child_by_name(image, "hash@1");
if (!hash) {
if (ret)
pr_err("image %s does not have hashes\n",
@@ -468,7 +470,9 @@ static int fit_image_verify_signature(struct fit_handle *handle,
ret = -EINVAL;
}
- sig_node = of_get_child_by_name(image, "signature@1");
+ sig_node = of_get_child_by_name(image, "signature-1");
+ if (!sig_node)
+ sig_node = of_get_child_by_name(image, "signature@1");
if (!sig_node) {
pr_err("Image %s has no signature\n", image->full_name);
return ret;