mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 10:14:55 +00:00
Try #2, now that ARM has the fix from http://gerrit.chromium.org/gerrit/4667 This cleans up the TPM calls inside vboot_reference. * TPM calls share mode code between boot modes. * Better handling for TPM_E_MUST_REBOOT, particularly in recovery mode. * TAB screen shows current TPM versions. No changes required to the wrapper API; these changes are internal to vboot. BUG=chromium-os:18084 TEST=make && make runtests; built for both alex and tegra2-seaboard Original-Change-Id: I2a52066f2889210af83409872b10f9d6380470af (cherry picked from commit da55560cddcf7a1aa8a881cdf52792a21a01e766) Change-Id: I120797145772116f09b8125b9e56fdbb11dc16b3 Reviewed-on: http://gerrit.chromium.org/gerrit/4671 Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
93 lines
3.3 KiB
C
93 lines
3.3 KiB
C
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*
|
|
* Functions for querying, manipulating and locking rollback indices
|
|
* stored in the TPM NVRAM.
|
|
*/
|
|
|
|
#ifndef VBOOT_REFERENCE_ROLLBACK_INDEX_H_
|
|
#define VBOOT_REFERENCE_ROLLBACK_INDEX_H_
|
|
|
|
#include "sysincludes.h"
|
|
#include "tss_constants.h"
|
|
|
|
/* TPM NVRAM location indices. */
|
|
#define FIRMWARE_NV_INDEX 0x1007
|
|
#define KERNEL_NV_INDEX 0x1008
|
|
|
|
/* Structure definitions for TPM spaces */
|
|
|
|
__pragma(pack(push, 1)) /* Support packing for MSVC. */
|
|
|
|
/* Kernel space - KERNEL_NV_INDEX, locked with physical presence. */
|
|
#define ROLLBACK_SPACE_KERNEL_VERSION 1
|
|
#define ROLLBACK_SPACE_KERNEL_UID 0x4752574C /* 'GRWL' */
|
|
typedef struct RollbackSpaceKernel {
|
|
uint8_t struct_version; /* Struct version, for backwards
|
|
* compatibility */
|
|
uint32_t uid; /* Unique ID to detect space redefinition */
|
|
uint32_t kernel_versions; /* Kernel versions */
|
|
uint32_t reserved; /* Reserved for future expansion */
|
|
} __attribute__((packed)) RollbackSpaceKernel;
|
|
|
|
|
|
/* Flags for firmware space */
|
|
/* Last boot was developer mode. TPM ownership is cleared when
|
|
* transitioning to/from developer mode. */
|
|
#define FLAG_LAST_BOOT_DEVELOPER 0x01
|
|
/* There have been one or more boots which left PP unlocked, so the
|
|
* contents of the kernel space are untrusted and must be restored
|
|
* from the backup copy. */
|
|
#define FLAG_KERNEL_SPACE_USE_BACKUP 0x02
|
|
|
|
#define ROLLBACK_SPACE_FIRMWARE_VERSION 1
|
|
/* Firmware space - FIRMWARE_NV_INDEX, locked with global lock. */
|
|
typedef struct RollbackSpaceFirmware {
|
|
uint8_t struct_version; /* Struct version, for backwards compatibility */
|
|
uint8_t flags; /* Flags (see FLAG_* above) */
|
|
uint32_t fw_versions; /* Firmware versions */
|
|
uint32_t reserved; /* Reserved for future expansion */
|
|
} __attribute__((packed)) RollbackSpaceFirmware;
|
|
|
|
__pragma(pack(pop)) /* Support packing for MSVC. */
|
|
|
|
|
|
/* All functions return TPM_SUCCESS (zero) if successful, non-zero if error */
|
|
|
|
/* These functions are called from S3Resume(). They cannot use
|
|
* global variables. */
|
|
uint32_t RollbackS3Resume(void);
|
|
|
|
/* These functions are callable from LoadFirmware(). They cannot use
|
|
* global variables. */
|
|
|
|
/* Setup must be called. Pass recovery_mode=nonzero if in recovery
|
|
* mode. Pass developer_mode=nonzero if in developer
|
|
* mode. */
|
|
uint32_t RollbackFirmwareSetup(int recovery_mode, int developer_mode,
|
|
uint32_t* version);
|
|
|
|
/* Write may be called if the versions change */
|
|
uint32_t RollbackFirmwareWrite(uint32_t version);
|
|
|
|
/* Lock must be called */
|
|
uint32_t RollbackFirmwareLock(void);
|
|
|
|
/* These functions are callable from LoadKernel(). They may use global
|
|
* variables. */
|
|
|
|
/* Read and write may be called to read and write the kernel version. */
|
|
uint32_t RollbackKernelRead(uint32_t* version);
|
|
uint32_t RollbackKernelWrite(uint32_t version);
|
|
|
|
/* Lock must be called. Internally, it's ignored in recovery mode. */
|
|
uint32_t RollbackKernelLock(void);
|
|
|
|
/* The following functions are here for testing only. */
|
|
|
|
/* Issue a TPM_Clear and reenable/reactivate the TPM. */
|
|
uint32_t TPMClearAndReenable(void);
|
|
|
|
#endif /* VBOOT_REFERENCE_ROLLBACK_INDEX_H_ */
|