[U-Boot] [PATCH v2] Implement generalised RSA public exponents for verified boot

Michael van der Westhuizen michael at smart-africa.com
Fri May 30 23:20:28 CEST 2014


Hi Simon,

On 30 May 2014, at 11:11 PM, Simon Glass <sjg at chromium.org> wrote:

<snip>
>> This code compiles on the host, so unfortunately yes.  That's the same
>> reason I had to work around the lack of handy *_u64 fdt helpers when reading
>> the public exponent.
> 
> OK, although Linux might have replacements. But if not, perhaps add a
> comment as to why you need the helper function.

Will do.

> 
> [snip]
> 
>> For example, if you did:
>> 
>>     montgomery_mul(key, result, val, key->rr); /* acc = a * RR / R mod n */
>> 
>> 
>> Yes, it's sizeof(uint32_t) - that would probably be a good thing to spell
>> out too.
>> 
>> result points to tmp, which is going to be repeatedly overwritten in the
>> loop, but we need a_scaled to stay constant (as the result of the first
>> montgomery_mul) throughout... or did I misunderstand your point?
>> 
>> 
>> OK I see thanks. Perhaps add a new temporary instead of using memcpy()?
>> 
>> 
>> And set it up using montgomery_mul?  Would that not be more expensive than a
>> memcpy?
> 
> On the host? Not sure we care about that. I was really just wondering
> if an assignment is better than a memcpy() which makes assumptions
> about the format.

In theory it should optimise to the same code, but I'll run tests with assignment to make sure it works as expected.

Michael


More information about the U-Boot mailing list