All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@bootlin.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fit: skip signature verification if board request
Date: Tue, 17 Apr 2018 14:06:48 +0200	[thread overview]
Message-ID: <20180417120648.hxyolrhkq4vqr2kj@qschulz> (raw)
In-Reply-To: <1523459585-7594-1-git-send-email-jun.nie@linaro.org>

Hi,

On Wed, Apr 11, 2018 at 11:13:05PM +0800, Jun Nie wrote:
> It may be unnecessary to check signature on unlocked board.
> Get the hint from platform specific code to support secure boot
> and non-secure boot with the same binary, so that boot is not
> blocked if board is not locked and has no key for signature
> verification.
> 

Isn't it what the environment variable `verify` is made for?

i.e. setting verify=no will skip checks and boot an image even though it
isn't signed or hash/signature does not match.

I may be missing some context here, so please ignore if it's not what
you're after.

BTW, I saw that you were speaking of reading the lock fuse to decide
whether to check the signature or not. I'd like to have at least a
bypass option for this as it would be horribly tedious for
debugging/development purposes. E.g. I want to be able to boot from an
unverified U-Boot binary a signed (and checked) fitImage so that I can
validate everything works as it should before locking down the
bootloader.

Regards,
Quentin

> Signed-off-by: Jun Nie <jun.nie@linaro.org>
> ---
>  common/image-sig.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/common/image-sig.c b/common/image-sig.c
> index d9f712f..f3d1252 100644
> --- a/common/image-sig.c
> +++ b/common/image-sig.c
> @@ -151,6 +151,11 @@ struct image_region *fit_region_make_list(const void *fit,
>  	return region;
>  }
>  
> +int __attribute__((weak)) fit_board_skip_sig_verification(void)
> +{
> +	return 0;
> +}
> +
>  static int fit_image_setup_verify(struct image_sign_info *info,
>  		const void *fit, int noffset, int required_keynode,
>  		char **err_msgp)
> @@ -188,6 +193,12 @@ int fit_image_check_sig(const void *fit, int noffset, const void *data,
>  	uint8_t *fit_value;
>  	int fit_value_len;
>  
> +	/* Skip verification if board says that */
> +	if (fit_board_skip_sig_verification()) {
> +		printf("signature check skipped\n");
> +		return 0;
> +	}
> +
>  	*err_msgp = NULL;
>  	if (fit_image_setup_verify(&info, fit, noffset, required_keynode,
>  				   err_msgp))
> @@ -438,6 +449,12 @@ int fit_config_verify_required_sigs(const void *fit, int conf_noffset,
>  	int noffset;
>  	int sig_node;
>  
> +	/* Skip verification if board says that */
> +	if (fit_board_skip_sig_verification()) {
> +		printf("signature check skipped\n");
> +		return 0;
> +	}
> +
>  	/* Work out what we need to verify */
>  	sig_node = fdt_subnode_offset(sig_blob, 0, FIT_SIG_NODENAME);
>  	if (sig_node < 0) {
> -- 
> 2.7.4
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180417/c1992908/attachment.sig>

  parent reply	other threads:[~2018-04-17 12:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11 15:13 [U-Boot] [PATCH] fit: skip signature verification if board request Jun Nie
2018-04-12 13:53 ` Tom Rini
2018-04-13  9:58   ` Jun Nie
2018-04-12 17:24 ` Simon Glass
2018-04-13 10:05   ` Jun Nie
2018-04-16 19:06     ` Simon Glass
2018-04-18 15:34       ` Jun Nie
2018-04-17 12:06 ` Quentin Schulz [this message]
2018-04-18 15:22   ` Jun Nie

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=20180417120648.hxyolrhkq4vqr2kj@qschulz \
    --to=quentin.schulz@bootlin.com \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.