| 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 * Functions for querying, manipulating and locking rollback indices | 5 * Functions for querying, manipulating and locking rollback indices |
| 6 * stored in the TPM NVRAM. | 6 * stored in the TPM NVRAM. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef VBOOT_REFERENCE_ROLLBACK_INDEX_H_ | 9 #ifndef VBOOT_REFERENCE_ROLLBACK_INDEX_H_ |
| 10 #define VBOOT_REFERENCE_ROLLBACK_INDEX_H_ | 10 #define VBOOT_REFERENCE_ROLLBACK_INDEX_H_ |
| 11 | 11 |
| 12 #include <stdint.h> | 12 #include <stdint.h> |
| 13 | 13 |
| 14 extern uint16_t g_firmware_key_version; | 14 extern uint16_t g_firmware_key_version; |
| 15 extern uint16_t g_firmware_version; | 15 extern uint16_t g_firmware_version; |
| 16 extern uint16_t g_kernel_key_version; | 16 extern uint16_t g_kernel_key_version; |
| 17 extern uint16_t g_kernel_version; | 17 extern uint16_t g_kernel_version; |
| 18 | 18 |
| 19 /* Rollback version types. */ | 19 /* Rollback version types. */ |
| 20 #define FIRMWARE_VERSIONS 0 | 20 #define FIRMWARE_VERSIONS 0 |
| 21 #define KERNEL_VERSIONS 1 | 21 #define KERNEL_VERSIONS 1 |
| 22 | 22 |
| 23 /* TPM NVRAM location indices. */ | 23 /* TPM NVRAM location indices. */ |
| 24 #define FIRMWARE_VERSIONS_NV_INDEX 0x1001 | 24 #define FIRMWARE_VERSIONS_NV_INDEX 0x1001 |
| 25 #define KERNEL_VERSIONS_NV_INDEX 0x1002 | 25 #define KERNEL_VERSIONS_NV_INDEX 0x1002 |
| 26 #define TPM_IS_INITIALIZED_NV_INDEX 0x1003 | 26 #define TPM_IS_INITIALIZED_NV_INDEX 0x1003 |
| 27 #define KERNEL_VERSIONS_BACKUP_NV_INDEX 0x1004 | 27 #define KERNEL_VERSIONS_BACKUP_NV_INDEX 0x1004 |
| 28 #define KERNEL_BACKUP_IS_VALID_NV_INDEX 0x1005 | 28 #define KERNEL_MUST_USE_BACKUP_NV_INDEX 0x1005 |
| 29 |
| 30 /* Unique ID to detect kernel space redefinition */ |
| 31 #define KERNEL_SPACE_UID "GRWL" /* unique ID with secret meaning */ |
| 32 #define KERNEL_SPACE_UID_SIZE (sizeof(KERNEL_SPACE_UID) - 1) |
| 33 #define KERNEL_SPACE_INIT_DATA ((uint8_t*) "\0\0\0\0" KERNEL_SPACE_UID) |
| 34 #define KERNEL_SPACE_SIZE (sizeof(uint32_t) + KERNEL_SPACE_UID_SIZE) |
| 29 | 35 |
| 30 /* All functions return 0 if successful, non-zero if error */ | 36 /* All functions return 0 if successful, non-zero if error */ |
| 31 uint32_t SetupTPM(void); | 37 uint32_t SetupTPM(void); |
| 32 uint32_t GetStoredVersions(int type, uint16_t* key_version, uint16_t* version); | 38 uint32_t GetStoredVersions(int type, uint16_t* key_version, uint16_t* version); |
| 33 uint32_t WriteStoredVersions(int type, uint16_t key_version, uint16_t version); | 39 uint32_t WriteStoredVersions(int type, uint16_t key_version, uint16_t version); |
| 34 uint32_t LockFirmwareVersions(void); | 40 uint32_t LockFirmwareVersions(void); |
| 35 uint32_t LockKernelVersionsByLockingPP(void); | 41 uint32_t LockKernelVersionsByLockingPP(void); |
| 36 | 42 |
| 37 #endif /* VBOOT_REFERENCE_ROLLBACK_INDEX_H_ */ | 43 #endif /* VBOOT_REFERENCE_ROLLBACK_INDEX_H_ */ |
| OLD | NEW |