summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_boottime.c
diff options
context:
space:
mode:
authorMasahisa Kojima <masahisa.kojima@linaro.org>2021-08-13 10:12:40 +0300
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-08-14 21:54:41 +0300
commit8fc4e0b4273adc741dfd1917970162ca224f98bf (patch)
treec2ff67ece6ecfa4203f6d562e6f5e6afcb2365cc /lib/efi_loader/efi_boottime.c
parentcfbcf054a323b692e85e73fc2a57400ee92f6b63 (diff)
downloadu-boot-8fc4e0b4273adc741dfd1917970162ca224f98bf.tar.xz
efi_loader: add boot variable measurement
TCG PC Client PFP spec requires to measure "Boot####" and "BootOrder" variables, EV_SEPARATOR event prior to the Ready to Boot invocation. Since u-boot does not implement Ready to Boot event, these measurements are performed when efi_start_image() is called. TCG spec also requires to measure "Calling EFI Application from Boot Option" for each boot attempt, and "Returning from EFI Application from Boot Option" if a boot device returns control back to the Boot Manager. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Diffstat (limited to 'lib/efi_loader/efi_boottime.c')
-rw-r--r--lib/efi_loader/efi_boottime.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 0b98e91813..13ab139222 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -2994,6 +2994,16 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
image_obj->exit_status = &exit_status;
image_obj->exit_jmp = &exit_jmp;
+ if (IS_ENABLED(CONFIG_EFI_TCG2_PROTOCOL)) {
+ if (image_obj->image_type == IMAGE_SUBSYSTEM_EFI_APPLICATION) {
+ ret = efi_tcg2_measure_efi_app_invocation();
+ if (ret != EFI_SUCCESS) {
+ log_warning("tcg2 measurement fails(0x%lx)\n",
+ ret);
+ }
+ }
+ }
+
/* call the image! */
if (setjmp(&exit_jmp)) {
/*
@@ -3252,6 +3262,16 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle,
exit_status != EFI_SUCCESS)
efi_delete_image(image_obj, loaded_image_protocol);
+ if (IS_ENABLED(CONFIG_EFI_TCG2_PROTOCOL)) {
+ if (image_obj->image_type == IMAGE_SUBSYSTEM_EFI_APPLICATION) {
+ ret = efi_tcg2_measure_efi_app_exit();
+ if (ret != EFI_SUCCESS) {
+ log_warning("tcg2 measurement fails(0x%lx)\n",
+ ret);
+ }
+ }
+ }
+
/* Make sure entry/exit counts for EFI world cross-overs match */
EFI_EXIT(exit_status);