All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test/py: efi_secboot: fix Test Case 6c
@ 2020-07-10  0:27 AKASHI Takahiro
  2020-07-17  5:55 ` Heinrich Schuchardt
  0 siblings, 1 reply; 3+ messages in thread
From: AKASHI Takahiro @ 2020-07-10  0:27 UTC (permalink / raw)
  To: u-boot

As the commit cb7116030aff ("efi_loader: time based authentication")
fixed the timestamp handling, Test Case 6c has no longer worked as
expected.
So adjust the timestamp of "dbx" variable.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 test/py/tests/test_efi_secboot/conftest.py    | 4 +++-
 test/py/tests/test_efi_secboot/test_signed.py | 2 --
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/py/tests/test_efi_secboot/conftest.py b/test/py/tests/test_efi_secboot/conftest.py
index 94c50f6cf7ca..b74640240318 100644
--- a/test/py/tests/test_efi_secboot/conftest.py
+++ b/test/py/tests/test_efi_secboot/conftest.py
@@ -141,7 +141,9 @@ def efi_boot_env(request, u_boot_config):
         check_call('cd %s; %shash-to-efi-sig-list helloworld.efi.signed db_hello_signed.hash; %ssign-efi-sig-list -c KEK.crt -k KEK.key db db_hello_signed.hash db_hello_signed.auth'
                    % (mnt_point, EFITOOLS_PATH, EFITOOLS_PATH),
                    shell=True)
-        check_call('cd %s; %ssign-efi-sig-list -c KEK.crt -k KEK.key dbx db_hello_signed.hash dbx_hello_signed.auth'
+        # 'sleep 2' here because timestamp should be newer than dbx_db.auth
+        # See Test Case 6c
+        check_call('cd %s; sleep 2; %ssign-efi-sig-list -c KEK.crt -k KEK.key dbx db_hello_signed.hash dbx_hello_signed.auth'
                    % (mnt_point, EFITOOLS_PATH),
                    shell=True)
 
diff --git a/test/py/tests/test_efi_secboot/test_signed.py b/test/py/tests/test_efi_secboot/test_signed.py
index 7531bbac6a5f..8b1e132c756c 100644
--- a/test/py/tests/test_efi_secboot/test_signed.py
+++ b/test/py/tests/test_efi_secboot/test_signed.py
@@ -237,8 +237,6 @@ class TestEfiSignedImage(object):
         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)
-- 
2.27.0

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

* [PATCH] test/py: efi_secboot: fix Test Case 6c
  2020-07-10  0:27 [PATCH] test/py: efi_secboot: fix Test Case 6c AKASHI Takahiro
@ 2020-07-17  5:55 ` Heinrich Schuchardt
  2020-07-17  5:57   ` AKASHI Takahiro
  0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2020-07-17  5:55 UTC (permalink / raw)
  To: u-boot

On 10.07.20 02:27, AKASHI Takahiro wrote:
> As the commit cb7116030aff ("efi_loader: time based authentication")
> fixed the timestamp handling, Test Case 6c has no longer worked as
> expected.
> So adjust the timestamp of "dbx" variable.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  test/py/tests/test_efi_secboot/conftest.py    | 4 +++-
>  test/py/tests/test_efi_secboot/test_signed.py | 2 --
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/test/py/tests/test_efi_secboot/conftest.py b/test/py/tests/test_efi_secboot/conftest.py
> index 94c50f6cf7ca..b74640240318 100644
> --- a/test/py/tests/test_efi_secboot/conftest.py
> +++ b/test/py/tests/test_efi_secboot/conftest.py
> @@ -141,7 +141,9 @@ def efi_boot_env(request, u_boot_config):
>          check_call('cd %s; %shash-to-efi-sig-list helloworld.efi.signed db_hello_signed.hash; %ssign-efi-sig-list -c KEK.crt -k KEK.key db db_hello_signed.hash db_hello_signed.auth'
>                     % (mnt_point, EFITOOLS_PATH, EFITOOLS_PATH),
>                     shell=True)
> -        check_call('cd %s; %ssign-efi-sig-list -c KEK.crt -k KEK.key dbx db_hello_signed.hash dbx_hello_signed.auth'
> +        # 'sleep 2' here because timestamp should be newer than dbx_db.auth
> +        # See Test Case 6c
> +        check_call('cd %s; sleep 2; %ssign-efi-sig-list -c KEK.crt -k KEK.key dbx db_hello_signed.hash dbx_hello_signed.auth'

We should not use sleep in tests except when testing time related
routines. sign-efi-sig-list has a -t parameter for time stamps.

See patch bc246c69aecea1
test: correct time stamps for UEFI authentication

Best regards

Heinrich

>                     % (mnt_point, EFITOOLS_PATH),
>                     shell=True)
>
> diff --git a/test/py/tests/test_efi_secboot/test_signed.py b/test/py/tests/test_efi_secboot/test_signed.py
> index 7531bbac6a5f..8b1e132c756c 100644
> --- a/test/py/tests/test_efi_secboot/test_signed.py
> +++ b/test/py/tests/test_efi_secboot/test_signed.py
> @@ -237,8 +237,6 @@ class TestEfiSignedImage(object):
>          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)
>

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

* [PATCH] test/py: efi_secboot: fix Test Case 6c
  2020-07-17  5:55 ` Heinrich Schuchardt
@ 2020-07-17  5:57   ` AKASHI Takahiro
  0 siblings, 0 replies; 3+ messages in thread
From: AKASHI Takahiro @ 2020-07-17  5:57 UTC (permalink / raw)
  To: u-boot

Heinrich,

On Fri, Jul 17, 2020 at 07:55:03AM +0200, Heinrich Schuchardt wrote:
> On 10.07.20 02:27, AKASHI Takahiro wrote:
> > As the commit cb7116030aff ("efi_loader: time based authentication")
> > fixed the timestamp handling, Test Case 6c has no longer worked as
> > expected.
> > So adjust the timestamp of "dbx" variable.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  test/py/tests/test_efi_secboot/conftest.py    | 4 +++-
> >  test/py/tests/test_efi_secboot/test_signed.py | 2 --
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/test/py/tests/test_efi_secboot/conftest.py b/test/py/tests/test_efi_secboot/conftest.py
> > index 94c50f6cf7ca..b74640240318 100644
> > --- a/test/py/tests/test_efi_secboot/conftest.py
> > +++ b/test/py/tests/test_efi_secboot/conftest.py
> > @@ -141,7 +141,9 @@ def efi_boot_env(request, u_boot_config):
> >          check_call('cd %s; %shash-to-efi-sig-list helloworld.efi.signed db_hello_signed.hash; %ssign-efi-sig-list -c KEK.crt -k KEK.key db db_hello_signed.hash db_hello_signed.auth'
> >                     % (mnt_point, EFITOOLS_PATH, EFITOOLS_PATH),
> >                     shell=True)
> > -        check_call('cd %s; %ssign-efi-sig-list -c KEK.crt -k KEK.key dbx db_hello_signed.hash dbx_hello_signed.auth'
> > +        # 'sleep 2' here because timestamp should be newer than dbx_db.auth
> > +        # See Test Case 6c
> > +        check_call('cd %s; sleep 2; %ssign-efi-sig-list -c KEK.crt -k KEK.key dbx db_hello_signed.hash dbx_hello_signed.auth'
> 

I will drop this patch, and

> We should not use sleep in tests except when testing time related
> routines. sign-efi-sig-list has a -t parameter for time stamps.

I have already fixed this issue in other tests as well.
Let's discuss locally.

-Takahiro Akashi

> 
> See patch bc246c69aecea1
> test: correct time stamps for UEFI authentication
> 
> Best regards
> 
> Heinrich
> 
> >                     % (mnt_point, EFITOOLS_PATH),
> >                     shell=True)
> >
> > diff --git a/test/py/tests/test_efi_secboot/test_signed.py b/test/py/tests/test_efi_secboot/test_signed.py
> > index 7531bbac6a5f..8b1e132c756c 100644
> > --- a/test/py/tests/test_efi_secboot/test_signed.py
> > +++ b/test/py/tests/test_efi_secboot/test_signed.py
> > @@ -237,8 +237,6 @@ class TestEfiSignedImage(object):
> >          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)
> >
> 

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

end of thread, other threads:[~2020-07-17  5:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10  0:27 [PATCH] test/py: efi_secboot: fix Test Case 6c AKASHI Takahiro
2020-07-17  5:55 ` Heinrich Schuchardt
2020-07-17  5:57   ` AKASHI Takahiro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.