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 * High-level firmware API for loading and verifying rewritable firmware. | 5 * High-level firmware API for loading and verifying rewritable firmware. |
6 * (Firmware portion) | 6 * (Firmware portion) |
7 */ | 7 */ |
8 | 8 |
9 #include "load_firmware_fw.h" | 9 #include "load_firmware_fw.h" |
10 #include "rollback_index.h" | 10 #include "rollback_index.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return LOAD_FIRMWARE_RECOVERY; | 53 return LOAD_FIRMWARE_RECOVERY; |
54 } | 54 } |
55 | 55 |
56 /* Must have a root key */ | 56 /* Must have a root key */ |
57 if (!root_key) { | 57 if (!root_key) { |
58 VBDEBUG(("No root key\n")); | 58 VBDEBUG(("No root key\n")); |
59 return LOAD_FIRMWARE_RECOVERY; | 59 return LOAD_FIRMWARE_RECOVERY; |
60 } | 60 } |
61 | 61 |
62 /* Initialize the TPM and read rollback indices. */ | 62 /* Initialize the TPM and read rollback indices. */ |
63 /* TODO: fix SetupTPM parameter for developer mode */ | 63 if (0 != RollbackFirmwareSetup( |
64 if (0 != RollbackFirmwareSetup(0, &tpm_key_version, &tpm_fw_version)) { | 64 (params->boot_flags & BOOT_FLAG_DEVELOPER ? 1 : 0), |
| 65 &tpm_key_version, &tpm_fw_version)) { |
65 VBDEBUG(("Unable to get stored versions.\n")); | 66 VBDEBUG(("Unable to get stored versions.\n")); |
66 return LOAD_FIRMWARE_RECOVERY; | 67 return LOAD_FIRMWARE_RECOVERY; |
67 } | 68 } |
68 | 69 |
69 /* Allocate our internal data */ | 70 /* Allocate our internal data */ |
70 lfi = (VbLoadFirmwareInternal*)Malloc(sizeof(VbLoadFirmwareInternal)); | 71 lfi = (VbLoadFirmwareInternal*)Malloc(sizeof(VbLoadFirmwareInternal)); |
71 if (!lfi) | 72 if (!lfi) |
72 return LOAD_FIRMWARE_RECOVERY; | 73 return LOAD_FIRMWARE_RECOVERY; |
73 params->load_firmware_internal = (uint8_t*)lfi; | 74 params->load_firmware_internal = (uint8_t*)lfi; |
74 | 75 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 232 |
232 /* Success */ | 233 /* Success */ |
233 VBDEBUG(("Will boot firmware index %d\n", (int)params->firmware_index)); | 234 VBDEBUG(("Will boot firmware index %d\n", (int)params->firmware_index)); |
234 return LOAD_FIRMWARE_SUCCESS; | 235 return LOAD_FIRMWARE_SUCCESS; |
235 } | 236 } |
236 | 237 |
237 /* If we're still here, no good firmware, so go to recovery mode. */ | 238 /* If we're still here, no good firmware, so go to recovery mode. */ |
238 VBDEBUG(("Alas, no good firmware.\n")); | 239 VBDEBUG(("Alas, no good firmware.\n")); |
239 return LOAD_FIRMWARE_RECOVERY; | 240 return LOAD_FIRMWARE_RECOVERY; |
240 } | 241 } |
OLD | NEW |