mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Fabian Pflug <f.pflug@pengutronix.de>
Cc: barebox@lists.infradead.org, uol@pengutronix.de
Subject: Re: [PATCH] i.MX: hab: write srk lock with hab command
Date: Fri, 6 Mar 2026 11:26:43 +0100	[thread overview]
Message-ID: <ulfwp773ltirh4dbvcllje5sy7cxd2lolao6m4muqmn7lldcsq@zscclgrl3jso> (raw)
In-Reply-To: <20260306102038.4065007-1-f.pflug@pengutronix.de>

Hi Fabian,

On 26-03-06, Fabian Pflug wrote:
> The write_srk_hash functions already support the flag to write the SRK
> lock, but it is never used in barebox. To prevent an attacker from
> calculating an SRK hash that has the same bits set as the current SRK
> hash, but with maybe more, we lock the SRK hash to prevent turning bits.
> 
> Writing the lock twice will probably result in unusable garbage and the
> hab command itself already is written in a way to write the complete
> hash and not parts of it.
> 
> Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
> ---
>  commands/hab.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/commands/hab.c b/commands/hab.c
> index 8ae943a4c8..b8ef770066 100644
> --- a/commands/hab.c
> +++ b/commands/hab.c
> @@ -14,7 +14,7 @@ static int do_hab(int argc, char *argv[])
>  {
>  	int opt, ret, i;
>  	char *srkhashfile = NULL, *srkhash = NULL;
> -	unsigned flags = 0;
> +	unsigned flags = IMX_SRK_HASH_WRITE_LOCK;

This would fix only the hab cmd, not the C-API. Instead we should fix
the C-API to write the LOCK after the SRK was burned/fused.

Regards,
  Marco

>  	u8 srk[SRK_HASH_SIZE];
>  	int lockdown = 0, info = 0;
>  
> -- 
> 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	other threads:[~2026-03-06 10:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06 10:20 Fabian Pflug
2026-03-06 10:26 ` Marco Felsch [this message]
2026-03-06 10:36   ` Fabian Pflug

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=ulfwp773ltirh4dbvcllje5sy7cxd2lolao6m4muqmn7lldcsq@zscclgrl3jso \
    --to=m.felsch@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=f.pflug@pengutronix.de \
    --cc=uol@pengutronix.de \
    /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