aboutsummaryrefslogtreecommitdiff
path: root/src/lib/tpm2_marshaling.h
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2017-03-25 00:38:45 -0500
committerMartin Roth <martinroth@google.com>2017-04-24 19:07:07 +0200
commitee049fa8027745d8bd90e7abe8aa8a9646d390a8 (patch)
tree1faf2c3e2362b409e6196bbf3d90ad30f6008917 /src/lib/tpm2_marshaling.h
parent88b26b845cab11be3f925e2fb52b805f7f8f992a (diff)
drivers/i2c/tpm: use iobuf library for marshaling commands
Use the iobuf API instead of relying on own buffer management. It also provides consistency between marshaling and unmarshaling code paths for propagating return values instead of overloading the values of existing variables. BUG=b:36598499 Change-Id: Iec0bbff1312e8e6ec616d1528db8667f32e682c9 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/19063 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/lib/tpm2_marshaling.h')
-rw-r--r--src/lib/tpm2_marshaling.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/lib/tpm2_marshaling.h b/src/lib/tpm2_marshaling.h
index e177d0609a..5802044378 100644
--- a/src/lib/tpm2_marshaling.h
+++ b/src/lib/tpm2_marshaling.h
@@ -6,6 +6,7 @@
#ifndef __SRC_LIB_TPM2_MARSHALING_H
#define __SRC_LIB_TPM2_MARSHALING_H
+#include <commonlib/iobuf.h>
#include "tpm2_tlcl_structures.h"
/* The below functions are used to serialize/deserialize TPM2 commands. */
@@ -18,14 +19,13 @@
*
* @command: code of the TPM2 command to marshal
* @tpm_command_body: a pointer to the command specific structure
- * @buffer: buffer where command is marshaled to
- * @buffer_size: size of the buffer
+ * @ob: output buffer where command is marshaled to
*
- * Returns number of bytes placed in the buffer, or -1 on error.
+ * Returns 0 on success or -1 on error.
*
*/
int tpm_marshal_command(TPM_CC command, void *tpm_command_body,
- void *buffer, size_t buffer_size);
+ struct obuf *ob);
/**
* tpm_unmarshal_response
@@ -36,14 +36,11 @@ int tpm_marshal_command(TPM_CC command, void *tpm_command_body,
* struct tpm2_response is a union of all possible responses.
*
* @command: code of the TPM2 command for which a response is unmarshaled
- * @response_body: buffer containing the serialized response.
- * @response_size: number of bytes in the buffer containing response
+ * @ib: input buffer containing the serialized response.
*
* Returns a pointer to the deserialized response or NULL in case of
* unmarshaling problems.
*/
-struct tpm2_response *tpm_unmarshal_response(TPM_CC command,
- void *response_body,
- size_t response_size);
+struct tpm2_response *tpm_unmarshal_response(TPM_CC command, struct ibuf *ib);
#endif // __SRC_LIB_TPM2_MARSHALING_H