mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 20:24:36 +00:00
trivial: uefi: allow forcing to TPM2 via environment variable
Use this environment variable to ensure that TPM2 is used in self tests even if the system has TPM1.2.
This commit is contained in:
parent
f1accad201
commit
42ee62ef34
@ -50,6 +50,7 @@ fu_uefi_pcrs_2_0_func (void)
|
||||
g_autoptr(GPtrArray) pcr0s = NULL;
|
||||
g_autoptr(GPtrArray) pcrXs = NULL;
|
||||
const gchar *tpm_server_running = g_getenv ("TPM_SERVER_RUNNING");
|
||||
g_setenv ("FWUPD_FORCE_TPM2", "1", TRUE);
|
||||
|
||||
if (!fu_uefi_pcrs_setup (pcrs, &error)) {
|
||||
if (tpm_server_running == NULL &&
|
||||
@ -65,6 +66,7 @@ fu_uefi_pcrs_2_0_func (void)
|
||||
pcrXs = fu_uefi_pcrs_get_checksums (pcrs, 999);
|
||||
g_assert_nonnull (pcrXs);
|
||||
g_assert_cmpint (pcrXs->len, ==, 0);
|
||||
g_unsetenv ("FWUPD_FORCE_TPM2");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -188,7 +188,8 @@ fu_uefi_pcrs_setup (FuUefiPcrs *self, GError **error)
|
||||
sysfstpmdir = fu_common_get_path (FU_PATH_KIND_SYSFSDIR_TPM);
|
||||
devpath = g_build_filename (sysfstpmdir, "tpm0", NULL);
|
||||
fn_pcrs = g_build_filename (devpath, "pcrs", NULL);
|
||||
if (g_file_test (fn_pcrs, G_FILE_TEST_EXISTS)) {
|
||||
if (g_file_test (fn_pcrs, G_FILE_TEST_EXISTS) &&
|
||||
g_getenv ("FWUPD_FORCE_TPM2") == NULL) {
|
||||
if (!fu_uefi_pcrs_setup_tpm12 (self, fn_pcrs, error))
|
||||
return FALSE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user