Skip to content

Commit

Permalink
test: spdm-requester-emu: Remove the hello packet
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
alistair23 authored and jyao1 committed Jul 30, 2024
1 parent ba86f84 commit 2668874
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions test/spdm-requester-emu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Mutex<TcpStream>>,
transport_encap: Arc<Mutex<dyn common::SpdmTransportEncap + Send + Sync>>,
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<Mutex<TcpStream>>,
Expand Down Expand Up @@ -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<Mutex<dyn SpdmDeviceIo + Send + Sync>> =
Arc::new(Mutex::new(socket_io_transport));
Expand Down

0 comments on commit 2668874

Please sign in to comment.