[PATCH 2/4] dm: hash: Add new UCLASS_HASH support

Alex G. mr.nuke.me at gmail.com
Mon Sep 27 17:37:02 CEST 2021


On 9/23/21 9:49 PM, Simon Glass wrote:> On Thu, 16 Sept 2021 at 09:43, 
Alex G. <mr.nuke.me at gmail.com> wrote:
>> On 7/29/21 8:08 PM, Chia-Wei Wang wrote:

>>> +
>>> +enum HASH_ALGO hash_algo_lookup_by_name(const char *name)
>>
>>       string -> hash_lookup_algo() -> ops struct
>>
>> Is the current way to do things. hash_algo_lookup_by_name() does the
>> roundabout through an enum. That doesn't make sense to me.
> 
> Actually I'd like to see an enum to describe these, since looking up a
> string is less efficient in a bootloader. So some way of doing that
> seems good to me.
> 
> Of course it means we need a global list of this algos in a header
> file and each driver needs to indicate which one(s) it supports.

Let's assume strcmp() takes a lot of efforts. For a lot of cases, the 
algo comes in as a string. Think about FIT and image signature 
verification. So we have to do the strcmp() anyway, making the enum 
roundabout.


More information about the U-Boot mailing list