From patchwork Thu Aug 2 17:29:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 952909 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41hHJv0TY1z9s4c for ; Fri, 3 Aug 2018 03:31:11 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="jR7O6Txx"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41hHJt67m4zF2DC for ; Fri, 3 Aug 2018 03:31:10 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="jR7O6Txx"; dkim-atps=neutral X-Original-To: Petitboot@lists.ozlabs.org Delivered-To: Petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=geoff@infradead.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="jR7O6Txx"; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41hHH85tqtzF2DN for ; Fri, 3 Aug 2018 03:29:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Date:Cc:To:Subject:From:References: In-Reply-To:Message-Id:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=RG7a9gS4X3156fv1qxMZQ0d9Mp6qtrT4JIZ4BuOAYPQ=; b=jR7O6Txx+5f5h+BEl2ppH6mAw mCDF/S3r/fK4WVvZSjP2lBvZl2vBLTmqQBEcCg/e/vmOcCxqpOKKbdHNYHW0p2E71BjltSdu1fpWH TptUHGTwLlOurPDGSzAcsncBQ+Nnc4fnVnJX+PHOROKS96J7achN3VuRwa8Sq0MOyoCOe+NbPcEkN Poyb+qQINkq6LV3ExnLbXoOp3WcytNn+ezYJXQweUWAtscMCiiuDzJ+socq67KX8i5WEP99Y51E3U hSiSI4noPg7DyTwkdwTSpAbbBHkQe/ki471VUk+L40AnTpuzZ6YBczYg753sdlKtMpXCHPWfEj/6H TGgcuRbvA==; Received: from geoff by merlin.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1flHPt-0007YN-1h; Thu, 02 Aug 2018 17:29:37 +0000 Message-Id: In-Reply-To: References: From: Geoff Levand Patch-Date: Thu, 2 Aug 2018 10:19:53 -0700 Subject: [PATCH v2 17/30] test-efivar: Update to latest lib/efi routines To: Samuel Mendoza-Jonas Date: Thu, 02 Aug 2018 17:29:37 +0000 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ge Song , Petitboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" From: Samuel Mendoza-Jonas From: Samuel Mendoza-Jonas Signed-off-by: Geoff Levand --- test/lib/Makefile.am | 3 ++- test/lib/test-efivar.c | 25 +++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/test/lib/Makefile.am b/test/lib/Makefile.am index 047fcb2..65991a5 100644 --- a/test/lib/Makefile.am +++ b/test/lib/Makefile.am @@ -23,7 +23,8 @@ lib_TESTS = \ test/lib/test-process-parent-stdout \ test/lib/test-process-both \ test/lib/test-process-stdout-eintr \ - test/lib/test-fold + test/lib/test-fold \ + test/lib/test-efivar if WITH_OPENSSL lib_TESTS += \ diff --git a/test/lib/test-efivar.c b/test/lib/test-efivar.c index 8ceb8f5..a85b73c 100644 --- a/test/lib/test-efivar.c +++ b/test/lib/test-efivar.c @@ -87,33 +87,38 @@ int main(void) { void *ctx = NULL; int rc, errno_value; - size_t size; - uint8_t *data = NULL; uint32_t attr = DEF_ATTR; char *path = NULL; + struct efi_data *efi_data; if(!probe()) return ENOENT; talloc_new(ctx); - size = strlen(test_data) + 1; - rc = efi_set_variable(ctx, test_efivar_guid, test_varname, - (uint8_t *)test_data, size, attr); + efi_data = talloc_zero(ctx, struct efi_data); + efi_data->attributes = attr; + efi_data->data = talloc_strdup(efi_data, test_data); + efi_data->data_size = strlen(test_data) + 1; + + rc = efi_set_variable(test_efivar_guid, test_varname, + efi_data); + + talloc_free(efi_data); rc = efi_get_variable(ctx, test_efivar_guid, test_varname, - &data, &size, &attr); + &efi_data); - assert(data != NULL); - rc = strcmp((char *)data, test_data); + assert(efi_data->data != NULL); + rc = strcmp((char *)efi_data->data, test_data); if (rc) { talloc_free(ctx); assert(0); } - rc = efi_del_variable(ctx, test_efivar_guid, test_varname); + rc = efi_del_variable(test_efivar_guid, test_varname); rc = efi_get_variable(ctx, test_efivar_guid, test_varname, - &data, &size, &attr); + &efi_data); errno_value = errno; talloc_free(ctx);