From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Tue, 10 Aug 2021 12:00:19 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mDOYV-0002xX-L9 for lore@lore.pengutronix.de; Tue, 10 Aug 2021 12:00:19 +0200 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mDOYV-0000Ya-0I; Tue, 10 Aug 2021 12:00:19 +0200 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDOYK-0000PQ-9b; Tue, 10 Aug 2021 12:00:08 +0200 Received: from rhi by dude.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mDOYK-0006vx-1D; Tue, 10 Aug 2021 12:00:08 +0200 From: Roland Hieber To: ptxdist@pengutronix.de Date: Tue, 10 Aug 2021 11:59:58 +0200 Message-Id: <20210810100000.26602-2-rhi@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210810100000.26602-1-rhi@pengutronix.de> References: <20210810100000.26602-1-rhi@pengutronix.de> MIME-Version: 1.0 Mail-Followup-To: Roland Hieber , ptxdist@pengutronix.de Subject: [ptxdist] [PATCH v2 2/4] ptxd_lib_code_signing: refactor cs_check_env for SoftHSM workflow X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: Roland Hieber Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false Checking for PKCS11_MODULE_PATH etc. is also useful for the non-SoftHSM workflow, but the other variables are specific to SoftHSM. Split off the SoftHSM checks up into a separate function. Signed-off-by: Roland Hieber --- PATCH v2: no changes PATCH v1: https://lore.ptxdist.org/ptxdist/20210809144030.22764-2-rhi@pengutronix.de --- scripts/lib/ptxd_lib_code_signing.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/lib/ptxd_lib_code_signing.sh b/scripts/lib/ptxd_lib_code_signing.sh index 5579161cd5cf..f012f8e194c7 100644 --- a/scripts/lib/ptxd_lib_code_signing.sh +++ b/scripts/lib/ptxd_lib_code_signing.sh @@ -32,13 +32,8 @@ cs_export_pin() { } cs_export_pin +# internal cs_check_env() { - if [ -z "${SOFTHSM2_CONF}" ]; then - ptxd_bailout "SOFTHSM2_CONF is not defined. Maybe \$(CODE_SIGNING_ENV) is not used." - fi - if [ ! -e "${SOFTHSM2_CONF}" ]; then - ptxd_bailout "'${SOFTHSM2_CONF}' is missing." - fi if [ -z "${PKCS11_MODULE_PATH}" ]; then ptxd_bailout "PKCS11_MODULE_PATH is not defined. Maybe \$(CODE_SIGNING_ENV) is not used." fi @@ -48,6 +43,18 @@ cs_check_env() { } export -f cs_check_env +# internal +cs_check_env_softhsm() { + cs_check_env + if [ -z "${SOFTHSM2_CONF}" ]; then + ptxd_bailout "SOFTHSM2_CONF is not defined. Maybe \$(CODE_SIGNING_ENV) is not used." + fi + if [ ! -e "${SOFTHSM2_CONF}" ]; then + ptxd_bailout "'${SOFTHSM2_CONF}' is missing." + fi +} +export -f cs_check_env_softhsm + # # softhsm_pkcs11_tool_init # @@ -88,7 +95,7 @@ export -f cs_init_variables # Initialize SoftHSM and set the initial pin # cs_init_softhsm() { - cs_check_env + cs_check_env_softhsm cs_init_variables local shsm_keys="${sysroot}/var/cache/softhsm/${keyprovider}" -- 2.30.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de