linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Jimmy Zhang <jimmzhang-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Allen Martin <AMartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [cbootimage PATCH v5 2/5] Add support to dump rsa related fields for t210
Date: Tue, 13 Oct 2015 10:22:34 -0600	[thread overview]
Message-ID: <561D2FCA.9030607@wwwdotorg.org> (raw)
In-Reply-To: <ab16c6505a7e4e62b726e6433dc585b8-wO81nVYWzR7YuxH7O460wFaTQe2KTcn/@public.gmane.org>

On 10/12/2015 06:56 PM, Jimmy Zhang wrote:
>
>
>> -----Original Message-----
>> From: Stephen Warren [mailto:swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org]
>> Sent: Monday, October 12, 2015 3:51 PM
>> To: Jimmy Zhang
>> Cc: Allen Martin; Stephen Warren; linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Subject: Re: [cbootimage PATCH v5 2/5] Add support to dump rsa related
>> fields for t210
>>
>> On 10/09/2015 07:46 PM, Jimmy Zhang wrote:
>>> Add support to dump rsa pubkey, bct's rsa-pss signature and
>>> bootloader's rsa-pss signature.
>>
>>> diff --git a/src/bct_dump.c b/src/bct_dump.c
>>
>>> +#define ARSE_RSA_PARAM_MAX_BYTES	256
>>>    typedef union {
>>>    	u_int32_t val;
>>>    	u_int8_t uid[16];
>>> +	u_int8_t rsa_param[ARSE_RSA_PARAM_MAX_BYTES];
>>>    } param_types;
>>
>> Shouldn't that be replaced by something that uses the new get_size()
>> functionality now implemented in patch 1?
>
> For this data structure, I guess we better stay with a MAX constant.
>
> For display functions, ie
>
> values[i].format(...)
> bl_values[j].format(...)
>
> There is no id token being passed in. To use get_size(),  all format_xxx function prototype need to be redefined (by adding in id token).
>
> I can submit a new patch if you agree my observations.

If we can't pass the size through all the way to make everything fully 
generic, I'd recommend:

a)

Name the field and MAX_BYES constant something more generic so it could 
be re-used for arbitrary fields, e.g. such as:

#define PARAM_TYPE_BINARY_DATA_MAX_SIZE 256

u_int8_t binary[PARAM_TYPE_BINARY_DATA_MAX_SIZE]

b)

When filling in that field, call get_size() at that point in time, and 
validate that the value is equal to sizeof(binary) or 
PARAM_TYPE_BINARY_DATA_MAX_SIZE. At least that way we'll have a check 
that the sizes do actually match.


Or, perhaps we can make the field:

struct {
     size_t len;
     u_int8_t data[PARAM_TYPE_BINARY_DATA_MAX_SIZE];
} binary;

... and hence pass the size around that way?

  parent reply	other threads:[~2015-10-13 16:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-10  1:46 [cbootimage PATCH v5 0/5] Add RSA signing support Jimmy Zhang
     [not found] ` <1444441574-17205-1-git-send-email-jimmzhang-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-10-10  1:46   ` [cbootimage PATCH v5 1/5] Add support for update pubkey and rsa-pss signatures Jimmy Zhang
     [not found]     ` <1444441574-17205-2-git-send-email-jimmzhang-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-10-12 22:49       ` Stephen Warren
     [not found]         ` <561C38E1.6000103-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-10-13  2:02           ` Jimmy Zhang
     [not found]             ` <6bc0f021797c4eab93749693af343d5a-wO81nVYWzR7YuxH7O460wFaTQe2KTcn/@public.gmane.org>
2015-10-13 16:19               ` Stephen Warren
     [not found]                 ` <561D2F00.7000306-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-10-13 17:32                   ` Jimmy Zhang
2015-10-17  0:21               ` Jimmy Zhang
     [not found]                 ` <bc8eeffeced34fb1b912850b61a161f0-wO81nVYWzR7YuxH7O460wFaTQe2KTcn/@public.gmane.org>
2015-10-19 16:28                   ` Stephen Warren
2015-10-10  1:46   ` [cbootimage PATCH v5 2/5] Add support to dump rsa related fields for t210 Jimmy Zhang
     [not found]     ` <1444441574-17205-3-git-send-email-jimmzhang-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-10-12 22:50       ` Stephen Warren
     [not found]         ` <561C393E.2050707-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-10-13  0:56           ` Jimmy Zhang
     [not found]             ` <ab16c6505a7e4e62b726e6433dc585b8-wO81nVYWzR7YuxH7O460wFaTQe2KTcn/@public.gmane.org>
2015-10-13 16:22               ` Stephen Warren [this message]
2015-10-10  1:46   ` [cbootimage PATCH v5 3/5] Add new configuration keyword "RehashBl" Jimmy Zhang
2015-10-10  1:46   ` [cbootimage PATCH v5 4/5] Add a sample script to do rsa signing for T210 bootimage Jimmy Zhang
2015-10-10  1:46   ` [cbootimage PATCH v5 5/5] Bump to version 1.6 Jimmy Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561D2FCA.9030607@wwwdotorg.org \
    --to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
    --cc=AMartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=jimmzhang-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).