mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-25 01:07:22 +00:00
Add VbSharedData field parsing
R=reinauer@chromium.org BUG=chrome-os-partner:2578 TEST=manual crossystem vdat_timers should show 'LFS=0,0 LF=number1,number2 LK=number3,number4' where number1 < number2 < number3 < number4 crossystem vdat_lfdebug run from a dev mode console, should show 'check=12,0 index=0x00 tpmver=(hex number) lowestver=(hex number)' crossystem vdat_flags run from a dev mode console, flags should be 0x04. Review URL: http://codereview.chromium.org/6685068 Change-Id: Id7b958ae300d10cdcdc1b17a1bb17b7e5069166f
This commit is contained in:
@@ -11,9 +11,7 @@
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include "vboot_nvstorage.h"
|
||||
|
||||
/* Recommended size of shared_data_blob in bytes. */
|
||||
#define LOAD_FIRMWARE_SHARED_DATA_REC_SIZE 16384
|
||||
#include "vboot_struct.h"
|
||||
|
||||
/* Return codes for LoadFirmware() and S3Resume(). */
|
||||
#define LOAD_FIRMWARE_SUCCESS 0 /* Success */
|
||||
@@ -33,15 +31,19 @@ typedef struct LoadFirmwareParams {
|
||||
void* verification_block_1; /* Key block + preamble for firmware 1 */
|
||||
uint64_t verification_size_0; /* Verification block 0 size in bytes */
|
||||
uint64_t verification_size_1; /* Verification block 1 size in bytes */
|
||||
void* shared_data_blob; /* Destination buffer for data shared between
|
||||
* LoadFirmware() and LoadKernel(). Pass this
|
||||
|
||||
/* Shared data blob for data shared between LoadFirmware() and LoadKernel().
|
||||
* This should be at least VB_SHARED_DATA_MIN_SIZE bytes long, and ideally
|
||||
* is VB_SHARED_DATA_REC_SIZE bytes long. */
|
||||
void* shared_data_blob; /* Shared data blob buffer. Pass this
|
||||
* data to LoadKernel() in
|
||||
* LoadKernelParams.shared_data_blob. */
|
||||
uint64_t shared_data_size; /* Size of shared data blob buffer, in bytes.
|
||||
* On output, this will contain the actual
|
||||
* data size placed into the buffer. Caller
|
||||
* need only pass this much data to
|
||||
* LoadKernel().*/
|
||||
uint64_t shared_data_size; /* On input, set to size of shared data blob
|
||||
* buffer, in bytes. On output, this will
|
||||
* contain the actual data size placed into
|
||||
* the buffer. Caller need only pass that
|
||||
* much data to LoadKernel().*/
|
||||
|
||||
uint64_t boot_flags; /* Boot flags */
|
||||
VbNvContext* nv_context; /* Context for NV storage. nv_context->raw
|
||||
* must be filled before calling
|
||||
|
||||
@@ -131,10 +131,38 @@ typedef struct VbKernelPreambleHeader {
|
||||
|
||||
#define EXPECTED_VBKERNELPREAMBLEHEADER_SIZE 96
|
||||
|
||||
/* Magic number for recognizing VbSharedDataHeader ("VbSD") */
|
||||
#define VB_SHARED_DATA_MAGIC 0x44536256
|
||||
|
||||
/* Minimum and recommended size of shared_data_blob in bytes. */
|
||||
#define VB_SHARED_DATA_MIN_SIZE 3072
|
||||
#define VB_SHARED_DATA_REC_SIZE 16384
|
||||
|
||||
/* Flags for VbSharedDataHeader */
|
||||
/* LoadFirmware() tried firmware B because of VbNvStorage firmware B tries */
|
||||
#define VBSD_FWB_TRIED 0x00000001
|
||||
/* LoadKernel() verified the kernel keyblock using the kernel subkey from
|
||||
* the firmware. If this flag is not present, it just used the hash of the
|
||||
* kernel keyblock. */
|
||||
#define VBSD_KERNEL_KEY_VERIFIED 0x00000002
|
||||
/* LoadFirmware() was told the developer switch was on */
|
||||
#define VBSD_LF_DEV_SWITCH_ON 0x00000004
|
||||
|
||||
/* Result codes for checking firmware A and B */
|
||||
#define VBSD_LF_CHECK_NOT_DONE 0
|
||||
#define VBSD_LF_CHECK_DEV_MISMATCH 1
|
||||
#define VBSD_LF_CHECK_REC_MISMATCH 2
|
||||
#define VBSD_LF_CHECK_VERIFY_KEYBLOCK 3
|
||||
#define VBSD_LF_CHECK_KEY_ROLLBACK 4
|
||||
#define VBSD_LF_CHECK_DATA_KEY_PARSE 5
|
||||
#define VBSD_LF_CHECK_VERIFY_PREAMBLE 6
|
||||
#define VBSD_LF_CHECK_FW_ROLLBACK 7
|
||||
#define VBSD_LF_CHECK_HEADER_VALID 8
|
||||
#define VBSD_LF_CHECK_GET_FW_BODY 9
|
||||
#define VBSD_LF_CHECK_HASH_WRONG_SIZE 10
|
||||
#define VBSD_LF_CHECK_VERIFY_BODY 11
|
||||
#define VBSD_LF_CHECK_VALID 12
|
||||
|
||||
/* Data shared between LoadFirmware(), LoadKernel(), and OS.
|
||||
*
|
||||
* The boot process is:
|
||||
@@ -149,18 +177,19 @@ typedef struct VbKernelPreambleHeader {
|
||||
* For example, via ACPI or ATAGs. */
|
||||
typedef struct VbSharedDataHeader {
|
||||
/* Fields present in version 1 */
|
||||
uint32_t magic; /* Magic number for struct
|
||||
* (VB_SHARED_DATA_MAGIC) */
|
||||
uint32_t struct_version; /* Version of this structure */
|
||||
uint64_t struct_size; /* Size of this structure in bytes */
|
||||
uint64_t data_size; /* Size of shared data buffer in bytes */
|
||||
uint64_t data_used; /* Amount of shared data used so far */
|
||||
uint32_t flags; /* Flags */
|
||||
|
||||
VbPublicKey kernel_subkey; /* Kernel subkey, from firmware */
|
||||
uint64_t kernel_subkey_data_offset; /* Offset of kernel subkey data from
|
||||
* start of this struct */
|
||||
uint64_t kernel_subkey_data_size; /* Size of kernel subkey data */
|
||||
|
||||
uint64_t flags; /* Flags */
|
||||
|
||||
/* Timer values from VbGetTimer(). Unused values are set to 0. If a
|
||||
* function is called mutiple times, these are the times from the
|
||||
* most recent call. */
|
||||
@@ -171,6 +200,13 @@ typedef struct VbSharedDataHeader {
|
||||
uint64_t timer_load_kernel_enter; /* LoadKernel() - enter */
|
||||
uint64_t timer_load_kernel_exit; /* LoadKernel() - exit */
|
||||
|
||||
uint8_t check_fw_a_result; /* Result of checking RW firmware A */
|
||||
uint8_t check_fw_b_result; /* Result of checking RW firmware B */
|
||||
uint8_t firmware_index; /* Firmware index returned by
|
||||
* LoadFirmware() or 0xFF if failure */
|
||||
uint32_t fw_version_tpm_start; /* Firmware TPM version at start */
|
||||
uint32_t fw_version_lowest; /* Firmware lowest version found */
|
||||
|
||||
/* After read-only firmware which uses version 1 is released, any additional
|
||||
* fields must be added below, and the struct version must be increased.
|
||||
* Before reading/writing those fields, make sure that the struct being
|
||||
|
||||
Reference in New Issue
Block a user