Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(803)

Side by Side Diff: firmware/lib/vboot_firmware.c

Issue 3084030: Add structs for TPM NV simplification (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: Use new structs Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return LOAD_FIRMWARE_RECOVERY; 54 return LOAD_FIRMWARE_RECOVERY;
55 } 55 }
56 56
57 /* Must have a root key */ 57 /* Must have a root key */
58 if (!root_key) { 58 if (!root_key) {
59 VBDEBUG(("No root key\n")); 59 VBDEBUG(("No root key\n"));
60 return LOAD_FIRMWARE_RECOVERY; 60 return LOAD_FIRMWARE_RECOVERY;
61 } 61 }
62 62
63 /* Initialize the TPM and read rollback indices. */ 63 /* Initialize the TPM and read rollback indices. */
64 status = RollbackFirmwareSetup(params->boot_flags & BOOT_FLAG_DEVELOPER); 64 status = RollbackFirmwareSetup(params->boot_flags & BOOT_FLAG_DEVELOPER,
65 &tpm_key_version, &tpm_fw_version);
65 if (0 != status) { 66 if (0 != status) {
66 VBDEBUG(("Unable to setup TPM.\n")); 67 VBDEBUG(("Unable to setup TPM and read stored versions.\n"));
67 return (status == TPM_E_MUST_REBOOT ? 68 return (status == TPM_E_MUST_REBOOT ?
68 LOAD_FIRMWARE_REBOOT : LOAD_FIRMWARE_RECOVERY); 69 LOAD_FIRMWARE_REBOOT : LOAD_FIRMWARE_RECOVERY);
69 } 70 }
70 status = RollbackFirmwareRead(&tpm_key_version, &tpm_fw_version);
71 if (0 != status) {
72 VBDEBUG(("Unable to read stored versions.\n"));
73 return (status == TPM_E_MUST_REBOOT ?
74 LOAD_FIRMWARE_REBOOT : LOAD_FIRMWARE_RECOVERY);
75 }
76 71
77 /* Allocate our internal data */ 72 /* Allocate our internal data */
78 lfi = (VbLoadFirmwareInternal*)Malloc(sizeof(VbLoadFirmwareInternal)); 73 lfi = (VbLoadFirmwareInternal*)Malloc(sizeof(VbLoadFirmwareInternal));
79 if (!lfi) 74 if (!lfi)
80 return LOAD_FIRMWARE_RECOVERY; 75 return LOAD_FIRMWARE_RECOVERY;
81 params->load_firmware_internal = (uint8_t*)lfi; 76 params->load_firmware_internal = (uint8_t*)lfi;
82 77
83 /* Loop over indices */ 78 /* Loop over indices */
84 for (index = 0; index < 2; index++) { 79 for (index = 0; index < 2; index++) {
85 VbKeyBlockHeader* key_block; 80 VbKeyBlockHeader* key_block;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 239
245 /* Success */ 240 /* Success */
246 VBDEBUG(("Will boot firmware index %d\n", (int)params->firmware_index)); 241 VBDEBUG(("Will boot firmware index %d\n", (int)params->firmware_index));
247 return LOAD_FIRMWARE_SUCCESS; 242 return LOAD_FIRMWARE_SUCCESS;
248 } 243 }
249 244
250 /* If we're still here, no good firmware, so go to recovery mode. */ 245 /* If we're still here, no good firmware, so go to recovery mode. */
251 VBDEBUG(("Alas, no good firmware.\n")); 246 VBDEBUG(("Alas, no good firmware.\n"));
252 return LOAD_FIRMWARE_RECOVERY; 247 return LOAD_FIRMWARE_RECOVERY;
253 } 248 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698