Skip to contentSkip to conversation

vboot: Do not use hashed-strings offset

PATCH New Teddy Reed 2 participants 3 messages Jun 3, 2018 – Jun 7, 2018

lore
Share & tools
lore

Teddy Reed

author
#0 lore raw

PATCH 1/1 vboot: Do not use hashed-strings offset

The hashed-strings signature property includes two uint32_t values. The first is unneeded as there should never be a start offset into the strings region. The second, the size, is needed because the added signature node appends to this region.

See tools/image-host.c, where a static 0 value is used for the offset.

---
 common/image-sig.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
common/image-sig.c +1 -2
index f65d883..9b0a872 100644
@@ -372,8 +372,7 @@ int fit_config_check_sig(const void *fit, int noffset, int required_keynode,
 	/* Add the strings */
 	strings = fdt_getprop(fit, noffset, "hashed-strings", NULL);
 	if (strings) {
-		fdt_regions[count].offset = fdt_off_dt_strings(fit) +
-				fdt32_to_cpu(strings[0]);
+		fdt_regions[count].offset = fdt_off_dt_strings(fit);
 		fdt_regions[count].size = fdt32_to_cpu(strings[1]);
 		count++;
 	}
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 vboot: Do not use hashed-strings offset

Hi Teddy,

Quoted 18 lines · Teddy Reed

The hashed-strings signature property includes two uint32_t values. The first is unneeded as there should never be a start offset into the strings region. The second, the size, is needed because the added signature node appends to this region.

See tools/image-host.c, where a static 0 value is used for the offset.

---
 common/image-sig.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
common/image-sig.c +0 -0
index f65d883..9b0a872 100644

common/image-sig.c int fit_config_check_sig(const void *fit, int noffset, int required_keynode, · line 375

Quoted 6 lines
common/image-sig.c +1 -2
@@ -372,8 +372,7 @@ int fit_config_check_sig(const void *fit, int noffset, int required_keynode,
        /* Add the strings */
        strings = fdt_getprop(fit, noffset, "hashed-strings", NULL);
        if (strings) {
-               fdt_regions[count].offset = fdt_off_dt_strings(fit) +
-                               fdt32_to_cpu(strings[0]);
+               fdt_regions[count].offset = fdt_off_dt_strings(fit);

Can you please add a comment here, and in image-host.c, so that we keep these in sync?

Quoted 6 lines
common/image-sig.c +0 -1
                fdt_regions[count].size = fdt32_to_cpu(strings[1]);
                count++;
        }
--

2.7.4

Regards,
Simon

author
#2 lore raw

PATCH 1/1 vboot: Do not use hashed-strings offset

Quoted 16 lines · Simon Glass

Hi Teddy,

Quoted 13 lines · Teddy Reed

The hashed-strings signature property includes two uint32_t values. The first is unneeded as there should never be a start offset into the strings region. The second, the size, is needed because the added signature node appends to this region.

See tools/image-host.c, where a static 0 value is used for the offset.

---
 common/image-sig.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 14 lines

common/image-sig.c int fit_config_check_sig(const void *fit, int noffset, int required_keynode, · line 375

Quoted 11 lines
common/image-sig.c +1 -2
index f65d883..9b0a872 100644
@@ -372,8 +372,7 @@ int fit_config_check_sig(const void *fit, int noffset, int required_keynode,
        /* Add the strings */
        strings = fdt_getprop(fit, noffset, "hashed-strings", NULL);
        if (strings) {
-               fdt_regions[count].offset = fdt_off_dt_strings(fit) +
-                               fdt32_to_cpu(strings[0]);
+               fdt_regions[count].offset = fdt_off_dt_strings(fit);

Can you please add a comment here, and in image-host.c, so that we keep these in sync?

Will do!

Quoted 10 lines
Quoted 7 lines
common/image-sig.c +0 -1
                fdt_regions[count].size = fdt32_to_cpu(strings[1]);
                count++;
        }
--

2.7.4

Regards,
Simon

Signature · 1 line
Teddy Reed V