mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v3 0/2] i.MX6ULL: set engine software for Secure Boot on HABv4
@ 2020-09-17  9:36 Maik Otto
  2020-09-17  9:36 ` [PATCH v3 1/2] arch: arm: boards phytec: Split flash header for pcl063 with i.MX6Ul and i.MX6ULL Maik Otto
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maik Otto @ 2020-09-17  9:36 UTC (permalink / raw)
  To: barebox; +Cc: Maik Otto

The i.MX6ULL has no CAAM engine for Secure Boot on HABv4. This patch series
set the engine software for i.MX6ULL and for the PHYTEC boards PCL-063 with
i.MX6ULL.

Changes in v3 and Patch 2:
    - rework and move the file habv4-imx6-gencsf.h to habv4-imx6-gencsf-template.h
    - rework the file habv4-imx6ull-gencsf.h and add new file
      habv4-imx6-gencsf.h

Changes in v2:                                                                   
    - Rework in Patch 2 the file habv4-imx6-gencsf.h, because cst 3.3.1 fails
      for engine software with parameter Feature.

Maik Otto (2):
  arch: arm: boards phytec: Split flash header for pcl063 with i.MX6Ul
    and i.MX6ULL
  arch: arm: mach-imx: Add habv4 config file for i.MX6ULL

 ...b.imxcfg => flash-header-phytec-pcl063-512mb.h} |  1 -
 .../flash-header-phytec-pcl063ul-512mb.imxcfg      |  3 +
 ... => flash-header-phytec-pcl063ull-256mb.imxcfg} |  2 +-
 .../flash-header-phytec-pcl063ull-512mb.imxcfg     |  3 +
 .../include/mach/habv4-imx6-gencsf-template.h      | 64 ++++++++++++++++++++++
 arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h | 59 +-------------------
 .../mach-imx/include/mach/habv4-imx6ull-gencsf.h   |  4 ++
 images/Makefile.imx                                |  8 +--
 8 files changed, 82 insertions(+), 62 deletions(-)
 rename arch/arm/boards/phytec-som-imx6/{flash-header-phytec-pcl063-512mb.imxcfg => flash-header-phytec-pcl063-512mb.h} (83%)
 create mode 100644 arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ul-512mb.imxcfg
 rename arch/arm/boards/phytec-som-imx6/{flash-header-phytec-pcl063-256mb.imxcfg => flash-header-phytec-pcl063ull-256mb.imxcfg} (82%)
 create mode 100644 arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-512mb.imxcfg
 create mode 100644 arch/arm/mach-imx/include/mach/habv4-imx6-gencsf-template.h
 create mode 100644 arch/arm/mach-imx/include/mach/habv4-imx6ull-gencsf.h

-- 
2.7.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/2] arch: arm: boards phytec: Split flash header for pcl063 with i.MX6Ul and i.MX6ULL
  2020-09-17  9:36 [PATCH v3 0/2] i.MX6ULL: set engine software for Secure Boot on HABv4 Maik Otto
@ 2020-09-17  9:36 ` Maik Otto
  2020-09-17  9:36 ` [PATCH v3 2/2] arch: arm: mach-imx: Add habv4 config file for i.MX6ULL Maik Otto
  2020-09-21  6:32 ` [PATCH v3 0/2] i.MX6ULL: set engine software for Secure Boot on HABv4 Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Maik Otto @ 2020-09-17  9:36 UTC (permalink / raw)
  To: barebox; +Cc: Maik Otto

i.MX6UL and i.MX6ULL have different engines for Secure Boot on HABv4.
For better differentiation rename existing pcl063 flash headers to
pcl063ul and pcl063ull.

Signed-off-by: Maik Otto <m.otto@phytec.de>
---
Changes in v3:
    - none
Changes in v2:
    - none 
---
 ...tec-pcl063-512mb.imxcfg => flash-header-phytec-pcl063-512mb.h} | 1 -
 .../phytec-som-imx6/flash-header-phytec-pcl063ul-512mb.imxcfg     | 3 +++
 ...63-256mb.imxcfg => flash-header-phytec-pcl063ull-256mb.imxcfg} | 0
 .../phytec-som-imx6/flash-header-phytec-pcl063ull-512mb.imxcfg    | 3 +++
 images/Makefile.imx                                               | 8 ++++----
 5 files changed, 10 insertions(+), 5 deletions(-)
 rename arch/arm/boards/phytec-som-imx6/{flash-header-phytec-pcl063-512mb.imxcfg => flash-header-phytec-pcl063-512mb.h} (83%)
 create mode 100644 arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ul-512mb.imxcfg
 rename arch/arm/boards/phytec-som-imx6/{flash-header-phytec-pcl063-256mb.imxcfg => flash-header-phytec-pcl063ull-256mb.imxcfg} (100%)
 create mode 100644 arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-512mb.imxcfg

diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063-512mb.imxcfg b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063-512mb.h
similarity index 83%
rename from arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063-512mb.imxcfg
rename to arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063-512mb.h
index 26998c3..c4122d2 100644
--- a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063-512mb.imxcfg
+++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063-512mb.h
@@ -7,4 +7,3 @@
 	wm 32 0x021B0000 0x84180000
 
 #include "flash-header-phytec-pcl063.h"
-#include <mach/habv4-imx6-gencsf.h>
diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ul-512mb.imxcfg b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ul-512mb.imxcfg
new file mode 100644
index 0000000..f629a8e
--- /dev/null
+++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ul-512mb.imxcfg
@@ -0,0 +1,3 @@
+
+#include "flash-header-phytec-pcl063-512mb.h"
+#include <mach/habv4-imx6-gencsf.h>
diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063-256mb.imxcfg b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-256mb.imxcfg
similarity index 100%
rename from arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063-256mb.imxcfg
rename to arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-256mb.imxcfg
diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-512mb.imxcfg b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-512mb.imxcfg
new file mode 100644
index 0000000..f629a8e
--- /dev/null
+++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-512mb.imxcfg
@@ -0,0 +1,3 @@
+
+#include "flash-header-phytec-pcl063-512mb.h"
+#include <mach/habv4-imx6-gencsf.h>
diff --git a/images/Makefile.imx b/images/Makefile.imx
index 7b24e5f..3434a10 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -346,13 +346,13 @@ $(call build_imx_habv4img, CONFIG_MACH_GRINN_LITEBOARD, start_imx6ul_liteboard_5
 
 $(call build_imx_habv4img, CONFIG_MACH_NXP_IMX6ULL_EVK, start_nxp_imx6ull_evk, nxp-imx6ull-evk/flash-header-nxp-imx6ull-evk, nxp-imx6ull-evk)
 
-$(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, start_phytec_phycore_imx6ul_som_nand_512mb, phytec-som-imx6/flash-header-phytec-pcl063-512mb, phytec-phycore-imx6ul-nand-512mb)
+$(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, start_phytec_phycore_imx6ul_som_nand_512mb, phytec-som-imx6/flash-header-phytec-pcl063ul-512mb, phytec-phycore-imx6ul-nand-512mb)
 
-$(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, start_phytec_phycore_imx6ull_som_lc_nand_256mb, phytec-som-imx6/flash-header-phytec-pcl063-256mb, phytec-phycore-imx6ull-lc-nand-256mb)
+$(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, start_phytec_phycore_imx6ull_som_lc_nand_256mb, phytec-som-imx6/flash-header-phytec-pcl063ull-256mb, phytec-phycore-imx6ull-lc-nand-256mb)
 
-$(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, start_phytec_phycore_imx6ull_som_nand_512mb, phytec-som-imx6/flash-header-phytec-pcl063-512mb, phytec-phycore-imx6ull-nand-512mb)
+$(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, start_phytec_phycore_imx6ull_som_nand_512mb, phytec-som-imx6/flash-header-phytec-pcl063ull-512mb, phytec-phycore-imx6ull-nand-512mb)
 
-$(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, start_phytec_phycore_imx6ull_som_emmc_512mb, phytec-som-imx6/flash-header-phytec-pcl063-512mb, phytec-phycore-imx6ull-emmc-512mb)
+$(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, start_phytec_phycore_imx6ull_som_emmc_512mb, phytec-som-imx6/flash-header-phytec-pcl063ull-512mb, phytec-phycore-imx6ull-emmc-512mb)
 
 $(call build_imx_habv4img, CONFIG_MACH_PROTONIC_IMX6, start_imx6ul_prti6g, protonic-imx6/flash-header-prti6g, protonic-prti6g)
 
-- 
2.7.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] arch: arm: mach-imx: Add habv4 config file for i.MX6ULL
  2020-09-17  9:36 [PATCH v3 0/2] i.MX6ULL: set engine software for Secure Boot on HABv4 Maik Otto
  2020-09-17  9:36 ` [PATCH v3 1/2] arch: arm: boards phytec: Split flash header for pcl063 with i.MX6Ul and i.MX6ULL Maik Otto
@ 2020-09-17  9:36 ` Maik Otto
  2020-09-21  6:32 ` [PATCH v3 0/2] i.MX6ULL: set engine software for Secure Boot on HABv4 Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Maik Otto @ 2020-09-17  9:36 UTC (permalink / raw)
  To: barebox; +Cc: Maik Otto

The i.MX6ULL has no CAAM engine for Secure Boot on HABv4 (NXP AN4581).
For i.MX6ULL the engine Software (SW) must used for the image
validation.

Signed-off-by: Maik Otto <m.otto@phytec.de>
---
Changes in v3:
    - move habv4-imx6-gencsf.h to habv4-imx6-gencsf-template.h and rework it
    - create new habv4-imx6-gencsf.h
    - rework habv4-imx6ull-gencsf.h
Changes in v2:
    - Rework the file habv4-imx6-gencsf.h, because cst 3.3.1 fails for engine
      software with parameter Feature.
---
 .../flash-header-phytec-pcl063ull-256mb.imxcfg     |  2 +-
 .../flash-header-phytec-pcl063ull-512mb.imxcfg     |  2 +-
 .../include/mach/habv4-imx6-gencsf-template.h      | 64 ++++++++++++++++++++++
 arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h | 59 +-------------------
 .../mach-imx/include/mach/habv4-imx6ull-gencsf.h   |  4 ++
 5 files changed, 73 insertions(+), 58 deletions(-)
 create mode 100644 arch/arm/mach-imx/include/mach/habv4-imx6-gencsf-template.h
 create mode 100644 arch/arm/mach-imx/include/mach/habv4-imx6ull-gencsf.h

diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-256mb.imxcfg b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-256mb.imxcfg
index b93e81f..e6871d8 100644
--- a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-256mb.imxcfg
+++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-256mb.imxcfg
@@ -7,4 +7,4 @@
 	wm 32 0x021B0000 0x83180000
 
 #include "flash-header-phytec-pcl063.h"
-#include <mach/habv4-imx6-gencsf.h>
+#include <mach/habv4-imx6ull-gencsf.h>
diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-512mb.imxcfg b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-512mb.imxcfg
index f629a8e..d2d7183 100644
--- a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-512mb.imxcfg
+++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063ull-512mb.imxcfg
@@ -1,3 +1,3 @@
 
 #include "flash-header-phytec-pcl063-512mb.h"
-#include <mach/habv4-imx6-gencsf.h>
+#include <mach/habv4-imx6ull-gencsf.h>
diff --git a/arch/arm/mach-imx/include/mach/habv4-imx6-gencsf-template.h b/arch/arm/mach-imx/include/mach/habv4-imx6-gencsf-template.h
new file mode 100644
index 0000000..668fb06
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/habv4-imx6-gencsf-template.h
@@ -0,0 +1,64 @@
+/*
+ * This snippet can be included from a i.MX flash header configuration
+ * file for generating signed images. The necessary keys/certificates
+ * are expected in these config variables:
+ *
+ * CONFIG_HABV4_TABLE_BIN
+ * CONFIG_HABV4_CSF_CRT_PEM
+ * CONFIG_HABV4_IMG_CRT_PEM
+ */
+
+#ifndef SETUP_HABV4_ENGINE
+#error "SETUP_HABV4_ENGINE undefined"
+#endif
+
+hab [Header]
+hab Version = 4.1
+hab Hash Algorithm = sha256
+hab Engine Configuration = 0
+hab Certificate Format = X509
+hab Signature Format = CMS
+hab Engine = SETUP_HABV4_ENGINE
+
+hab [Install SRK]
+hab File = CONFIG_HABV4_TABLE_BIN
+hab # SRK index within SRK-Table 0..3
+hab Source index = CONFIG_HABV4_SRK_INDEX
+
+hab [Install CSFK]
+/* target key index in keystore 1 */
+hab File = CONFIG_HABV4_CSF_CRT_PEM
+
+hab [Authenticate CSF]
+
+hab [Unlock]
+hab Engine = SETUP_HABV4_ENGINE
+#ifdef SETUP_HABV4_FEATURES
+hab Features = SETUP_HABV4_FEATURES
+#endif
+
+hab [Install Key]
+/* verification key index in key store (0, 2...4) */
+hab Verification index = 0
+/* target key index in key store (2...4) */
+hab Target index = 2
+hab File = CONFIG_HABV4_IMG_CRT_PEM
+
+hab [Authenticate Data]
+/* verification key index in key store (2...4) */
+hab Verification index = 2
+
+hab_blocks
+
+hab_encrypt [Install Secret Key]
+hab_encrypt Verification index = 0
+hab_encrypt Target index = 0
+hab_encrypt_key
+hab_encrypt_key_length 256
+hab_encrypt_blob_address
+
+hab_encrypt [Decrypt Data]
+hab_encrypt Verification index = 0
+hab_encrypt Mac Bytes = 16
+
+hab_encrypt_blocks
diff --git a/arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h b/arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h
index 17c4d79..ca741b2 100644
--- a/arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h
+++ b/arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h
@@ -1,58 +1,5 @@
-/*
- * This snippet can be included from a i.MX flash header configuration
- * file for generating signed images. The necessary keys/certificates
- * are expected in these config variables:
- *
- * CONFIG_HABV4_TABLE_BIN
- * CONFIG_HABV4_CSF_CRT_PEM
- * CONFIG_HABV4_IMG_CRT_PEM
- */
 
-hab [Header]
-hab Version = 4.1
-hab Hash Algorithm = sha256
-hab Engine Configuration = 0
-hab Certificate Format = X509
-hab Signature Format = CMS
-hab Engine = CAAM
+#define SETUP_HABV4_ENGINE CAAM
+#define SETUP_HABV4_FEATURES  RNG, MID
 
-hab [Install SRK]
-hab File = CONFIG_HABV4_TABLE_BIN
-hab # SRK index within SRK-Table 0..3
-hab Source index = CONFIG_HABV4_SRK_INDEX
-
-hab [Install CSFK]
-/* target key index in keystore 1 */
-hab File = CONFIG_HABV4_CSF_CRT_PEM
-
-hab [Authenticate CSF]
-
-hab [Unlock]
-hab Engine = CAAM
-hab Features = RNG, MID
-
-hab [Install Key]
-/* verification key index in key store (0, 2...4) */
-hab Verification index = 0
-/* target key index in key store (2...4) */
-hab Target index = 2
-hab File = CONFIG_HABV4_IMG_CRT_PEM
-
-hab [Authenticate Data]
-/* verification key index in key store (2...4) */
-hab Verification index = 2
-
-hab_blocks
-
-hab_encrypt [Install Secret Key]
-hab_encrypt Verification index = 0
-hab_encrypt Target index = 0
-hab_encrypt_key
-hab_encrypt_key_length 256
-hab_encrypt_blob_address
-
-hab_encrypt [Decrypt Data]
-hab_encrypt Verification index = 0
-hab_encrypt Mac Bytes = 16
-
-hab_encrypt_blocks
+#include <mach/habv4-imx6-gencsf-template.h>
diff --git a/arch/arm/mach-imx/include/mach/habv4-imx6ull-gencsf.h b/arch/arm/mach-imx/include/mach/habv4-imx6ull-gencsf.h
new file mode 100644
index 0000000..6a558b8
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/habv4-imx6ull-gencsf.h
@@ -0,0 +1,4 @@
+
+#define SETUP_HABV4_ENGINE SW
+
+#include <mach/habv4-imx6-gencsf-template.h>
-- 
2.7.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 0/2] i.MX6ULL: set engine software for Secure Boot on HABv4
  2020-09-17  9:36 [PATCH v3 0/2] i.MX6ULL: set engine software for Secure Boot on HABv4 Maik Otto
  2020-09-17  9:36 ` [PATCH v3 1/2] arch: arm: boards phytec: Split flash header for pcl063 with i.MX6Ul and i.MX6ULL Maik Otto
  2020-09-17  9:36 ` [PATCH v3 2/2] arch: arm: mach-imx: Add habv4 config file for i.MX6ULL Maik Otto
@ 2020-09-21  6:32 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2020-09-21  6:32 UTC (permalink / raw)
  To: Maik Otto; +Cc: barebox

On Thu, Sep 17, 2020 at 11:36:53AM +0200, Maik Otto wrote:
> The i.MX6ULL has no CAAM engine for Secure Boot on HABv4. This patch series
> set the engine software for i.MX6ULL and for the PHYTEC boards PCL-063 with
> i.MX6ULL.
> 
> Changes in v3 and Patch 2:
>     - rework and move the file habv4-imx6-gencsf.h to habv4-imx6-gencsf-template.h
>     - rework the file habv4-imx6ull-gencsf.h and add new file
>       habv4-imx6-gencsf.h
> 
> Changes in v2:                                                                   
>     - Rework in Patch 2 the file habv4-imx6-gencsf.h, because cst 3.3.1 fails
>       for engine software with parameter Feature.
> 
> Maik Otto (2):
>   arch: arm: boards phytec: Split flash header for pcl063 with i.MX6Ul
>     and i.MX6ULL
>   arch: arm: mach-imx: Add habv4 config file for i.MX6ULL

Applied, thanks

Sascha


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-21  6:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17  9:36 [PATCH v3 0/2] i.MX6ULL: set engine software for Secure Boot on HABv4 Maik Otto
2020-09-17  9:36 ` [PATCH v3 1/2] arch: arm: boards phytec: Split flash header for pcl063 with i.MX6Ul and i.MX6ULL Maik Otto
2020-09-17  9:36 ` [PATCH v3 2/2] arch: arm: mach-imx: Add habv4 config file for i.MX6ULL Maik Otto
2020-09-21  6:32 ` [PATCH v3 0/2] i.MX6ULL: set engine software for Secure Boot on HABv4 Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox