OLD | NEW |
1 /* Copyright (c) 2010-2011 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 * | 4 * |
5 * Data structure definitions for verified boot, for on-disk / in-eeprom | 5 * Data structure definitions for verified boot, for on-disk / in-eeprom |
6 * data. | 6 * data. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef VBOOT_REFERENCE_VBOOT_STRUCT_H_ | 9 #ifndef VBOOT_REFERENCE_VBOOT_STRUCT_H_ |
10 #define VBOOT_REFERENCE_VBOOT_STRUCT_H_ | 10 #define VBOOT_REFERENCE_VBOOT_STRUCT_H_ |
11 | 11 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 VbSignature body_signature; /* Signature for the kernel body */ | 124 VbSignature body_signature; /* Signature for the kernel body */ |
125 } __attribute__((packed)) VbKernelPreambleHeader; | 125 } __attribute__((packed)) VbKernelPreambleHeader; |
126 /* This should be followed by: | 126 /* This should be followed by: |
127 * 2) The signature data for the kernel body, pointed to by | 127 * 2) The signature data for the kernel body, pointed to by |
128 * body_signature.sig_offset. | 128 * body_signature.sig_offset. |
129 * 3) The signature data for (VBFirmwarePreambleHeader + body signature | 129 * 3) The signature data for (VBFirmwarePreambleHeader + body signature |
130 * data), pointed to by preamble_signature.sig_offset. */ | 130 * data), pointed to by preamble_signature.sig_offset. */ |
131 | 131 |
132 #define EXPECTED_VBKERNELPREAMBLEHEADER_SIZE 96 | 132 #define EXPECTED_VBKERNELPREAMBLEHEADER_SIZE 96 |
133 | 133 |
| 134 /* Minimum and recommended size of shared_data_blob in bytes. */ |
| 135 #define VB_SHARED_DATA_MIN_SIZE 3072 |
| 136 #define VB_SHARED_DATA_REC_SIZE 16384 |
| 137 |
| 138 /* Data shared between LoadFirmware(), LoadKernel(), and OS. |
| 139 * |
| 140 * The boot process is: |
| 141 * 1) Caller allocates buffer, at least VB_SHARED_DATA_MIN bytes, ideally |
| 142 * VB_SHARED_DATA_REC_SIZE bytes. |
| 143 * 2) If non-recovery boot, this is passed to LoadFirmware(), which |
| 144 * initializes the buffer, adding this header and some data. |
| 145 * 3) Buffer is passed to LoadKernel(). If this is a recovery boot, |
| 146 * LoadKernel() initializes the buffer, adding this header. Regardless |
| 147 * of boot type, LoadKernel() adds some data to the buffer. |
| 148 * 4) Caller makes data available to the OS in a platform-dependent manner. |
| 149 * For example, via ACPI or ATAGs. */ |
| 150 typedef struct VbSharedDataHeader { |
| 151 /* Fields present in version 1 */ |
| 152 uint32_t struct_version; /* Version of this structure */ |
| 153 uint64_t struct_size; /* Size of this structure in bytes */ |
| 154 uint64_t data_size; /* Size of shared data buffer in bytes */ |
| 155 uint64_t data_used; /* Amount of shared data used so far */ |
| 156 |
| 157 VbPublicKey kernel_subkey; /* Kernel subkey, from firmware */ |
| 158 uint64_t kernel_subkey_data_offset; /* Offset of kernel subkey data from |
| 159 * start of this struct */ |
| 160 uint64_t kernel_subkey_data_size; /* Offset of kernel subkey data */ |
| 161 |
| 162 uint64_t flags; /* Flags */ |
| 163 |
| 164 /* After read-only firmware which uses version 1 is released, any additional |
| 165 * fields must be added below, and the struct version must be increased. |
| 166 * Before reading/writing those fields, make sure that the struct being |
| 167 * accessed is at least version 2. |
| 168 * |
| 169 * It's always ok for an older firmware to access a newer struct, since all |
| 170 * the fields it knows about are present. Newer firmware needs to use |
| 171 * reasonable defaults when accessing older structs. */ |
| 172 |
| 173 } __attribute__((packed)) VbSharedDataHeader; |
| 174 |
| 175 #define VB_SHARED_DATA_VERSION 1 /* Version for struct_version */ |
| 176 |
134 __pragma(pack(pop)) /* Support packing for MSVC. */ | 177 __pragma(pack(pop)) /* Support packing for MSVC. */ |
135 | 178 |
136 #endif /* VBOOT_REFERENCE_VBOOT_STRUCT_H_ */ | 179 #endif /* VBOOT_REFERENCE_VBOOT_STRUCT_H_ */ |
OLD | NEW |