From: Stefan Berger <stefanb@linux.ibm.com>
To: Gary Lin <glin@suse.com>,
The development of GNU GRUB <grub-devel@gnu.org>
Cc: Daniel Kiper <daniel.kiper@oracle.com>,
mchang@suse.com, patrick.colp@oracle.com
Subject: Re: [PATCH 5/7] tss2: Implement grub_tcg2_cap_pcr() for EMU
Date: Tue, 8 Jul 2025 12:19:18 -0400 [thread overview]
Message-ID: <1ee3b85f-991b-4770-a0ec-008dd90de712@linux.ibm.com> (raw)
In-Reply-To: <20250708083135.14809-6-glin@suse.com>
On 7/8/25 4:31 AM, Gary Lin wrote:
> Since there is no system fimware for grub-emu, the TPM2_PCR_Event
s/fimware/firmware
> command becomes the only choice to implement grub_tcg2_cap_pcr().
>
> Signed-off-by: Gary Lin <glin@suse.com>
> ---
> grub-core/lib/tss2/tcg2_emu.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/grub-core/lib/tss2/tcg2_emu.c b/grub-core/lib/tss2/tcg2_emu.c
> index cab930d2b..f461515de 100644
> --- a/grub-core/lib/tss2/tcg2_emu.c
> +++ b/grub-core/lib/tss2/tcg2_emu.c
> @@ -22,6 +22,7 @@
>
> #include <tss2_buffer.h>
> #include <tss2_structs.h>
> +#include <tpm2_cmd.h>
> #include <tcg2.h>
>
> grub_err_t
> @@ -47,3 +48,21 @@ grub_tcg2_submit_command (grub_size_t input_size, grub_uint8_t *input,
>
> return GRUB_ERR_NONE;
> }
> +
> +grub_err_t
> +grub_tcg2_cap_pcr (grub_uint8_t pcr)
> +{
> + TPMS_AUTH_COMMAND_t authCmd = {0};
TPMS_AUTH_COMMAND_t authCmd = {
.sessionHandle = TPM_RS_PW,
};
TPM2B_EVENT_t data = {
.size = 4,
};
> + TPM2B_EVENT_t data = {0};
> + TPM_RC_t rc;
> +
> + /* A SEPARATOR event is an event with 4 0-bytes. */
> + data.size = 4;
> + authCmd.sessionHandle = TPM_RS_PW;
> +
> + rc = grub_tpm2_pcr_event (pcr, &authCmd, &data, NULL, NULL);
> + if (rc != TPM_RC_SUCCESS)
> + return grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot cap PCR %u"), pcr);
> +> + return GRUB_ERR_NONE;
> +}
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next prev parent reply other threads:[~2025-07-08 19:59 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 8:31 [PATCH 0/7] TPM2 PCR Capping Gary Lin via Grub-devel
2025-07-08 8:31 ` [PATCH 1/7] tss2: Add TPM2_PCR_Event command Gary Lin via Grub-devel
2025-07-10 14:54 ` Sudhakar Kuppusamy
2025-07-11 1:59 ` Gary Lin via Grub-devel
2025-07-08 8:31 ` [PATCH 2/7] tss2: Introduce grub_tcg2_cap_pcr() Gary Lin via Grub-devel
2025-07-08 16:05 ` Stefan Berger
2025-07-10 15:09 ` Sudhakar Kuppusamy
2025-07-11 2:20 ` Gary Lin via Grub-devel
2025-07-08 8:31 ` [PATCH 3/7] tss2: Implement grub_tcg2_cap_pcr() for EFI Gary Lin via Grub-devel
2025-07-08 16:27 ` Stefan Berger
2025-07-09 2:04 ` Gary Lin via Grub-devel
2025-07-08 8:31 ` [PATCH 4/7] tss2: Implement grub_tcg2_cap_pcr() for ieee1275 Gary Lin via Grub-devel
2025-07-08 15:52 ` Stefan Berger
2025-07-09 2:08 ` Gary Lin via Grub-devel
2025-07-08 8:31 ` [PATCH 5/7] tss2: Implement grub_tcg2_cap_pcr() for EMU Gary Lin via Grub-devel
2025-07-08 16:19 ` Stefan Berger [this message]
2025-07-09 2:35 ` Gary Lin via Grub-devel
2025-07-08 8:31 ` [PATCH 6/7] tpm2_key_protector: Support PCR capping Gary Lin via Grub-devel
2025-07-08 17:00 ` Stefan Berger
2025-07-10 15:24 ` Sudhakar Kuppusamy
2025-07-08 8:31 ` [PATCH 7/7] tests/tpm2_key_protector_test: Add a test for PCR Capping Gary Lin via Grub-devel
2025-07-09 12:31 ` Stefan Berger
2025-07-10 15:26 ` Sudhakar Kuppusamy
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=1ee3b85f-991b-4770-a0ec-008dd90de712@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=daniel.kiper@oracle.com \
--cc=glin@suse.com \
--cc=grub-devel@gnu.org \
--cc=mchang@suse.com \
--cc=patrick.colp@oracle.com \
/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;
as well as URLs for NNTP newsgroup(s).