diff mbox series

[U-Boot] vboot: Do not use hashed-strings offset

Message ID 20180603144650.0a2f1ac5840f3276efdb8a34@gmail.com
State Changes Requested
Delegated to: Simon Glass
Headers show
Series [U-Boot] vboot: Do not use hashed-strings offset | expand

Commit Message

Teddy Reed June 3, 2018, 6:46 p.m. UTC
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.

Signed-off-by: Teddy Reed <teddy.reed@gmail.com>
---
 common/image-sig.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Simon Glass June 7, 2018, 8:28 p.m. UTC | #1
Hi Teddy,

On 3 June 2018 at 10:46, Teddy Reed <teddy.reed@gmail.com> wrote:
>
> 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.
>
> Signed-off-by: Teddy Reed <teddy.reed@gmail.com>
> ---
>  common/image-sig.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/common/image-sig.c b/common/image-sig.c
> index f65d883..9b0a872 100644
> --- a/common/image-sig.c
> +++ b/common/image-sig.c
> @@ -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?

>                 fdt_regions[count].size = fdt32_to_cpu(strings[1]);
>                 count++;
>         }
> --
> 2.7.4
>

Regards,
Simon
Teddy Reed June 7, 2018, 9:58 p.m. UTC | #2
On Thu, Jun 7, 2018 at 4:28 PM, Simon Glass <sjg@chromium.org> wrote:
> Hi Teddy,
>
> On 3 June 2018 at 10:46, Teddy Reed <teddy.reed@gmail.com> wrote:
>>
>> 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.
>>
>> Signed-off-by: Teddy Reed <teddy.reed@gmail.com>
>> ---
>>  common/image-sig.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/common/image-sig.c b/common/image-sig.c
>> index f65d883..9b0a872 100644
>> --- a/common/image-sig.c
>> +++ b/common/image-sig.c
>> @@ -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!

>
>>                 fdt_regions[count].size = fdt32_to_cpu(strings[1]);
>>                 count++;
>>         }
>> --
>> 2.7.4
>>
>
> Regards,
> Simon
diff mbox series

Patch

diff --git a/common/image-sig.c b/common/image-sig.c
index f65d883..9b0a872 100644
--- a/common/image-sig.c
+++ b/common/image-sig.c
@@ -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++;
 	}