public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] binman: add fast authentication method for i.MX8M signing
@ 2024-09-27 12:42 Brian Ruley
  2024-09-27 16:50 ` Simon Glass
  2024-09-30 10:21 ` [PATCH v2] " Brian Ruley
  0 siblings, 2 replies; 24+ messages in thread
From: Brian Ruley @ 2024-09-27 12:42 UTC (permalink / raw)
  To: Simon Glass, Alper Nebi Yasak, Tom Rini
  Cc: ian.ray, Brian Ruley, Marek Vasut, u-boot

Using the PKI tree with SRKs as intermediate CA isn't necessary or even
desirable in some situations (boot time, for example). Add the possbility
to use the "fast authentication" method where the image and CSF are both
signed using the SRK [1, p.63].

[1] https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors/202591/1/CST_UG.pdf

Signed-off-by: Brian Ruley <brian.ruley@gehealthcare.com>
Cc: Marek Vasut <marex@denx.de>

 tools/binman/etype/nxp_imx8mcst.py | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/tools/binman/etype/nxp_imx8mcst.py b/tools/binman/etype/nxp_imx8mcst.py
index 8221517b0c..d39b6a79de 100644
--- a/tools/binman/etype/nxp_imx8mcst.py
+++ b/tools/binman/etype/nxp_imx8mcst.py
@@ -36,6 +36,9 @@ csf_config_template = """
   File = "SRK_1_2_3_4_table.bin"
   Source index = 0

+[Install NOCAK]
+  File = "SRK1_sha256_4096_65537_v3_usr_crt.pem"
+
 [Install CSFK]
   File = "CSF1_1_sha256_4096_65537_v3_usr_crt.pem"

@@ -70,8 +73,13 @@ class Entry_nxp_imx8mcst(Entry_mkimage):
         super().ReadNode()
         self.loader_address = fdt_util.GetInt(self._node, 'nxp,loader-address')
         self.srk_table = os.getenv('SRK_TABLE', fdt_util.GetString(self._node, 'nxp,srk-table', 'SRK_1_2_3_4_table.bin'))
-        self.csf_crt = os.getenv('CSF_KEY', fdt_util.GetString(self._node, 'nxp,csf-crt', 'CSF1_1_sha256_4096_65537_v3_usr_crt.pem'))
-        self.img_crt = os.getenv('IMG_KEY', fdt_util.GetString(self._node, 'nxp,img-crt', 'IMG1_1_sha256_4096_65537_v3_usr_crt.pem'))
+        self.fast_auth = fdt_util.GetBool(self._node, 'nxp,fast-auth')
+        if not self.fast_auth:
+            self.csf_crt = os.getenv('CSF_KEY', fdt_util.GetString(self._node, 'nxp,csf-crt', 'CSF1_1_sha256_4096_65537_v3_usr_crt.pem'))
+            self.img_crt = os.getenv('IMG_KEY', fdt_util.GetString(self._node, 'nxp,img-crt', 'IMG1_1_sha256_4096_65537_v3_usr_crt.pem'))
+        else:
+            self.srk_crt = os.getenv('SRK_KEY', fdt_util.GetString(self._node, 'nxp,srk-crt', 'SRK1_sha256_2048_65537_v3_usr_crt.pem'))
+
         self.unlock = fdt_util.GetBool(self._node, 'nxp,unlock')
         self.ReadEntries()

@@ -125,8 +133,16 @@ class Entry_nxp_imx8mcst(Entry_mkimage):
         # Load configuration template and modify keys of interest
         config.read_string(csf_config_template)
         config['Install SRK']['File'] = '"' + self.srk_table + '"'
-        config['Install CSFK']['File'] = '"' + self.csf_crt + '"'
-        config['Install Key']['File'] = '"' + self.img_crt + '"'
+        if not self.fast_auth:
+            config.remove_section('Install NOCAK')
+            config['Install CSFK']['File'] = '"' + self.csf_crt + '"'
+            config['Install Key']['File'] = '"' + self.img_crt + '"'
+        else:
+            config.remove_section('Install CSFK')
+            config.remove_section('Install Key')
+            config['Install NOCAK']['File'] = '"' + self.srk_crt + '"'
+            config['Authenticate Data']['Verification index'] = '0'
+
         config['Authenticate Data']['Blocks'] = hex(signbase) + ' 0 ' + hex(len(data)) + ' "' + str(output_dname) + '"'
         if not self.unlock:
             config.remove_section('Unlock')
--
2.39.2


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

end of thread, other threads:[~2024-10-13 20:22 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27 12:42 [PATCH] binman: add fast authentication method for i.MX8M signing Brian Ruley
2024-09-27 16:50 ` Simon Glass
2024-09-27 20:40   ` Tom Rini
2024-09-29 20:53     ` Fabio Estevam
2024-09-29 22:49       ` Simon Glass
2024-09-30  0:46         ` Tom Rini
2024-09-30 11:28           ` Brian Ruley
2024-09-30 14:10             ` Simon Glass
2024-09-30 14:47               ` Brian Ruley
2024-09-30 15:55                 ` Simon Glass
2024-09-30 10:21 ` [PATCH v2] " Brian Ruley
2024-09-30 16:10   ` [PATCH v3 1/2] binman: cosmetic: code formatting fixes Brian Ruley
2024-09-30 16:10     ` [PATCH v3 2/2] binman: add fast authentication method for i.MX8M signing Brian Ruley
2024-09-30 18:52       ` Simon Glass
2024-09-30 18:52     ` [PATCH v3 1/2] binman: cosmetic: code formatting fixes Simon Glass
2024-10-02  6:41       ` Brian Ruley
2024-10-02 22:55         ` Simon Glass
2024-10-07 12:33           ` Brian Ruley
2024-10-09  1:57             ` Simon Glass
2024-10-01 13:58     ` [PATCH v4 1/2] binman: cosmetic: refactor `nxp_imx8mcst' etype code Brian Ruley
2024-10-01 13:58       ` [PATCH v4 2/2] binman: add fast authentication method for i.MX8M signing Brian Ruley
2024-10-08 14:10         ` Fabio Estevam
2024-10-09  1:57         ` Simon Glass
2024-10-13 20:21           ` Fabio Estevam

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