From patchwork Wed Apr 7 11:53:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 416681 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp393866jai; Wed, 7 Apr 2021 04:55:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFvZsgIRVGw44G6wBIsXB9pZuW+y9HQJYtUrhgyvOiov3VVOWldFqsTYHr0AGDyi1L06Qd X-Received: by 2002:a17:906:2e0f:: with SMTP id n15mr3271572eji.447.1617796510248; Wed, 07 Apr 2021 04:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617796510; cv=none; d=google.com; s=arc-20160816; b=qpd6mT2UHu9BdqRD6nlFMUC5fUQMyLECBbyG6BBlwPd/ybfBoQjbS3RSmzExoDwrt6 +4rLilwm93xLBpzSdyvoOFR2IWjYtsvm+gx526eAK4AJdXWJih5bwgyJTcLJM+P7Yhkx 56gBGJazFNw09xc99QUpS/6+1hVkHJjqi4GINMqKRAfFFgZFEj5tgYjUbcio4KFLKOy0 TE8ICF+EIQ2Yf+OHbDphAEdDJYFPZL002fC89DIYQDIqpjY/1C4R+IdPEonk4Jq5eQyV XR263dLt3Lx55qtKBi9cicODb6nYkKdoNwgQHNjav+Jyy1yppJnqCuo1t1o9Gjv1BaWW Y9Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from; bh=t205bdVzpcL9aEMd2sIIkmG3I7d3gfmpDyql/kiO2SA=; b=JJLcZcJ7GO8KZvCD05Xpr0pM9amVjgBQbiipgtmAkc0oOd4C5+rF82/ppIADnTYh7y 3cHib9GXdtj5jGwwDQC4TGCJvizXRZylTrJe5/JZoA+MSNM0LQsAsVDT1N5ZIgHi5PZa qFxdZw1oAZL9PPTqSNxKivcDJA1G2gwKIk5ijROeWIFbMwA1SkLELPcERe/woAQE/biy EtyzaHc56h6RZXBt76gS5cSMNAiuGp2P0QmAxsnju3xAWt4MGuIZ6kRu8D0KsulU/cEi SCLiZb6GyGtat4Hm1rWzECz0yL1PcTKdYfpu96B5aQZqsPQyiIO2tF+0ieM7GQ77WXCr TFuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id r6si10499023edx.180.2021.04.07.04.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 04:55:10 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B82A9816AF; Wed, 7 Apr 2021 13:54:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 9655A81692; Wed, 7 Apr 2021 13:54:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 3212680C67 for ; Wed, 7 Apr 2021 13:54:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BFC23139F; Wed, 7 Apr 2021 04:54:21 -0700 (PDT) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A8B803F792; Wed, 7 Apr 2021 04:54:19 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Alexander Graf , Simon Glass , Bin Meng , =?utf-8?q?Pali_Roh=C3=A1r?= , Sughosh Ganu Subject: [PATCH 3/5] efi_capsule: Add a weak function to check whether capsule authentication is enabled Date: Wed, 7 Apr 2021 17:23:33 +0530 Message-Id: <20210407115335.8615-4-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210407115335.8615-1-sughosh.ganu@linaro.org> References: <20210407115335.8615-1-sughosh.ganu@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Define a weak function which checks if the environment variable capsule_authentication_enabled has been set, for enabling capsule authentication. Other platforms might have a different mechanism to determine this, and would then define their own platform specific function. Signed-off-by: Sughosh Ganu --- board/emulation/common/qemu_capsule.c | 6 ------ lib/efi_loader/efi_capsule.c | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/board/emulation/common/qemu_capsule.c b/board/emulation/common/qemu_capsule.c index 5cb461d52b..6b8a87022a 100644 --- a/board/emulation/common/qemu_capsule.c +++ b/board/emulation/common/qemu_capsule.c @@ -41,9 +41,3 @@ int efi_get_public_key_data(void **pkey, efi_uintn_t *pkey_len) return 0; } - -bool efi_capsule_auth_enabled(void) -{ - return env_get("capsule_authentication_enabled") != NULL ? - true : false; -} diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 0cfff0daf7..1423b675c8 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -218,6 +218,12 @@ __weak int efi_get_public_key_data(void **pkey, efi_uintn_t *pkey_len) return 0; } +__weak bool efi_capsule_auth_enabled(void) +{ + return env_get("capsule_authentication_enabled") ? + true : false; +} + efi_status_t efi_capsule_authenticate(const void *capsule, efi_uintn_t capsule_size, void **image, efi_uintn_t *image_size) {