diff options
| author | AKASHI Takahiro <takahiro.akashi@linaro.org> | 2020-07-08 14:02:03 +0900 | 
|---|---|---|
| committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-07-11 23:14:16 +0200 | 
| commit | 7fdc02b3d7d2085231f44d44c0556f4a592c8daf (patch) | |
| tree | 25dab007a44c0c0b361ba9e6f731facb850d031f /test/py/tests/test_efi_secboot/test_signed.py | |
| parent | 0c7772d40f7994b1ff75ad9acd220101241c1feb (diff) | |
test/py: efi_secboot: add a test for verifying with digest of signed image
Signature database (db or dbx) may have not only certificates that contain
a public key for RSA decryption, but also digests of signed images.
In this test case, if database has an image's digest (EFI_CERT_SHA256_GUID)
and if the value matches to a hash value calculated from image's binary,
authentication should pass in case of db, and fail in case of dbx.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Use defined time stamps for sign-efi-sig-list.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'test/py/tests/test_efi_secboot/test_signed.py')
| -rw-r--r-- | test/py/tests/test_efi_secboot/test_signed.py | 49 | 
1 files changed, 49 insertions, 0 deletions
| diff --git a/test/py/tests/test_efi_secboot/test_signed.py b/test/py/tests/test_efi_secboot/test_signed.py index 1a31a57e12c..7531bbac6a5 100644 --- a/test/py/tests/test_efi_secboot/test_signed.py +++ b/test/py/tests/test_efi_secboot/test_signed.py @@ -198,3 +198,52 @@ class TestEfiSignedImage(object):                  'efidebug test bootmgr'])              assert '\'HELLO\' failed' in ''.join(output)              assert 'efi_start_image() returned: 26' in ''.join(output) + +    def test_efi_signed_image_auth6(self, u_boot_console, efi_boot_env): +        """ +        Test Case 6 - using digest of signed image in database +        """ +        u_boot_console.restart_uboot() +        disk_img = efi_boot_env +        with u_boot_console.log.section('Test Case 6a'): +            # Test Case 6a, verified by image's digest in db +            output = u_boot_console.run_command_list([ +                'host bind 0 %s' % disk_img, +                'fatload host 0:1 4000000 db_hello_signed.auth', +                'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', +                'fatload host 0:1 4000000 KEK.auth', +                'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', +                'fatload host 0:1 4000000 PK.auth', +                'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) +            assert 'Failed to set EFI variable' not in ''.join(output) +            output = u_boot_console.run_command_list([ +                'efidebug boot add 1 HELLO host 0:1 /helloworld.efi.signed ""', +                'efidebug boot next 1', +                'bootefi bootmgr']) +            assert 'Hello, world!' in ''.join(output) + +        with u_boot_console.log.section('Test Case 6b'): +            # Test Case 6b, rejected by TEST_db certificate in dbx +            output = u_boot_console.run_command_list([ +                'fatload host 0:1 4000000 dbx_db.auth', +                'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx']) +            assert 'Failed to set EFI variable' not in ''.join(output) +            output = u_boot_console.run_command_list([ +                'efidebug boot next 1', +                'efidebug test bootmgr']) +            assert '\'HELLO\' failed' in ''.join(output) +            assert 'efi_start_image() returned: 26' in ''.join(output) + +        with u_boot_console.log.section('Test Case 6c'): +            # Test Case 6c, rejected by image's digest in dbx +            output = u_boot_console.run_command_list([ +                'fatload host 0:1 4000000 db.auth', +                'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', +                'fatload host 0:1 4000000 dbx_hello_signed.auth', +                'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx']) +            assert 'Failed to set EFI variable' not in ''.join(output) +            output = u_boot_console.run_command_list([ +                'efidebug boot next 1', +                'efidebug test bootmgr']) +            assert '\'HELLO\' failed' in ''.join(output) +            assert 'efi_start_image() returned: 26' in ''.join(output) | 
