lib: rsa: rsa-verify: don't look for keys in the FIT image
PATCH 1/1 lib: rsa: rsa-verify: don't look for keys in the FIT image
In the function rsa_verify_hash, if the "main" key doesn't work, u-boot try others keys. But it searches those keys in the FIT image instead of the u-boot device tree.
--- lib/rsa/rsa-verify.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/rsa/rsa-verify.c +2 -2
@@ -522,10 +522,10 @@ int rsa_verify_hash(struct image_sign_info *info,return ret;/* No luck, so try each of the keys in turn */ -for (ndepth =0 , noffset =fdt_next_node (info->fit, sig_node, +for (ndepth =0 , noffset =fdt_next_node (blob, sig_node, &ndepth); (noffset >=0 ) && (ndepth >0 ); - noffset =fdt_next_node (info->fit, noffset, &ndepth)) { + noffset =fdt_next_node (blob, noffset, &ndepth)) {if (ndepth ==1 && noffset != node) { ret = rsa_verify_with_keynode(info, hash, sig, sig_len,
Signature · 1 line
2.17.1
PATCH 1/1 lib: rsa: rsa-verify: don't look for keys in the FIT image
On 1/12/21 12:18 PM, Philippe Reynes wrote:
Hi Philippe,
Quoted 16 lines
In the function
rsa_verify_hash, if the "main" key doesn't work, u-boot try others keys. But it searches those keys in the FIT image instead of the u-boot device tree.Signed-off-by Philippe Reynes <[email protected]>--- lib/rsa/rsa-verify.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)lib/rsa/rsa-verify.c +0
-0@@ -522,10 +522,10 @@ int rsa_verify_hash(struct image_sign_info *info,return ret;
lib/rsa/rsa-verify.c int rsa_verify_hash(struct image_sign_info *info, · line 531
Quoted 10 lines
lib/rsa/rsa-verify.c +2
-2/* No luck, so try each of the keys in turn */ -for (ndepth =0 , noffset =fdt_next_node (info->fit, sig_node, +for (ndepth =0 , noffset =fdt_next_node (blob, sig_node, &ndepth); (noffset >=0 ) && (ndepth >0 ); - noffset =fdt_next_node (info->fit, noffset, &ndepth)) { + noffset =fdt_next_node (blob, noffset, &ndepth)) {if (ndepth ==1 && noffset != node) { ret = rsa_verify_with_keynode(info, hash, sig, sig_len,
I was looking at this code ot too long ago and didn't notice the inconsistency. I think it would be better to use 'info->fdt_blob' and get rid of 'blob' completely.
Alex
PATCH 1/1 lib: rsa: rsa-verify: don't look for keys in the FIT image
Hi Alex
Le 12/01/2021 ? 19:30, Alex G. a ?crit?:
Quoted 25 lines · Philippe Reynes
Hi Philippe,
Quoted 21 lines
In the function
rsa_verify_hash, if the "main" key doesn't work, u-boot try others keys. But it searches those keys in the FIT image instead of the u-boot device tree.Signed-off-by Philippe Reynes <[email protected]>---
?lib/rsa/rsa-verify.c| 4 ++--
? 1 file changed, 2 insertions(+), 2 deletions(-)lib/rsa/rsa-verify.c +0
-0@@ -522,10 +522,10 @@ int rsa_verify_hash(struct image_sign_info *info, ????????????? return ret;? ????????? /* No luck, so try each of the keys in turn */ -??????? for (ndepth = 0, noffset = fdt_next_node(info->fit,
sig_node, +??????? for (ndepth = 0, noffset =fdt_next_node(blob, sig_node, ?????????????????????????????? &ndepth);
?????????????? (noffset >= 0) && (ndepth > 0); -???????????? noffset =fdt_next_node(info->fit, noffset, &ndepth)) {
Quoted 9 lines
Quoted 4 lines
+???????????? noffset =
fdt_next_node(blob, noffset, &ndepth)) { ????????????? if (ndepth == 1 && noffset != node) { ????????????????? ret = rsa_verify_with_keynode(info, hash, ??????????????????????????????????? sig,sig_len,I was looking at this code ot too long ago and didn't notice the inconsistency. I think it would be better to use '
info->fdt_blob' and get rid of 'blob' completely.
The variable blob is also used in function rsa_verify_with_keynode. So it is the coding style for this part of code.
If you prefer to change this coding style and remove this variable blob to use directly info->fdt_blob or rename this variable blob to fdt_blob, I can send another patch to change it.
What other people (and you) think about this proposal ?
Quoted 1 line
Alex
Regards,
Philippe
PATCH 1/1 lib: rsa: rsa-verify: don't look for keys in the FIT image
In reply to Philippe ReynesHi ,
Quoted 17 lines · Philippe Reynes
In the function
rsa_verify_hash, if the "main" key doesn't work, u-boot try others keys. But it searches those keys in the FIT image instead of the u-boot device tree.Signed-off-by Philippe Reynes <[email protected]>--- lib/rsa/rsa-verify.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)lib/rsa/rsa-verify.c +0
-0@@ -522,10 +522,10 @@ int rsa_verify_hash(struct image_sign_info *info,return ret;
lib/rsa/rsa-verify.c int rsa_verify_hash(struct image_sign_info *info, · line 531
Quoted 10 lines
lib/rsa/rsa-verify.c +2
-2/* No luck, so try each of the keys in turn */ -for (ndepth =0 , noffset =fdt_next_node (info->fit, sig_node, +for (ndepth =0 , noffset =fdt_next_node (blob, sig_node, &ndepth); (noffset >=0 ) && (ndepth >0 ); - noffset =fdt_next_node (info->fit, noffset, &ndepth)) { + noffset =fdt_next_node (blob, noffset, &ndepth)) {if (ndepth ==1 && noffset != node) { ret = rsa_verify_with_keynode(info, hash, sig, sig_len,
But I wonder how this is not caught by tests? Can you look into that please? We are obviously missing a test case.
- Simon
PATCH 1/1 lib: rsa: rsa-verify: don't look for keys in the FIT image
In reply to Philippe ReynesQuoted 6 lines · Philippe Reynes
In the function
rsa_verify_hash, if the "main" key doesn't work, u-boot try others keys. But it searches those keys in the FIT image instead of the u-boot device tree.Signed-off-by Philippe Reynes <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210128/7055284d/attachment.sig>