summaryrefslogtreecommitdiff
path: root/firmware/lib/tpm2_lite/marshaling.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/lib/tpm2_lite/marshaling.c')
-rw-r--r--firmware/lib/tpm2_lite/marshaling.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/firmware/lib/tpm2_lite/marshaling.c b/firmware/lib/tpm2_lite/marshaling.c
index 42e9c401..786bfc0b 100644
--- a/firmware/lib/tpm2_lite/marshaling.c
+++ b/firmware/lib/tpm2_lite/marshaling.c
@@ -349,6 +349,20 @@ static void marshal_nv_read(void **buffer,
marshal_u16(buffer, command_body->offset, buffer_space);
}
+static void marshal_nv_read_lock(void **buffer,
+ struct tpm2_nv_read_lock_cmd *command_body,
+ int *buffer_space)
+{
+ struct tpm2_session_header session_header;
+
+ tpm_tag = TPM_ST_SESSIONS;
+ marshal_TPM_HANDLE(buffer, TPM_RH_PLATFORM, buffer_space);
+ marshal_TPM_HANDLE(buffer, command_body->nvIndex, buffer_space);
+ Memset(&session_header, 0, sizeof(session_header));
+ session_header.session_handle = TPM_RS_PW;
+ marshal_session_header(buffer, &session_header, buffer_space);
+}
+
static void marshal_nv_write_lock(void **buffer,
struct tpm2_nv_write_lock_cmd *command_body,
int *buffer_space)
@@ -452,6 +466,10 @@ int tpm_marshal_command(TPM_CC command, void *tpm_command_body,
marshal_nv_write(&cmd_body, tpm_command_body, &body_size);
break;
+ case TPM2_NV_ReadLock:
+ marshal_nv_read_lock(&cmd_body, tpm_command_body, &body_size);
+ break;
+
case TPM2_NV_WriteLock:
marshal_nv_write_lock(&cmd_body, tpm_command_body, &body_size);
break;