| 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 #include "rollback_index.h" | 9 #include "rollback_index.h" |
| 10 | 10 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 /* We perform the reads, making sure they succeed. A failure means that the | 115 /* We perform the reads, making sure they succeed. A failure means that the |
| 116 * rollback index locations are missing or somehow messed up. We let the | 116 * rollback index locations are missing or somehow messed up. We let the |
| 117 * caller deal with that. | 117 * caller deal with that. |
| 118 */ | 118 */ |
| 119 switch (type) { | 119 switch (type) { |
| 120 case FIRMWARE_VERSIONS: | 120 case FIRMWARE_VERSIONS: |
| 121 RETURN_ON_FAILURE(TlclRead(FIRMWARE_VERSIONS_NV_INDEX, | 121 RETURN_ON_FAILURE(TlclRead(FIRMWARE_VERSIONS_NV_INDEX, |
| 122 (uint8_t*) &firmware_versions, | 122 (uint8_t*) &firmware_versions, |
| 123 sizeof(firmware_versions))); | 123 sizeof(firmware_versions))); |
| 124 g_firmware_key_version = firmware_versions >> 16; | 124 g_firmware_key_version = (uint16_t) (firmware_versions >> 16); |
| 125 g_firmware_version = firmware_versions && 0xffff; | 125 g_firmware_version = (uint16_t) (firmware_versions & 0xffff); |
| 126 break; | 126 break; |
| 127 case KERNEL_VERSIONS: | 127 case KERNEL_VERSIONS: |
| 128 RETURN_ON_FAILURE(TlclRead(KERNEL_VERSIONS_NV_INDEX, | 128 RETURN_ON_FAILURE(TlclRead(KERNEL_VERSIONS_NV_INDEX, |
| 129 (uint8_t*) &kernel_versions, | 129 (uint8_t*) &kernel_versions, |
| 130 sizeof(kernel_versions))); | 130 sizeof(kernel_versions))); |
| 131 g_kernel_key_version = kernel_versions >> 16; | 131 g_kernel_key_version = (uint16_t) (kernel_versions >> 16); |
| 132 g_kernel_version = kernel_versions && 0xffff; | 132 g_kernel_version = (uint16_t) (kernel_versions & 0xffff); |
| 133 break; | 133 break; |
| 134 } | 134 } |
| 135 | 135 |
| 136 return TPM_SUCCESS; | 136 return TPM_SUCCESS; |
| 137 } | 137 } |
| 138 | 138 |
| 139 /* Checks if the kernel version space has been mucked with. If it has, | 139 /* Checks if the kernel version space has been mucked with. If it has, |
| 140 * reconstructs it using the backup value. | 140 * reconstructs it using the backup value. |
| 141 */ | 141 */ |
| 142 uint32_t RecoverKernelSpace(void) { | 142 uint32_t RecoverKernelSpace(void) { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 return TPM_SUCCESS; | 353 return TPM_SUCCESS; |
| 354 } | 354 } |
| 355 | 355 |
| 356 uint32_t LockFirmwareVersions() { | 356 uint32_t LockFirmwareVersions() { |
| 357 return TlclSetGlobalLock(); | 357 return TlclSetGlobalLock(); |
| 358 } | 358 } |
| 359 | 359 |
| 360 uint32_t LockKernelVersionsByLockingPP() { | 360 uint32_t LockKernelVersionsByLockingPP() { |
| 361 return TlclLockPhysicalPresence(); | 361 return TlclLockPhysicalPresence(); |
| 362 } | 362 } |
| OLD | NEW |