| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 "gbb_header.h" | 9 #include "gbb_header.h" |
| 10 #include "load_firmware_fw.h" | 10 #include "load_firmware_fw.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 VbPublicKey* root_key; | 47 VbPublicKey* root_key; |
| 48 VbLoadFirmwareInternal* lfi; | 48 VbLoadFirmwareInternal* lfi; |
| 49 VbNvContext* vnc = params->nv_context; | 49 VbNvContext* vnc = params->nv_context; |
| 50 | 50 |
| 51 uint32_t try_b_count; | 51 uint32_t try_b_count; |
| 52 uint32_t tpm_version = 0; | 52 uint32_t tpm_version = 0; |
| 53 uint64_t lowest_version = 0xFFFFFFFF; | 53 uint64_t lowest_version = 0xFFFFFFFF; |
| 54 uint32_t status; | 54 uint32_t status; |
| 55 uint32_t test_err = 0; | 55 uint32_t test_err = 0; |
| 56 int good_index = -1; | 56 int good_index = -1; |
| 57 int boot_fw_keyblock_flags = 0; | 57 uint64_t boot_fw_keyblock_flags = 0; |
| 58 int is_dev; | 58 int is_dev; |
| 59 int index; | 59 int index; |
| 60 int i; | 60 int i; |
| 61 | 61 |
| 62 int retval = LOAD_FIRMWARE_RECOVERY; | 62 int retval = LOAD_FIRMWARE_RECOVERY; |
| 63 int recovery = VBNV_RECOVERY_RO_UNSPECIFIED; | 63 int recovery = VBNV_RECOVERY_RO_UNSPECIFIED; |
| 64 | 64 |
| 65 /* Clear output params in case we fail */ | 65 /* Clear output params in case we fail */ |
| 66 params->firmware_index = 0; | 66 params->firmware_index = 0; |
| 67 | 67 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 * Otherwise, we'll check all the other headers to see if they | 285 * Otherwise, we'll check all the other headers to see if they |
| 286 * contain a newer key. */ | 286 * contain a newer key. */ |
| 287 if (combined_version == tpm_version) | 287 if (combined_version == tpm_version) |
| 288 break; | 288 break; |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 /* At this point, we have a good idea of how we are going to boot. Update the | 292 /* At this point, we have a good idea of how we are going to boot. Update the |
| 293 * TPM with this state information. | 293 * TPM with this state information. |
| 294 */ | 294 */ |
| 295 status = SetTPMBootModeState(is_dev, 0, boot_fw_keyblock_flags); | 295 status = SetTPMBootModeState(is_dev, 0, (int)boot_fw_keyblock_flags); |
| 296 if (0 != status) { | 296 if (0 != status) { |
| 297 VBDEBUG(("Unable to update the TPM with boot mode information.\n")); | 297 VBDEBUG(("Unable to update the TPM with boot mode information.\n")); |
| 298 if (status == TPM_E_MUST_REBOOT) | 298 if (status == TPM_E_MUST_REBOOT) |
| 299 retval = LOAD_FIRMWARE_REBOOT; | 299 retval = LOAD_FIRMWARE_REBOOT; |
| 300 else | 300 else |
| 301 recovery = VBNV_RECOVERY_RO_TPM_ERROR; | 301 recovery = VBNV_RECOVERY_RO_TPM_ERROR; |
| 302 goto LoadFirmwareExit; | 302 goto LoadFirmwareExit; |
| 303 } | 303 } |
| 304 | 304 |
| 305 /* Free internal data */ | 305 /* Free internal data */ |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 uint32_t status = RollbackS3Resume(); | 368 uint32_t status = RollbackS3Resume(); |
| 369 | 369 |
| 370 /* If we can't resume, just do a full reboot. No need to go to recovery | 370 /* If we can't resume, just do a full reboot. No need to go to recovery |
| 371 * mode here, since if the TPM is really broken we'll catch it on the | 371 * mode here, since if the TPM is really broken we'll catch it on the |
| 372 * next boot. */ | 372 * next boot. */ |
| 373 if (status == TPM_SUCCESS) | 373 if (status == TPM_SUCCESS) |
| 374 return LOAD_FIRMWARE_SUCCESS; | 374 return LOAD_FIRMWARE_SUCCESS; |
| 375 else | 375 else |
| 376 return LOAD_FIRMWARE_REBOOT; | 376 return LOAD_FIRMWARE_REBOOT; |
| 377 } | 377 } |
| OLD | NEW |