| 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 firmware image. | 5 * Functions for verifying a verified boot firmware image. |
| 6 * (Firmware Portion) | 6 * (Firmware Portion) |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "firmware_image_fw.h" | 9 #include "firmware_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 FirmwareImage | 17 /* Macro to determine the size of a field structure in the FirmwareImage |
| 16 * structure. */ | 18 * structure. */ |
| 17 #define FIELD_LEN(field) (sizeof(((FirmwareImage*)0)->field)) | 19 #define FIELD_LEN(field) (sizeof(((FirmwareImage*)0)->field)) |
| 18 | 20 |
| 19 char* kVerifyFirmwareErrors[VERIFY_FIRMWARE_MAX] = { | 21 char* kVerifyFirmwareErrors[VERIFY_FIRMWARE_MAX] = { |
| 20 "Success.", | 22 "Success.", |
| 21 "Invalid Image.", | 23 "Invalid Image.", |
| 22 "Root Key Signature Failed.", | 24 "Root Key Signature Failed.", |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 * attempted. | 314 * attempted. |
| 313 * If FirmwareB is not a rollback, then we attempt to do the verification. | 315 * If FirmwareB is not a rollback, then we attempt to do the verification. |
| 314 */ | 316 */ |
| 315 if (stored_lversion <= firmwareB_lversion && | 317 if (stored_lversion <= firmwareB_lversion && |
| 316 (VERIFY_FIRMWARE_SUCCESS == VerifyFirmware(root_key_blob, firmwareB))) | 318 (VERIFY_FIRMWARE_SUCCESS == VerifyFirmware(root_key_blob, firmwareB))) |
| 317 return BOOT_FIRMWARE_B_CONTINUE; | 319 return BOOT_FIRMWARE_B_CONTINUE; |
| 318 } | 320 } |
| 319 /* D'oh: No bootable firmware. */ | 321 /* D'oh: No bootable firmware. */ |
| 320 return BOOT_FIRMWARE_RECOVERY_CONTINUE; | 322 return BOOT_FIRMWARE_RECOVERY_CONTINUE; |
| 321 } | 323 } |
| OLD | NEW |