soc/mediatek/mt8173: Remove unneeded header inclusion
[coreboot.git] / src / lib / tpm2_marshaling.h
blob58020443783482e037dc845f0b7417df3a66eda6
1 /*
2 * Copyright 2016 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6 #ifndef __SRC_LIB_TPM2_MARSHALING_H
7 #define __SRC_LIB_TPM2_MARSHALING_H
9 #include <commonlib/iobuf.h>
10 #include "tpm2_tlcl_structures.h"
12 /* The below functions are used to serialize/deserialize TPM2 commands. */
14 /**
15 * tpm_marshal_command
17 * Given a structure containing a TPM2 command, serialize the structure for
18 * sending it to the TPM.
20 * @command: code of the TPM2 command to marshal
21 * @tpm_command_body: a pointer to the command specific structure
22 * @ob: output buffer where command is marshaled to
24 * Returns 0 on success or -1 on error.
27 int tpm_marshal_command(TPM_CC command, void *tpm_command_body,
28 struct obuf *ob);
30 /**
31 * tpm_unmarshal_response
33 * Given a buffer received from the TPM in response to a certain command,
34 * deserialize the buffer into the expeced response structure.
36 * struct tpm2_response is a union of all possible responses.
38 * @command: code of the TPM2 command for which a response is unmarshaled
39 * @ib: input buffer containing the serialized response.
41 * Returns a pointer to the deserialized response or NULL in case of
42 * unmarshaling problems.
44 struct tpm2_response *tpm_unmarshal_response(TPM_CC command, struct ibuf *ib);
46 #endif // __SRC_LIB_TPM2_MARSHALING_H