On 6/15/23 08:57, Ilias Apalodimas wrote:
The tcg protocol currently adds and removes protocols with
efi_(add/remove)_protocol(). Although this works fine protocol
interfaces should be installed using the EFI API functions instead
of the internal API ones
I would prefer the commit message to explicitly state the reason:
Currently DisconnectController() is not called when uninstalling the
TCG2 protocol which does not comply to the UEFI specification.
Signed-off-by: Ilias Apalodimas <[email protected]>
---
lib/efi_loader/efi_tcg2.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index a83ae7a46cf3..49f8a5e77cbf 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -1680,8 +1680,8 @@ void tcg2_uninit(void)
if (!is_tcg2_protocol_installed())
return;
- ret = efi_remove_protocol(efi_root, &efi_guid_tcg2_protocol,
- (void *)&efi_tcg2_protocol);
+ ret = efi_uninstall_multiple_protocol_interfaces(efi_root,
&efi_guid_tcg2_protocol,
+ &efi_tcg2_protocol,
NULL);
For a single protocol interface efi_uninstall_protocol() is good enough.
if (ret != EFI_SUCCESS)
log_err("Failed to remove EFI TCG2 protocol\n");
}
@@ -2507,8 +2507,8 @@ efi_status_t efi_tcg2_register(void)
goto fail;
}
- ret = efi_add_protocol(efi_root, &efi_guid_tcg2_protocol,
- (void *)&efi_tcg2_protocol);
+ ret = efi_install_multiple_protocol_interfaces(&efi_root,
&efi_guid_tcg2_protocol,
+ &efi_tcg2_protocol,
NULL);
What is the benefit of this change?
Best regards
Heinrich
if (ret != EFI_SUCCESS) {
tcg2_uninit();
goto fail;