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 * Functions for verifying a verified boot kernel image. | 5 * Functions for verifying a verified boot kernel image. |
6 * (Firmware portion) | 6 * (Firmware portion) |
7 */ | 7 */ |
8 | 8 |
9 #include "kernel_image_fw.h" | 9 #include "kernel_image_fw.h" |
10 | 10 |
11 #include "cryptolib.h" | 11 #include "padding.h" |
12 #include "rollback_index.h" | 12 #include "rollback_index.h" |
| 13 #include "rsa_utility.h" |
| 14 #include "sha_utility.h" |
13 #include "utility.h" | 15 #include "utility.h" |
14 | 16 |
15 /* Macro to determine the size of a field structure in the KernelImage | 17 /* Macro to determine the size of a field structure in the KernelImage |
16 * structure. */ | 18 * structure. */ |
17 #define FIELD_LEN(field) (sizeof(((KernelImage*)0)->field)) | 19 #define FIELD_LEN(field) (sizeof(((KernelImage*)0)->field)) |
18 #define KERNEL_CONFIG_FIELD_LEN (FIELD_LEN(kernel_version) + FIELD_LEN(options.v
ersion) + \ | 20 #define KERNEL_CONFIG_FIELD_LEN (FIELD_LEN(kernel_version) + FIELD_LEN(options.v
ersion) + \ |
19 FIELD_LEN(options.cmd_line) + \ | 21 FIELD_LEN(options.cmd_line) + \ |
20 FIELD_LEN(options.kernel_len) + \ | 22 FIELD_LEN(options.kernel_len) + \ |
21 FIELD_LEN(options.kernel_load_addr) + \ | 23 FIELD_LEN(options.kernel_load_addr) + \ |
22 FIELD_LEN(options.kernel_entry_addr)) | 24 FIELD_LEN(options.kernel_entry_addr)) |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 /* Lock Kernel TPM rollback indices from further writes. | 359 /* Lock Kernel TPM rollback indices from further writes. |
358 * TODO(gauravsh): Figure out if these can be combined into one | 360 * TODO(gauravsh): Figure out if these can be combined into one |
359 * 32-bit location since we seem to always use them together. This can help | 361 * 32-bit location since we seem to always use them together. This can help |
360 * us minimize the number of NVRAM writes/locks (which are limited over flash | 362 * us minimize the number of NVRAM writes/locks (which are limited over flash |
361 * memory lifetimes. | 363 * memory lifetimes. |
362 */ | 364 */ |
363 LockStoredVersion(KERNEL_KEY_VERSION); | 365 LockStoredVersion(KERNEL_KEY_VERSION); |
364 LockStoredVersion(KERNEL_VERSION); | 366 LockStoredVersion(KERNEL_VERSION); |
365 return kernel_to_boot; | 367 return kernel_to_boot; |
366 } | 368 } |
OLD | NEW |