diff --git a/sh_script/build.sh b/sh_script/build.sh index f3e8dd63..18b894df 100755 --- a/sh_script/build.sh +++ b/sh_script/build.sh @@ -70,8 +70,8 @@ build() { echo_command cargo build -p spdm-responder-emu } -SPDM_EMU_PRE_BUILD_NAME=${SPDM_EMU_PRE_BUILD_NAME:-spdm-emu-v2.2.0.tar.bz2} -SPDM_EMU_PRE_BUILD_URL=${SPDM_EMU_PRE_BUILD_URL:-https://github.com/xiaoyuxlu/spdm-emu/releases/download/v2.2.0/spdm-emu-v2.2.0.tar.bz2} +SPDM_EMU_PRE_BUILD_NAME=${SPDM_EMU_PRE_BUILD_NAME:-spdm-emu-v2.3.1.tar.bz2} +SPDM_EMU_PRE_BUILD_URL=${SPDM_EMU_PRE_BUILD_URL:-https://github.com/longlongyang/spdm-emu/releases/download/2.3.1/spdm-emu-v2.3.1.tar.bz2} download_spdm_emu() { if [ -f ${SPDM_EMU_PRE_BUILD_NAME} ] @@ -89,7 +89,7 @@ RUN_RESPONDER_FEATURES=${RUN_RESPONDER_FEATURES:-spdmlib/spdm-ring,spdmlib/std,s run_with_spdm_emu() { echo "Running with spdm-emu..." - pushd spdm-emu-v2.2.0 + pushd spdm-emu-v2.3.1 echo_command ./spdm_responder_emu --ver 1.2 --trans PCI_DOE & popd sleep 5 @@ -98,7 +98,7 @@ run_with_spdm_emu() { echo_command cargo run -p spdm-responder-emu --no-default-features --features="$RUN_REQUESTER_FEATURES" & sleep 5 - pushd spdm-emu-v2.2.0 + pushd spdm-emu-v2.3.1 echo_command ./spdm_requester_emu --ver 1.2 --trans PCI_DOE popd } diff --git a/spdmlib/src/requester/key_exchange_req.rs b/spdmlib/src/requester/key_exchange_req.rs index 2d526ca5..7f39c096 100644 --- a/spdmlib/src/requester/key_exchange_req.rs +++ b/spdmlib/src/requester/key_exchange_req.rs @@ -267,8 +267,8 @@ impl<'a> RequesterContext<'a> { secure_spdm_version_sel ); - let session_id = ((INITIAL_SESSION_ID as u32) << 16) - + key_exchange_rsp.rsp_session_id as u32; + let session_id = ((key_exchange_rsp.rsp_session_id as u32) << 16) + + INITIAL_SESSION_ID as u32; let spdm_version_sel = self.common.negotiate_info.spdm_version_sel; let session = self .common diff --git a/spdmlib/src/requester/psk_exchange_req.rs b/spdmlib/src/requester/psk_exchange_req.rs index f85ca091..4b5b5afd 100644 --- a/spdmlib/src/requester/psk_exchange_req.rs +++ b/spdmlib/src/requester/psk_exchange_req.rs @@ -199,8 +199,8 @@ impl<'a> RequesterContext<'a> { 0 }; - let session_id = ((INITIAL_SESSION_ID as u32) << 16) - + psk_exchange_rsp.rsp_session_id as u32; + let session_id = ((psk_exchange_rsp.rsp_session_id as u32) << 16) + + INITIAL_SESSION_ID as u32; let spdm_version_sel = self.common.negotiate_info.spdm_version_sel; let session = self .common diff --git a/spdmlib/src/responder/key_exchange_rsp.rs b/spdmlib/src/responder/key_exchange_rsp.rs index b58356ec..16b3b431 100644 --- a/spdmlib/src/responder/key_exchange_rsp.rs +++ b/spdmlib/src/responder/key_exchange_rsp.rs @@ -257,7 +257,7 @@ impl<'a> ResponderContext<'a> { let session = session.unwrap(); let session_id = - ((key_exchange_req.unwrap().req_session_id as u32) << 16) + rsp_session_id as u32; + ((rsp_session_id as u32) << 16) + key_exchange_req.unwrap().req_session_id as u32; session.setup(session_id).unwrap(); session.set_use_psk(false); session.set_crypto_param(hash_algo, dhe_algo, aead_algo, key_schedule_algo); diff --git a/spdmlib/src/responder/psk_exchange_rsp.rs b/spdmlib/src/responder/psk_exchange_rsp.rs index 0f827fb3..b90caed2 100644 --- a/spdmlib/src/responder/psk_exchange_rsp.rs +++ b/spdmlib/src/responder/psk_exchange_rsp.rs @@ -203,7 +203,7 @@ impl<'a> ResponderContext<'a> { let session = session.unwrap(); let session_id = - ((psk_exchange_req.unwrap().req_session_id as u32) << 16) + rsp_session_id as u32; + ((rsp_session_id as u32) << 16) + psk_exchange_req.unwrap().req_session_id as u32; session.setup(session_id).unwrap(); session.set_use_psk(true); let mut psk_key = SpdmDheFinalKeyStruct {