| 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 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef VBOOT_REFERENCE_KERNEL_IMAGE_H_ | 8 #ifndef VBOOT_REFERENCE_KERNEL_IMAGE_H_ |
| 9 #define VBOOT_REFERENCE_KERNEL_IMAGE_H_ | 9 #define VBOOT_REFERENCE_KERNEL_IMAGE_H_ |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 uint8_t* kernel_key_signature; /* Signature of the header above. */ | 56 uint8_t* kernel_key_signature; /* Signature of the header above. */ |
| 57 | 57 |
| 58 uint16_t kernel_version; /* Kernel Version# for preventing rollbacks. */ | 58 uint16_t kernel_version; /* Kernel Version# for preventing rollbacks. */ |
| 59 kconfig_options options; /* Other kernel/bootloader options. */ | 59 kconfig_options options; /* Other kernel/bootloader options. */ |
| 60 | 60 |
| 61 uint8_t* config_signature; /* Signature of the kernel config file. */ | 61 uint8_t* config_signature; /* Signature of the kernel config file. */ |
| 62 | 62 |
| 63 /* The kernel signature comes first as it may allow us to parallelize | 63 /* The kernel signature comes first as it may allow us to parallelize |
| 64 * the kernel data fetch and RSA public key operation. | 64 * the kernel data fetch and RSA public key operation. |
| 65 */ | 65 */ |
| 66 uint8_t* kernel_signature; /* Signature on [kernel_data]. */ | 66 uint8_t* kernel_signature; /* Signature on the concatenation of |
| 67 * [kernel_version], [options] and |
| 68 * [kernel_data]. */ |
| 67 uint8_t* kernel_data; /* Actual kernel data. */ | 69 uint8_t* kernel_data; /* Actual kernel data. */ |
| 68 | 70 |
| 69 } KernelImage; | 71 } KernelImage; |
| 70 | 72 |
| 71 /* Allocate and return a new KernelImage structure. */ | 73 /* Allocate and return a new KernelImage structure. */ |
| 72 KernelImage* KernelImageNew(void); | 74 KernelImage* KernelImageNew(void); |
| 73 | 75 |
| 74 /* Deep free the contents of [image]. */ | 76 /* Deep free the contents of [image]. */ |
| 75 void KernelImageFree(KernelImage* image); | 77 void KernelImageFree(KernelImage* image); |
| 76 | 78 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 int* kernel_len); | 166 int* kernel_len); |
| 165 | 167 |
| 166 /* Checks the signature on the kernel data at location [kernel_data_start]. | 168 /* Checks the signature on the kernel data at location [kernel_data_start]. |
| 167 * The length of the actual kernel data is kernel _len and it is assumed to | 169 * The length of the actual kernel data is kernel _len and it is assumed to |
| 168 * be prepended with the signature whose size depends on the signature_algorithm | 170 * be prepended with the signature whose size depends on the signature_algorithm |
| 169 * [algorithm]. | 171 * [algorithm]. |
| 170 * | 172 * |
| 171 * Return 0 on success, error code on failure. | 173 * Return 0 on success, error code on failure. |
| 172 */ | 174 */ |
| 173 int VerifyKernelData(RSAPublicKey* kernel_sign_key, | 175 int VerifyKernelData(RSAPublicKey* kernel_sign_key, |
| 176 const uint8_t* kernel_config_start, |
| 174 const uint8_t* kernel_data_start, | 177 const uint8_t* kernel_data_start, |
| 175 int kernel_len, | 178 int kernel_len, |
| 176 int algorithm); | 179 int algorithm); |
| 177 | 180 |
| 178 /* Performs a chained verify of the kernel blob [kernel_blob]. If | 181 /* Performs a chained verify of the kernel blob [kernel_blob]. If |
| 179 * [dev_mode] is 0 [inactive], then the pre-processed public signing key | 182 * [dev_mode] is 0 [inactive], then the pre-processed public signing key |
| 180 * [root_key_blob] is used to verify the signature of the signing key, | 183 * [root_key_blob] is used to verify the signature of the signing key, |
| 181 * else the check is skipped. | 184 * else the check is skipped. |
| 182 * | 185 * |
| 183 * TODO(gauravsh): Does the dev mode only effect the R/W firmware verification, | 186 * TODO(gauravsh): Does the dev mode only effect the R/W firmware verification, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 * BOOT_KERNEL_A_CONTINUE Boot from Kenrel A | 261 * BOOT_KERNEL_A_CONTINUE Boot from Kenrel A |
| 259 * BOOT_KERNEL_B_CONTINUE Boot from Kernel B | 262 * BOOT_KERNEL_B_CONTINUE Boot from Kernel B |
| 260 * BOOT_KERNEL_RECOVERY_CONTINUE Jump to recovery mode | 263 * BOOT_KERNEL_RECOVERY_CONTINUE Jump to recovery mode |
| 261 */ | 264 */ |
| 262 int VerifyKernelDriver_f(uint8_t* firmware_key_blob, | 265 int VerifyKernelDriver_f(uint8_t* firmware_key_blob, |
| 263 kernel_entry* kernelA, | 266 kernel_entry* kernelA, |
| 264 kernel_entry* kernelB, | 267 kernel_entry* kernelB, |
| 265 int dev_mode); | 268 int dev_mode); |
| 266 | 269 |
| 267 #endif /* VBOOT_REFERENCE_KERNEL_IMAGE_H_ */ | 270 #endif /* VBOOT_REFERENCE_KERNEL_IMAGE_H_ */ |
| OLD | NEW |