binman: Tidy up tests for pre-load entry type
PATCH 1/4 binman: Tidy up tests for pre-load entry type
Drop the use of a numbered key file since numbering is just for the test devicetree files. Also adjust the tests to avoid putting a hard-coded path to binman in the file, using the entry arg instead.
---
tools/binman/etype/pre_load.py | 6 +--
tools/binman/ftest.py | 48 ++++++++++++++-----
tools/binman/test/230_pre_load.dts | 2 +-
tools/binman/test/231_pre_load_pkcs.dts | 2 +-
tools/binman/test/232_pre_load_pss.dts | 2 +-
.../test/233_pre_load_invalid_padding.dts | 2 +-
.../binman/test/234_pre_load_invalid_sha.dts | 2 +-
.../binman/test/235_pre_load_invalid_algo.dts | 2 +-
.../binman/test/236_pre_load_invalid_key.dts | 2 +-
tools/binman/test/{230_dev.key => dev.key} | 0
10 files changed, 46 insertions(+), 22 deletions(-)
rename tools/binman/test/{230_dev.key => dev.key} (100%)tools/binman/etype/pre_load.py +3 -3
@@ -81,7 +81,8 @@ class Entry_pre_load(Entry_collection): def ReadNode(self): super().ReadNode() - self.key_path, = self.GetEntryArgsOrProps([EntryArg('pre-load-key-path', str)]) + self.key_path, = self.GetEntryArgsOrProps( + [EntryArg('pre-load-key-path', str)]) if self.key_path is None: self.key_path = ''
@@ -98,8 +99,7 @@ class Entry_pre_load(Entry_collection): self.Raise(sign_name + " is not supported") # Read the key - with open(key_name, 'rb') as pem: - key = RSA.import_key(pem.read()) + key = RSA.import_key(tools.read_file(key_name)) # Check if the key has the expected size if key.size_in_bytes() != RSAS[sign_name]:
tools/binman/ftest.py +36 -12
85 lines not on this page · raw message
tools/binman/test/230_pre_load.dts +1 -1
@@ -10,7 +10,7 @@ pre-load { content = <&image>; algo-name = "sha256,rsa2048"; - key-name = "tools/binman/test/230_dev.key"; + key-name = "dev.key"; header-size = <4096>; version = <0x11223344>; };
tools/binman/test/231_pre_load_pkcs.dts +1 -1
@@ -11,7 +11,7 @@ content = <&image>; algo-name = "sha256,rsa2048"; padding-name = "pkcs-1.5"; - key-name = "tools/binman/test/230_dev.key"; + key-name = "dev.key"; header-size = <4096>; version = <0x11223344>; };
tools/binman/test/232_pre_load_pss.dts +1 -1
@@ -11,7 +11,7 @@ content = <&image>; algo-name = "sha256,rsa2048"; padding-name = "pss"; - key-name = "tools/binman/test/230_dev.key"; + key-name = "dev.key"; header-size = <4096>; version = <0x11223344>; };
tools/binman/test/233_pre_load_invalid_padding.dts +1 -1
@@ -11,7 +11,7 @@ content = <&image>; algo-name = "sha256,rsa2048"; padding-name = "padding"; - key-name = "tools/binman/test/230_dev.key"; + key-name = "dev.key"; header-size = <4096>; version = <1>; };
tools/binman/test/234_pre_load_invalid_sha.dts +1 -1
@@ -11,7 +11,7 @@ content = <&image>; algo-name = "sha2560,rsa2048"; padding-name = "pkcs-1.5"; - key-name = "tools/binman/test/230_dev.key"; + key-name = "dev.key"; header-size = <4096>; version = <1>; };
tools/binman/test/235_pre_load_invalid_algo.dts +1 -1
@@ -11,7 +11,7 @@ content = <&image>; algo-name = "sha256,rsa20480"; padding-name = "pkcs-1.5"; - key-name = "tools/binman/test/230_dev.key"; + key-name = "dev.key"; header-size = <4096>; version = <1>; };
tools/binman/test/236_pre_load_invalid_key.dts +1 -1
@@ -11,7 +11,7 @@ content = <&image>; algo-name = "sha256,rsa4096"; padding-name = "pkcs-1.5"; - key-name = "tools/binman/test/230_dev.key"; + key-name = "dev.key"; header-size = <4096>; version = <1>; };
tools/binman/test/dev.key renamed from tools/binman/test/230_dev.key +0 -0
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
PATCH 2/4 binman: Renumber 277_rockchip and 278_mkimage test files
These have ended up with the same numbers as earlier files. Fix them.
---
tools/binman/ftest.py | 6 +++---
.../test/{277_rockchip_tpl.dts => 291_rockchip_tpl.dts} | 0
...issing_multiple.dts => 292_mkimage_missing_multiple.dts} | 0
3 files changed, 3 insertions(+), 3 deletions(-)
rename tools/binman/test/{277_rockchip_tpl.dts => 291_rockchip_tpl.dts} (100%)
rename tools/binman/test/{278_mkimage_missing_multiple.dts => 292_mkimage_missing_multiple.dts} (100%)tools/binman/ftest.py +3 -3
@@ -6683,18 +6683,18 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testPackRockchipTpl(self): """Test that an image with a Rockchip TPL binary can be created""" - data = self._DoReadFile('277_rockchip_tpl.dts') + data = self._DoReadFile('291_rockchip_tpl.dts') self.assertEqual(ROCKCHIP_TPL_DATA, data[:len(ROCKCHIP_TPL_DATA)]) def testMkimageMissingBlobMultiple(self): """Test missing blob with mkimage entry and multiple-data-files""" with test_util.capture_sys_output() as (stdout, stderr): - self._DoTestFile('278_mkimage_missing_multiple.dts', allow_missing=True) + self._DoTestFile('292_mkimage_missing_multiple.dts', allow_missing=True) err = stderr.getvalue() self.assertIn("is missing external blobs and is non-functional", err) with self.assertRaises(ValueError) as e: - self._DoTestFile('278_mkimage_missing_multiple.dts', allow_missing=False) + self._DoTestFile('292_mkimage_missing_multiple.dts', allow_missing=False) self.assertIn("not found in input path", str(e.exception)) def _PrepareSignEnv(self, dts='280_fit_sign.dts'):
tools/binman/test/291_rockchip_tpl.dts renamed from tools/binman/test/277_rockchip_tpl.dts +0 -0
tools/binman/test/292_mkimage_missing_multiple.dts renamed from tools/binman/test/278_mkimage_missing_multiple.dts +0 -0
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
Re: [PATCH 2/4] binman: Renumber 277_rockchip and 278_mkimage test files
These have ended up with the same numbers as earlier files. Fix them.
---
tools/binman/ftest.py | 6 +++---
.../test/{277_rockchip_tpl.dts => 291_rockchip_tpl.dts} | 0
...issing_multiple.dts => 292_mkimage_missing_multiple.dts} | 0
3 files changed, 3 insertions(+), 3 deletions(-)
rename tools/binman/test/{277_rockchip_tpl.dts => 291_rockchip_tpl.dts} (100%)
rename tools/binman/test/{278_mkimage_missing_multiple.dts =>292_mkimage_missing_multiple.dts} (100%)
Applied to u-boot-dm, thanks!
PATCH 3/4 binman: Renumber 277...289 TI test files
In reply to Simon GlassThese have ended up with the same numbers as earlier files. Fix them.
---
tools/binman/ftest.py | 18 +++++++++---------
...7_ti_board_cfg.dts => 293_ti_board_cfg.dts} | 0
...bined.dts => 294_ti_board_cfg_combined.dts} | 0
...o_type.dts => 295_ti_board_cfg_no_type.dts} | 0
.../{279_ti_secure.dts => 296_ti_secure.dts} | 0
...ti_secure_rom.dts => 297_ti_secure_rom.dts} | 0
...ined.dts => 298_ti_secure_rom_combined.dts} | 0
...ecure_rom_a.dts => 299_ti_secure_rom_a.dts} | 0
...ecure_rom_b.dts => 300_ti_secure_rom_b.dts} | 0
9 files changed, 9 insertions(+), 9 deletions(-)
rename tools/binman/test/{277_ti_board_cfg.dts => 293_ti_board_cfg.dts} (100%)
rename tools/binman/test/{278_ti_board_cfg_combined.dts => 294_ti_board_cfg_combined.dts} (100%)
rename tools/binman/test/{279_ti_board_cfg_no_type.dts => 295_ti_board_cfg_no_type.dts} (100%)
rename tools/binman/test/{279_ti_secure.dts => 296_ti_secure.dts} (100%)
rename tools/binman/test/{280_ti_secure_rom.dts => 297_ti_secure_rom.dts} (100%)
rename tools/binman/test/{281_ti_secure_rom_combined.dts => 298_ti_secure_rom_combined.dts} (100%)
rename tools/binman/test/{288_ti_secure_rom_a.dts => 299_ti_secure_rom_a.dts} (100%)
rename tools/binman/test/{289_ti_secure_rom_b.dts => 300_ti_secure_rom_b.dts} (100%)tools/binman/ftest.py +9 -9
@@ -6930,19 +6930,19 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testTIBoardConfig(self): """Test that a schema validated board config file can be generated""" - data = self._DoReadFile('277_ti_board_cfg.dts') + data = self._DoReadFile('293_ti_board_cfg.dts') self.assertEqual(TI_BOARD_CONFIG_DATA, data) def testTIBoardConfigCombined(self): """Test that a schema validated combined board config file can be generated""" - data = self._DoReadFile('278_ti_board_cfg_combined.dts') + data = self._DoReadFile('294_ti_board_cfg_combined.dts') configlen_noheader = TI_BOARD_CONFIG_DATA * 4 self.assertGreater(data, configlen_noheader) def testTIBoardConfigNoDataType(self): """Test that error is thrown when data type is not supported""" with self.assertRaises(ValueError) as e: - data = self._DoReadFile('279_ti_board_cfg_no_type.dts') + data = self._DoReadFile('295_ti_board_cfg_no_type.dts') self.assertIn("Schema validation error", str(e.exception)) def testPackTiSecure(self):
@@ -6951,7 +6951,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap entry_args = { 'keyfile': keyfile, } - data = self._DoReadFileDtb('279_ti_secure.dts', + data = self._DoReadFileDtb('296_ti_secure.dts', entry_args=entry_args)[0] self.assertGreater(len(data), len(TI_UNSECURE_DATA))
@@ -6963,7 +6963,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap 'keyfile': keyfile, } with test_util.capture_sys_output() as (_, stderr): - self._DoTestFile('279_ti_secure.dts', + self._DoTestFile('296_ti_secure.dts', force_missing_bintools='openssl', entry_args=entry_args) err = stderr.getvalue()
@@ -6975,11 +6975,11 @@ fdt fdtmap Extract the devicetree blob from the fdtmap entry_args = { 'keyfile': keyfile, } - data = self._DoReadFileDtb('280_ti_secure_rom.dts', + data = self._DoReadFileDtb('297_ti_secure_rom.dts', entry_args=entry_args)[0] - data_a = self._DoReadFileDtb('288_ti_secure_rom_a.dts', + data_a = self._DoReadFileDtb('299_ti_secure_rom_a.dts', entry_args=entry_args)[0] - data_b = self._DoReadFileDtb('289_ti_secure_rom_b.dts', + data_b = self._DoReadFileDtb('300_ti_secure_rom_b.dts', entry_args=entry_args)[0] self.assertGreater(len(data), len(TI_UNSECURE_DATA)) self.assertGreater(len(data_a), len(TI_UNSECURE_DATA))
@@ -6991,7 +6991,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap entry_args = { 'keyfile': keyfile, } - data = self._DoReadFileDtb('281_ti_secure_rom_combined.dts', + data = self._DoReadFileDtb('298_ti_secure_rom_combined.dts', entry_args=entry_args)[0] self.assertGreater(len(data), len(TI_UNSECURE_DATA))
tools/binman/test/293_ti_board_cfg.dts renamed from tools/binman/test/277_ti_board_cfg.dts +0 -0
tools/binman/test/294_ti_board_cfg_combined.dts renamed from tools/binman/test/278_ti_board_cfg_combined.dts +0 -0
tools/binman/test/295_ti_board_cfg_no_type.dts renamed from tools/binman/test/279_ti_board_cfg_no_type.dts +0 -0
tools/binman/test/296_ti_secure.dts renamed from tools/binman/test/279_ti_secure.dts +0 -0
tools/binman/test/297_ti_secure_rom.dts renamed from tools/binman/test/280_ti_secure_rom.dts +0 -0
tools/binman/test/298_ti_secure_rom_combined.dts renamed from tools/binman/test/281_ti_secure_rom_combined.dts +0 -0
tools/binman/test/299_ti_secure_rom_a.dts renamed from tools/binman/test/288_ti_secure_rom_a.dts +0 -0
tools/binman/test/300_ti_secure_rom_b.dts renamed from tools/binman/test/289_ti_secure_rom_b.dts +0 -0
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
Re: [PATCH 3/4] binman: Renumber 277...289 TI test files
These have ended up with the same numbers as earlier files. Fix them.
---
tools/binman/ftest.py | 18 +++++++++---------
...7_ti_board_cfg.dts => 293_ti_board_cfg.dts} | 0
...bined.dts => 294_ti_board_cfg_combined.dts} | 0
...o_type.dts => 295_ti_board_cfg_no_type.dts} | 0
.../{279_ti_secure.dts => 296_ti_secure.dts} | 0
...ti_secure_rom.dts => 297_ti_secure_rom.dts} | 0
...ined.dts => 298_ti_secure_rom_combined.dts} | 0
...ecure_rom_a.dts => 299_ti_secure_rom_a.dts} | 0
...ecure_rom_b.dts => 300_ti_secure_rom_b.dts} | 0
9 files changed, 9 insertions(+), 9 deletions(-)
rename tools/binman/test/{277_ti_board_cfg.dts => 293_ti_board_cfg.dts} (100%)
rename tools/binman/test/{278_ti_board_cfg_combined.dts =>
294_ti_board_cfg_combined.dts} (100%)
rename tools/binman/test/{279_ti_board_cfg_no_type.dts =>
295_ti_board_cfg_no_type.dts} (100%)
rename tools/binman/test/{279_ti_secure.dts => 296_ti_secure.dts} (100%)
rename tools/binman/test/{280_ti_secure_rom.dts =>
297_ti_secure_rom.dts} (100%)
rename tools/binman/test/{281_ti_secure_rom_combined.dts =>
298_ti_secure_rom_combined.dts} (100%)
rename tools/binman/test/{288_ti_secure_rom_a.dts =>
299_ti_secure_rom_a.dts} (100%)
rename tools/binman/test/{289_ti_secure_rom_b.dts =>300_ti_secure_rom_b.dts} (100%)
Applied to u-boot-dm, thanks!
PATCH 4/4 binman: Add missing ssl documentation
In reply to Simon GlassRerun 'binman bintool-docs' to regenerate bintools.rst
---
tools/binman/bintools.rst | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/binman/bintools.rst +11 -0
@@ -155,6 +155,17 @@ Support is provided for fetching this on Debian-like systems, using apt. +Bintool: openssl: openssl tool +------------------------------ + +This bintool supports creating new openssl certificates. + +It also supports fetching a binary openssl + +Documentation about openssl is at https://www.openssl.org/ + + + Bintool: xz: Compression/decompression using the xz algorithm -------------------------------------------------------------
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
Re: [PATCH 4/4] binman: Add missing ssl documentation
Rerun 'binman bintool-docs' to regenerate bintools.rst
---
tools/binman/bintools.rst | 11 +++++++++++ 1 file changed, 11 insertions(+)
Applied to u-boot-dm, thanks!
Drop the use of a numbered key file since numbering is just for the test devicetree files. Also adjust the tests to avoid putting a hard-coded path to binman in the file, using the entry arg instead.
---
tools/binman/etype/pre_load.py | 6 +--
tools/binman/ftest.py | 48 ++++++++++++++-----
tools/binman/test/230_pre_load.dts | 2 +-
tools/binman/test/231_pre_load_pkcs.dts | 2 +-
tools/binman/test/232_pre_load_pss.dts | 2 +-
.../test/233_pre_load_invalid_padding.dts | 2 +-
.../binman/test/234_pre_load_invalid_sha.dts | 2 +-
.../binman/test/235_pre_load_invalid_algo.dts | 2 +-
.../binman/test/236_pre_load_invalid_key.dts | 2 +-
tools/binman/test/{230_dev.key => dev.key} | 0
10 files changed, 46 insertions(+), 22 deletions(-)
rename tools/binman/test/{230_dev.key => dev.key} (100%)Applied to u-boot-dm, thanks!