Skip to contentSkip to conversation

spl: fit: enable hash control even without signature

PATCH New Dario Binacchi 2 participants 2 messages Dec 3, 2019 – Jan 7, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl: fit: enable hash control even without signature

The function "fit_image_verify_with_data" that performs the integrity protection of FIT images is already able to correctly manage the device tree nodes that require signature and/or hash control.
Tests with device tree with or without hash nodes but certainly not signed have given positive results. Furthermore, the hash calculation is performed only if the hash property has been detected, without adding unnecessary calculations.
It is therefore useless and limiting to enable hash control only in the case of a signed image.

---

 common/spl/spl_fit.c | 2 --
 1 file changed, 2 deletions(-)
common/spl/spl_fit.c +0 -2
index cbc00a4e7c..58ba40cb2f 100644
@@ -242,14 +242,12 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 		src = (void *)data;
 	}
 
-#ifdef CONFIG_SPL_FIT_SIGNATURE
 	printf("## Checking hash(es) for Image %s ... ",
 	       fit_get_name(fit, node, NULL));
 	if (!fit_image_verify_with_data(fit, node,
 					 src, length))
 		return -EPERM;
 	puts("OK\n");
-#endif
 
 #ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS
 	board_fit_image_post_process(&src, &length);
Signature · 1 line
2.24.0
#1 lore raw

PATCH 1/1 spl: fit: enable hash control even without signature

Quoted 25 lines · Dario Binacchi

The function "fit_image_verify_with_data" that performs the integrity protection of FIT images is already able to correctly manage the device tree nodes that require signature and/or hash control.
Tests with device tree with or without hash nodes but certainly not signed have given positive results. Furthermore, the hash calculation is performed only if the hash property has been detected, without adding unnecessary calculations.
It is therefore useless and limiting to enable hash control only in the case of a signed image.

---

 common/spl/spl_fit.c | 2 --
 1 file changed, 2 deletions(-)
common/spl/spl_fit.c +0 -1
index cbc00a4e7c..58ba40cb2f 100644
@@ -242,14 +242,12 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 		src = (void *)data;
 	}
 
-#ifdef CONFIG_SPL_FIT_SIGNATURE

common/spl/spl_fit.c static int spl_load_fit_image(struct spl_load_info *info, ulong sector, · line 253

Quoted 10 lines
common/spl/spl_fit.c +0 -1
 	printf("## Checking hash(es) for Image %s ... ",
 	       fit_get_name(fit, node, NULL));
 	if (!fit_image_verify_with_data(fit, node,
 					 src, length))
 		return -EPERM;
 	puts("OK\n");
-#endif
 
 #ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS
 	board_fit_image_post_process(&src, &length);

This makes a massive number (of mainly sunxi boards in SPL) fail to link due to size overflows as we're no longer discarding a lot of code I believe.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200107/5166704b/attachment.sig>