All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikko Rapeli <mikko.rapeli@linaro.org>
To: Jon Mason <jdmason@kudzu.us>
Cc: Javier Tia <javier.tia@linaro.org>,
	meta-arm@lists.yoctoproject.org,
	Ross Burton <Ross.Burton@arm.com>, Jon Mason <jon.mason@arm.com>
Subject: Re: [PATCH v4 05/13] sbsign.bbclass: Add class to sign binaries
Date: Mon, 2 Sep 2024 09:35:48 +0300	[thread overview]
Message-ID: <ZtVcxCF_-24g2O-T@nuoska> (raw)
In-Reply-To: <ZtHTNSrczs4x90TA@kudzu.us>

Hi,

On Fri, Aug 30, 2024 at 10:12:05AM -0400, Jon Mason wrote:
> On Thu, Aug 29, 2024 at 10:32:01AM -0600, Javier Tia wrote:
> > A lot of recipes are using these same steps to sign binaries
> > for UEFI secure boot.
> 
> Okay, I'm being overly nitpicky here.  But SB means "sign binary",
> right?  So this is "sign binary sign"?  I have a mild concern of name
> space of "SB" and I think it would generally be more obvious if "sb"
> became "signbinary" or something similar.  I don't have very strong
> feelings about it.  So feel free to ignore if you disagree.

sbsign is the name of the tool used to sign these binaries. Another tool,
pesign can also be used. For example systemd refers to sbsign and defaults
to it
https://www.freedesktop.org/software/systemd/man/latest/ukify.html#SecureBootSigningTool=SIGNER

Hence the name of this class to sbsign and variables with SBSIGN prefix.

> Also, I think this could be squashed with the previous (as I'm having
> to use a local git branch to review since these patches are split too
> small).

Ok.

Cheers,

-Mikko

> Thanks,
> Jon
> 
> > 
> > Authored-by: Mikko Rapeli <mikko.rapeli@linaro.org>
> > Signed-off-by: Javier Tia <javier.tia@linaro.org>
> > ---
> >  meta-arm/classes/sbsign.bbclass | 39 +++++++++++++++++++++++++++++++++
> >  1 file changed, 39 insertions(+)
> >  create mode 100644 meta-arm/classes/sbsign.bbclass
> > 
> > diff --git a/meta-arm/classes/sbsign.bbclass b/meta-arm/classes/sbsign.bbclass
> > new file mode 100644
> > index 00000000..a99c0218
> > --- /dev/null
> > +++ b/meta-arm/classes/sbsign.bbclass
> > @@ -0,0 +1,39 @@
> > +# Sign binaries for UEFI secure boot
> > +# Usage in recipes:
> > +#
> > +# Set key and cert files in recipe or machine/distro config:
> > +# SBSIGN_KEY = "db.key"
> > +# SBSIGN_CERT = "db.crt"
> > +#
> > +# Set binary to sign per recipe:
> > +# SBSIGN_TARGET_BINARY = "${B}/binary_to_sign"
> > +#
> > +# Then call do_sbsign() in correct stage of the build
> > +# do_compile:append() {
> > +#     do_sbsign
> > +# }
> > +
> > +DEPENDS += "sbsigntool-native"
> > +
> > +SBSIGN_KEY ?= "db.key"
> > +SBSIGN_CERT ?= "db.crt"
> > +SBSIGN_TARGET_BINARY ?= "binary_to_sign"
> > +
> > +# makes sure changed keys trigger rebuild/re-signing
> > +SRC_URI += "\
> > +    file://${SBSIGN_KEY} \
> > +    file://${SBSIGN_CERT} \
> > +"
> > +
> > +# not adding as task since recipes may need to sign binaries at different
> > +# stages. Instead they can call this function when needed by calling this function
> > +do_sbsign() {
> > +    bbnote "Signing ${PN} binary ${SBSIGN_TARGET_BINARY} with ${SBSIGN_KEY} and ${SBSIGN_CERT}"
> > +    ${STAGING_BINDIR_NATIVE}/sbsign \
> > +        --key "${UNPACKDIR}/${SBSIGN_KEY}" \
> > +        --cert "${UNPACKDIR}/${SBSIGN_CERT}" \
> > +        --output  "${SBSIGN_TARGET_BINARY}.signed" \
> > +        "${SBSIGN_TARGET_BINARY}"
> > +    cp "${SBSIGN_TARGET_BINARY}" "${SBSIGN_TARGET_BINARY}.unsigned"
> > +    cp "${SBSIGN_TARGET_BINARY}.signed" "${SBSIGN_TARGET_BINARY}"
> > +}
> > \ No newline at end of file
> > -- 
> > 2.46.0
> > 
> > 


  reply	other threads:[~2024-09-02  6:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 16:31 [PATCH v4 00/13] qemuarm64-secureboot: Add UEFI Secure Boot Javier Tia
2024-08-29 16:31 ` [PATCH v4 01/13] qemuarm64-secureboot: Introduce uefi-secureboot machine feature Javier Tia
2024-08-30 15:42   ` Jon Mason
2024-08-29 16:31 ` [PATCH v4 02/13] core-image-minimal: Use UEFI layout disk partitions Javier Tia
2024-08-30 15:32   ` Jon Mason
2024-08-29 16:31 ` [PATCH v4 03/13] layer.conf: Introduce UEFI_SB_KEYS_DIR Javier Tia
2024-08-30 14:00   ` Jon Mason
2024-08-29 16:32 ` [PATCH v4 04/13] uefi-sb-keys.bbclass: Add class to validate UEFI keys Javier Tia
2024-08-30 14:03   ` Jon Mason
2024-08-29 16:32 ` [PATCH v4 05/13] sbsign.bbclass: Add class to sign binaries Javier Tia
2024-08-30 14:12   ` Jon Mason
2024-09-02  6:35     ` Mikko Rapeli [this message]
2024-08-29 16:32 ` [PATCH v4 06/13] core-image-minimal: Inherit uefi-sb-keys Javier Tia
2024-08-30 14:14   ` Jon Mason
2024-08-29 16:32 ` [PATCH v4 07/13] meta-arm: Introduce gen-uefi-sb-keys.bb recipe Javier Tia
2024-08-30 14:17   ` Jon Mason
2024-08-29 16:32 ` [PATCH v4 08/13] u-boot: Setup UEFI and Secure Boot Javier Tia
2024-08-30 14:23   ` Jon Mason
2024-08-29 16:32 ` [PATCH v4 09/13] qemuarm64-secureboot: Add meta-secure-core layer as dependency Javier Tia
2024-08-30 15:03   ` Jon Mason
2024-08-29 16:32 ` [PATCH v4 10/13] linux-yocto: Setup UEFI and sign kernel image Javier Tia
2024-08-30 15:16   ` Jon Mason
2024-08-29 16:32 ` [PATCH v4 11/13] systemd: Add UEFI support Javier Tia
2024-08-30 15:24   ` Jon Mason
2024-09-02  6:43     ` Mikko Rapeli
2024-08-29 16:32 ` [PATCH v4 12/13] systemd-boot: Use it as bootloader & sign UEFI image Javier Tia
2024-08-29 16:32 ` [PATCH v4 13/13] meta-arm: Add UEFI Secure Boot test Javier Tia
2024-08-30 15:28   ` Jon Mason
2024-08-30  3:06 ` [PATCH v4 00/13] qemuarm64-secureboot: Add UEFI Secure Boot Jon Mason
2024-08-30  6:10   ` Mikko Rapeli
2024-08-30 13:24     ` Jon Mason
2024-09-02 17:53       ` Javier Tia

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=ZtVcxCF_-24g2O-T@nuoska \
    --to=mikko.rapeli@linaro.org \
    --cc=Ross.Burton@arm.com \
    --cc=javier.tia@linaro.org \
    --cc=jdmason@kudzu.us \
    --cc=jon.mason@arm.com \
    --cc=meta-arm@lists.yoctoproject.org \
    /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.