summaryrefslogtreecommitdiff
path: root/firmware/include/tlcl_stub.h
blob: b9a1f9abdb2d72467b72eec31dfaa226896100bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Copyright (c) 2010 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.
 */

/* TPM Lightweight Command Library.
 *
 * A low-level library for interfacing to TPM hardware or an emulator.
 */

#ifndef VBOOT_REFERENCE_TLCL_STUB_H_
#define VBOOT_REFERENCE_TLCL_STUB_H_

#include "sysincludes.h"
#include "tss_constants.h"

/*****************************************************************************/
/* Functions to be implemented by the stub library */

/* Initialize the stub library.  Returns 0 if success, nonzero if error. */
uint32_t TlclStubInit(void);

/* Close and open the device.  This is needed for running more complex commands
 * at user level, such as TPM_TakeOwnership, since the TPM device can be opened
 * only by one process at a time.  Returns 0 if success, nonzero if error.
 */
uint32_t TlclCloseDevice(void);
uint32_t TlclOpenDevice(void);

/* Send data to the TPM and receive a response.  Returns 0 if success,
 * nonzero if error. */
uint32_t TlclStubSendReceive(const uint8_t* request, int request_length,
                             uint8_t* response, int max_length);

#endif  /* VBOOT_REFERENCE_TLCL_STUB_H_ */