On Tue, Jul 08, 2025 at 12:19:18PM -0400, Stefan Berger wrote: > > > 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 Will fix the typo in v2.
> > > command becomes the only choice to implement grub_tcg2_cap_pcr(). > > > > Signed-off-by: Gary Lin <g...@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, > }; > Will update the initialization of the variables in v2. > > > + 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 <stef...@linux.ibm.com> > Thanks, Gary Lin _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel