From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=supreeth.venkatesh@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id A5DD22194D387 for ; Tue, 16 Oct 2018 02:48:38 -0700 (PDT) Received: by usa-sjc-mx-foss1.foss.arm.com (Postfix, from userid 105) id F3F843586; Tue, 16 Oct 2018 03:28:31 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5761D3503; Sun, 14 Oct 2018 19:47:01 -0700 (PDT) Received: from [10.6.43.238] (bc-c3-3-14.eu.iaas.arm.com [10.6.43.238]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 670CE3F5B1; Sun, 14 Oct 2018 19:46:40 -0700 (PDT) To: Eric Jin , edk2-devel@lists.01.org Cc: Jiaxin Wu References: <20181013151936.15784-1-eric.jin@intel.com> From: Supreeth Venkatesh Message-ID: <14e09b08-f90f-5b7a-5c04-54aa490562bf@arm.com> Date: Mon, 15 Oct 2018 03:46:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181013151936.15784-1-eric.jin@intel.com> Subject: Re: [PATCH] uefi-sct/SctPkg:Add conformance test cases for deprecated EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS attribute. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Oct 2018 09:48:39 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Reviewed-by: Supreeth Venkatesh If the commit message is broken down into multiple lines less than 80 cols. On 10/13/2018 04:19 PM, Eric Jin wrote: > Cc: Supreeth Venkatesh > Cc: Jiaxin Wu > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Jin > --- > .../AuthVariableServicesBBTestConformance.c | 143 ++++++++++++++---- > .../VariableServices/BlackBoxTest/Guid.c | 6 +- > .../VariableServices/BlackBoxTest/Guid.h | 11 +- > 3 files changed, 132 insertions(+), 28 deletions(-) > > diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/AuthVariableServicesBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/AuthVariableServicesBBTestConformance.c > index 05281054..a1d1c4c3 100644 > --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/AuthVariableServicesBBTestConformance.c > +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/AuthVariableServicesBBTestConformance.c > @@ -1,7 +1,7 @@ > /** @file > > Copyright 2006 - 2012 Unified EFI, Inc.
> - Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
> + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD License > @@ -151,6 +151,44 @@ AuthVariableDERConfTest ( > EFI_TEST_LOGGING_LIBRARY_PROTOCOL *LoggingLib; > UINT32 Attr; > EFI_TEST_ASSERTION Result; > + UINTN Index; > + UINTN MaximumVariableStorageSize; > + UINTN RemainingVariableStorageSize; > + UINTN MaximumVariableSize; > + UINT32 AttrArray[] = { > + // > + // For 1 attribute. > + // > + EFI_VARIABLE_NON_VOLATILE, > + EFI_VARIABLE_RUNTIME_ACCESS, > + EFI_VARIABLE_BOOTSERVICE_ACCESS, > + EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS, > + > + // > + // For 2 attributes. > + // > + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS, > + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS, > + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS, > + > + EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS, > + EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS, > + > + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS, > + > + // > + // For 3 attributes. > + // > + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS, > + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS, > + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS, > + EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS, > + > + // > + // For 4 attributes. > + // > + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS, > + }; > > Status = GetTestSupportLibrary ( > SupportHandle, > @@ -192,33 +230,86 @@ AuthVariableDERConfTest ( > Status > ); > > - Attr = EFI_VARIABLE_NON_VOLATILE | > - EFI_VARIABLE_RUNTIME_ACCESS | > - EFI_VARIABLE_BOOTSERVICE_ACCESS | > - EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS; > + for (Index = 0; Index < sizeof (AttrArray) / sizeof (AttrArray[0]); Index = Index + 1) { > + Attr = AttrArray[Index]; > + Attr |= EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS; > + > + Status = RT->SetVariable ( > + L"AuthVarDER", > + &mVarVendorGuid, > + Attr, > + sizeof (mValidAuthVarDERCreate), > + (VOID *) mValidAuthVarDERCreate > + ); > + if (Status == EFI_UNSUPPORTED) { > + Result = EFI_TEST_ASSERTION_PASSED; > + } else { > + Result = EFI_TEST_ASSERTION_FAILED; > + } > + > + StandardLib->RecordAssertion ( > + StandardLib, > + Result, > + gVariableServicesBbTestConformanceAssertionGuid020, > + L"RT.SetVariable - Set Auth Variable with valid cert.", > + L"Attributes = Array[%d]. %a:%d:Status - %r", > + Index, > + __FILE__, > + (UINTN)__LINE__, > + Status > + ); > + > + Status = RT->SetVariable ( > + L"AuthVarDER", > + &mVarVendorGuid, > + Attr, > + sizeof (mInvalidAuthVarDERCreate), > + (VOID *) mInvalidAuthVarDERCreate > + ); > + if (Status == EFI_UNSUPPORTED) { > + Result = EFI_TEST_ASSERTION_PASSED; > + } else { > + Result = EFI_TEST_ASSERTION_FAILED; > + } > + > + StandardLib->RecordAssertion ( > + StandardLib, > + Result, > + gVariableServicesBbTestConformanceAssertionGuid023, > + L"RT.SetVariable - Set Auth Variable with invalid cert.", > + L"Attributes = Array[%d]. %a:%d:Status - %r", > + Index, > + __FILE__, > + (UINTN)__LINE__, > + Status > + ); > + > + Status = RT->QueryVariableInfo ( > + Attr, > + &MaximumVariableStorageSize, > + &RemainingVariableStorageSize, > + &MaximumVariableSize > + ); > + > + if (Status == EFI_UNSUPPORTED) { > + Result = EFI_TEST_ASSERTION_PASSED; > + } else { > + Result = EFI_TEST_ASSERTION_FAILED; > + } > + > + StandardLib->RecordAssertion ( > + StandardLib, > + Result, > + gVariableServicesBbTestConformanceAssertionGuid024, > + L"RT.QueryVariableInfo - Query Auth Variable.", > + L"Attributes = Array[%d]. %a:%d:Status - %r", > + Index, > + __FILE__, > + (UINTN)__LINE__, > + Status > + ); > > - Status = RT->SetVariable( > - L"AuthVarDER", > - &mVarVendorGuid, > - Attr, > - sizeof(mValidAuthVarDERCreate), > - (VOID*) mValidAuthVarDERCreate > - ); > - if (Status == EFI_SECURITY_VIOLATION) { > - Result = EFI_TEST_ASSERTION_PASSED; > - } else { > - Result = EFI_TEST_ASSERTION_FAILED; > } > - StandardLib->RecordAssertion ( > - StandardLib, > - Result, > - gVariableServicesBbTestConformanceAssertionGuid020, > - L"RT.SetVariable - Set Auth Variable with invalid Attr", > - L"%a:%d:Status - %r", > - __FILE__, > - (UINTN)__LINE__, > - Status > - ); > > return EFI_SUCCESS; > } > diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/Guid.c > index 6e14012a..4bbbb6e8 100644 > --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/Guid.c > +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/Guid.c > @@ -1,7 +1,7 @@ > /** @file > > Copyright 2006 - 2016 Unified EFI, Inc.
> - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
> + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD License > @@ -84,6 +84,10 @@ EFI_GUID gVariableServicesBbTestConformanceAssertionGuid021 = EFI_TEST_VARIABLES > > EFI_GUID gVariableServicesBbTestConformanceAssertionGuid022 = EFI_TEST_VARIABLESERVICESBBTESTCONFORMANCE_ASSERTION_022_GUID; > > +EFI_GUID gVariableServicesBbTestConformanceAssertionGuid023 = EFI_TEST_VARIABLESERVICESBBTESTCONFORMANCE_ASSERTION_023_GUID; > + > +EFI_GUID gVariableServicesBbTestConformanceAssertionGuid024 = EFI_TEST_VARIABLESERVICESBBTESTCONFORMANCE_ASSERTION_024_GUID; > + > EFI_GUID gVariableServicesBbTestFunctionAssertionGuid001 = EFI_TEST_VARIABLESERVICESBBTESTFUNCTION_ASSERTION_001_GUID; > > EFI_GUID gVariableServicesBbTestFunctionAssertionGuid002 = EFI_TEST_VARIABLESERVICESBBTESTFUNCTION_ASSERTION_002_GUID; > diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/Guid.h > index 1d213905..4e43fbc9 100644 > --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/Guid.h > +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/Guid.h > @@ -1,7 +1,7 @@ > /** @file > > Copyright 2006 - 2016 Unified EFI, Inc.
> - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
> + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD License > @@ -167,6 +167,15 @@ extern EFI_GUID gVariableServicesBbTestConformanceAssertionGuid021; > > extern EFI_GUID gVariableServicesBbTestConformanceAssertionGuid022; > > +#define EFI_TEST_VARIABLESERVICESBBTESTCONFORMANCE_ASSERTION_023_GUID \ > +{ 0x55af8fad, 0x1b12, 0x45ad, { 0xb0, 0x42, 0xa6, 0x43, 0x96, 0x2f, 0x4, 0x70 }} > + > +extern EFI_GUID gVariableServicesBbTestConformanceAssertionGuid023; > + > +#define EFI_TEST_VARIABLESERVICESBBTESTCONFORMANCE_ASSERTION_024_GUID \ > +{ 0x6d0740fb, 0x388a, 0x491f, { 0xb8, 0x18, 0x9b, 0x5c, 0xb5, 0x17, 0xf, 0x95 }} > + > +extern EFI_GUID gVariableServicesBbTestConformanceAssertionGuid024; > > > #define EFI_TEST_VARIABLESERVICESBBTESTFUNCTION_ASSERTION_001_GUID \