printf("%d. %s\n", maxmenu
, strtcpy(desc, pos->description, ARRAY_SIZE(desc)));
}
- if (tpm_is_working()) {
+ if (tpm_can_show_menu()) {
printf("\nt. TPM Configuration\n");
}
scan_code = get_keystroke(1000);
if (scan_code == 1 && !irqtimer_check(esc_accepted_time))
continue;
- if (tpm_is_working() && scan_code == 20 /* t */) {
+ if (tpm_can_show_menu() && scan_code == 20 /* t */) {
printf("\n");
tpm_menu();
}
u8 * log_area_last_entry;
} tpm_state VARLOW;
+static int TPM_has_physical_presence;
+
static struct tcpa_descriptor_rev2 *
find_tcpa_by_rsdp(struct rsdp_descriptor *rsdp)
{
u8 TPM_working VARLOW;
-int
+static int
tpm_is_working(void)
{
return CONFIG_TCGBIOS && TPM_working;
}
+int
+tpm_can_show_menu(void)
+{
+ return tpm_is_working() && TPM_has_physical_presence;
+}
+
/*
* Send a TPM command with the given ordinal. Append the given buffer
* containing all data in network byte order to the command (this is
if (ret)
goto err_exit;
+ /* assertion of physical presence is only possible after startup */
+ ret = assert_physical_presence();
+ if (!ret)
+ TPM_has_physical_presence = 1;
+
ret = determine_timeouts();
if (ret)
return -1;
if (pf.flags[PERM_FLAG_IDX_DISABLE] && !enable)
return 0;
- ret = assert_physical_presence();
- if (ret)
- return -1;
-
ret = build_and_send_cmd(0, enable ? TPM_ORD_PhysicalEnable
: TPM_ORD_PhysicalDisable,
NULL, 0, TPM_DURATION_TYPE_SHORT);
if (pf.flags[PERM_FLAG_IDX_DISABLE])
return 0;
- ret = assert_physical_presence();
- if (ret)
- return -1;
-
ret = build_and_send_cmd(0, TPM_ORD_PhysicalSetDeactivated,
activate ? CommandFlag_FALSE
: CommandFlag_TRUE,
}
}
- ret = assert_physical_presence();
- if (ret)
- return -1;
-
ret = build_and_send_cmd(0, TPM_ORD_ForceClear,
NULL, 0, TPM_DURATION_TYPE_SHORT);
if (ret)
return 0;
}
- ret = assert_physical_presence();
- if (ret)
- return -1;
-
ret = build_and_send_cmd(0, TPM_ORD_SetOwnerInstall,
(allow) ? CommandFlag_TRUE
: CommandFlag_FALSE,
void tpm_add_cdrom(u32 bootdrv, const u8 *addr, u32 length);
void tpm_add_cdrom_catalog(const u8 *addr, u32 length);
void tpm_option_rom(const void *addr, u32 len);
-int tpm_is_working(void);
+int tpm_can_show_menu(void);
void tpm_menu(void);
#endif /* TCGBIOS_H */