summaryrefslogtreecommitdiff
path: root/firmware/include/tpm2_marshaling.h
diff options
context:
space:
mode:
authorAndrey Pronin <apronin@chromium.org>2018-03-22 17:45:20 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-03-27 14:58:10 -0700
commit3ee5c7d8adf5d78d6864c73bf4f33b95f04a7979 (patch)
tree0b6506791bb56bcae5f99a4c90ce0b50209cca9f /firmware/include/tpm2_marshaling.h
parentd3ec8f8116b167f58d76f0c798ae1b4d14aec389 (diff)
downloadvboot-3ee5c7d8adf5d78d6864c73bf4f33b95f04a7979.tar.gz
firmware: tpm2_lite: propagate actual errors
Propagate the actual error - a non-successful response code from the tpm or communication/serializing failure - to the caller of the Tlcl functions in TPM 2.0 case. Currently, the callers only have special processing for the error codes from TCG TPM 1.2 range, which are never returned in case of communication or serialization failures or from the actual TPM 2.0. (The only case of mapping TPM 2.0 error codes to TPM_E_BADINDEX is preserved in this CL.) Thus, changing the actual values returned from the functions won't change any current behavior in the calling layers. This CL is a preparatory work for adding special processing for communication errors in mount-encrypted. BUG=chromium:702724 BRANCH=none TEST=build; test that tpmc getvf, tpmc read still work. Change-Id: I96b20e7285e83f0038abc01e4b7175c938867e7d Signed-off-by: Andrey Pronin <apronin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/977225 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'firmware/include/tpm2_marshaling.h')
-rw-r--r--firmware/include/tpm2_marshaling.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/firmware/include/tpm2_marshaling.h b/firmware/include/tpm2_marshaling.h
index cbfded11..3ebea388 100644
--- a/firmware/include/tpm2_marshaling.h
+++ b/firmware/include/tpm2_marshaling.h
@@ -33,18 +33,18 @@ int tpm_marshal_command(TPM_CC command, void *tpm_command_body,
* Given a buffer received from the TPM in response to a certain command,
* deserialize the buffer into the expeced response structure.
*
- * 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
+ * @response: structure to be filled with deserialized response,
+ * struct tpm2_response is a union of all possible responses.
*
- * Returns a pointer to the deserialized response or NULL in case of
- * unmarshaling problems.
+ * Returns 0 on success, or -1 on error.
*/
-struct tpm2_response *tpm_unmarshal_response(TPM_CC command,
- void *response_body,
- int response_size);
+int tpm_unmarshal_response(TPM_CC command,
+ void *response_body,
+ int response_size,
+ struct tpm2_response *response);
/**
* tpm_get_packet_size