mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 10:14:55 +00:00
Cleanup and preparation for inside-wrapper TPM refactoring.
Add recovery reason for already in recovery and need to reboot to recovery to let the TPM init. Add vboot_struct fields. Fix type for keyblock flags param to SetTPMBootModeState(). BUG=none TEST=make && make runtests Change-Id: I4035bdb377aaebaca03a43799be57977166da739 Reviewed-on: http://gerrit.chromium.org/gerrit/4599 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
@@ -91,6 +91,9 @@ typedef enum VbNvParam {
|
|||||||
/* Firmware boot failure outside of verified boot (RAM init, missing SSD,
|
/* Firmware boot failure outside of verified boot (RAM init, missing SSD,
|
||||||
* etc.). */
|
* etc.). */
|
||||||
#define VBNV_RECOVERY_RO_FIRMWARE 0x20
|
#define VBNV_RECOVERY_RO_FIRMWARE 0x20
|
||||||
|
/* Recovery mode TPM initialization requires a system reboot. The system was
|
||||||
|
* already in recovery mode for some other reason when this happened. */
|
||||||
|
#define VBNV_RECOVERY_RO_TPM_REBOOT 0x21
|
||||||
/* Unspecified/unknown error in read-only firmware */
|
/* Unspecified/unknown error in read-only firmware */
|
||||||
#define VBNV_RECOVERY_RO_UNSPECIFIED 0x3F
|
#define VBNV_RECOVERY_RO_UNSPECIFIED 0x3F
|
||||||
/* User manually requested recovery by pressing a key at developer
|
/* User manually requested recovery by pressing a key at developer
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ typedef struct VbSharedDataHeader {
|
|||||||
* LoadFirmware() or 0xFF if failure */
|
* LoadFirmware() or 0xFF if failure */
|
||||||
uint8_t reserved1; /* Reserved for padding */
|
uint8_t reserved1; /* Reserved for padding */
|
||||||
uint32_t fw_version_tpm_start; /* Firmware TPM version at start of
|
uint32_t fw_version_tpm_start; /* Firmware TPM version at start of
|
||||||
* LoadFirmware() */
|
* VbSelectFirmware() */
|
||||||
uint32_t fw_version_lowest; /* Firmware lowest version found */
|
uint32_t fw_version_lowest; /* Firmware lowest version found */
|
||||||
|
|
||||||
/* Debugging information from LoadKernel() */
|
/* Debugging information from LoadKernel() */
|
||||||
@@ -359,6 +359,10 @@ typedef struct VbSharedDataHeader {
|
|||||||
* struct_version >= 2*/
|
* struct_version >= 2*/
|
||||||
uint8_t recovery_reason; /* Recovery reason for current boot */
|
uint8_t recovery_reason; /* Recovery reason for current boot */
|
||||||
uint8_t reserved2[7]; /* Reserved for padding */
|
uint8_t reserved2[7]; /* Reserved for padding */
|
||||||
|
uint64_t fw_keyblock_flags; /* Flags from firmware keyblock */
|
||||||
|
uint32_t kernel_version_tpm_start; /* Kernel TPM version at start of
|
||||||
|
* VbSelectAndLoadKernel() */
|
||||||
|
uint32_t kernel_version_lowest; /* Kernel lowest version found */
|
||||||
|
|
||||||
/* After read-only firmware which uses version 2 is released, any additional
|
/* After read-only firmware which uses version 2 is released, any additional
|
||||||
* fields must be added below, and the struct version must be increased.
|
* fields must be added below, and the struct version must be increased.
|
||||||
|
|||||||
@@ -20,6 +20,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
uint32_t SetTPMBootModeState(int developer_mode, int recovery_mode,
|
uint32_t SetTPMBootModeState(int developer_mode, int recovery_mode,
|
||||||
int fw_keyblock_flags);
|
uint64_t fw_keyblock_flags);
|
||||||
|
|
||||||
#endif /* VBOOT_REFERENCE_TPM_BOOTMODE_H_ */
|
#endif /* VBOOT_REFERENCE_TPM_BOOTMODE_H_ */
|
||||||
|
|||||||
@@ -11,6 +11,6 @@
|
|||||||
|
|
||||||
|
|
||||||
uint32_t SetTPMBootModeState(int developer_mode, int recovery_mode,
|
uint32_t SetTPMBootModeState(int developer_mode, int recovery_mode,
|
||||||
int fw_keyblock_flags) {
|
uint64_t fw_keyblock_flags) {
|
||||||
return TPM_SUCCESS;
|
return TPM_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ const uint8_t kBootInvalidSHA1Digest[] = {
|
|||||||
|
|
||||||
/* Given the boot state, return the correct SHA1 digest index for TPMExtend
|
/* Given the boot state, return the correct SHA1 digest index for TPMExtend
|
||||||
* in kBootStateSHA1Digests[]. */
|
* in kBootStateSHA1Digests[]. */
|
||||||
int GetBootStateIndex(int dev_mode, int rec_mode, int keyblock_flags) {
|
int GetBootStateIndex(int dev_mode, int rec_mode, uint64_t keyblock_flags) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
/* Convert keyblock flags into keyblock mode which we use to index into
|
/* Convert keyblock flags into keyblock mode which we use to index into
|
||||||
@@ -117,7 +117,7 @@ int GetBootStateIndex(int dev_mode, int rec_mode, int keyblock_flags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t SetTPMBootModeState(int developer_mode, int recovery_mode,
|
uint32_t SetTPMBootModeState(int developer_mode, int recovery_mode,
|
||||||
int fw_keyblock_flags) {
|
uint64_t fw_keyblock_flags) {
|
||||||
uint32_t result;
|
uint32_t result;
|
||||||
const uint8_t* in_digest = NULL;
|
const uint8_t* in_digest = NULL;
|
||||||
uint8_t out_digest[20]; /* For PCR extend output. */
|
uint8_t out_digest[20]; /* For PCR extend output. */
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ int LoadFirmware(LoadFirmwareParams* params) {
|
|||||||
/* At this point, we have a good idea of how we are going to boot. Update the
|
/* At this point, we have a good idea of how we are going to boot. Update the
|
||||||
* TPM with this state information.
|
* TPM with this state information.
|
||||||
*/
|
*/
|
||||||
status = SetTPMBootModeState(is_dev, 0, (int)boot_fw_keyblock_flags);
|
status = SetTPMBootModeState(is_dev, 0, boot_fw_keyblock_flags);
|
||||||
if (0 != status) {
|
if (0 != status) {
|
||||||
VBDEBUG(("Unable to update the TPM with boot mode information.\n"));
|
VBDEBUG(("Unable to update the TPM with boot mode information.\n"));
|
||||||
if (status == TPM_E_MUST_REBOOT)
|
if (status == TPM_E_MUST_REBOOT)
|
||||||
|
|||||||
Reference in New Issue
Block a user