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

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

Issue 2711006: Import recent tpm_lite changes that make all TPM commands return a status. (Closed) Base URL: ssh://git@chromiumos-git/vboot_reference.git
Patch Set: cleanup from gauravsh's feedback Created 10 years, 6 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
« no previous file with comments | « vboot_firmware/include/tlcl.h ('k') | vboot_firmware/lib/rollback_index.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * 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 "cryptolib.h"
12 #include "rollback_index.h" 12 #include "rollback_index.h"
13 #include "tss_constants.h"
13 #include "utility.h" 14 #include "utility.h"
14 15
15 /* Macro to determine the size of a field structure in the FirmwareImage 16 /* Macro to determine the size of a field structure in the FirmwareImage
16 * structure. */ 17 * structure. */
17 #define FIELD_LEN(field) (sizeof(((FirmwareImage*)0)->field)) 18 #define FIELD_LEN(field) (sizeof(((FirmwareImage*)0)->field))
18 19
19 char* kVerifyFirmwareErrors[VERIFY_FIRMWARE_MAX] = { 20 char* kVerifyFirmwareErrors[VERIFY_FIRMWARE_MAX] = {
20 "Success.", 21 "Success.",
21 "Invalid Image.", 22 "Invalid Image.",
22 "Root Key Signature Failed.", 23 "Root Key Signature Failed.",
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 (uint16_t) (min_lversion & 0xFFFF)); 304 (uint16_t) (min_lversion & 0xFFFF));
304 stored_lversion = min_lversion; /* Update stored version as it's used 305 stored_lversion = min_lversion; /* Update stored version as it's used
305 * later. */ 306 * later. */
306 } 307 }
307 } 308 }
308 } 309 }
309 /* Lock Firmware TPM rollback indices from further writes. In this design, 310 /* Lock Firmware TPM rollback indices from further writes. In this design,
310 * this is done by setting the globalLock bit, which is cleared only by 311 * this is done by setting the globalLock bit, which is cleared only by
311 * TPM_Init at reboot. 312 * TPM_Init at reboot.
312 */ 313 */
313 LockFirmwareVersions(); 314 if (TPM_SUCCESS != LockFirmwareVersions()) {
315 return VERIFY_FIRMWARE_TPM_ERROR;
316 }
314 317
315 /* Determine which firmware (if any) to jump to. 318 /* Determine which firmware (if any) to jump to.
316 * 319 *
317 * We always attempt to jump to FirmwareA first. If verification of FirmwareA 320 * We always attempt to jump to FirmwareA first. If verification of FirmwareA
318 * fails, we try FirmwareB. In all cases, if the firmware successfully 321 * fails, we try FirmwareB. In all cases, if the firmware successfully
319 * verified but is a rollback, we jump to recovery. 322 * verified but is a rollback, we jump to recovery.
320 * 323 *
321 * Note: This means that if FirmwareA verified successfully and is a 324 * Note: This means that if FirmwareA verified successfully and is a
322 * rollback, then no attempt is made to check FirmwareB. We still jump to 325 * rollback, then no attempt is made to check FirmwareB. We still jump to
323 * recovery. FirmwareB is only used as a backup in case FirmwareA gets 326 * recovery. FirmwareB is only used as a backup in case FirmwareA gets
(...skipping 12 matching lines...) Expand all
336 */ 339 */
337 if (stored_lversion <= firmwareB_lversion && 340 if (stored_lversion <= firmwareB_lversion &&
338 (VERIFY_FIRMWARE_SUCCESS == VerifyFirmware(root_key_blob, 341 (VERIFY_FIRMWARE_SUCCESS == VerifyFirmware(root_key_blob,
339 verification_headerB, 342 verification_headerB,
340 firmwareB))) 343 firmwareB)))
341 return BOOT_FIRMWARE_B_CONTINUE; 344 return BOOT_FIRMWARE_B_CONTINUE;
342 } 345 }
343 /* D'oh: No bootable firmware. */ 346 /* D'oh: No bootable firmware. */
344 return BOOT_FIRMWARE_RECOVERY_CONTINUE; 347 return BOOT_FIRMWARE_RECOVERY_CONTINUE;
345 } 348 }
OLDNEW
« no previous file with comments | « vboot_firmware/include/tlcl.h ('k') | vboot_firmware/lib/rollback_index.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698