From 0f9b1837454517802307a3bff8164870a5431800 Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Fri, 26 Jul 2024 12:00:59 +1000 Subject: [PATCH] test: Remove the hello packet The hello message isn't used on QEMU [1] or SPDM-Utils [2], so let's remove it here as we don't need it and it breaks compability with other emulators. 1: https://github.com/qemu/qemu/blob/029e13a8a56a2931e7c24c0db52ae7256b932cb0/docs/specs/spdm.rst#L42 2: https://github.com/westerndigitalcorporation/spdm-utils Signed-off-by: Alistair Francis --- test/spdm-emu/src/spdm_emu.rs | 1 - test/spdm-requester-emu/src/main.rs | 43 ----------------------------- test/spdm-responder-emu/src/main.rs | 34 ----------------------- 3 files changed, 78 deletions(-) diff --git a/test/spdm-emu/src/spdm_emu.rs b/test/spdm-emu/src/spdm_emu.rs index e5d557b..fea5a16 100644 --- a/test/spdm-emu/src/spdm_emu.rs +++ b/test/spdm-emu/src/spdm_emu.rs @@ -23,7 +23,6 @@ pub const SOCKET_TRANSPORT_TYPE_PCI_DOE: u32 = 0x02; pub const SOCKET_SPDM_COMMAND_NORMAL: u32 = 0x0001; pub const SOCKET_SPDM_COMMAND_STOP: u32 = 0xFFFE; pub const SOCKET_SPDM_COMMAND_UNKOWN: u32 = 0xFFFF; -pub const SOCKET_SPDM_COMMAND_TEST: u32 = 0xDEAD; #[derive(Debug, Copy, Clone, Default)] pub struct SpdmSocketHeader { diff --git a/test/spdm-requester-emu/src/main.rs b/test/spdm-requester-emu/src/main.rs index 017f7f3..e1b80d0 100644 --- a/test/spdm-requester-emu/src/main.rs +++ b/test/spdm-requester-emu/src/main.rs @@ -63,39 +63,6 @@ extern crate alloc; use alloc::sync::Arc; use core::ops::DerefMut; -#[maybe_async::maybe_async] -async fn send_receive_hello( - stream: Arc>, - transport_encap: Arc>, - transport_type: u32, -) { - println!("send test"); - let mut payload = [0u8; 1024]; - - let mut transport_encap = transport_encap.lock(); - let transport_encap = transport_encap.deref_mut(); - let used = transport_encap - .encap( - Arc::new(b"Client Hello!\0"), - Arc::new(Mutex::new(&mut payload[..])), - false, - ) - .await - .unwrap(); - - let _buffer_size = spdm_emu::spdm_emu::send_message( - stream.clone(), - transport_type, - SOCKET_SPDM_COMMAND_TEST, - &payload[0..used], - ); - let mut buffer = [0u8; config::RECEIVER_BUFFER_SIZE]; - let (_transport_type, _command, _payload) = - spdm_emu::spdm_emu::receive_message(stream, &mut buffer[..], ST1) - .await - .unwrap(); -} - #[maybe_async::maybe_async] async fn send_receive_stop( stream: Arc>, @@ -1535,16 +1502,6 @@ fn emu_main_inner() { SOCKET_TRANSPORT_TYPE_MCTP }; - #[cfg(not(feature = "is_sync"))] - block_on(Box::pin(send_receive_hello( - socket.clone(), - transport_encap.clone(), - transport_type, - ))); - - #[cfg(feature = "is_sync")] - send_receive_hello(socket.clone(), transport_encap.clone(), transport_type); - let socket_io_transport = SocketIoTransport::new(socket.clone()); let socket_io_transport: Arc> = Arc::new(Mutex::new(socket_io_transport)); diff --git a/test/spdm-responder-emu/src/main.rs b/test/spdm-responder-emu/src/main.rs index d41289f..4b39e25 100644 --- a/test/spdm-responder-emu/src/main.rs +++ b/test/spdm-responder-emu/src/main.rs @@ -76,10 +76,6 @@ async fn process_socket_message( ); match socket_header.command.to_be() { - SOCKET_SPDM_COMMAND_TEST => { - send_hello(stream.clone(), transport_encap.clone(), res.0).await; - true - } SOCKET_SPDM_COMMAND_STOP => { send_stop(stream.clone(), transport_encap.clone(), res.0).await; false @@ -394,36 +390,6 @@ async fn handle_message( } } -#[maybe_async::maybe_async] -pub async fn send_hello( - stream: Arc>, - transport_encap: Arc>, - tranport_type: u32, -) { - println!("get hello"); - - let mut payload = [0u8; 1024]; - - let mut transport_encap = transport_encap.lock(); - let transport_encap = transport_encap.deref_mut(); - - let used = transport_encap - .encap( - Arc::new(b"Server Hello!\0"), - Arc::new(Mutex::new(&mut payload[..])), - false, - ) - .await - .unwrap(); - - let _buffer_size = spdm_emu::spdm_emu::send_message( - stream, - tranport_type, - spdm_emu::spdm_emu::SOCKET_SPDM_COMMAND_TEST, - &payload[..used], - ); -} - #[maybe_async::maybe_async] pub async fn send_unknown( stream: Arc>,