On 25-10-10, Ahmad Fatoum wrote:
> When given a key name hint, we first attempt verification using the key
> it describes and fall through to verifying with all other keys.
> 
> The code implementing this is not necessarily intuitive and strcmp()
> makes it harder to understand.
> 
> As we check for NULL pointer anyway, let's use streq_ptr, which returns
> true instead of 0 on equality.
> 
> Signed-off-by: Ahmad Fatoum <[email protected]>

Reviewed-by: Marco Felsch <[email protected]>

> ---
>  common/image-fit.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 6b44a79e9d1c..3017ccb5048f 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -290,7 +290,8 @@ static int fit_check_signature(struct fit_handle *handle, 
> struct device_node *si
>       for_each_public_key(key) {
>               fail_reason = "verification failed";
>  
> -             if (key_name && !strcmp(key->key_name_hint, key_name))
> +             /* Don't recheck with same key as before */
> +             if (streq_ptr(key->key_name_hint, key_name))
>                       continue;
>  
>               ret = public_key_verify(key, sig_value, sig_len, hash, algo);
> -- 
> 2.47.3
> 
> 
> 

Reply via email to