signing.bbclass: add label length check

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 <johannes.schneider@leica-geosystems.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Johannes Schneider 2024-11-01 13:05:14 +01:00 committed by Khem Raj
parent a825b85363
commit 4a05d9a185
No known key found for this signature in database
GPG Key ID: BB053355919D3314

View File

@ -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_"