| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 /* Deep free the contents of [image]. */ | 68 /* Deep free the contents of [image]. */ |
| 69 void KernelImageFree(KernelImage* image); | 69 void KernelImageFree(KernelImage* image); |
| 70 | 70 |
| 71 /* Read kernel data from file named [input_file]. | 71 /* Read kernel data from file named [input_file]. |
| 72 * | 72 * |
| 73 * Returns a filled up KernelImage on success, NULL on error. | 73 * Returns a filled up KernelImage on success, NULL on error. |
| 74 */ | 74 */ |
| 75 KernelImage* ReadKernelImage(const char* input_file); | 75 KernelImage* ReadKernelImage(const char* input_file); |
| 76 | 76 |
| 77 /* Get the length of the header for kernel image [image]. */ |
| 78 int GetKernelHeaderLen(const KernelImage* image); |
| 79 |
| 77 /* Get kernel header binary blob from an [image]. | 80 /* Get kernel header binary blob from an [image]. |
| 78 * | 81 * |
| 79 * Caller owns the returned pointer and must Free() it. | 82 * Caller owns the returned pointer and must Free() it. |
| 80 */ | 83 */ |
| 81 uint8_t* GetKernelHeaderBlob(const KernelImage* image); | 84 uint8_t* GetKernelHeaderBlob(const KernelImage* image); |
| 82 | 85 |
| 83 /* Get kernel config binary blob from an [image]. | 86 /* Get kernel config binary blob from an [image]. |
| 84 * | 87 * |
| 85 * Caller owns the returned pointer and must Free() it. | 88 * Caller owns the returned pointer and must Free() it. |
| 86 */ | 89 */ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 108 /* Error Codes for VerifyFirmware. */ | 111 /* Error Codes for VerifyFirmware. */ |
| 109 #define VERIFY_KERNEL_SUCCESS 0 | 112 #define VERIFY_KERNEL_SUCCESS 0 |
| 110 #define VERIFY_KERNEL_INVALID_IMAGE 1 | 113 #define VERIFY_KERNEL_INVALID_IMAGE 1 |
| 111 #define VERIFY_KERNEL_KEY_SIGNATURE_FAILED 2 | 114 #define VERIFY_KERNEL_KEY_SIGNATURE_FAILED 2 |
| 112 #define VERIFY_KERNEL_INVALID_ALGORITHM 3 | 115 #define VERIFY_KERNEL_INVALID_ALGORITHM 3 |
| 113 #define VERIFY_KERNEL_CONFIG_SIGNATURE_FAILED 4 | 116 #define VERIFY_KERNEL_CONFIG_SIGNATURE_FAILED 4 |
| 114 #define VERIFY_KERNEL_SIGNATURE_FAILED 5 | 117 #define VERIFY_KERNEL_SIGNATURE_FAILED 5 |
| 115 #define VERIFY_KERNEL_WRONG_MAGIC 6 | 118 #define VERIFY_KERNEL_WRONG_MAGIC 6 |
| 116 #define VERIFY_KERNEL_MAX 7 /* Generic catch-all. */ | 119 #define VERIFY_KERNEL_MAX 7 /* Generic catch-all. */ |
| 117 | 120 |
| 118 char* kVerifyKernelErrors[VERIFY_KERNEL_MAX]; | 121 extern char* kVerifyKernelErrors[VERIFY_KERNEL_MAX]; |
| 119 | 122 |
| 120 /* Checks for the sanity of the kernel header pointed by [kernel_header_blob]. | 123 /* Checks for the sanity of the kernel header pointed by [kernel_header_blob]. |
| 121 * If [dev_mode] is enabled, also checks the firmware key signature using the | 124 * If [dev_mode] is enabled, also checks the firmware key signature using the |
| 122 * pre-processed public firmware signing key [firmware_sign_key_blob]. | 125 * pre-processed public firmware signing key [firmware_sign_key_blob]. |
| 123 * | 126 * |
| 124 * On success, put firmware signature algorithm in [firmware_algorithm], | 127 * On success, put firmware signature algorithm in [firmware_algorithm], |
| 125 * kernel signature algorithm in [kernel_algorithm], kernel header | 128 * kernel signature algorithm in [kernel_algorithm], kernel header |
| 126 * length in [header_len], and return 0. | 129 * length in [header_len], and return 0. |
| 127 * Else, return error code on failure. | 130 * Else, return error code on failure. |
| 128 */ | 131 */ |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 203 |
| 201 /* Add a kernel and kernel config signature to a kernel image [image] | 204 /* Add a kernel and kernel config signature to a kernel image [image] |
| 202 * using the private signing key in file [kernel_sigining_key_file]. | 205 * using the private signing key in file [kernel_sigining_key_file]. |
| 203 * | 206 * |
| 204 * Return 1 on success, 0 on failure. | 207 * Return 1 on success, 0 on failure. |
| 205 */ | 208 */ |
| 206 int AddKernelSignature(KernelImage* image, | 209 int AddKernelSignature(KernelImage* image, |
| 207 const char* kernel_sigining_key_file); | 210 const char* kernel_sigining_key_file); |
| 208 | 211 |
| 209 #endif /* VBOOT_REFERENCE_KERNEL_IMAGE_H_ */ | 212 #endif /* VBOOT_REFERENCE_KERNEL_IMAGE_H_ */ |
| OLD | NEW |