Skip to content

Commit

Permalink
Add 1.3 DIGEST to transcript.
Browse files Browse the repository at this point in the history
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
  • Loading branch information
jyao1 committed Nov 20, 2023
1 parent 0d1248a commit df71d7a
Showing 1 changed file with 78 additions and 2 deletions.
80 changes: 78 additions & 2 deletions spdm_dump/spdm/spdm_dump_spdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ uint16_t m_spdm_aead_cipher_suite;
uint16_t m_spdm_req_base_asym_alg;
uint16_t m_spdm_key_schedule;
uint8_t m_spdm_other_params_support;
bool m_multi_key_conn_req;
bool m_multi_key_conn_rsp;

dispatch_table_entry_t m_spdm_vendor_dispatch[] = {
{ SPDM_REGISTRY_ID_DMTF, "DMTF", NULL },
Expand Down Expand Up @@ -71,6 +73,11 @@ value_string_entry_t m_spdm_requester_capabilities_string_table[] = {
"HANDSHAKE_IN_CLEAR" },
{ SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PUB_KEY_ID_CAP, "PUB_KEY_ID" },
{ SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CHUNK_CAP, "CHUNK" },
{ SPDM_GET_CAPABILITIES_REQUEST_FLAGS_EP_INFO_CAP_NO_SIG, "EP_INFO_NO_SIG" },
{ SPDM_GET_CAPABILITIES_REQUEST_FLAGS_EP_INFO_CAP_SIG, "EP_INFO_SIG" },
{ SPDM_GET_CAPABILITIES_REQUEST_FLAGS_EVENT_CAP, "EVENT" },
{ SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_ONLY, "MULTI_KEY_ONLY" },
{ SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_NEG, "MULTI_KEY_NEG" },
};
size_t m_spdm_requester_capabilities_string_table_count =
LIBSPDM_ARRAY_SIZE(m_spdm_requester_capabilities_string_table);
Expand Down Expand Up @@ -100,6 +107,14 @@ value_string_entry_t m_spdm_responder_capabilities_string_table[] = {
{ SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_SET_CERT_CAP, "SET_CERT" },
{ SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CSR_CAP, "CSR" },
{ SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_INSTALL_RESET_CAP, "CERT_INSTALL_RESET" },
{ SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_EP_INFO_CAP_NO_SIG, "EP_INFO_NO_SIG" },
{ SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_EP_INFO_CAP_SIG, "EP_INFO_SIG" },
{ SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEL_CAP, "MEL" },
{ SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_EVENT_CAP, "EVENT" },
{ SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP_ONLY, "MULTI_KEY_ONLY" },
{ SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP_NEG, "MULTI_KEY_NEG" },
{ SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_GET_KEY_PAIR_INFO_CAP, "GET_KEY_PAIR_INFO" },
{ SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_SET_KEY_PAIR_INFO_CAP, "SET_KEY_PAIR_INFO" },
};
size_t m_spdm_responder_capabilities_string_table_count =
LIBSPDM_ARRAY_SIZE(m_spdm_responder_capabilities_string_table);
Expand Down Expand Up @@ -190,6 +205,18 @@ value_string_entry_t m_spdm_other_param_value_string_table[] = {
size_t m_spdm_other_param_value_string_table_count =
LIBSPDM_ARRAY_SIZE(m_spdm_other_param_value_string_table);

value_string_entry_t m_spdm_multi_key_conn_rsp_value_string_table[] = {
{ SPDM_ALGORITHMS_MULTI_KEY_CONN, "MULTI_KEY_CONN_RSP" },
};
size_t m_spdm_multi_key_conn_rsp_value_string_table_count =
LIBSPDM_ARRAY_SIZE(m_spdm_multi_key_conn_rsp_value_string_table);

value_string_entry_t m_spdm_multi_key_conn_req_value_string_table[] = {
{ SPDM_ALGORITHMS_MULTI_KEY_CONN, "MULTI_KEY_CONN_REQ" },
};
size_t m_spdm_multi_key_conn_req_value_string_table_count =
LIBSPDM_ARRAY_SIZE(m_spdm_multi_key_conn_req_value_string_table);

value_string_entry_t m_spdm_measurement_type_value_string_table[] = {
{ SPDM_MEASUREMENT_BLOCK_MEASUREMENT_TYPE_IMMUTABLE_ROM,
"ImmutableROM" },
Expand Down Expand Up @@ -612,6 +639,14 @@ void dump_spdm_negotiate_algorithms(const void *buffer, size_t buffer_size)
return;
}

m_multi_key_conn_rsp = false;
if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
if ((spdm_request->other_params_support & SPDM_ALGORITHMS_MULTI_KEY_CONN) != 0) {
m_multi_key_conn_rsp = true;
}
}


if (!m_param_quite_mode) {
printf("(MeasSpec=0x%02x(",
spdm_request->measurement_specification);
Expand All @@ -624,7 +659,17 @@ void dump_spdm_negotiate_algorithms(const void *buffer, size_t buffer_size)
printf("), OtherParam=0x%02x(", spdm_request->other_params_support);
dump_entry_flags(m_spdm_other_param_value_string_table,
LIBSPDM_ARRAY_SIZE(m_spdm_other_param_value_string_table),
spdm_request->other_params_support);
spdm_request->other_params_support &
SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK);
if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
if ((spdm_request->other_params_support & SPDM_ALGORITHMS_MULTI_KEY_CONN) != 0) {
printf(", ");
dump_entry_flags(m_spdm_multi_key_conn_rsp_value_string_table,
LIBSPDM_ARRAY_SIZE(m_spdm_multi_key_conn_rsp_value_string_table),
spdm_request->other_params_support &
SPDM_ALGORITHMS_MULTI_KEY_CONN);
}
}
}
printf("), Hash=0x%08x(", spdm_request->base_hash_algo);
dump_entry_flags(m_spdm_hash_value_string_table,
Expand Down Expand Up @@ -736,6 +781,13 @@ void dump_spdm_algorithms(const void *buffer, size_t buffer_size)
return;
}

m_multi_key_conn_req = false;
if (spdm_response->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
if ((spdm_response->other_params_selection & SPDM_ALGORITHMS_MULTI_KEY_CONN) != 0) {
m_multi_key_conn_req = true;
}
}

if (!m_param_quite_mode) {
printf("(MeasSpec=0x%02x(",
spdm_response->measurement_specification_sel);
Expand All @@ -748,7 +800,17 @@ void dump_spdm_algorithms(const void *buffer, size_t buffer_size)
printf("), OtherParam=0x%02x(", spdm_response->other_params_selection);
dump_entry_value(m_spdm_other_param_value_string_table,
LIBSPDM_ARRAY_SIZE(m_spdm_other_param_value_string_table),
spdm_response->other_params_selection);
spdm_response->other_params_selection &
SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK);
if (spdm_response->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
if ((spdm_response->other_params_selection & SPDM_ALGORITHMS_MULTI_KEY_CONN) != 0) {
printf(", ");
dump_entry_flags(m_spdm_multi_key_conn_req_value_string_table,
LIBSPDM_ARRAY_SIZE(m_spdm_multi_key_conn_req_value_string_table),
spdm_response->other_params_selection &
SPDM_ALGORITHMS_MULTI_KEY_CONN);
}
}
}
printf("), Hash=0x%08x(", spdm_response->base_hash_sel);
dump_entry_value(m_spdm_hash_value_string_table,
Expand Down Expand Up @@ -898,6 +960,10 @@ void dump_spdm_algorithms(const void *buffer, size_t buffer_size)
&m_spdm_key_schedule, sizeof(uint16_t));
libspdm_set_data(m_spdm_context, LIBSPDM_DATA_OTHER_PARAMS_SUPPORT, &parameter,
&m_spdm_other_params_support, sizeof(uint8_t));
libspdm_set_data(m_spdm_context, LIBSPDM_DATA_MULTI_KEY_CONN_REQ, &parameter,
&m_multi_key_conn_req, sizeof(bool));
libspdm_set_data(m_spdm_context, LIBSPDM_DATA_MULTI_KEY_CONN_RSP, &parameter,
&m_multi_key_conn_rsp, sizeof(bool));

libspdm_append_message_a(m_spdm_context, buffer, message_size);
}
Expand Down Expand Up @@ -969,6 +1035,16 @@ void dump_spdm_digests(const void *buffer, size_t buffer_size)
}
}

if (!m_encapsulated) {
if (m_multi_key_conn_rsp) {
libspdm_append_message_d(m_spdm_context, buffer, message_size);
}
} else {
if (m_multi_key_conn_req && (m_current_session_info != NULL)) {
libspdm_append_message_encap_d(m_spdm_context, m_current_session_info, true,
buffer, message_size);
}
}
printf("\n");
}

Expand Down

0 comments on commit df71d7a

Please sign in to comment.