Skip to contentSkip to conversation

mach-imx: hab: Unlock CAAM MID for OP-TEE

PATCH In review Albert Schwarzkopf 3 participants 4 messages Apr 22, 2020 – Apr 23, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mach-imx: hab: Unlock CAAM MID for OP-TEE

The current CSF config used by barebox does not allow a successful bootup of OP-TEE within a closed HAB configuration. As specified in section 2.1 of the application notes [1], OP-TEE requires that the "UNLOCK MID" HAB command is present in the CSF file for this case.

This patch adds the mentioned command if support for OP-TEE is enabled in the configuration. It's based on the discussion in [2].

[1] https://www.nxp.com/docs/en/application-note/AN12056.pdf
[2] https://github.com/OP-TEE/optee_os/issues/3609

---
 arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h +4 -0
index 581887960..0e6c7e2dd 100644
@@ -29,7 +29,11 @@ hab [Authenticate CSF]
 
 hab [Unlock]
 hab Engine = CAAM
+#if defined(CONFIG_BOOTM_OPTEE) || defined(CONFIG_PBL_OPTEE)
+hab Features = MID,RNG
+#else
 hab Features = RNG
+#endif
 
 hab [Install Key]
 /* verification key index in key store (0, 2...4) */
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

Hi,

Quoted 24 lines · Albert Schwarzkopf

The current CSF config used by barebox does not allow a successful bootup of OP-TEE within a closed HAB configuration. As specified in section 2.1 of the application notes [1], OP-TEE requires that the "UNLOCK MID" HAB command is present in the CSF file for this case.

This patch adds the mentioned command if support for OP-TEE is enabled in the configuration. It's based on the discussion in [2].

[1] https://www.nxp.com/docs/en/application-note/AN12056.pdf
[2] https://github.com/OP-TEE/optee_os/issues/3609

---
 arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h +0 -0
index 581887960..0e6c7e2dd 100644

arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h hab [Authenticate CSF] · line 36

Quoted 8 lines
arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h +4 -0
@@ -29,7 +29,11 @@ hab [Authenticate CSF]
 
 hab [Unlock]
 hab Engine = CAAM
+#if defined(CONFIG_BOOTM_OPTEE) || defined(CONFIG_PBL_OPTEE)
+hab Features = MID,RNG
+#else
 hab Features = RNG
+#endif

I don't see any reason to not unlock the MID settings in a secure configuration without OP-TEE. MID Setup only really makes sense if normal and secure world require different access policies to the CAAM, which isn't the case if only linux is run in the secure world. AFAIK unlocked MID should not prevent Linux from working correctly with the CAAM even if no OP-TEE is present, although I have not specifically tested this case.

Regards,
Rouven Czerwinski

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

maintainer
#2 lore raw
Quoted 28 lines · Rouven Czerwinski

Hi,

Quoted 25 lines · Albert Schwarzkopf

The current CSF config used by barebox does not allow a successful bootup of OP-TEE within a closed HAB configuration. As specified in section 2.1 of the application notes [1], OP-TEE requires that the "UNLOCK MID" HAB command is present in the CSF file for this case.

This patch adds the mentioned command if support for OP-TEE is enabled in the configuration. It's based on the discussion in [2].

[1] https://www.nxp.com/docs/en/application-note/AN12056.pdf
[2] https://github.com/OP-TEE/optee_os/issues/3609

---
 arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h +0 -0
index 581887960..0e6c7e2dd 100644
@@ -29,7 +29,11 @@ hab [Authenticate CSF]
 
Quoted 15 lines

arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h hab [Authenticate CSF] · line 36

Quoted 7 lines
arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h +4 -0
 hab [Unlock]
 hab Engine = CAAM
+#if defined(CONFIG_BOOTM_OPTEE) || defined(CONFIG_PBL_OPTEE)
+hab Features = MID,RNG
+#else
 hab Features = RNG
+#endif

I don't see any reason to not unlock the MID settings in a secure configuration without OP-TEE. MID Setup only really makes sense if normal and secure world require different access policies to the CAAM, which isn't the case if only linux is run in the secure world. AFAIK unlocked MID should not prevent Linux from working correctly with the CAAM even if no OP-TEE is present, although I have not specifically tested this case.

Are you suggesting to drop the #ifdef and do a "hab Features = MID,RNG" unconditionally?

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
Quoted 49 lines · Sascha Hauer
Quoted 39 lines · Rouven Czerwinski

Hi,

Quoted 25 lines · Albert Schwarzkopf

The current CSF config used by barebox does not allow a successful
bootup of OP-TEE within a closed HAB configuration. As specified in section 2.1 of the application notes [1], OP-TEE requires that the "UNLOCK MID" HAB command is present in the CSF file for this case.

This patch adds the mentioned command if support for OP-TEE is enabled in the configuration. It's based on the discussion in [2].

[1] https://www.nxp.com/docs/en/application-note/AN12056.pdf
[2] https://github.com/OP-TEE/optee_os/issues/3609

---
 arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h +0 -0
index 581887960..0e6c7e2dd 100644

arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h hab [Authenticate CSF] · line 36

Quoted 8 lines
arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h +4 -0
@@ -29,7 +29,11 @@ hab [Authenticate CSF]
 
 hab [Unlock]
 hab Engine = CAAM
+#if defined(CONFIG_BOOTM_OPTEE) || defined(CONFIG_PBL_OPTEE)
+hab Features = MID,RNG
+#else
 hab Features = RNG
+#endif

I don't see any reason to not unlock the MID settings in a secure configuration without OP-TEE. MID Setup only really makes sense if

Quoted 8 lines

normal and secure world require different access policies to the CAAM,
which isn't the case if only linux is run in the secure world. AFAIK unlocked MID should not prevent Linux from working correctly with
the CAAM even if no OP-TEE is present, although I have not specifically
tested this case.

Quoted 3 lines

Are you suggesting to drop the #ifdef and do a "hab Features = MID,RNG"
unconditionally?

Yes.

- Rouven

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox