mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
spdm-socket: add seperate send/recv functions
This is to support uni-directional transports such as SPDM over Storage. As specified by the DMTF DSP0286. Also update spdm_socket_rsp() to use the new send()/receive() functions. For the case of spdm_socket_receive(), this allows us to do error checking in one place with the addition of spdm_socket_command_valid(). Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
committed by
Klaus Jensen
parent
e090e0312d
commit
169e8d0c4b
@@ -50,6 +50,35 @@ uint32_t spdm_socket_rsp(const int socket, uint32_t transport_type,
|
||||
void *req, uint32_t req_len,
|
||||
void *rsp, uint32_t rsp_len);
|
||||
|
||||
/**
|
||||
* spdm_socket_rsp: Receive a message from an SPDM server
|
||||
* @socket: socket returned from spdm_socket_connect()
|
||||
* @transport_type: SPDM_SOCKET_TRANSPORT_TYPE_* macro
|
||||
* @rsp: response buffer
|
||||
* @rsp_len: response buffer length
|
||||
*
|
||||
* Receives a message from the SPDM server and returns the number of bytes
|
||||
* received or 0 on failure. This can be used to receive a message from the SPDM
|
||||
* server without sending anything first.
|
||||
*/
|
||||
uint32_t spdm_socket_receive(const int socket, uint32_t transport_type,
|
||||
void *rsp, uint32_t rsp_len);
|
||||
|
||||
/**
|
||||
* spdm_socket_rsp: Sends a message to an SPDM server
|
||||
* @socket: socket returned from spdm_socket_connect()
|
||||
* @socket_cmd: socket command type (normal/if_recv/if_send etc...)
|
||||
* @transport_type: SPDM_SOCKET_TRANSPORT_TYPE_* macro
|
||||
* @req: request buffer
|
||||
* @req_len: request buffer length
|
||||
*
|
||||
* Sends platform data to a SPDM server on socket, returns true on success.
|
||||
* The response from the server must then be fetched by using
|
||||
* spdm_socket_receive().
|
||||
*/
|
||||
bool spdm_socket_send(const int socket, uint32_t socket_cmd,
|
||||
uint32_t transport_type, void *req, uint32_t req_len);
|
||||
|
||||
/**
|
||||
* spdm_socket_close: send a shutdown command to the server
|
||||
* @socket: socket returned from spdm_socket_connect()
|
||||
@@ -60,6 +89,9 @@ uint32_t spdm_socket_rsp(const int socket, uint32_t transport_type,
|
||||
void spdm_socket_close(const int socket, uint32_t transport_type);
|
||||
|
||||
#define SPDM_SOCKET_COMMAND_NORMAL 0x0001
|
||||
#define SPDM_SOCKET_STORAGE_CMD_IF_SEND 0x0002
|
||||
#define SPDM_SOCKET_STORAGE_CMD_IF_RECV 0x0003
|
||||
#define SOCKET_SPDM_STORAGE_ACK_STATUS 0x0004
|
||||
#define SPDM_SOCKET_COMMAND_OOB_ENCAP_KEY_UPDATE 0x8001
|
||||
#define SPDM_SOCKET_COMMAND_CONTINUE 0xFFFD
|
||||
#define SPDM_SOCKET_COMMAND_SHUTDOWN 0xFFFE
|
||||
|
||||
Reference in New Issue
Block a user