From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4D99C07E95 for ; Tue, 20 Jul 2021 06:48:33 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3AB016113B for ; Tue, 20 Jul 2021 06:48:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3AB016113B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B220682C54; Tue, 20 Jul 2021 08:48:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="BsL3G7OR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3138682C5F; Tue, 20 Jul 2021 08:48:29 +0200 (CEST) Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 09AFD82C44 for ; Tue, 20 Jul 2021 08:48:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pg1-x52a.google.com with SMTP id i16so4088227pgi.9 for ; Mon, 19 Jul 2021 23:48:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=gkt77XirdCWWYzUGiL68divZURmqxdkZrshrV3yWtuE=; b=BsL3G7ORqUu7/ZlOpyfBTZ7BYRAryS40xRA61mr1Dpr+wbSDihk2dWmMGlPVCZ8Pel lhB6Whv7yCVQnaurX2UGKD8aYueTYJhTg2HbsarFJ3HDv9OGMAp3SqK4c28GO8cWaIAS ReNhWjYHp/bXtMNVlzZ4+nsRkSl/eDQzYdIk4knjLN2mRxXeeDzsX7U9DkwoEAk0vDy+ nf3NZ6aL00gt6eRwWvAfG/psnOg8+xXnf6S2O7FJFTIPIKvjeZuC/BxwoDphz00brdyY savUAS8NAvi5Sh5W8sDrMno/lWNqbhzdTzl9Y/aCNdPJz7sTki23j/zFzNf0y7hSaxLh n3MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=gkt77XirdCWWYzUGiL68divZURmqxdkZrshrV3yWtuE=; b=A8YGSC+KvZkvVHRpjF4KZk1C407ODOBQ6oDVlksCvzZPkXm/QFRCCCEawqnbL/Drpu OexixfPAbIbBXqCSJoW5argOs6Lf2xiFRacSKVBynVJYgOzFv6hoNwzWyM9CFbwI5NJB eebFehjzQc5JKMfWp9lpoJUWUjH5W8lvoakGhTZdIzCk89eShdbLEQAGgl5CcCo14w2e pGeq7cnDj9lLW8G/zbdhNIwnKo2JdCkxiBP529kNwYLWOg8UeNGvuj7YuU/J/7IoysBr V5+T3rkxjw3CMVbRQwBQF/1jQeSRHRJHfpKNblcnXQwOCQADgdEjJsDieFIuTcserur/ zHDg== X-Gm-Message-State: AOAM530VoJK6i2Yik8cW/smqsmTkrAB2BKjGTWkbQv4mg0sprMB8BMJ+ +6aLanvkariV08hcL1rOkj1yrA== X-Google-Smtp-Source: ABdhPJwEuTC+CSzDDWnq3iYnhybMK6GJQcSmikYqLLCyRkH3LFb0dTn+aaTm1EgEIaGt1pT0HthyQg== X-Received: by 2002:a63:5244:: with SMTP id s4mr22219270pgl.267.1626763704381; Mon, 19 Jul 2021 23:48:24 -0700 (PDT) Received: from laputa (p784a236a.tkyea130.ap.so-net.ne.jp. [120.74.35.106]) by smtp.gmail.com with ESMTPSA id c9sm18019091pja.7.2021.07.19.23.48.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 23:48:23 -0700 (PDT) Date: Tue, 20 Jul 2021 15:48:16 +0900 From: AKASHI Takahiro To: Ilias Apalodimas Cc: Heinrich Schuchardt , sughosh.ganu@linaro.org, u-boot@lists.denx.de, agraf@csgraf.de Subject: Re: [PATCH] efi_loader: capsule: add a debug message in case of no key Message-ID: <20210720064816.GA107447@laputa> Mail-Followup-To: AKASHI Takahiro , Ilias Apalodimas , Heinrich Schuchardt , sughosh.ganu@linaro.org, u-boot@lists.denx.de, agraf@csgraf.de References: <20210510081931.43983-1-takahiro.akashi@linaro.org> <656e9aad-86cf-b988-8deb-b85f18237d9c@gmx.de> <20210720021340.GB77259@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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.103.2 at phobos.denx.de X-Virus-Status: Clean On Tue, Jul 20, 2021 at 09:39:12AM +0300, Ilias Apalodimas wrote: > Akashi-san, > > On Tue, Jul 20, 2021 at 11:13:40AM +0900, AKASHI Takahiro wrote: > > On Thu, May 20, 2021 at 04:06:12AM +0200, Heinrich Schuchardt wrote: > > > On 5/10/21 10:19 AM, AKASHI Takahiro wrote: > > > > It will probably be a common error case that a certificate (public key) > > > > is not provided by the system while capsule authentication is enabled. > > > > So add a debug message. > > > > > > > > Signed-off-by: AKASHI Takahiro > > > > --- > > > > lib/efi_loader/efi_capsule.c | 4 +++- > > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > > > > index 90893f85e22c..84ddaf50d13f 100644 > > > > --- a/lib/efi_loader/efi_capsule.c > > > > +++ b/lib/efi_loader/efi_capsule.c > > > > @@ -316,8 +316,10 @@ efi_status_t efi_capsule_authenticate(const void *capsule, efi_uintn_t capsule_s > > > > } > > > > > > > > ret = efi_get_public_key_data(&fdt_pkey, &pkey_len); > > > > - if (ret < 0) > > > > + if (ret < 0) { > > > > + debug("Public key/certificate not found\n"); > > > > > > Currently the only implementation of efi_get_public_key_data() actually > > > providing keys is the one in board/emulation/common/qemu_capsule.c where > > > the user has to manually upload the esl file. > > > > > > For future implementation it is preferable to build the public key data > > > into the U-Boot binary. If it is part of the build process then the only > > > error that could come up is that the public key data has the wrong format. > > > > Now Ilias posted a patch to embed a public key in the U-Boot binary. > > But it won't be the only solution in the future and the system owners > > may want to provide a key in their own way; hence, it might not be "part > > of build process." > > > > Correct. My patch intentionally leaves out that part and I hope someone > will need it and implement it. > > > So I think that adding a message is still valid, even it should be > > treated as an error message instead of a debug message to warn "users". > > > Keep in mind that the makefile currently checks for the .esl file. if the > file is not found there's a compilation error, prompting the user to add a > valid file If your efi_get_public_key_data() is the only implementation in the system, checking a return value (if ret < 0) is also meaningless. -Takahiro Akashi > > Thanks > /Ilias > > > > -Takahiro Akashi > > > > > > > If we are using the weak implementation of efi_get_public_key_data() in > > > lib/efi_loader/efi_capsule.cwith CONFIG_EFI_CAPSULE_AUTHENTICATE=y, the > > > system is misconfigured. Do we need that weak implementation at all? I > > > would prefer to remove to get a build error. > > > > > > I suggest that you add a log_err() message with above text into the > > > board/emulation/common/qemu_capsule.c implementation of > > > efi_get_public_key_data(). This way the user will see that he forgot a step. > > > > > > Best regards > > > > > > Heinrich > > > > > > > goto out; > > > > + } > > > > > > > > pkey = malloc(pkey_len); > > > > if (!pkey) > > > > > > >