Skip to contentSkip to conversation

binman: nxp_imx8mcst: allow enabling fast authentication via environment

PATCH In review Sergio Prado 2 participants 2 messages Nov 17 – Dec 1 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 binman: nxp_imx8mcst: allow enabling fast authentication via environment

All the signing parameters of the nxp_imx8mcst etype can be set through environment variables, which lets a build system use its own key material without modifying the device tree. The fast authentication method is the exception, since it can only be enabled with the nxp,fast-auth device tree property.

Add the FAST_AUTH environment variable, which overrides the device tree property. FAST_AUTH=1 enables fast authentication and any other value disables it.

Add tests to check that FAST_AUTH=1 enables fast authentication and that FAST_AUTH=0 overrides the nxp,fast-auth property.

---
 doc/imx/habv4/guides/mx8m_spl_secure_boot.txt |  2 +-
 tools/binman/etype/nxp_imx8mcst.py            |  6 ++-
 tools/binman/ftest.py                         | 49 +++++++++++++++++++
 3 files changed, 55 insertions(+), 2 deletions(-)
doc/imx/habv4/guides/mx8m_spl_secure_boot.txt +1 -1
index 163e6c600a21..774c7a49d8b4 100644
@@ -180,7 +180,7 @@ Note that environment variables override DT properties.
 +--------------------+-------------+------------------------------------------------------------------+
 | nxp,img-crt        | IMG_KEY     | full path to the IMG Key IMG1_1_sha256_4096_65537_v3_usr_crt.pem |
 +--------------------+-------------+------------------------------------------------------------------+
-| nxp,fast-auth      |             | enable fast authentication method                                |
+| nxp,fast-auth      | FAST_AUTH   | enable fast authentication method (FAST_AUTH=1)                  |
 +--------------------+-------------+------------------------------------------------------------------+
 | nxp,srk-crt        | SRK_KEY     | full path to the SRK Key SRK1_sha256_4096_65537_v3_ca_crt.pem    |
 +--------------------+-------------+------------------------------------------------------------------+
tools/binman/etype/nxp_imx8mcst.py +5 -1
index 02ef9c255860..860b6323fbdb 100644
@@ -80,7 +80,11 @@ class Entry_nxp_imx8mcst(Entry_nxp_imxcst):
         self.loader_address = fdt_util.GetInt(self._node, 'nxp,loader-address')
         self.srk_index = os.getenv(
             'SRK_INDEX', fdt_util.GetInt(self._node, 'nxp,srk-index', 0))
-        self.fast_auth = fdt_util.GetBool(self._node, 'nxp,fast-auth')
+        fast_auth = os.getenv('FAST_AUTH')
+        if fast_auth is not None:
+            self.fast_auth = fast_auth == '1'
+        else:
+            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',
tools/binman/ftest.py +49 -0

55 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw
Quoted 25 lines

All the signing parameters of the nxp_imx8mcst etype can be set through environment variables, which lets a build system use its own key material without modifying the device tree. The fast authentication method is the exception, since it can only be enabled with the nxp,fast-auth device tree property.

Add the FAST_AUTH environment variable, which overrides the device tree property. FAST_AUTH=1 enables fast authentication and any other value disables it.

Add tests to check that FAST_AUTH=1 enables fast authentication and that FAST_AUTH=0 overrides the nxp,fast-auth property.

---
 doc/imx/habv4/guides/mx8m_spl_secure_boot.txt |  2 +-
 tools/binman/etype/nxp_imx8mcst.py            |  6 ++-
 tools/binman/ftest.py                         | 49 +++++++++++++++++++
 3 files changed, 55 insertions(+), 2 deletions(-)
doc/imx/habv4/guides/mx8m_spl_secure_boot.txt +0 -0
index 163e6c600a2..774c7a49d8b 100644

doc/imx/habv4/guides/mx8m_spl_secure_boot.txt Note that environment variables override DT properties. · line 183

Quoted 5 lines
doc/imx/habv4/guides/mx8m_spl_secure_boot.txt +1 -1
@@ -180,7 +180,7 @@ Note that environment variables override DT properties.
 +--------------------+-------------+------------------------------------------------------------------+
 | nxp,img-crt        | IMG_KEY     | full path to the IMG Key IMG1_1_sha256_4096_65537_v3_usr_crt.pem |
 +--------------------+-------------+------------------------------------------------------------------+
-| nxp,fast-auth      |             | enable fast authentication method                                |
+| nxp,fast-auth      | FAST_AUTH   | enable fast authentication method (FAST_AUTH=1)                  |

Should we mention that FAST_AUTH=0 disables here?

Quoted 8 lines
doc/imx/habv4/guides/mx8m_spl_secure_boot.txt +0 -0
 +--------------------+-------------+------------------------------------------------------------------+
 | nxp,srk-crt        | SRK_KEY     | full path to the SRK Key SRK1_sha256_4096_65537_v3_ca_crt.pem    |
 +--------------------+-------------+------------------------------------------------------------------+
tools/binman/etype/nxp_imx8mcst.py +0 -0
index 02ef9c25586..860b6323fbd 100644

tools/binman/etype/nxp_imx8mcst.py class Entry_nxp_imx8mcst(Entry_nxp_imxcst): · line 85

Quoted 7 lines
tools/binman/etype/nxp_imx8mcst.py +3 -1
@@ -80,7 +80,11 @@ class Entry_nxp_imx8mcst(Entry_nxp_imxcst):
         self.loader_address = fdt_util.GetInt(self._node, 'nxp,loader-address')
         self.srk_index = os.getenv(
             'SRK_INDEX', fdt_util.GetInt(self._node, 'nxp,srk-index', 0))
-        self.fast_auth = fdt_util.GetBool(self._node, 'nxp,fast-auth')
+        fast_auth = os.getenv('FAST_AUTH')
+        if fast_auth is not None:
+            self.fast_auth = fast_auth == '1'

Should we be strict about the false value too? I.e. FAST_AUTH=y would disable it right now.

tools/binman/ftest.py fdt fdtmap Extract the devicetree blob from the fdtmap · line 8252

Quoted 11 lines
tools/binman/etype/nxp_imx8mcst.py +2 -0
+        else:
+            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',
tools/binman/ftest.py +0 -0
index 567ffa96b2b..07c89f68562 100644
@@ -8252,6 +8252,55 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         config.read(cfg_fname)

Should we use _ReadNxpImx8mCSTConfig() here too?

Signature · 1 line
David Lechner <[email protected]>