U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: u-boot@lists.denx.de, Alexander Graf <agraf@csgraf.de>,
	Masahisa Kojima <masahisa.kojima@linaro.org>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	Sughosh Ganu <sughosh.ganu@linaro.org>
Subject: Re: [PATCH v3 4/4] efi_loader: simplify tcg2_measure_secure_boot_variable()
Date: Wed, 6 Oct 2021 09:26:23 +0300	[thread overview]
Message-ID: <YV1Bj2GsqewC/Z/B@apalos.home> (raw)
In-Reply-To: <20211003092320.4671-5-heinrich.schuchardt@canonical.com>

On Sun, Oct 03, 2021 at 11:23:20AM +0200, Heinrich Schuchardt wrote:
> Don't duplicate GUIDs.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
> v3:
> 	no change
> v2:
> 	no change
> ---
>  lib/efi_loader/efi_tcg2.c | 29 +++++++++++++----------------
>  1 file changed, 13 insertions(+), 16 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
> index ed1506012b..52bf1b775f 100644
> --- a/lib/efi_loader/efi_tcg2.c
> +++ b/lib/efi_loader/efi_tcg2.c
> @@ -11,6 +11,7 @@
>  #include <common.h>
>  #include <dm.h>
>  #include <efi_loader.h>
> +#include <efi_variable.h>
>  #include <efi_tcg2.h>
>  #include <log.h>
>  #include <malloc.h>
> @@ -79,17 +80,12 @@ static const struct digest_info hash_algo_list[] = {
>  	},
>  };
>  
> -struct variable_info {
> -	u16		*name;
> -	const efi_guid_t	*guid;
> -};
> -
> -static struct variable_info secure_variables[] = {
> -	{L"SecureBoot", &efi_global_variable_guid},
> -	{L"PK", &efi_global_variable_guid},
> -	{L"KEK", &efi_global_variable_guid},
> -	{L"db", &efi_guid_image_security_database},
> -	{L"dbx", &efi_guid_image_security_database},
> +static const u16 *secure_variables[] = {
> +	u"SecureBoot",
> +	u"PK",
> +	u"KEK",
> +	u"db",
> +	u"dbx",
>  };
>  
>  #define MAX_HASH_COUNT ARRAY_SIZE(hash_algo_list)
> @@ -1593,19 +1589,20 @@ static efi_status_t tcg2_measure_secure_boot_variable(struct udevice *dev)
>  
>  	count = ARRAY_SIZE(secure_variables);
>  	for (i = 0; i < count; i++) {
> +		const efi_guid_t *guid;
> +
> +		guid = efi_auth_var_get_guid(secure_variables[i]);
> +
>  		/*
>  		 * According to the TCG2 PC Client PFP spec, "SecureBoot",
>  		 * "PK", "KEK", "db" and "dbx" variables must be measured
>  		 * even if they are empty.
>  		 */
> -		data = efi_get_var(secure_variables[i].name,
> -				   secure_variables[i].guid,
> -				   &data_size);
> +		data = efi_get_var(secure_variables[i], guid, &data_size);
>  
>  		ret = tcg2_measure_variable(dev, 7,
>  					    EV_EFI_VARIABLE_DRIVER_CONFIG,
> -					    secure_variables[i].name,
> -					    secure_variables[i].guid,
> +					    secure_variables[i], guid,
>  					    data_size, data);
>  		free(data);
>  		if (ret != EFI_SUCCESS)
> -- 
> 2.32.0
> 
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

      reply	other threads:[~2021-10-06  6:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-03  9:23 [PATCH v3 0/4] efi_loader: centralize known vendor GUIDs Heinrich Schuchardt
2021-10-03  9:23 ` [PATCH v3 1/4] efi_loader: treat UEFI variable name as const Heinrich Schuchardt
2021-10-06  6:27   ` Ilias Apalodimas
2021-10-03  9:23 ` [PATCH v3 2/4] efi_loader: function to get GUID for variable name Heinrich Schuchardt
2021-10-06  6:25   ` Ilias Apalodimas
2021-10-03  9:23 ` [PATCH v3 3/4] efi_loader: simplify efi_sigstore_parse_sigdb() Heinrich Schuchardt
2021-10-06  6:29   ` Ilias Apalodimas
2021-10-06  7:21     ` Heinrich Schuchardt
2021-10-06  8:02       ` Ilias Apalodimas
2021-10-06 13:15         ` Heinrich Schuchardt
2021-10-06 13:15         ` Heinrich Schuchardt
2021-10-06 14:05           ` Ilias Apalodimas
2021-10-07  5:54             ` Heinrich Schuchardt
2021-10-07 10:43               ` Ilias Apalodimas
2021-10-03  9:23 ` [PATCH v3 4/4] efi_loader: simplify tcg2_measure_secure_boot_variable() Heinrich Schuchardt
2021-10-06  6:26   ` Ilias Apalodimas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YV1Bj2GsqewC/Z/B@apalos.home \
    --to=ilias.apalodimas@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=masahisa.kojima@linaro.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox