From patchwork Wed Nov 13 00:53:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1193946 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="b/cB5sj+"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47CRGq6707z9sPh for ; Wed, 13 Nov 2019 12:04:51 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 81639C21FA8; Wed, 13 Nov 2019 00:57:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0DC71C21F7E; Wed, 13 Nov 2019 00:56:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0D8A0C21F63; Wed, 13 Nov 2019 00:53:30 +0000 (UTC) Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by lists.denx.de (Postfix) with ESMTPS id A88BAC21FA6 for ; Wed, 13 Nov 2019 00:53:18 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id s10so292264plp.2 for ; Tue, 12 Nov 2019 16:53:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pv26WsrJJuIxq5QJ47O0IzZ9EpmLDsfqW5NljQhTQ+M=; b=b/cB5sj+wSl5zBETHr3dif7m86gKwCy6rfXUr11isVorvlzT+MvzJKSihS02wTUcrJ l0JDXP36UDyzFHvLtPp0Yy1D5TP3RVP6zSjCQQtUECTik1l55e8abHTgYHt46PowMv1R Jy5WbdcRB/Ng4wB+BzsKQoGOAd3ok4XlacQJih03SUoDf95KIb3LRkT3eVsTydpzklm6 PqDRwpc/TTHbCpvLseCKYWpU8cr9NdldVFlbtFTP4WNSHvxvcLif6gcLnTBADK/6Q320 H3QG5v5dphHnQE2f5cit/xdHFYYR2/WxMSGR21SXnMySrNK3ZqkIRrWuFT1g7yYJahg8 IueA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pv26WsrJJuIxq5QJ47O0IzZ9EpmLDsfqW5NljQhTQ+M=; b=gO/90XKVnNR6hLA0E8DcdZg36DP+qKN1D54kGFFukZz/076tXlQsxnkqpKqkaLWZtg HalsKauLgwi1blNJ/beNZyykUSuRoUxNJOKgNl0U6uQeMvB/YqkRfCVjSrRRtikoZm60 e6jx6Oq6RIf/QXWSFDb6+2BbMW8Lee9NMvsghvsiJ21wusay10k2Yy7jkykxlh8SxGnq gCctgogJAwqyTUbir9QpAibYVUucqlIgEMMhl+3b9HpZ7vr+K5ulu3HgLc2nz5h2ljWy GT2qPbJoT7lRb/XZI1KDpySKSYHQU7NidtJa/UQl598AneBNKOs8cL3IU8XnUahcnaEX z+EQ== X-Gm-Message-State: APjAAAVmrNYmKBvyL2YuxNsoZN8w9KKfG4a8yf17ZzrbQW14uE04QgE7 VkAOie4i6EJmWePPFztr0ae8xw== X-Google-Smtp-Source: APXvYqwurI9eHgeLm/DmE5r+29d5wqj2sQ7Bu3SEUaXHFzv7HSbf90isuGb7AdVM56ZaKKbsSqDfcQ== X-Received: by 2002:a17:902:ba91:: with SMTP id k17mr775634pls.100.1573606397214; Tue, 12 Nov 2019 16:53:17 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id k5sm283359pju.14.2019.11.12.16.53.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Nov 2019 16:53:16 -0800 (PST) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, trini@konsulko.com Date: Wed, 13 Nov 2019 09:53:03 +0900 Message-Id: <20191113005306.30356-14-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191113005306.30356-1-takahiro.akashi@linaro.org> References: <20191113005306.30356-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: u-boot@lists.denx.de, mail@patrick-wildt.de Subject: [U-Boot] [PATCH 13/16] cmd: env: add "-at" option to "env set -e" command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" With "-at" option, EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS will be passed to SetVariable() to authenticate the variable. Signed-off-by: AKASHI Takahiro --- cmd/nvedit.c | 5 +++-- cmd/nvedit_efi.c | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 99a3bc57b15f..30cd655b7260 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -1399,7 +1399,7 @@ static char env_help_text[] = #endif #endif #if defined(CONFIG_CMD_NVEDIT_EFI) - "env set -e [-nv][-bs][-rt][-a][-i addr,size][-v] name [arg ...]\n" + "env set -e [-nv][-bs][-rt][-at][-a][-i addr,size][-v] name [arg ...]\n" " - set UEFI variable; unset if '-i' or 'arg' not specified\n" #endif "env set [-f] name [arg ...]\n"; @@ -1461,13 +1461,14 @@ U_BOOT_CMD_COMPLETE( setenv, CONFIG_SYS_MAXARGS, 0, do_env_set, "set environment variables", #if defined(CONFIG_CMD_NVEDIT_EFI) - "-e [-guid guid][-nv][-bs][-rt][-a][-v]\n" + "-e [-guid guid][-nv][-bs][-rt][-at][-a][-v]\n" " [-i addr,size name], or [name [value ...]]\n" " - set UEFI variable 'name' to 'value' ...'\n" " \"-guid\": set vendor guid\n" " \"-nv\": set non-volatile attribute\n" " \"-bs\": set boot-service attribute\n" " \"-rt\": set runtime attribute\n" + " \"-at\": set time-based authentication attribute\n" " \"-a\": append-write\n" " \"-i addr,size\": use as variable's value\n" " \"-v\": verbose message\n" diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c index 579cf430593c..837e39e02179 100644 --- a/cmd/nvedit_efi.c +++ b/cmd/nvedit_efi.c @@ -458,7 +458,7 @@ out: * Return: CMD_RET_SUCCESS on success, or CMD_RET_RET_FAILURE * * This function is for "env set -e" or "setenv -e" command: - * => env set -e [-guid guid][-nv][-bs][-rt][-a][-v] + * => env set -e [-guid guid][-nv][-bs][-rt][-at][-a][-v] * [-i address,size] var, or * var [value ...] * Encode values specified and set given UEFI variable. @@ -517,6 +517,9 @@ int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) attributes |= EFI_VARIABLE_RUNTIME_ACCESS; } else if (!strcmp(argv[0], "-nv")) { attributes |= EFI_VARIABLE_NON_VOLATILE; + } else if (!strcmp(argv[0], "-at")) { + attributes |= + EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; } else if (!strcmp(argv[0], "-a")) { attributes |= EFI_VARIABLE_APPEND_WRITE; } else if (!strcmp(argv[0], "-i")) {