| /* 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. |
| */ |
| |
| #ifndef TRUNKS_TPM_AUTHORIZATION_H_ |
| #define TRUNKS_TPM_AUTHORIZATION_H_ |
| |
| #include "g_tpm_structures.h" |
| |
| /* Structure to store the context of a OIAP or OSAP session. */ |
| typedef struct { |
| /* Session handle. */ |
| TPM_HANDLE handle; |
| /* Session secret. */ |
| uint8_t secret[TPM_SHA1_160_HASH_LEN]; |
| /* Nonce generated by the caller and associated with the session. */ |
| TPM_NONCE nonceEven; |
| /* Nonce generated by the TPM and associated with the session. */ |
| TPM_NONCE nonceOdd; |
| /* Nonce generated by the caller and associated with the object. */ |
| TPM_NONCE nonceEvenOSAP; |
| /* Nonce generated by the TPM and associated with the object. */ |
| TPM_NONCE nonceOddOSAP; |
| /* Whether to continue with the session. */ |
| TPM_BOOL continueAuthSession; |
| } APSession; |
| |
| /* Computes and marshals the authorization trailer of a TPM request. */ |
| void TtlComputeAndMarshal_TPM_AUTH( |
| APSession* auth, uint8_t* cmd, uint32_t cmd_length, |
| uint32_t ordinal, uint8_t** cursorp); |
| |
| /* Unmarshals and verifies the authorization trailer of a TPM response. */ |
| TPM_RESULT TtlUnmarshalAndVerify_TPM_AUTH( |
| APSession* auth, uint8_t* cmd, uint32_t cmd_length, |
| uint32_t ordinal, uint8_t** cursorp); |
| |
| #endif /* TRUNKS_TPM_AUTHORIZATION_H_ */ |