| 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 | 5 |
| 6 /* A lightweight TPM command library. | 6 /* A lightweight TPM command library. |
| 7 * | 7 * |
| 8 * The general idea is that TPM commands are array of bytes whose fields are | 8 * The general idea is that TPM commands are array of bytes whose fields are |
| 9 * mostly compile-time constant. The goal is to build much of the commands at | 9 * mostly compile-time constant. The goal is to build much of the commands at |
| 10 * compile time (or build time) and change some of the fields at run time as | 10 * compile time (or build time) and change some of the fields at run time as |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } | 332 } |
| 333 | 333 |
| 334 uint32_t TlclForceClear(void) { | 334 uint32_t TlclForceClear(void) { |
| 335 return Send(tpm_forceclear_cmd.buffer); | 335 return Send(tpm_forceclear_cmd.buffer); |
| 336 } | 336 } |
| 337 | 337 |
| 338 uint32_t TlclSetEnable(void) { | 338 uint32_t TlclSetEnable(void) { |
| 339 return Send(tpm_physicalenable_cmd.buffer); | 339 return Send(tpm_physicalenable_cmd.buffer); |
| 340 } | 340 } |
| 341 | 341 |
| 342 uint32_t TlclClearEnable(void) { |
| 343 return Send(tpm_physicaldisable_cmd.buffer); |
| 344 } |
| 345 |
| 342 uint32_t TlclSetDeactivated(uint8_t flag) { | 346 uint32_t TlclSetDeactivated(uint8_t flag) { |
| 343 *((uint8_t*)tpm_physicalsetdeactivated_cmd.deactivated) = flag; | 347 *((uint8_t*)tpm_physicalsetdeactivated_cmd.deactivated) = flag; |
| 344 return Send(tpm_physicalsetdeactivated_cmd.buffer); | 348 return Send(tpm_physicalsetdeactivated_cmd.buffer); |
| 345 } | 349 } |
| 346 | 350 |
| 347 uint32_t TlclGetFlags(uint8_t* disable, uint8_t* deactivated) { | 351 uint32_t TlclGetFlags(uint8_t* disable, uint8_t* deactivated) { |
| 348 uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE]; | 352 uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE]; |
| 349 TPM_PERMANENT_FLAGS* pflags; | 353 TPM_PERMANENT_FLAGS* pflags; |
| 350 uint32_t result; | 354 uint32_t result; |
| 351 uint32_t size; | 355 uint32_t size; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 ToTpmUint32(tpm_getpermissions_cmd.index, index); | 391 ToTpmUint32(tpm_getpermissions_cmd.index, index); |
| 388 SendReceive(tpm_getpermissions_cmd.buffer, response, sizeof(response)); | 392 SendReceive(tpm_getpermissions_cmd.buffer, response, sizeof(response)); |
| 389 result = TpmReturnCode(response); | 393 result = TpmReturnCode(response); |
| 390 if (result != TPM_SUCCESS) { | 394 if (result != TPM_SUCCESS) { |
| 391 return result; | 395 return result; |
| 392 } | 396 } |
| 393 nvdata = response + kTpmResponseHeaderLength + sizeof(size); | 397 nvdata = response + kTpmResponseHeaderLength + sizeof(size); |
| 394 FromTpmUint32(nvdata + kNvDataPublicPermissionsOffset, permissions); | 398 FromTpmUint32(nvdata + kNvDataPublicPermissionsOffset, permissions); |
| 395 return result; | 399 return result; |
| 396 } | 400 } |
| OLD | NEW |