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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 61998C433F5 for ; Thu, 25 Nov 2021 13:22:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7D90182F89; Thu, 25 Nov 2021 14:22:28 +0100 (CET) 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="DhlAlML4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4B18A8349B; Thu, 25 Nov 2021 14:22:27 +0100 (CET) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (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 6ED6680F7A for ; Thu, 25 Nov 2021 14:22:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x436.google.com with SMTP id c4so11592634wrd.9 for ; Thu, 25 Nov 2021 05:22:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KzpJg5unb4E9EgndJCg0A+APCmcjqFCoaCV1/qZEIaI=; b=DhlAlML4ptgBP45X+Cxy1av5NfRK10WzwZ1WMuQQQ/SIqW6LXFn6COO/eNlUcFZ4bu wD1tQWNVyqWEZIquAHkHCXWAc5Telg5PvIDvWrI4Fg+aTeGsfT/yLzFVixmugvedv4/C cDrbYFhLSEae7BbgtVUDzXZNmXqF5r2rXkFqRh6zWtxEzvYecFmjwrR+5U25uBgMpU3N Ybocv4BSd7pcEmhw95RKKhQts0IsAgeh41jzotD+AEeB0PPx0LZ/rdo2XvzUrzSPsX0d vTUcdx/bCG1eLaI58STowFzKm6CW8iQfi3fi1k+I8IegYhKlxcJtKPlswMSLRn7F+OHy pt5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KzpJg5unb4E9EgndJCg0A+APCmcjqFCoaCV1/qZEIaI=; b=N6JlTzgXuEM4dT29h8Hyu/5VRbGcIj1Xm5D+KqmpIEGPCN+iS7gEW9FzfPqLvygmm9 8wgxFWGHNInNJKQdSo0JR9sGMyNOBmP3pbCVWXA87yNF5XUVLNQDXbRRhIZk4aF5SmL8 3MOsCqzNVBJ0ol1zFaKTe9gNNbOYX0Ye3k8nDesbvbYz3X8D/JWTknYL5bFcTwJ5pwAb ssp8tWe2JvR9Mf3L+5ZcQLc8lNjgRYSBwNsgwYLFEpmYLt12nhyYnpPLZ0cjlKzhM+sK Y0vpsjSS2zv5+LBBX9mBoaye+jMDskaE4XXHAUx7ceFnUN4TXdskYftv9Z/r17HqyaOX El1A== X-Gm-Message-State: AOAM5312dcaZ/LAn0PoaiLUNejHTW5CNLlpV6SAPt/5EkrxQ2Ra16yq+ pK7uOhamyNPmy2PxZCGrVKNBaw== X-Google-Smtp-Source: ABdhPJxGNfsleAjGJ92Pv5q9t45lUtktladyiKS+sP2ZN9YLQCwhxbPZf387Z5NE6nzWCg1X/pihYg== X-Received: by 2002:a5d:58fb:: with SMTP id f27mr6579794wrd.10.1637846543984; Thu, 25 Nov 2021 05:22:23 -0800 (PST) Received: from apalos.home (ppp-94-66-220-227.home.otenet.gr. [94.66.220.227]) by smtp.gmail.com with ESMTPSA id g5sm4031823wri.45.2021.11.25.05.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 05:22:22 -0800 (PST) Date: Thu, 25 Nov 2021 15:22:18 +0200 From: Ilias Apalodimas To: Masahisa Kojima Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass , Ruchika Gupta , Alexander Graf Subject: Re: [PATCH v2] efi_loader: check tcg2 protocol installation outside the TCG protocol Message-ID: References: <20211125113628.29609-1-masahisa.kojima@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211125113628.29609-1-masahisa.kojima@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 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 Hi Kojima-san, On Thu, Nov 25, 2021 at 08:36:28PM +0900, Masahisa Kojima wrote: > +/** [...] > + * is_tcg2_protocol_installed - chech whether tcg2 protocol is installed > + * > + * @Return: true if tcg2 protocol is installed, false if not > + */ > +bool is_tcg2_protocol_installed(void) > +{ > + struct efi_handler *handler; > + efi_status_t ret; > + > + ret = efi_search_protocol(efi_root, &efi_guid_tcg2_protocol, &handler); > + return ((ret == EFI_SUCCESS) ? true : false); > +} return ret == EFI_SUCCESS; is enough here. > + > static u32 tcg_event_final_size(struct tpml_digest_values *digest_list) > { > u32 len; > @@ -962,6 +976,9 @@ efi_status_t tcg2_measure_pe_image(void *efi, u64 efi_size, > IMAGE_NT_HEADERS32 *nt; > struct efi_handler *handler; > > + if (!is_tcg2_protocol_installed()) > + return EFI_NOT_READY; > + > ret = platform_get_tpm2_device(&dev); > if (ret != EFI_SUCCESS) > return ret; > @@ -2140,6 +2157,9 @@ efi_status_t efi_tcg2_measure_efi_app_invocation(struct efi_loaded_image_obj *ha > u32 event = 0; > struct smbios_entry *entry; > > + if (!is_tcg2_protocol_installed()) > + return EFI_NOT_READY; > + > if (tcg2_efi_app_invoked) > return EFI_SUCCESS; > > @@ -2190,6 +2210,9 @@ efi_status_t efi_tcg2_measure_efi_app_exit(void) > efi_status_t ret; > struct udevice *dev; > > + if (!is_tcg2_protocol_installed()) [...] Heinrich, this whole patch is needed because installing the tcg2 protocol always returns EFI_SUCCESS. The reason is that some sandbox tests with sandbox_tpm used to fail. Do you want to keep this or perhaps just failing the boot now is the protocol fails to install is an option ? Thanks /Ilias