Should auth_cntr provide a return value?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Should auth_cntr provide a return value?

跳至解决方案
1,464 次查看
HH_Mov
Contributor III

Using an i.mx93 in OEM_Open mode, I was validating the detection of invalidly signed containers.

The code in u-boot for "\include\configs\imx93_evk.h" implies that the auth_cntr returns a value which could be used in an "if statement" in the environment.

"auth_os=auth_cntr ${cntr_addr}\0" \
"mmcboot=echo Booting from mmc ...; " \
		"run mmcargs; " \
		"if test ${sec_boot} = yes; then " \
			"if run auth_os; then " \
				"run boot_os; " \
			"else " \
				"echo ERR: failed to authenticate; " \
			"fi; " \
		....

The check "if run auth_os; then" gives the impression that the success of the container validation is available as a return value. 

However testing shows that the result is always "0", for both a valid and invalid signed container. The ahab_status command does report errors after validating the invalid signed container.

Is this expected behavior for an OEM_Open device ? Or is the imx93_evk.h file implying something that is not there ?

标签 (2)
标记 (2)
0 项奖励
回复
1 解答
1,160 次查看
HH_Mov
Contributor III

It seems the result value only reports something about the execution of the auth_cntr command and not if the container itself is authentic.


For OEM_Open scenarios this might result in the "run boot_os" to be executed even when the container is not authentic.

For OEM_Closed scenarios, the call to auth_cntr will result in an immediate reboot, so the if statement will never be completed.

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,161 次查看
HH_Mov
Contributor III

It seems the result value only reports something about the execution of the auth_cntr command and not if the container itself is authentic.


For OEM_Open scenarios this might result in the "run boot_os" to be executed even when the container is not authentic.

For OEM_Closed scenarios, the call to auth_cntr will result in an immediate reboot, so the if statement will never be completed.

0 项奖励
回复
1,421 次查看
Harvey021
NXP TechSupport
NXP TechSupport

The auth_os verifies the container which is built with kernel and DTB. The ahab_status just reports what was verified.

Which version of BSP are you testing and what AHAB events?

 

Best regards

Harvey

0 项奖励
回复
1,416 次查看
HH_Mov
Contributor III

I am running a yocto scarthgap based image on an i.MX93 based board, running a rather old 2022.04 u-boot (at the moment).

The idea was to have a number of ahab containers:
  - 1st container: ELE, DDR FW, SPL
  - 2nd container: ATF, OP-TEE, U-Boot
  - 3rd container: Kernel
  - 4th container: dtb
  - ....nth

All containers are verified via the chain of trust, starting with ROM verifying the 1st, SPL the 2nd, u-boot the 3rd, 4th and possibly additional containers.

To verify the 3rd and 4th container in u-boot, I use the auth_cntr command and it provides info via ahab_status on the result. However the idea was to add this to a bootcmd, allowing each container to be validated and stopping or moving to a recovery mode on failure.

So the question I have is, how can I use the auth_cntr in an automated/scripted implementation? Or is adding these steps/verifications in the code itself and calling a custom command to handle these checks more suitable/normal practice?

0 项奖励
回复
1,347 次查看
Harvey021
NXP TechSupport
NXP TechSupport

Hope that the section <10.9 Security reference design> of the guide may help for you. 

 

Regards

Harvey

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2138272%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eauth_cntr%20%E6%98%AF%E5%90%A6%E5%BA%94%E8%AF%A5%E6%8F%90%E4%BE%9B%E8%BF%94%E5%9B%9E%E5%80%BC%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2138272%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%88%91%E5%9C%A8%20OEM_Open%20%E6%A8%A1%E5%BC%8F%E4%B8%8B%E4%BD%BF%E7%94%A8%20i.mx93%20%E9%AA%8C%E8%AF%81%E4%BA%86%E5%AF%B9%E6%97%A0%E6%95%88%E7%AD%BE%E5%90%8D%E5%AE%B9%E5%99%A8%E7%9A%84%E6%A3%80%E6%B5%8B%E3%80%82%3C%2FP%3E%3CP%3Eu-%E5%90%AF%E5%8A%A8%20%E4%B8%AD%20%22%5C%20include%5C%20configs%5C%20imx93_evk.h%20%E7%9A%84%E4%BB%A3%E7%A0%81%20%22%E8%BF%99%E6%84%8F%E5%91%B3%E7%9D%80%20auth_cntr%20%E8%BF%94%E5%9B%9E%E7%9A%84%E5%80%BC%E5%8F%AF%E7%94%A8%E4%BA%8E%E7%8E%AF%E5%A2%83%E4%B8%AD%E7%9A%84%22if%20%E8%AF%AD%E5%8F%A5%22%20%E3%80%82%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%20translate%3D%22no%22%3E%22auth_os%3Dauth_cntr%20%24%7Bcntr_addr%7D%5C0%22%20%5C%0A%22mmcboot%3Decho%20Booting%20from%20mmc%20...%3B%20%22%20%5C%0A%09%09%22run%20mmcargs%3B%20%22%20%5C%0A%09%09%22if%20test%20%24%7Bsec_boot%7D%20%3D%20yes%3B%20then%20%22%20%5C%0A%09%09%09%22if%20run%20auth_os%3B%20then%20%22%20%5C%0A%09%09%09%09%22run%20boot_os%3B%20%22%20%5C%0A%09%09%09%22else%20%22%20%5C%0A%09%09%09%09%22echo%20ERR%3A%20failed%20to%20authenticate%3B%20%22%20%5C%0A%09%09%09%22fi%3B%20%22%20%5C%0A%09%09....%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%E5%A6%82%E6%9E%9C%E8%BF%90%E8%A1%8C%20auth_os%EF%BC%8C%E5%88%99%E6%A3%80%E6%9F%A5%22%EF%BC%9B%E5%A6%82%E6%9E%9C%E8%BF%90%E8%A1%8C%20auth_os%EF%BC%8C%E5%88%99%22%20%EF%BC%8C%E7%BB%99%E4%BA%BA%E7%9A%84%E5%8D%B0%E8%B1%A1%E6%98%AF%E5%AE%B9%E5%99%A8%E9%AA%8C%E8%AF%81%E6%88%90%E5%8A%9F%E5%8F%AF%E4%BD%9C%E4%B8%BA%E8%BF%94%E5%9B%9E%E5%80%BC%E3%80%82%20%3CBR%20%2F%3E%3CBR%20%2F%3E%E4%BD%86%E6%B5%8B%E8%AF%95%E8%A1%A8%E6%98%8E%EF%BC%8C%E5%AF%B9%E4%BA%8E%E6%9C%89%E6%95%88%E5%92%8C%E6%97%A0%E6%95%88%E7%9A%84%E7%AD%BE%E5%90%8D%E5%AE%B9%E5%99%A8%EF%BC%8C%E7%BB%93%E6%9E%9C%E6%80%BB%E6%98%AF%220%22%20%E3%80%82ahab_status%20%E5%91%BD%E4%BB%A4%E5%9C%A8%E9%AA%8C%E8%AF%81%E6%97%A0%E6%95%88%E7%AD%BE%E5%90%8D%E5%AE%B9%E5%99%A8%E5%90%8E%E7%A1%AE%E5%AE%9E%E4%BC%9A%E6%8A%A5%E9%94%99%E3%80%82%3C%2FP%3E%3CP%3E%E8%BF%99%E6%98%AF%20OEM_Open%20%E8%AE%BE%E5%A4%87%E7%9A%84%E9%A2%84%E6%9C%9F%E8%A1%8C%E4%B8%BA%E5%90%97%EF%BC%9F%E6%88%96%E8%80%85%E6%98%AF%20imx93_evk.h%E6%96%87%E4%BB%B6%E6%98%AF%E5%90%A6%E6%9A%97%E7%A4%BA%E4%BA%86%E4%B8%80%E4%BA%9B%E4%B8%8D%E5%AD%98%E5%9C%A8%E7%9A%84%E4%B8%9C%E8%A5%BF%EF%BC%9F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2138272%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3E%E5%AE%89%E5%85%A8%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EYocto%20Project%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2161187%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Should%20auth_cntr%20provide%20a%20return%20value%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2161187%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E7%BB%93%E6%9E%9C%E5%80%BC%E4%BC%BC%E4%B9%8E%E5%8F%AA%E4%BC%9A%E6%8A%A5%E5%91%8A%20auth_cntr%20%E5%91%BD%E4%BB%A4%E7%9A%84%E6%89%A7%E8%A1%8C%E6%83%85%E5%86%B5%EF%BC%8C%E8%80%8C%3CSTRONG%3E%E4%B8%8D%E4%BC%9A%3C%2FSTRONG%3E%E6%8A%A5%E5%91%8A%E5%AE%B9%E5%99%A8%E6%9C%AC%E8%BA%AB%E6%98%AF%E5%90%A6%E7%9C%9F%E5%AE%9E%E3%80%82%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%E5%AF%B9%E4%BA%8E%20OEM_Open%20%E6%96%B9%E6%A1%88%EF%BC%8C%E8%BF%99%E5%8F%AF%E8%83%BD%E4%BC%9A%E5%AF%BC%E8%87%B4%22run%20boot_os%22%20%E5%9C%A8%E5%AE%B9%E5%99%A8%E4%B8%8D%E6%98%AF%E7%9C%9F%E5%AE%9E%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%E4%B9%9F%E4%BC%9A%E8%A2%AB%E6%89%A7%E8%A1%8C%E3%80%82%3C%2FP%3E%3CP%3E%E5%AF%B9%E4%BA%8E%20OEM_Closed%20%E6%96%B9%E6%A1%88%EF%BC%8C%E8%B0%83%E7%94%A8%20auth_cntr%20%E4%BC%9A%E5%AF%BC%E8%87%B4%E7%AB%8B%E5%8D%B3%E9%87%8D%E5%90%AF%EF%BC%8C%E5%9B%A0%E6%AD%A4%20if%20%E8%AF%AD%E5%8F%A5%E6%B0%B8%E8%BF%9C%E4%B8%8D%E4%BC%9A%E5%AE%8C%E6%88%90%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2142768%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Should%20auth_cntr%20provide%20a%20return%20value%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2142768%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E5%B8%8C%E6%9C%9B%E6%9C%AC%E8%8A%82%26lt%3B10.9%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%3E%E6%9C%AC%E6%8C%87%E5%8D%97%3C%2FA%3E%E7%9A%84%E7%BD%91%E7%BB%9C%E5%AE%89%E5%85%A8%E5%8F%82%E8%80%83%E8%AE%BE%E8%AE%A1%20%26gt%3B%20%E5%8F%AF%E8%83%BD%E4%BC%9A%E5%AF%B9%E4%BD%A0%E6%9C%89%E6%89%80%E5%B8%AE%E5%8A%A9%E3%80%82%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%E6%AD%A4%E8%87%B4%3C%2FP%3E%0A%3CP%3E%E5%93%88%E7%BB%B4%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2140631%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Should%20auth_cntr%20provide%20a%20return%20value%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2140631%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%88%91%E6%AD%A3%E5%9C%A8%E5%9F%BA%E4%BA%8E%20i.MX93%20%E7%9A%84%E6%9D%BF%E4%B8%8A%E8%BF%90%E8%A1%8C%E5%9F%BA%E4%BA%8E%20yocto%20scarthgap%20%E7%9A%84%E9%95%9C%E5%83%8F%EF%BC%8C%E8%BF%90%E8%A1%8C%E7%9A%84%E6%98%AF%E7%9B%B8%E5%BD%93%E6%97%A7%E7%9A%84%202022.04%20u-boot%EF%BC%88%E7%9B%AE%E5%89%8D%EF%BC%89%E3%80%82%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%BD%93%E6%97%B6%E7%9A%84%E6%83%B3%E6%B3%95%E6%98%AF%E6%8B%A5%E6%9C%89%E5%A4%9A%E4%B8%AA%20ahab%20%E5%AE%B9%E5%99%A8%EF%BC%9A%3CBR%20%2F%3E-%E7%AC%AC%201%20%E4%B8%AA%E5%AE%B9%E5%99%A8%EF%BC%9AELE%E3%80%81DDR%20FW%E3%80%81SPL%20%3CBR%20%2F%3E-%E7%AC%AC%202%20%E4%B8%AA%E5%AE%B9%E5%99%A8%EF%BC%9AATF%E3%80%81OP-TEE%E3%80%81U-%E5%90%AF%E5%8A%A8%20%3CBR%20%2F%3E-%E7%AC%AC%203%20%E4%B8%AA%E5%AE%B9%E5%99%A8%EF%BC%9A%E5%86%85%E6%A0%B8%20%3CBR%20%2F%3E-%E7%AC%AC%204%20%E4%B8%AA%E5%AE%B9%E5%99%A8%EF%BC%9Adtb%20%3CBR%20%2F%3E-...%20nth%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%E6%89%80%E6%9C%89%E5%AE%B9%E5%99%A8%E9%83%BD%E9%80%9A%E8%BF%87%E4%BF%A1%E4%BB%BB%E9%93%BE%E8%BF%9B%E8%A1%8C%E9%AA%8C%E8%AF%81%EF%BC%8C%E9%A6%96%E5%85%88%E6%98%AF%20ROM%20%E9%AA%8C%E8%AF%81%E7%AC%AC%201%20%E4%B8%AA%EF%BC%8CSPL%20%E9%AA%8C%E8%AF%81%E7%AC%AC%E4%BA%8C%E4%B8%AA%E5%AE%B9%E5%99%A8%EF%BC%8C%E7%AC%AC%E4%B8%89%E4%B8%AA%E3%80%81%E7%AC%AC%E5%9B%9B%E4%B8%AA%EF%BC%8C%E5%8F%AF%E8%83%BD%E8%BF%98%E6%9C%89%E5%85%B6%E4%BB%96%E5%AE%B9%E5%99%A8%E3%80%82%3CBR%20%2F%3E%3CBR%20%2F%3E%E4%B8%BA%E4%BA%86%E9%AA%8C%E8%AF%81%20u-boot%20%E4%B8%AD%E7%9A%84%E7%AC%AC%203%20%E4%B8%AA%E5%92%8C%E7%AC%AC%204%20%E4%B8%AA%E5%AE%B9%E5%99%A8%EF%BC%8C%E6%88%91%E4%BD%BF%E7%94%A8%E4%BA%86%20auth_cntr%20%E5%91%BD%E4%BB%A4%EF%BC%8C%E5%AE%83%E9%80%9A%E8%BF%87%20ahab_status%20%E6%8F%90%E4%BE%9B%E6%9C%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en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Should%20auth_cntr%20provide%20a%20return%20value%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2140493%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%20data-teams%3D%22true%22%3Eauth_os%20%E9%AA%8C%E8%AF%81%E4%BD%BF%E7%94%A8%E5%86%85%E6%A0%B8%E5%92%8C%20DTB%20%E7%89%88%E6%9C%AC%20%E7%9A%84%E5%AE%B9%E5%99%A8%E3%80%82ahab_status%20%E4%BB%85%E6%8A%A5%E5%91%8A%E7%BB%8F%E8%BF%87%E9%AA%8C%E8%AF%81%E7%9A%84%E5%86%85%E5%AE%B9%3C%2FSPAN%3E%E3%80%82%3CSPAN%20data-teams%3D%22true%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-teams%3D%22true%22%3E%E4%BD%A0%E6%AD%A3%E5%9C%A8%E6%B5%8B%E8%AF%95%E5%93%AA%E4%B8%AA%E7%89%88%E6%9C%AC%E7%9A%84%E7%94%B5%E8%B7%AF%E6%9D%BF%E6%94%AF%E6%8C%81%E5%8C%85%E4%BB%A5%E5%8F%8A%E4%BB%80%E4%B9%88%20AHAB%20%E4%BA%8B%E4%BB%B6%EF%BC%9F%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%20data-teams%3D%22true%22%3E%E9%A1%BA%E7%A5%9D%E5%95%86%E7%A5%BA%EF%BC%81%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-teams%3D%22true%22%3E%E5%93%88%E7%BB%B4%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E