Add a (more helpful) error message in case the Package-Name exceeds a
certain length which would have the softhsm tools error out.

The $PN is used as 'label' in the softhsm, which is a
"CK_UTF8CHAR paddedLabel[32]" in softhsm2-util.cpp,
so it must not be longer.

Signed-off-by: Johannes Schneider <[email protected]>
---
 meta-oe/classes/signing.bbclass | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meta-oe/classes/signing.bbclass b/meta-oe/classes/signing.bbclass
index f52d861b7..3e662ff73 100644
--- a/meta-oe/classes/signing.bbclass
+++ b/meta-oe/classes/signing.bbclass
@@ -92,6 +92,11 @@ signing_pkcs11_tool() {
 }
 
 signing_import_prepare() {
+    # the $PN is used as 'label' in the softhsm, which is a "CK_UTF8CHAR
+    # paddedLabel[32]" in softhsm2-util.cpp, so it must not be longer.
+    LEN=$(echo -n ${PN} | wc -c)
+    test $LEN -le 32 || bbfatal "PN must not have a length greater than 32 
chars."
+
     export _SIGNING_ENV_FILE_="${B}/meta-signing.env"
     rm -f "$_SIGNING_ENV_FILE_"
 
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#113383): 
https://lists.openembedded.org/g/openembedded-devel/message/113383
Mute This Topic: https://lists.openembedded.org/mt/109331456/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to