| 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 "sysincludes.h" | 12 #include "sysincludes.h" |
| 13 #include "tss_constants.h" | 13 #include "tss_constants.h" |
| 14 | 14 |
| 15 /* Rollback version types. */ | 15 /* Rollback version types. */ |
| 16 #define FIRMWARE_VERSIONS 0 | 16 #define FIRMWARE_VERSIONS 0 |
| 17 #define KERNEL_VERSIONS 1 | 17 #define KERNEL_VERSIONS 1 |
| 18 | 18 |
| 19 /* Initialization mode */ | 19 /* Initialization mode */ |
| 20 #define RO_RECOVERY_MODE 0 | 20 #define RO_RECOVERY_MODE 0 |
| 21 #define RO_NORMAL_MODE 1 | 21 #define RO_NORMAL_MODE 1 |
| 22 #define RW_NORMAL_MODE 2 | 22 #define RW_NORMAL_MODE 2 |
| 23 | 23 |
| 24 /* TPM NVRAM location indices. */ | 24 /* TPM NVRAM location indices. */ |
| 25 #define FIRST_ROLLBACK_NV_INDEX 0x1001 /* First index used here */ |
| 25 #define FIRMWARE_VERSIONS_NV_INDEX 0x1001 | 26 #define FIRMWARE_VERSIONS_NV_INDEX 0x1001 |
| 26 #define KERNEL_VERSIONS_NV_INDEX 0x1002 | 27 #define KERNEL_VERSIONS_NV_INDEX 0x1002 |
| 27 #define TPM_IS_INITIALIZED_NV_INDEX 0x1003 | 28 #define TPM_IS_INITIALIZED_NV_INDEX 0x1003 |
| 28 #define KERNEL_VERSIONS_BACKUP_NV_INDEX 0x1004 | 29 #define KERNEL_VERSIONS_BACKUP_NV_INDEX 0x1004 |
| 29 #define KERNEL_MUST_USE_BACKUP_NV_INDEX 0x1005 | 30 #define KERNEL_MUST_USE_BACKUP_NV_INDEX 0x1005 |
| 30 #define DEVELOPER_MODE_NV_INDEX 0x1006 | 31 #define DEVELOPER_MODE_NV_INDEX 0x1006 |
| 32 #define LAST_ROLLBACK_NV_INDEX 0x1006 /* Last index used here */ |
| 31 | 33 |
| 32 /* Unique ID to detect kernel space redefinition */ | 34 /* Unique ID to detect kernel space redefinition */ |
| 33 #define KERNEL_SPACE_UID "GRWL" /* unique ID with secret meaning */ | 35 #define KERNEL_SPACE_UID "GRWL" /* unique ID with secret meaning */ |
| 34 #define KERNEL_SPACE_UID_SIZE (sizeof(KERNEL_SPACE_UID) - 1) | 36 #define KERNEL_SPACE_UID_SIZE (sizeof(KERNEL_SPACE_UID) - 1) |
| 35 #define KERNEL_SPACE_INIT_DATA ((uint8_t*) "\0\0\0\0" KERNEL_SPACE_UID) | 37 #define KERNEL_SPACE_INIT_DATA ((uint8_t*) "\0\0\0\0" KERNEL_SPACE_UID) |
| 36 #define KERNEL_SPACE_SIZE (sizeof(uint32_t) + KERNEL_SPACE_UID_SIZE) | 38 #define KERNEL_SPACE_SIZE (sizeof(uint32_t) + KERNEL_SPACE_UID_SIZE) |
| 37 | 39 |
| 38 /* All functions return TPM_SUCCESS (zero) if successful, non-zero if error */ | 40 /* All functions return TPM_SUCCESS (zero) if successful, non-zero if error */ |
| 39 | 41 |
| 40 /* | 42 /* |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 /* The following functions are here for testing only. */ | 101 /* The following functions are here for testing only. */ |
| 100 | 102 |
| 101 /* Store 1 in *|initialized| if the TPM NVRAM spaces have been initialized, 0 | 103 /* Store 1 in *|initialized| if the TPM NVRAM spaces have been initialized, 0 |
| 102 * otherwise. Return TPM errors. */ | 104 * otherwise. Return TPM errors. */ |
| 103 uint32_t GetSpacesInitialized(int* initialized); | 105 uint32_t GetSpacesInitialized(int* initialized); |
| 104 | 106 |
| 105 /* Issue a TPM_Clear and reenable/reactivate the TPM. */ | 107 /* Issue a TPM_Clear and reenable/reactivate the TPM. */ |
| 106 uint32_t TPMClearAndReenable(void); | 108 uint32_t TPMClearAndReenable(void); |
| 107 | 109 |
| 108 #endif /* VBOOT_REFERENCE_ROLLBACK_INDEX_H_ */ | 110 #endif /* VBOOT_REFERENCE_ROLLBACK_INDEX_H_ */ |
| OLD | NEW |