From patchwork Wed Oct 22 09:40:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 401980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id DDC1F14003E; Wed, 22 Oct 2014 20:40:52 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XgsPT-00083L-Qt; Wed, 22 Oct 2014 09:40:51 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XgsPN-000834-Sv for fwts-devel@lists.ubuntu.com; Wed, 22 Oct 2014 09:40:45 +0000 Received: from [175.41.48.77] (helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1XgsPN-0004sZ-AU; Wed, 22 Oct 2014 09:40:45 +0000 From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 08/15] uefirtauthvar: delete authenticated variable test Date: Wed, 22 Oct 2014 17:40:33 +0800 Message-Id: <1413970840-27212-1-git-send-email-ivan.hu@canonical.com> X-Mailer: git-send-email 1.7.9.5 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com This test deletes the test authenticated variable and checks if it still exists. Signed-off-by: Ivan Hu Acked-by: Colin Ian King --- src/uefi/uefirtauthvar/uefirtauthvar.c | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c index 0d98f33..fc123f3 100644 --- a/src/uefi/uefirtauthvar/uefirtauthvar.c +++ b/src/uefi/uefirtauthvar/uefirtauthvar.c @@ -464,6 +464,58 @@ static int uefirtauthvar_test6(fwts_framework *fw) return FWTS_ERROR; } +/* + * Delete the test authenticated variable. + */ +static int uefirtauthvar_test7(fwts_framework *fw) +{ + long ioret; + int supcheck; + + uint8_t data[getvar_buf_size]; + uint64_t getdatasize = sizeof(data); + uint64_t status; + uint32_t attributestest; + + ioret = setvar(>estguid, attributes, sizeof(AuthVarDel), AuthVarDel, &status); + + if (ioret == -1) { + supcheck = check_fw_support(fw, status); + if (supcheck != FWTS_OK) + return supcheck; + + fwts_failed(fw, LOG_LEVEL_HIGH, + "UEFIDelAuthVar", + "Failed to delete autheticated variable with UEFI " + "runtime service."); + fwts_uefi_print_status_info(fw, status); + return FWTS_ERROR; + } + + ioret = getvar(>estguid, &attributestest, &getdatasize, data, &status); + if (ioret == -1) { + if (status == EFI_NOT_FOUND) { + fwts_passed(fw, "Delete authenticated variable tests passed."); + return FWTS_OK; + } + + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "UEFIDelAuthVar", + "Failed to get authenticated variable with UEFI " + "runtime service."); + fwts_uefi_print_status_info(fw, status); + return FWTS_ERROR; + } + + fwts_failed(fw, LOG_LEVEL_HIGH, + "UEFIDelAuthVar", + "Failed to delete autheticated variable still get the test" + "autheticated variable."); + + return FWTS_ERROR; +} + + static fwts_framework_minor_test uefirtauthvar_tests[] = { { uefirtauthvar_test1, "Create authenticated variable test." }, { uefirtauthvar_test2, "Authenticated variable test with the same authenticated variable." }, @@ -471,6 +523,7 @@ static fwts_framework_minor_test uefirtauthvar_tests[] = { { uefirtauthvar_test4, "Append authenticated variable test." }, { uefirtauthvar_test5, "Update authenticated variable test." }, { uefirtauthvar_test6, "Authenticated variable test with old authenticated variable." }, + { uefirtauthvar_test7, "Delete authenticated variable test." }, { NULL, NULL } };