From: Michael Olbrich <m.olbrich@pengutronix.de>
To: Roland Hieber <rhi@pengutronix.de>
Cc: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH v2 3/5] ptxd_lib_code_signing: refactor hard-coded SoftHSM PIN in PKCS11 URIs
Date: Wed, 8 Sep 2021 16:01:51 +0200 [thread overview]
Message-ID: <20210908140151.GP4027748@pengutronix.de> (raw)
In-Reply-To: <20210908112711.jq7m547swsksvhu7@pengutronix.de>
On Wed, Sep 08, 2021 at 01:27:11PM +0200, Roland Hieber wrote:
> On Fri, Sep 03, 2021 at 02:46:46PM +0200, Michael Olbrich wrote:
> > On Mon, Aug 09, 2021 at 10:06:06AM +0200, Roland Hieber wrote:
> > > We'll need this type of function more often later.
> >
> > I don't see another user of this function in the rest of the series.
>
> Huh yes. I think I used it multiple times in a previous version of the
> series. I think this patch can be dropped.
>
> >
> > >
> > > Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> > > ---
> > > PATCH v2: no changes
> > >
> > > PATCH v1: https://lore.ptxdist.org/ptxdist/20210804142330.32739-3-rhi@pengutronix.de
> > > ---
> > > scripts/lib/ptxd_lib_code_signing.sh | 14 +++++++++++++-
> > > 1 file changed, 13 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/scripts/lib/ptxd_lib_code_signing.sh b/scripts/lib/ptxd_lib_code_signing.sh
> > > index 5ba1a4666af4..66a2cab81395 100644
> > > --- a/scripts/lib/ptxd_lib_code_signing.sh
> > > +++ b/scripts/lib/ptxd_lib_code_signing.sh
> > > @@ -49,6 +49,17 @@ softhsm_pkcs11_tool() {
> > > }
> > > export -f softhsm_pkcs11_tool
> > >
> > > +#
> > > +# softhsm_pkcs11_uri <uri>
> > > +#
> > > +# Add the SoftHSM PIN to the given URI.
> > > +#
> > > +softhsm_pkcs11_uri() {
> > > + local role="$1"
> >
> > Why is 'role' passed as argument and 'keyprovider' is not?
> >
> > > + printf "pkcs11:token=%s;object=%s;pin-value=1111\n" "${keyprovider}" "${role}"
> >
> > Why not just:
> >
> > echo "pkcs11:token=${keyprovider};object=${role};pin-value=1111"
>
> Force of habit from using C and Python. And depending on the actual echo
> implementation (POSIX sh, bash, or /bin/echo), there are different
> behaviours regarding things like printing a literal -e, or interpolation
> of \r, \t etc., and I've never encountered this with printf. So I
> usually use printf instead of echo.
In ptxdist, the shell is always bash and we use 'echo' everywhere else, so
I prefer it here as well.
Michael
> > > +}
> > > +export -f softhsm_pkcs11_uri
> > > +
> > > #
> > > # cs_init_variables
> > > #
> > > @@ -95,7 +106,8 @@ cs_define_role() {
> > >
> > > mkdir -p "${keydir}/${role}" &&
> > > # default for SoftHSM
> > > - cs_set_uri "${role}" "pkcs11:token=${keyprovider};object=${role};pin-value=1111"
> > > + local uri=$(softhsm_pkcs11_uri "${role}")
> >
> > Why the extra local variable?
> > Michael
> >
> > > + cs_set_uri "${role}" "${uri}"
> > > }
> > > export -f cs_define_role
> > >
> > > --
> > > 2.30.2
>
> --
> 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
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://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 14:02 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 [this message]
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
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=20210908140151.GP4027748@pengutronix.de \
--to=m.olbrich@pengutronix.de \
--cc=ptxdist@pengutronix.de \
--cc=rhi@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