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 * Data structure and API definitions for a verified boot kernel image. | 5 * Data structure and API definitions for a verified boot kernel image. |
6 * (Firmware Portion) | 6 * (Firmware Portion) |
7 */ | 7 */ |
8 | 8 |
9 #ifndef VBOOT_REFERENCE_KERNEL_IMAGE_FW_H_ | 9 #ifndef VBOOT_REFERENCE_KERNEL_IMAGE_FW_H_ |
10 #define VBOOT_REFERENCE_KERNEL_IMAGE_FW_H_ | 10 #define VBOOT_REFERENCE_KERNEL_IMAGE_FW_H_ |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 * | 130 * |
131 * The signing key to use for kernel data verification is returned in | 131 * The signing key to use for kernel data verification is returned in |
132 * [kernel_sign_key], This must be free-d explicitly by the caller after use. | 132 * [kernel_sign_key], This must be free-d explicitly by the caller after use. |
133 * The kernel signing algorithm is returned in [kernel_sign_algorithm] and its | 133 * The kernel signing algorithm is returned in [kernel_sign_algorithm] and its |
134 * length in [kernel_len]. | 134 * length in [kernel_len]. |
135 * | 135 * |
136 * Returns 0 on success, error code on failure. | 136 * Returns 0 on success, error code on failure. |
137 */ | 137 */ |
138 int VerifyKernelHeader(const uint8_t* firmware_key_blob, | 138 int VerifyKernelHeader(const uint8_t* firmware_key_blob, |
139 const uint8_t* kernel_header_blob, | 139 const uint8_t* kernel_header_blob, |
| 140 uint64_t kernel_header_blob_len, |
140 const int dev_mode, | 141 const int dev_mode, |
141 const uint8_t** expected_kernel_signature, | 142 KernelImage *image, |
142 RSAPublicKey** kernel_sign_key, | 143 RSAPublicKey** kernel_sign_key); |
143 int* kernel_sign_algorithm, | |
144 uint64_t* kernel_len); | |
145 | 144 |
146 /* Performs a chained verify of the kernel blob [kernel_blob]. If | 145 /* Performs a chained verify of the kernel blob [kernel_blob]. If |
147 * [dev_mode] is 0 [inactive], then the pre-processed public signing key | 146 * [dev_mode] is 0 [inactive], then the pre-processed public signing key |
148 * [root_key_blob] is used to verify the signature of the signing key, | 147 * [root_key_blob] is used to verify the signature of the signing key, |
149 * else the check is skipped. | 148 * else the check is skipped. |
150 * | 149 * |
| 150 * On success, fills in image with the kernel header and preamble fields. |
| 151 * Note that pointers in the image directly point into the input |
| 152 * kernel_header_blob. image->kernel_data is set to NULL, since it's not |
| 153 * part of the header and preamble data itself. |
151 * | 154 * |
152 * Returns 0 on success, error code on failure. | 155 * Returns 0 on success, error code on failure. |
153 * | 156 * |
154 * NOTE: The length of the kernel blob is derived from reading the fields | 157 * NOTE: The length of the kernel blob is derived from reading the fields |
155 * in the first few bytes of the buffer. This might look risky but in firmware | 158 * in the first few bytes of the buffer. This might look risky but in firmware |
156 * land, the start address of the kernel_blob will always be fixed depending | 159 * land, the start address of the kernel_blob will always be fixed depending |
157 * on the memory map on the particular platform. In addition, the signature on | 160 * on the memory map on the particular platform. In addition, the signature on |
158 * length itself is checked early in the verification process for extra safety. | 161 * length itself is checked early in the verification process for extra safety. |
159 */ | 162 */ |
160 int VerifyKernel(const uint8_t* signing_key_blob, | 163 int VerifyKernel(const uint8_t* signing_key_blob, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 * BOOT_KERNEL_A_CONTINUE Boot from Kenrel A | 196 * BOOT_KERNEL_A_CONTINUE Boot from Kenrel A |
194 * BOOT_KERNEL_B_CONTINUE Boot from Kernel B | 197 * BOOT_KERNEL_B_CONTINUE Boot from Kernel B |
195 * BOOT_KERNEL_RECOVERY_CONTINUE Jump to recovery mode | 198 * BOOT_KERNEL_RECOVERY_CONTINUE Jump to recovery mode |
196 */ | 199 */ |
197 int VerifyKernelDriver_f(uint8_t* firmware_key_blob, | 200 int VerifyKernelDriver_f(uint8_t* firmware_key_blob, |
198 kernel_entry* kernelA, | 201 kernel_entry* kernelA, |
199 kernel_entry* kernelB, | 202 kernel_entry* kernelB, |
200 int dev_mode); | 203 int dev_mode); |
201 | 204 |
202 #endif /* VBOOT_REFERENCE_KERNEL_IMAGE_FW_H_ */ | 205 #endif /* VBOOT_REFERENCE_KERNEL_IMAGE_FW_H_ */ |
OLD | NEW |