Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about SPDM message read/write between requester and responder #244

Open
owen126315 opened this issue May 8, 2023 · 5 comments
Labels
question Further information is requested

Comments

@owen126315
Copy link

I am trying to understand how requester send SPDM message over MCTP to responder through using wireshark to capture the tcp packets between requester and responder.

And I found that the captured packets seem mismatched from the SPDM message format and MCTP message format.

Is SOCKET_SPDM_COMMAND_NORMAL necessary for SPDM request/respond?
Why the write function would split the request into four packets?
Why the mctp header information is not included in the packet payload?

bool send_platform_data(const SOCKET socket, uint32_t command,
const uint8_t *send_buffer, size_t bytes_to_send)
{
bool result;
uint32_t request;
uint32_t transport_type;
request = command;
result = write_data32(socket, request);
if (!result) {
return result;
}
printf("Platform port Transmit command: ");
request = htonl(request);
dump_data((uint8_t *)&request, sizeof(uint32_t));
printf("\n");
result = write_data32(socket, m_use_transport_layer);
if (!result) {
return result;
}
printf("Platform port Transmit transport_type: ");
transport_type = ntohl(m_use_transport_layer);
dump_data((uint8_t *)&transport_type, sizeof(uint32_t));
printf("\n");
result = write_multiple_bytes(socket, send_buffer,
(uint32_t)bytes_to_send);
if (!result) {
return result;
}
switch (command) {
case SOCKET_SPDM_COMMAND_SHUTDOWN:
close_pcap_packet_file();
break;
case SOCKET_SPDM_COMMAND_NORMAL:
if (m_use_transport_layer == SOCKET_TRANSPORT_TYPE_MCTP) {
/* Append mctp_header_t for PCAP*/
mctp_header_t mctp_header;
mctp_header.header_version = 0;
mctp_header.destination_id = 0;
mctp_header.source_id = 0;
mctp_header.message_tag = 0xC0;
append_pcap_packet_data(&mctp_header,
sizeof(mctp_header),
send_buffer, bytes_to_send);
} else {
append_pcap_packet_data(NULL, 0, send_buffer,
bytes_to_send);
}
break;
}
return true;
}

@jyao1 jyao1 added the question Further information is requested label May 8, 2023
@jyao1
Copy link
Member

jyao1 commented May 8, 2023

SPDM-EMU implements a mechanism to send message via socket, not MCTP.

MCTP or DOE is just treated as payload in the TCP socket message.

@owen126315
Copy link
Author

(Please correct me if I am wrong :))
Therefore, SPDM-EMU does not construct complete MCTP packets.
Instead, it just adding the MCTP message header to the front of SPDM messages to construct MCTP messages, the MCTP transport header is not included. Only the green block is constructed.

If I want to encode the SPDM messages into complete MCTP packets, do I need to construct it by myself?

image

@jyao1
Copy link
Member

jyao1 commented May 10, 2023

yes, you are right. In current implementation, we just add MCTP message header. There is no MCTP transport header. The purpose of the SPDM-EMU is to test SPDM, not MCTP.

Feel free to proposal a patch to add MCTP transport header, if you see there is such need.

@FangYuFan
Copy link

yes, you are right. In current implementation, we just add MCTP message header. There is no MCTP transport header. The purpose of the SPDM-EMU is to test SPDM, not MCTP.

Feel free to proposal a patch to add MCTP transport header, if you see there is such need.

Hi Yao,
Do you know where the official MCTP protocol source code library is located? Because I couldn't find any relevant repository under the DMTF organization

@jyao1
Copy link
Member

jyao1 commented Aug 15, 2023

Do you know where the official MCTP protocol source code library is located? Because I couldn't find any relevant repository under the DMTF organization

No. I don't know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants