diff options
Diffstat (limited to 'src/lib/tpm2_marshaling.c')
-rw-r--r-- | src/lib/tpm2_marshaling.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/tpm2_marshaling.c b/src/lib/tpm2_marshaling.c index 1edc69007a..38c8d2f05c 100644 --- a/src/lib/tpm2_marshaling.c +++ b/src/lib/tpm2_marshaling.c @@ -373,6 +373,23 @@ static void marshal_selftest(void **buffer, marshal_u8(buffer, command_body->yes_no, buffer_space); } +static void marshal_hierarchy_control(void **buffer, + struct tpm2_hierarchy_control_cmd *command_body, + size_t *buffer_space) +{ + struct tpm2_session_header session_header; + + car_set_var(tpm_tag, TPM_ST_SESSIONS); + + marshal_TPM_HANDLE(buffer, TPM_RH_PLATFORM, buffer_space); + memset(&session_header, 0, sizeof(session_header)); + session_header.session_handle = TPM_RS_PW; + marshal_session_header(buffer, &session_header, buffer_space); + + marshal_TPM_HANDLE(buffer, command_body->enable, buffer_space); + marshal_u8(buffer, command_body->state, buffer_space); +} + int tpm_marshal_command(TPM_CC command, void *tpm_command_body, void *buffer, size_t buffer_size) { @@ -414,6 +431,11 @@ int tpm_marshal_command(TPM_CC command, void *tpm_command_body, marshal_selftest(&cmd_body, tpm_command_body, &body_size); break; + case TPM2_Hierarchy_Control: + marshal_hierarchy_control(&cmd_body, tpm_command_body, + &body_size); + break; + case TPM2_Clear: marshal_clear(&cmd_body, &body_size); break; @@ -583,6 +605,7 @@ struct tpm2_response *tpm_unmarshal_response(TPM_CC command, &tpm2_resp->nvr); break; + case TPM2_Hierarchy_Control: case TPM2_Clear: case TPM2_NV_DefineSpace: case TPM2_NV_Write: |