diff options
| author | Tom Rini <[email protected]> | 2025-02-28 16:51:10 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-02-28 16:51:10 -0600 |
| commit | 5bc4240eb65c378eeca3f45069eeb125cd01ceed (patch) | |
| tree | 9ed59cbf2b17e758d08bb1839ef81772db41a41a /tools/binman/ftest.py | |
| parent | 962217d218cfb4e9584e2669f091eaba60654dd8 (diff) | |
| parent | b9b87d01efc496d18bbc17c58c552d54a06ef6ba (diff) | |
Merge patch series "rsa: Add rsa_verify_openssl() to use openssl for host builds"
Paul HENRYS <[email protected]> says:
This serie of patches adds a new tool to authenticate files signed with
a preload header. This tool is also used in the tests to actually
verify the authenticity of the file signed with such a preload header.
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'tools/binman/ftest.py')
| -rw-r--r-- | tools/binman/ftest.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index d2802f67e2d..e0685884cef 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -762,6 +762,16 @@ class TestFunctional(unittest.TestCase): return False return True + def _CheckPreload(self, image, key, algo="sha256,rsa2048", + padding="pkcs-1.5"): + try: + tools.run('preload_check_sign', '-k', key, '-a', algo, '-p', + padding, '-f', image) + except: + self.fail('Expected image signed with a pre-load') + return False + return True + def testRun(self): """Test a basic run with valid args""" result = self._RunBinman('-h') @@ -5781,9 +5791,14 @@ fdt fdtmap Extract the devicetree blob from the fdtmap data = self._DoReadFileDtb( '230_pre_load.dts', entry_args=entry_args, extra_indirs=[os.path.join(self._binman_dir, 'test')])[0] + + image_fname = tools.get_output_filename('image.bin') + is_signed = self._CheckPreload(image_fname, self.TestFile("dev.key")) + self.assertEqual(PRE_LOAD_MAGIC, data[:len(PRE_LOAD_MAGIC)]) self.assertEqual(PRE_LOAD_VERSION, data[4:4 + len(PRE_LOAD_VERSION)]) self.assertEqual(PRE_LOAD_HDR_SIZE, data[8:8 + len(PRE_LOAD_HDR_SIZE)]) + self.assertEqual(is_signed, True) def testPreLoadNoKey(self): """Test an image with a pre-load heade0r with missing key""" |
