Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

correct the session id creation. #399

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sh_script/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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} ]
Expand All @@ -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
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions spdmlib/src/requester/key_exchange_req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spdmlib/src/requester/psk_exchange_req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spdmlib/src/responder/key_exchange_rsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion spdmlib/src/responder/psk_exchange_rsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down