drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / src / security / tpm / tss / tcg-2.0 / tss_marshaling.h
blob3ae48eb48432aa20cef52595ea985538fb0b3186
1 /* SPDX-License-Identifier: BSD-3-Clause */
3 #ifndef TCG2_TSS_MARSHALING_H_
4 #define TCG2_TSS_MARSHALING_H_
6 #include <commonlib/iobuf.h>
7 #include "tss_structures.h"
9 /* The below functions are used to serialize/deserialize TPM2 commands. */
11 /**
12 * tpm_marshal_command
14 * Given a structure containing a TPM2 command, serialize the structure for
15 * sending it to the TPM.
17 * @command: code of the TPM2 command to marshal
18 * @tpm_command_body: a pointer to the command specific structure
19 * @ob: output buffer where command is marshaled to
21 * Returns 0 on success or -1 on error.
24 int tpm_marshal_command(TPM_CC command, const void *tpm_command_body,
25 struct obuf *ob);
27 /**
28 * tpm_unmarshal_response
30 * Given a buffer received from the TPM in response to a certain command,
31 * deserialize the buffer into the expected response structure.
33 * struct tpm2_response is a union of all possible responses.
35 * @command: code of the TPM2 command for which a response is unmarshaled
36 * @ib: input buffer containing the serialized response.
38 * Returns a pointer to the deserialized response or NULL in case of
39 * unmarshaling problems.
41 struct tpm2_response *tpm_unmarshal_response(TPM_CC command, struct ibuf *ib);
43 #endif // TCG2_TSS_MARSHALING_H_