[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/6] tpm: Drop unneeded code
From: |
Daniel Kiper |
Subject: |
[PATCH 4/6] tpm: Drop unneeded code |
Date: |
Mon, 25 May 2020 21:02:13 +0200 |
Drop unused grub_tpm*_execute() and declaration of nonexistent grub_tpm_init().
Signed-off-by: Daniel Kiper <address@hidden>
---
grub-core/commands/efi/tpm.c | 97 --------------------------------------------
include/grub/tpm.h | 3 --
2 files changed, 100 deletions(-)
diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c
index 3ea37a15e..b03b6b296 100644
--- a/grub-core/commands/efi/tpm.c
+++ b/grub-core/commands/efi/tpm.c
@@ -120,103 +120,6 @@ grub_tpm_handle_find (grub_efi_handle_t *tpm_handle,
}
static grub_err_t
-grub_tpm1_execute (grub_efi_handle_t tpm_handle,
- PassThroughToTPM_InputParamBlock *inbuf,
- PassThroughToTPM_OutputParamBlock *outbuf)
-{
- grub_efi_status_t status;
- grub_efi_tpm_protocol_t *tpm;
- grub_uint32_t inhdrsize = sizeof (*inbuf) - sizeof (inbuf->TPMOperandIn);
- grub_uint32_t outhdrsize =
- sizeof (*outbuf) - sizeof (outbuf->TPMOperandOut);
-
- tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid,
- GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
-
- if (!grub_tpm1_present (tpm))
- return 0;
-
- /* UEFI TPM protocol takes the raw operand block, no param block header. */
- status = efi_call_5 (tpm->pass_through_to_tpm, tpm,
- inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn,
- outbuf->OPBLength - outhdrsize, outbuf->TPMOperandOut);
-
- switch (status)
- {
- case GRUB_EFI_SUCCESS:
- return 0;
- case GRUB_EFI_DEVICE_ERROR:
- return grub_error (GRUB_ERR_IO, N_("Command failed"));
- case GRUB_EFI_INVALID_PARAMETER:
- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter"));
- case GRUB_EFI_BUFFER_TOO_SMALL:
- return grub_error (GRUB_ERR_BAD_ARGUMENT,
- N_("Output buffer too small"));
- case GRUB_EFI_NOT_FOUND:
- return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
- default:
- return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error"));
- }
-}
-
-static grub_err_t
-grub_tpm2_execute (grub_efi_handle_t tpm_handle,
- PassThroughToTPM_InputParamBlock *inbuf,
- PassThroughToTPM_OutputParamBlock *outbuf)
-{
- grub_efi_status_t status;
- grub_efi_tpm2_protocol_t *tpm;
- grub_uint32_t inhdrsize = sizeof (*inbuf) - sizeof (inbuf->TPMOperandIn);
- grub_uint32_t outhdrsize =
- sizeof (*outbuf) - sizeof (outbuf->TPMOperandOut);
-
- tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid,
- GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
-
- if (!grub_tpm2_present (tpm))
- return 0;
-
- /* UEFI TPM protocol takes the raw operand block, no param block header. */
- status = efi_call_5 (tpm->submit_command, tpm,
- inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn,
- outbuf->OPBLength - outhdrsize, outbuf->TPMOperandOut);
-
- switch (status)
- {
- case GRUB_EFI_SUCCESS:
- return 0;
- case GRUB_EFI_DEVICE_ERROR:
- return grub_error (GRUB_ERR_IO, N_("Command failed"));
- case GRUB_EFI_INVALID_PARAMETER:
- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter"));
- case GRUB_EFI_BUFFER_TOO_SMALL:
- return grub_error (GRUB_ERR_BAD_ARGUMENT,
- N_("Output buffer too small"));
- case GRUB_EFI_NOT_FOUND:
- return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
- default:
- return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error"));
- }
-}
-
-grub_err_t
-grub_tpm_execute (PassThroughToTPM_InputParamBlock *inbuf,
- PassThroughToTPM_OutputParamBlock *outbuf)
-{
- grub_efi_handle_t tpm_handle;
- grub_uint8_t protocol_version;
-
- /* Absence of a TPM isn't a failure. */
- if (!grub_tpm_handle_find (&tpm_handle, &protocol_version))
- return 0;
-
- if (protocol_version == 1)
- return grub_tpm1_execute (tpm_handle, inbuf, outbuf);
- else
- return grub_tpm2_execute (tpm_handle, inbuf, outbuf);
-}
-
-static grub_err_t
grub_tpm1_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
grub_size_t size, grub_uint8_t pcr,
const char *description)
diff --git a/include/grub/tpm.h b/include/grub/tpm.h
index 304507957..49fe76e81 100644
--- a/include/grub/tpm.h
+++ b/include/grub/tpm.h
@@ -74,7 +74,4 @@ typedef struct
grub_err_t grub_tpm_measure (unsigned char *buf, grub_size_t size,
grub_uint8_t pcr, const char *description);
-grub_err_t grub_tpm_init (void);
-grub_err_t grub_tpm_execute (PassThroughToTPM_InputParamBlock *inbuf,
- PassThroughToTPM_OutputParamBlock *outbuf);
#endif
--
2.11.0
- [PATCH 0/6] GRUB: Bundle of various fixes and cleanups, Daniel Kiper, 2020/05/25
- [PATCH 2/6] net/http: Return an error on HTTP error responses, Daniel Kiper, 2020/05/25
- [PATCH 6/6] efi/tpm: Fix typo in grub_efi_tpm2_protocol struct, Daniel Kiper, 2020/05/25
- [PATCH 4/6] tpm: Drop unneeded code,
Daniel Kiper <=
- [PATCH 1/6] grub-install: Fix inverted test for NLS enabled when copying locales, Daniel Kiper, 2020/05/25
- [PATCH 3/6] docs: Fix devicetree command description, Daniel Kiper, 2020/05/25
- [PATCH 5/6] i386/efi/init: Drop bogus include, Daniel Kiper, 2020/05/25