From: Roland Hieber <rhi@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH v2 4/5] ptxd_lib_code_signing: provide consumer functions with some environment
Date: Wed, 8 Sep 2021 22:53:14 +0200 [thread overview]
Message-ID: <20210908205314.yttzc7zdfis64t3k@pengutronix.de> (raw)
In-Reply-To: <20210809080608.23475-4-rhi@pengutronix.de>
On Mon, Aug 09, 2021 at 10:06:07AM +0200, Roland Hieber wrote:
> The code signing consumer functions should be able to retrieve some
> information about the recipe in which they were called in order to make
> additional checks if needed. Refactor the (shell cs_get_*, …) calls into
> macro calls of the form $(call ptx/cs-get-*, <PKG>, …). Let these
> macros look up the package name (for now) from PTX_MAP_TO_package_<PKG>
> before passing it to the shell functions. Using $(call world/env) here
> would be practical, but would also cause make to complain about
> recursive variable dependencies. Therefore variables must be added
> to ptx/cs-consumer-env manually, but additional information can be added
> later if needed.
>
> Refactor the existing consumers in the code base too, and add an error
> message in case anyone else that still uses the old API.
>
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> ---
> PATCH v2:
> - define multiline macros using "define"
>
> PATCH v1: https://lore.ptxdist.org/ptxdist/20210804142330.32739-4-rhi@pengutronix.de
> ---
> doc/dev_code_signing.rst | 2 +-
> doc/ref_code_signing_helpers.rst | 25 ++++++-----
> rules/barebox.make | 2 +-
> rules/image-rauc.make | 6 +--
> rules/kernel.make | 6 +--
> rules/pre/030-code-signing-consumers.make | 44 +++++++++++++++++++
> rules/rauc.make | 2 +-
> .../templates/template-barebox-imx-habv4-make | 6 +--
> scripts/lib/ptxd_lib_code_signing.sh | 13 ++++++
> 9 files changed, 83 insertions(+), 23 deletions(-)
> create mode 100644 rules/pre/030-code-signing-consumers.make
>
[...]
> diff --git a/scripts/lib/ptxd_lib_code_signing.sh b/scripts/lib/ptxd_lib_code_signing.sh
> index 66a2cab81395..24730d3cf742 100644
> --- a/scripts/lib/ptxd_lib_code_signing.sh
> +++ b/scripts/lib/ptxd_lib_code_signing.sh
> @@ -1,6 +1,7 @@
> #!/bin/bash
> #
> # Copyright (C) 2019 Sascha Hauer <s.hauer@pengutronix.de>
> +# Copyright (C) 2021 Roland Hieber, Pengutronix <rhi@pengutronix.de>
> #
> # For further information about the PTXdist project and license conditions
> # see the README file.
> @@ -176,6 +177,12 @@ export -f cs_set_uri
> # Get the uri from a role
> #
> cs_get_uri() {
> + if [ -z "${pkg_name}" ]; then
> + echo ERROR_UNSUPPORTED_CS_API_CALL
> + ptxd_bailout '$(shell cs_get_uri, <role>) is no longer supported in make files.' \
> + 'Use $(call ptx/cs-get-uri, <PKG>, <role>) instead.'
> + fi
> +
> local role="${1}"
> cs_init_variables
Mmh, cs_append_ca_* calls cs_get_uri too and now fails because pkg_name
is empty… I did not catch this in my tests because I never re-installed
the code provider. This needs another workaround in v3.
- Roland
--
Roland Hieber, Pengutronix e.K. | r.hieber@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
next prev parent reply other threads:[~2021-09-08 20:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-09 8:06 [ptxdist] [PATCH v2 1/5] ptxd_make_world_common: make the package name available to scripts Roland Hieber
2021-08-09 8:06 ` [ptxdist] [PATCH v2 2/5] libptxdist: introduce ptxd_exec_silent_stderr Roland Hieber
2021-08-09 8:06 ` [ptxdist] [PATCH v2 3/5] ptxd_lib_code_signing: refactor hard-coded SoftHSM PIN in PKCS11 URIs Roland Hieber
2021-09-03 12:46 ` Michael Olbrich
2021-09-08 11:27 ` Roland Hieber
2021-09-08 14:01 ` Michael Olbrich
2021-08-09 8:06 ` [ptxdist] [PATCH v2 4/5] ptxd_lib_code_signing: provide consumer functions with some environment Roland Hieber
2021-09-03 12:54 ` Michael Olbrich
2021-09-08 11:30 ` Roland Hieber
2021-09-08 14:08 ` Michael Olbrich
2021-09-08 20:53 ` Roland Hieber [this message]
2021-08-09 8:06 ` [ptxdist] [PATCH v2 5/5] ptxd_lib_code_signing: add key whitelist checks Roland Hieber
2021-08-09 9:30 ` Roland Hieber
2021-09-03 13:17 ` Michael Olbrich
2021-09-08 11:43 ` Roland Hieber
2021-09-12 20:33 ` Roland Hieber
2021-09-29 11:51 ` Michael Olbrich
2021-09-03 12:48 ` [ptxdist] [PATCH v2 1/5] ptxd_make_world_common: make the package name available to scripts Michael Olbrich
2021-09-08 10:17 ` Roland Hieber
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=20210908205314.yttzc7zdfis64t3k@pengutronix.de \
--to=rhi@pengutronix.de \
--cc=ptxdist@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