We'll need this type of function more often later.

Signed-off-by: Roland Hieber <r...@pengutronix.de>
---
PATCH v2: no changes

PATCH v1: 
https://lore.ptxdist.org/ptxdist/20210804142330.32739-3-...@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"
+    printf "pkcs11:token=%s;object=%s;pin-value=1111\n" "${keyprovider}" 
"${role}"
+}
+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}")
+    cs_set_uri "${role}" "${uri}"
 }
 export -f cs_define_role
 
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to 
ptxdist-requ...@pengutronix.de

Reply via email to