OLD | NEW |
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 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 * High-level firmware API for loading and verifying rewritable firmware. | 5 * High-level firmware API for loading and verifying rewritable firmware. |
6 * (Firmware Portion) | 6 * (Firmware Portion) |
7 */ | 7 */ |
8 | 8 |
9 #ifndef VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ | 9 #ifndef VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ |
10 #define VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ | 10 #define VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ |
11 | 11 |
12 #include "sysincludes.h" | 12 #include "sysincludes.h" |
13 | 13 |
14 /* Recommended size of kernel_sign_key_blob in bytes, for | 14 /* Recommended size of kernel_sign_key_blob in bytes, for |
15 * implementations which must preallocate a transfer buffer between | 15 * implementations which must preallocate a transfer buffer between |
16 * boot phases */ | 16 * boot phases */ |
17 #define LOAD_FIRMWARE_KEY_BLOB_REC_SIZE 2104 | 17 #define LOAD_FIRMWARE_KEY_BLOB_REC_SIZE 2104 |
18 | 18 |
19 /* Return codes for LoadFirmware() */ | 19 /* Return codes for LoadFirmware() */ |
20 #define LOAD_FIRMWARE_SUCCESS 0 /* Success */ | 20 #define LOAD_FIRMWARE_SUCCESS 0 /* Success */ |
21 #define LOAD_FIRMWARE_RECOVERY 1 /* Reboot to recovery mode */ | 21 #define LOAD_FIRMWARE_RECOVERY 1 /* Reboot to recovery mode */ |
22 | 22 |
| 23 /* Boot flags for LoadFirmware().boot_flags */ |
| 24 #define BOOT_FLAG_DEVELOPER UINT64_C(0x01) /* Developer switch is on */ |
| 25 |
23 typedef struct LoadFirmwareParams { | 26 typedef struct LoadFirmwareParams { |
24 /* Inputs to LoadFirmware() */ | 27 /* Inputs to LoadFirmware() */ |
25 void *firmware_root_key_blob; /* Key used to sign firmware header */ | 28 void *firmware_root_key_blob; /* Key used to sign firmware header */ |
26 void *verification_block_0; /* Key block + preamble for firmware 0 */ | 29 void *verification_block_0; /* Key block + preamble for firmware 0 */ |
27 void *verification_block_1; /* Key block + preamble for firmware 1 */ | 30 void *verification_block_1; /* Key block + preamble for firmware 1 */ |
28 uint64_t verification_size_0; /* Verification block 0 size in bytes */ | 31 uint64_t verification_size_0; /* Verification block 0 size in bytes */ |
29 uint64_t verification_size_1; /* Verification block 1 size in bytes */ | 32 uint64_t verification_size_1; /* Verification block 1 size in bytes */ |
30 void *kernel_sign_key_blob; /* Destination buffer for key to use | 33 void *kernel_sign_key_blob; /* Destination buffer for key to use |
31 * when loading kernel. Pass this | 34 * when loading kernel. Pass this |
32 * data to LoadKernel() in | 35 * data to LoadKernel() in |
33 * LoadKernelParams.header_sign_key_blob. */ | 36 * LoadKernelParams.header_sign_key_blob. */ |
34 uint64_t kernel_sign_key_size; /* Size of kernel signing key blob | 37 uint64_t kernel_sign_key_size; /* Size of kernel signing key blob |
35 * buffer, in bytes. On output, this | 38 * buffer, in bytes. On output, this |
36 * will contain the actual key blob | 39 * will contain the actual key blob |
37 * size placed into the buffer. */ | 40 * size placed into the buffer. */ |
| 41 uint64_t boot_flags; /* Boot flags */ |
38 | 42 |
39 /* Outputs from LoadFirmware(); valid only if LoadFirmware() returns | 43 /* Outputs from LoadFirmware(); valid only if LoadFirmware() returns |
40 * LOAD_FIRMWARE_SUCCESS. */ | 44 * LOAD_FIRMWARE_SUCCESS. */ |
41 uint64_t firmware_index; /* Firmware index to run. */ | 45 uint64_t firmware_index; /* Firmware index to run. */ |
42 | 46 |
43 /* Internal data for LoadFirmware() / UpdateFirmwareBodyHash(). */ | 47 /* Internal data for LoadFirmware() / UpdateFirmwareBodyHash(). */ |
44 void* load_firmware_internal; | 48 void* load_firmware_internal; |
45 | 49 |
46 /* Internal data for caller / GetFirmwareBody(). */ | 50 /* Internal data for caller / GetFirmwareBody(). */ |
47 void* caller_internal; | 51 void* caller_internal; |
(...skipping 29 matching lines...) Expand all Loading... |
77 /* Update the data hash for the current firmware image, extending it | 81 /* Update the data hash for the current firmware image, extending it |
78 * by [size] bytes stored in [*data]. This function must only be | 82 * by [size] bytes stored in [*data]. This function must only be |
79 * called inside GetFirmwareBody(). */ | 83 * called inside GetFirmwareBody(). */ |
80 void UpdateFirmwareBodyHash(LoadFirmwareParams* params, | 84 void UpdateFirmwareBodyHash(LoadFirmwareParams* params, |
81 uint8_t* data, uint64_t size); | 85 uint8_t* data, uint64_t size); |
82 | 86 |
83 | 87 |
84 | 88 |
85 | 89 |
86 #endif /* VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ */ | 90 #endif /* VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ */ |
OLD | NEW |