On 25-10-22, Ahmad Fatoum wrote:
> FIT: fix use of multiple FIT keys
> 
> streq_ptr returns true if both arguments are NULL. This can happen if we

Damn!

> have no FIT key name hints at all and shouldn't lead to ignoring keys,
> so add the check for the hint.
> 
> Cc: Marco Felsch <[email protected]>
> Reported-by: Jonas Rebmann <[email protected]>
> Signed-off-by: Ahmad Fatoum <[email protected]>

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

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

-- 
#gernperDu 
#CallMeByMyFirstName

Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |

Reply via email to