Two Issues in meta-nxp-security-reference-design for i.MX93 Custom Board with HSM Signing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Two Issues in meta-nxp-security-reference-design for i.MX93 Custom Board with HSM Signing

276 Views
udayMouli
Contributor I

I am currently integrating the meta-nxp-security-reference-design layer into our Yocto build system to enable secure boot for i.MX93. Following NXP's recommendation, I am using SPSDK for the AHAB signing process. During this integration, I have encountered two issues that prevent successful builds for custom hardware with HSM-based signing.
Environment:

Issue 1: Missing KERNEL_DTB Parameter Breaks Custom Board Support

file:meta-secure-boot/recipes-secure-boot/imx-mkimage/imx-boot_%.bbappend
The kernel container build command lacks the DTB parameter: make 

SOC=${IMX_BOOT_SOC_TARGET} flash_kernel --> no dtb file input

The iMX93/soc.mak has a hardcoded default:KERNEL_DTB ?= imx93-11x11-evk.dtb

Build fails for custom boards with:make[1]: *** No rule to make target 'imx93-11x11-evk.dtb', needed by 'flash_kernel'. Stop.

Issue 2: imx_signer Generates Incorrect YAML for PKCS11/HSM Signing
Files:
meta-secure-boot/recipes-secure-boot/linux/linux-imx-signature.bb
imx_signer tool

imx_signer reads my spsdk_ahab.cfg but generates nxpimage_config.yaml with hardcoded default paths instead of my PKCS11 configuration.

imx_signer doesn't parse PKCS11 configuration from CFG files correctly. It:

Ignores signer=type=pkcs11(spsdk yaml reference file contains signer not signature_provider) and uses type=file instead
Ignores srk_array_X paths and uses hardcoded template paths
Appears designed for file-based signing only

Issue 1: Can you add KERNEL_DTB parameter support to the flash_kernel recipe or should I follow different approach please suggest?
Issue 2: Does imx_signer support PKCS11 configuration? If not, what's the recommended approach for HSM signing with the security reference design?

Is there documentation reference for using PKCS11/HSM with meta-nxp-security-reference-design?

0 Kudos
Reply
5 Replies

244 Views
JosephAtNXP
NXP TechSupport
NXP TechSupport

Hi,

Thank you for your interest in NXP Semiconductor products,

Can you please confirm both manifest and meta-layer are branch aligned?

The documentation to get started should be found under chapter 10.9 Security reference design. Could you share a fresh build log following the steps quoted?

Regards

0 Kudos
Reply

219 Views
udayMouli
Contributor I

Thanks for your response and the documentation pointers—I've been referencing the same NXP Security Reference Design to integrate secure boot into our Yocto build for i.MX devices.

However, I'm running into a compatibility issue with the prerequisites mentioned in the document. The document specifies that for both CST and SPSDK, the private key password must be in a file named key_pass.txt in the keys folder. In our setup, the private keys are securely stored in a Hardware Security Module (HSM), not as local files.

Directly using SPSDK's nxpimage ahab sign command with the spsdk-pkcs11 plugin works perfectly—I can sign successfully with a YAML config file, leveraging the HSM via PKCS#11.

The challenge arises in Yocto, where the imx_signer tool acts as a wrapper. It converts the .cfg file to YAML and handles signing. The command looks like this:

SIG_TOOL_PATH=${SIG_TOOL_PATH} SIG_DATA_PATH=${SIG_DATA_PATH} ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/imx_signer -d -i ${DEPLOY_DIR_IMAGE}/${BOOT_IMAGE_SD} -c ${SIGNDIR}/${SIG_CFGFILE}
I've set SIG_TOOL_PATH to the SPSDK binary location and SIG_DATA_PATH to include the public keys and spsdk_ahab.cfg.

I have attached failure log and yaml file generated for reference
0 Kudos
Reply

170 Views
JosephAtNXP
NXP TechSupport
NXP TechSupport

Hi @udayMouli 

Seems strange, it fails when it doesn't find the binaries or the data, could you share your history output so I can replicate on my side? Also, share the tree output for the following paths.

$ tree /home/xxx/spsdk/venv/
$ tree /home/xxx/secureboot/

Regards,

0 Kudos
Reply

87 Views
udayMouli
Contributor I

Hi @JosephAtNXP,

Could you please share an email address where I can send the complete details? The log may contain sensitive information, so I’ll send it separately.
 
Thanks,
Uday
0 Kudos
Reply

49 Views
JosephAtNXP
NXP TechSupport
NXP TechSupport

Hi @udayMouli,

Please create a private ticket https://support.nxp.com/s/?language=en_US

I will make sure to follow up on it.

Regards

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2253725%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ETwo%20Issues%20in%20meta-nxp-security-reference-design%20for%20i.MX93%20Custom%20Board%20with%20HSM%20Signing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2253725%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EI%20am%20currently%20integrating%20the%20meta-nxp-security-reference-design%20layer%20into%20our%20Yocto%20build%20system%20to%20enable%20secure%20boot%20for%20i.MX93.%20Following%20NXP's%20recommendation%2C%20I%20am%20using%20SPSDK%20for%20the%20AHAB%20signing%20process.%20During%20this%20integration%2C%20I%20have%20encountered%20two%20issues%20that%20prevent%20successful%20builds%20for%20custom%20hardware%20with%20HSM-based%20signing.%3C%2FFONT%3E%3CSTRONG%3E%3CBR%20%2F%3EEnvironment%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CUL%3E%3CLI%3E%3CSTRONG%3ESoC%3A%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ei.MX93%3C%2FLI%3E%3CLI%3E%3CSTRONG%3ESecurity%20Layer%3A%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20title%3D%22%22%20href%3D%22vscode-file%3A%2F%2Fvscode-app%2Fc%3A%2FProgram%2520Files%2FMicrosoft%2520VS%2520Code%2Fresources%2Fapp%2Fout%2Fvs%2Fcode%2Felectron-browser%2Fworkbench%2Fworkbench.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fnxp-imx-support%2Fmeta-nxp-security-reference-design%2Ftree%2Fscarthgap-6.6.23-2.0.0%3C%2FA%3E%3C%2FLI%3E%3CLI%3E%3CSTRONG%3ESPSDK%20Version%3A%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E3.4.0%3C%2FLI%3E%3CLI%3E%3CSTRONG%3ESigning%20Method%3A%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3ESPSDK%20with%20spsdk_PKCS11%20plugin%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%3CSTRONG%3EIssue%201%3A%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EMissing%20KERNEL_DTB%20Parameter%20Breaks%20Custom%20Board%20Support%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3Efile%3A%3C%2FSTRONG%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3Emeta-secure-boot%2Frecipes-secure-boot%2Fimx-mkimage%2Fimx-boot_%25.bbappend%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EThe%20kernel%20container%20build%20command%20lacks%20the%20DTB%20parameter%3A%20make%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3ESOC%3D%24%7BIMX_BOOT_SOC_TARGET%7D%20flash_kernel%20--%26gt%3B%20no%20dtb%20file%20input%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EThe%20iMX93%2Fsoc.mak%20has%20a%20hardcoded%20default%3AKERNEL_DTB%20%3F%3D%20imx93-11x11-evk.dtb%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3E%3CEM%3EBuild%20fails%20for%20custom%20boards%20with%3Amake%5B1%5D%3A%20***%20No%20rule%20to%20make%20target%20'imx93-11x11-evk.dtb'%2C%20needed%20by%20'flash_kernel'.%20Stop.%3C%2FEM%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3EIssue%202%3A%20imx_signer%20Generates%20Incorrect%20YAML%20for%20PKCS11%2FHSM%20Signing%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3EFiles%3A%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3Emeta-secure-boot%2Frecipes-secure-boot%2Flinux%2Flinux-imx-signature.bb%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3Eimx_signer%20tool%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3Eimx_signer%20reads%20my%20spsdk_ahab.cfg%20but%20generates%20nxpimage_config.yaml%20with%20hardcoded%20default%20paths%20instead%20of%20my%20PKCS11%20configuration.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3Eimx_signer%20doesn't%20parse%20PKCS11%20configuration%20from%20CFG%20files%20correctly.%20It%3A%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EIgnores%20signer%3Dtype%3Dpkcs11(spsdk%20yaml%20reference%20file%20contains%20signer%20not%20signature_provider)%20and%20uses%20type%3Dfile%20instead%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EIgnores%20srk_array_X%20paths%20and%20uses%20hardcoded%20template%20paths%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EAppears%20designed%20for%20file-based%20signing%20only%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3E%3CSTRONG%3EIssue%201%3C%2FSTRONG%3E%3A%20Can%20you%20add%20KERNEL_DTB%20parameter%20support%20to%20the%20flash_kernel%20recipe%20or%20should%20I%20follow%20different%20approach%20please%20suggest%3F%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3E%3CSTRONG%3EIssue%202%3C%2FSTRONG%3E%3A%20Does%20imx_signer%20support%20PKCS11%20configuration%3F%20If%20not%2C%20what's%20the%20recommended%20approach%20for%20HSM%20signing%20with%20the%20security%20reference%20design%3F%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EIs%20there%20documentation%20reference%20for%20using%20PKCS11%2FHSM%20with%20meta-nxp-security-reference-design%3F%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2254367%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Two%20Issues%20in%20meta-nxp-security-reference-design%20for%20i.MX93%20Custom%20Board%20with%20HSM%20Signing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2254367%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EThank%20you%20for%20your%20interest%20in%20NXP%20Semiconductor%20products%2C%3C%2FP%3E%0A%3CP%3ECan%20you%20please%20confirm%20both%20manifest%20and%20meta-layer%20are%20branch%20aligned%3F%3C%2FP%3E%0A%3CP%3EThe%20documentation%20to%20get%20started%20should%20be%20found%20under%20chapter%20%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fuser-guide%2FUG10163.pdf%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E10.9%20Security%20reference%20design%3C%2FA%3E.%20Could%20you%20share%20a%20fresh%20build%20log%20following%20the%20steps%20quoted%3F%3C%2FP%3E%0A%3CP%3ERegards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2255051%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Two%20Issues%20in%20meta-nxp-security-reference-design%20for%20i.MX93%20Custom%20Board%20with%20HSM%20Signing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2255051%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThanks%20for%20your%20response%20and%20the%20documentation%20pointers%E2%80%94I've%20been%20referencing%20the%20same%20NXP%20Security%20Reference%20Design%20to%20integrate%20secure%20boot%20into%20our%20Yocto%20build%20for%20i.MX%20devices.%3C%2FP%3E%3CP%3EHowever%2C%20I'm%20running%20into%20a%20compatibility%20issue%20with%20the%20prerequisites%20mentioned%20in%20the%20document.%20The%20document%20specifies%20that%20for%20both%20CST%20and%20SPSDK%2C%20the%20private%20key%20password%20must%20be%20in%20a%20file%20named%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ekey_pass.txt%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ein%20the%20keys%20folder.%20In%20our%20setup%2C%20the%20private%20keys%20are%20securely%20stored%20in%20a%20Hardware%20Security%20Module%20(HSM)%2C%20not%20as%20local%20files.%3C%2FP%3E%3CP%3EDirectly%20using%20SPSDK's%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Enxpimage%20ahab%20sign%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ecommand%20with%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Espsdk-pkcs11%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eplugin%20works%20perfectly%E2%80%94I%20can%20sign%20successfully%20with%20a%20YAML%20config%20file%2C%20leveraging%20the%20HSM%20via%20PKCS%2311.%3C%2FP%3E%3CP%3EThe%20challenge%20arises%20in%20Yocto%2C%20where%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eimx_signer%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etool%20acts%20as%20a%20wrapper.%20It%20converts%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E.cfg%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20to%20YAML%20and%20handles%20signing.%20The%20command%20looks%20like%20this%3A%3C%2FP%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CEM%3E%3CSPAN%3ES%3CSTRONG%3EIG_TOOL_PATH%3D%24%7BSIG_TOOL_PATH%7D%20SIG_DATA_PATH%3D%24%7BSIG_DATA_PATH%7D%20%24%7BDEPLOY_DIR_IMAGE%7D%2F%24%7BBOOT_TOOLS%7D%2F%3CFONT%20color%3D%22%23FF0000%22%3Eimx_signer%3C%2FFONT%3E%20-d%20-i%20%24%7BDEPLOY_DIR_IMAGE%7D%2F%24%7BBOOT_IMAGE_SD%7D%20-c%20%24%7BSIGNDIR%7D%2F%24%7BSIG_CFGFILE%7D%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FEM%3E%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%3CSPAN%3EI've%20set%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3ESIG_TOOL_PATH%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eto%20the%20SPSDK%20binary%20location%20and%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3ESIG_DATA_PATH%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eto%20include%20the%20public%20keys%20and%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Espsdk_ahab.cfg%3CSPAN%3E.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20have%20attached%20failure%20log%20and%20yaml%20file%20generated%20for%20reference%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2256331%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Two%20Issues%20in%20meta-nxp-security-reference-design%20for%20i.MX93%20Custom%20Board%20with%20HSM%20Signing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2256331%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F251287%22%20target%3D%22_blank%22%3E%40udayMouli%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESeems%20strange%2C%20it%20fails%20when%20it%20doesn't%20find%20the%20binaries%20or%20the%20data%2C%20could%20you%20share%20your%20history%20output%20so%20I%20can%20replicate%20on%20my%20side%3F%20Also%2C%20share%20the%20tree%20output%20for%20the%20following%20paths.%3C%2FP%3E%0A%3CP%3E%24%20tree%20%2Fhome%2Fxxx%2Fspsdk%2Fvenv%2F%3CBR%20%2F%3E%24%20tree%20%2Fhome%2Fxxx%2Fsecureboot%2F%3C%2FP%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E