From patchwork Wed Apr 7 14:41:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 416717 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp531528jai; Wed, 7 Apr 2021 07:43:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJekhyRwmHcnk29BZIqyfY2Wkp70AYfKnIki0QCQvtsQPGAUuZPepfdqHjZHZ0ltJtKp3j X-Received: by 2002:a05:6402:10c9:: with SMTP id p9mr4954720edu.268.1617806586457; Wed, 07 Apr 2021 07:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617806586; cv=none; d=google.com; s=arc-20160816; b=XELZlkdNyE7wfh/EPngajbH56ARjlcja6QhSOR4QVwtC0/lOF6RGXqup+9EmEWdSXq RIhGaefX91tcycFWj2MktLT3fiMlPTgwTi88YKkfqT9GChQOT2aGpkBSdXuIR0rsIA9t N2WIj3brLXrYtEGPHBuBgu4p9EVy0NeniJB1fDfN9OP4GtEQp1cfzs9b61SeobDqJt7i r6H/m9pxvOkWrnAbc2Xk91HcZuxAfSbxPD3QIGBhzY8gWwUzT+gptxC7WkZXZHQpDIxu XAEIREn+1wW2E1xuuVE1JT74o2QpNyxfKXDNRrY7lDSxSGKK+7/6ZL2rUCqTefYo7K7N UVvA== 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=kOWDTzSeS2cy/tlyzYppY8dNX2+5a8wMmSPRRxPEYd4xKq6nFllUdFXWSdpNNLXF0s /pLArPaCvaB1atFJ3+fNXJwl7yz0/Vuqef9qWzy8s4YZfjxYdnbaYcg9u6nWKWM7PxGY aXOqQjA61d8wieD3tthrBBe8Hgusmx2mepACVdJgDlrupHLIalX0+iB+3QJxmVeGPsns 7kmyjlPezxdKYm2JqUYUXbIsUZa0qr1hmwiJ4q5pM3Bf6R0WXzmCe4o9aP9/YF07mX0G 7vMGsvxE9e8PBN2MXB9Iknmjf3aN2URjgfOol+iQs83kiIbjcDBt4hO2g+ZWqWeCk6aT BTuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id t8si18463297ejj.661.2021.04.07.07.43.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 07:43:06 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 B29148187C; Wed, 7 Apr 2021 16:42:38 +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 7B7C68179F; Wed, 7 Apr 2021 16:42:27 +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 1D52E81743 for ; Wed, 7 Apr 2021 16:42:20 +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 194B8139F; Wed, 7 Apr 2021 07:42:20 -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 0002A3F792; Wed, 7 Apr 2021 07:42:17 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Alexander Graf , Simon Glass , Bin Meng , Pali Rohar , Sughosh Ganu Subject: [RESEND PATCH v1 3/5] efi_capsule: Add a weak function to check whether capsule authentication is enabled Date: Wed, 7 Apr 2021 20:11:45 +0530 Message-Id: <20210407144147.29251-4-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210407144147.29251-1-sughosh.ganu@linaro.org> References: <20210407144147.29251-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) {