blob: d8d998136bd47d00c61d0537faf4b85a601ef142 [file] [log] [blame]
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.tpm;
using zx;
/// Arbitrarily large value which should be enough to handle any vendor
/// commands.
const MAX_VENDOR_COMMAND_LEN uint32 = 65535;
/// Arbitrarily large value which should be enough to handle any tpm
/// commands.
const MAX_COMMAND_LEN uint32 = 65535;
/// TPM response codes are fairly complex.
/// See Section 6.6, "TPM_RC (Response Codes)" of the "Trusted Platform Module Library
/// Part 2: Structures" for more information on how they should be interpreted.
/// The TPM may return vendor-defined error codes or set various bits in the
/// error to provide more information about the nature of the error.
alias TpmRc = uint16;
closed protocol TpmDevice {
/// Get the TPM's device ID, vendor ID, and revision ID.
strict GetDeviceId() -> (struct {
vendor_id uint16;
device_id uint16;
revision_id uint8;
}) error zx.Status;
/// Execute a vendor command.
/// This method will construct a header for the TPM command from the
/// command_code. The data section should just contain the body of
/// the command and not the header.
/// Returns ZX_ERR_BUFFER_TOO_SMALL if the TPM responded with data that
/// wouldn't fit in the response buffer.
@deprecated("use fuchsia.tpm.ExecuteCommand instead")
strict ExecuteVendorCommand(struct {
command_code uint16;
data vector<uint8>:MAX_VENDOR_COMMAND_LEN;
}) -> (struct {
result TpmRc;
data vector<uint8>:MAX_VENDOR_COMMAND_LEN;
}) error zx.Status;
/// Execute a complete command.
/// This method expects a complete command passed in data including
/// any header required.
/// Returns ZX_ERR_BUFFER_TOO_SMALL if the TPM responded with data that
/// wouldn't fit in the response buffer.
strict ExecuteCommand(struct {
data vector<uint8>:MAX_COMMAND_LEN;
}) -> (struct {
data vector<uint8>:MAX_COMMAND_LEN;
}) error zx.Status;
};