diff --git a/spdmlib/src/common/mod.rs b/spdmlib/src/common/mod.rs index 2741ed7..8527642 100644 --- a/spdmlib/src/common/mod.rs +++ b/spdmlib/src/common/mod.rs @@ -1138,6 +1138,7 @@ pub struct SpdmConfigInfo { pub max_spdm_msg_size: u32, pub heartbeat_period: u8, // used by responder only pub secure_spdm_version: [Option; MAX_SECURE_SPDM_VERSION_COUNT], + pub mel_specification: SpdmMelSpecification, // spdm 1.3 } #[derive(Debug, Default)] @@ -1161,6 +1162,7 @@ pub struct SpdmNegotiateInfo { pub req_max_spdm_msg_size_sel: u32, // spdm 1.2 pub rsp_data_transfer_size_sel: u32, // spdm 1.2 pub rsp_max_spdm_msg_size_sel: u32, // spdm 1.2 + pub mel_specification_sel: SpdmMelSpecification, // spdm 1.3 pub multi_key_conn_req: bool, // spdm 1.3 pub multi_key_conn_rsp: bool, // spdm 1.3 } diff --git a/spdmlib/src/message/algorithm.rs b/spdmlib/src/message/algorithm.rs index ade9d22..ba16242 100644 --- a/spdmlib/src/message/algorithm.rs +++ b/spdmlib/src/message/algorithm.rs @@ -17,6 +17,7 @@ pub struct SpdmNegotiateAlgorithmsRequestPayload { pub other_params_support: SpdmAlgoOtherParams, pub base_asym_algo: SpdmBaseAsymAlgo, pub base_hash_algo: SpdmBaseHashAlgo, + pub mel_specification: SpdmMelSpecification, pub alg_struct_count: u8, pub alg_struct: [SpdmAlgStruct; MAX_SUPPORTED_ALG_STRUCTURE_COUNT], } @@ -77,7 +78,16 @@ impl SpdmCodec for SpdmNegotiateAlgorithmsRequestPayload { cnt += 0u8.encode(bytes).map_err(|_| SPDM_STATUS_BUFFER_FULL)?; // ext_hash_count - cnt += 0u16.encode(bytes).map_err(|_| SPDM_STATUS_BUFFER_FULL)?; // reserved3 + cnt += 0u8.encode(bytes).map_err(|_| SPDM_STATUS_BUFFER_FULL)?; // reserved3 + + if context.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion13 { + cnt += self + .mel_specification + .encode(bytes) + .map_err(|_| SPDM_STATUS_BUFFER_FULL)?; + } else { + cnt += 0u8.encode(bytes).map_err(|_| SPDM_STATUS_BUFFER_FULL)?; + } if context.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion11 { for algo in self.alg_struct.iter().take(self.alg_struct_count as usize) { @@ -130,7 +140,15 @@ impl SpdmCodec for SpdmNegotiateAlgorithmsRequestPayload { return None; } - u16::read(r)?; // reserved3 + u8::read(r)?; // reserved3 + + let mel_specification = + if context.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion13 { + SpdmMelSpecification::read(r)? + } else { + u8::read(r)?; + SpdmMelSpecification::default() + }; let mut alg_struct = gen_array_clone(SpdmAlgStruct::default(), 4); if context.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion11 { @@ -196,6 +214,7 @@ impl SpdmCodec for SpdmNegotiateAlgorithmsRequestPayload { other_params_support, base_asym_algo, base_hash_algo, + mel_specification, alg_struct_count, alg_struct, }) @@ -209,6 +228,7 @@ pub struct SpdmAlgorithmsResponsePayload { pub measurement_hash_algo: SpdmMeasurementHashAlgo, pub base_asym_sel: SpdmBaseAsymAlgo, pub base_hash_sel: SpdmBaseHashAlgo, + pub mel_specification_sel: SpdmMelSpecification, pub alg_struct_count: u8, pub alg_struct: [SpdmAlgStruct; 4], } @@ -265,10 +285,19 @@ impl SpdmCodec for SpdmAlgorithmsResponsePayload { .base_hash_sel .encode(bytes) .map_err(|_| SPDM_STATUS_BUFFER_FULL)?; - for _i in 0..12 { + for _i in 0..11 { cnt += 0u8.encode(bytes).map_err(|_| SPDM_STATUS_BUFFER_FULL)?; // reserved2 } + if context.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion13 { + cnt += self + .mel_specification_sel + .encode(bytes) + .map_err(|_| SPDM_STATUS_BUFFER_FULL)?; + } else { + cnt += 0u8.encode(bytes).map_err(|_| SPDM_STATUS_BUFFER_FULL)?; + } + cnt += 0u8.encode(bytes).map_err(|_| SPDM_STATUS_BUFFER_FULL)?; // ext_asym_count cnt += 0u8.encode(bytes).map_err(|_| SPDM_STATUS_BUFFER_FULL)?; // ext_hash_count @@ -429,10 +458,25 @@ impl SpdmCodec for SpdmAlgorithmsResponsePayload { return None; } - for _i in 0..12 { + for _i in 0..11 { u8::read(r)?; // reserved2 } + let mel_specification_sel = + if context.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion13 { + SpdmMelSpecification::read(r)? + } else { + u8::read(r)?; + SpdmMelSpecification::default() + }; + + //if context.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion13 { + // if context.negotiate_info.rsp_capabilities_sel.contains(SpdmResponseCapabilityFlags::MEL_CAP) + // && mel_specification_sel != SpdmMelSpecification::empty() { + // return None; + // } + //} + let ext_asym_count = u8::read(r)?; if ext_asym_count != 0 { return None; @@ -591,6 +635,7 @@ impl SpdmCodec for SpdmAlgorithmsResponsePayload { measurement_hash_algo, base_asym_sel, base_hash_sel, + mel_specification_sel, alg_struct_count, alg_struct, }) @@ -614,9 +659,11 @@ mod tests { let mut writer = Writer::init(u8_slice); let value = SpdmNegotiateAlgorithmsRequestPayload { measurement_specification: SpdmMeasurementSpecification::DMTF, - other_params_support: SpdmAlgoOtherParams::empty(), + other_params_support: SpdmAlgoOtherParams::OPAQUE_DATA_FMT1 + | SpdmAlgoOtherParams::MULTI_KEY_CONN, base_asym_algo: SpdmBaseAsymAlgo::TPM_ALG_RSASSA_2048, base_hash_algo: SpdmBaseHashAlgo::TPM_ALG_SHA_256, + mel_specification: SpdmMelSpecification::DMTF_MEL_SPEC, alg_struct_count: 4, alg_struct: [ SpdmAlgStruct { @@ -642,7 +689,7 @@ mod tests { ], }; create_spdm_context!(context); - context.negotiate_info.spdm_version_sel = SpdmVersion::SpdmVersion11; + context.negotiate_info.spdm_version_sel = SpdmVersion::SpdmVersion13; assert!(value.spdm_encode(&mut context, &mut writer).is_ok()); let mut reader = Reader::init(u8_slice); @@ -653,6 +700,10 @@ mod tests { spdm_sturct_data.measurement_specification, SpdmMeasurementSpecification::DMTF ); + assert_eq!( + spdm_sturct_data.other_params_support, + SpdmAlgoOtherParams::OPAQUE_DATA_FMT1 | SpdmAlgoOtherParams::MULTI_KEY_CONN + ); assert_eq!( spdm_sturct_data.base_asym_algo, SpdmBaseAsymAlgo::TPM_ALG_RSASSA_2048 @@ -661,6 +712,10 @@ mod tests { spdm_sturct_data.base_hash_algo, SpdmBaseHashAlgo::TPM_ALG_SHA_256 ); + assert_eq!( + spdm_sturct_data.mel_specification, + SpdmMelSpecification::DMTF_MEL_SPEC + ); assert_eq!(spdm_sturct_data.alg_struct_count, 4); assert_eq!( spdm_sturct_data.alg_struct[0].alg_type, @@ -706,12 +761,13 @@ mod tests { other_params_support: SpdmAlgoOtherParams::empty(), base_asym_algo: SpdmBaseAsymAlgo::empty(), base_hash_algo: SpdmBaseHashAlgo::empty(), + mel_specification: SpdmMelSpecification::empty(), alg_struct_count: 0, alg_struct: gen_array_clone(SpdmAlgStruct::default(), 4), }; create_spdm_context!(context); - context.negotiate_info.spdm_version_sel = SpdmVersion::SpdmVersion11; + context.negotiate_info.spdm_version_sel = SpdmVersion::SpdmVersion13; assert!(value.spdm_encode(&mut context, &mut writer).is_ok()); let mut reader = Reader::init(u8_slice); @@ -724,6 +780,10 @@ mod tests { ); assert_eq!(spdm_sturct_data.base_asym_algo, SpdmBaseAsymAlgo::empty()); assert_eq!(spdm_sturct_data.base_hash_algo, SpdmBaseHashAlgo::empty()); + assert_eq!( + spdm_sturct_data.mel_specification, + SpdmMelSpecification::empty() + ); assert_eq!(spdm_sturct_data.alg_struct_count, 0); assert_eq!(18, reader.left()); } @@ -736,6 +796,7 @@ mod tests { other_params_support: SpdmAlgoOtherParams::empty(), base_asym_algo: SpdmBaseAsymAlgo::TPM_ALG_RSASSA_2048, base_hash_algo: SpdmBaseHashAlgo::TPM_ALG_SHA_256, + mel_specification: SpdmMelSpecification::empty(), alg_struct_count: 0, alg_struct: gen_array_clone(SpdmAlgStruct::default(), 4), }; @@ -758,10 +819,12 @@ mod tests { let mut writer = Writer::init(u8_slice); let value = SpdmAlgorithmsResponsePayload { measurement_specification_sel: SpdmMeasurementSpecification::DMTF, - other_params_selection: SpdmAlgoOtherParams::empty(), + other_params_selection: SpdmAlgoOtherParams::OPAQUE_DATA_FMT1 + | SpdmAlgoOtherParams::MULTI_KEY_CONN, measurement_hash_algo: SpdmMeasurementHashAlgo::RAW_BIT_STREAM, base_asym_sel: SpdmBaseAsymAlgo::TPM_ALG_RSASSA_2048, base_hash_sel: SpdmBaseHashAlgo::TPM_ALG_SHA_256, + mel_specification_sel: SpdmMelSpecification::DMTF_MEL_SPEC, alg_struct_count: 4, alg_struct: [ SpdmAlgStruct { @@ -788,7 +851,7 @@ mod tests { }; create_spdm_context!(context); - context.negotiate_info.spdm_version_sel = SpdmVersion::SpdmVersion11; + context.negotiate_info.spdm_version_sel = SpdmVersion::SpdmVersion13; context.config_info.measurement_specification = SpdmMeasurementSpecification::DMTF; context.config_info.measurement_hash_algo = SpdmMeasurementHashAlgo::RAW_BIT_STREAM; @@ -804,6 +867,10 @@ mod tests { spdm_sturct_data.measurement_specification_sel, SpdmMeasurementSpecification::DMTF ); + assert_eq!( + spdm_sturct_data.other_params_selection, + SpdmAlgoOtherParams::OPAQUE_DATA_FMT1 | SpdmAlgoOtherParams::MULTI_KEY_CONN + ); assert_eq!( spdm_sturct_data.measurement_hash_algo, SpdmMeasurementHashAlgo::RAW_BIT_STREAM @@ -816,6 +883,10 @@ mod tests { spdm_sturct_data.base_hash_sel, SpdmBaseHashAlgo::TPM_ALG_SHA_256 ); + assert_eq!( + spdm_sturct_data.mel_specification_sel, + SpdmMelSpecification::DMTF_MEL_SPEC + ); assert_eq!(spdm_sturct_data.alg_struct_count, 4); assert_eq!( spdm_sturct_data.alg_struct[0].alg_type, @@ -862,6 +933,7 @@ mod tests { measurement_hash_algo: SpdmMeasurementHashAlgo::RAW_BIT_STREAM, base_asym_sel: SpdmBaseAsymAlgo::TPM_ALG_RSASSA_2048, base_hash_sel: SpdmBaseHashAlgo::TPM_ALG_SHA_256, + mel_specification_sel: SpdmMelSpecification::DMTF_MEL_SPEC, alg_struct_count: 0, alg_struct: gen_array_clone(SpdmAlgStruct::default(), 4), }; @@ -912,12 +984,13 @@ mod tests { measurement_hash_algo: SpdmMeasurementHashAlgo::empty(), base_asym_sel: SpdmBaseAsymAlgo::empty(), base_hash_sel: SpdmBaseHashAlgo::empty(), + mel_specification_sel: SpdmMelSpecification::empty(), alg_struct_count: 0, alg_struct: gen_array_clone(SpdmAlgStruct::default(), 4), }; create_spdm_context!(context); - context.negotiate_info.spdm_version_sel = SpdmVersion::SpdmVersion11; + context.negotiate_info.spdm_version_sel = SpdmVersion::SpdmVersion13; assert!(value.spdm_encode(&mut context, &mut writer).is_ok()); let mut reader = Reader::init(u8_slice); @@ -928,12 +1001,20 @@ mod tests { spdm_sturct_data.measurement_specification_sel, SpdmMeasurementSpecification::empty() ); + assert_eq!( + spdm_sturct_data.other_params_selection, + SpdmAlgoOtherParams::empty() + ); assert_eq!( spdm_sturct_data.measurement_hash_algo, SpdmMeasurementHashAlgo::empty() ); assert_eq!(spdm_sturct_data.base_asym_sel, SpdmBaseAsymAlgo::empty()); assert_eq!(spdm_sturct_data.base_hash_sel, SpdmBaseHashAlgo::empty()); + assert_eq!( + spdm_sturct_data.mel_specification_sel, + SpdmMelSpecification::empty() + ); assert_eq!(spdm_sturct_data.alg_struct_count, 0); assert_eq!(16, reader.left()); } diff --git a/spdmlib/src/message/mod.rs b/spdmlib/src/message/mod.rs index d09dd40..dbc2fcc 100644 --- a/spdmlib/src/message/mod.rs +++ b/spdmlib/src/message/mod.rs @@ -712,6 +712,7 @@ mod tests { other_params_support: SpdmAlgoOtherParams::empty(), base_asym_algo: SpdmBaseAsymAlgo::TPM_ALG_RSASSA_2048, base_hash_algo: SpdmBaseHashAlgo::TPM_ALG_SHA_256, + mel_specification: SpdmMelSpecification::empty(), alg_struct_count: 4, alg_struct: [ SpdmAlgStruct { @@ -798,6 +799,7 @@ mod tests { measurement_hash_algo: SpdmMeasurementHashAlgo::RAW_BIT_STREAM, base_asym_sel: SpdmBaseAsymAlgo::TPM_ALG_RSASSA_2048, base_hash_sel: SpdmBaseHashAlgo::TPM_ALG_SHA_256, + mel_specification_sel: SpdmMelSpecification::empty(), alg_struct_count: 4, alg_struct: [ SpdmAlgStruct { diff --git a/spdmlib/src/protocol/algo.rs b/spdmlib/src/protocol/algo.rs index ef3ad2f..04ba157 100644 --- a/spdmlib/src/protocol/algo.rs +++ b/spdmlib/src/protocol/algo.rs @@ -341,6 +341,55 @@ impl Codec for SpdmBaseHashAlgo { } } +bitflags! { + #[derive(Default)] + pub struct SpdmMelSpecification: u8 { + const DMTF_MEL_SPEC = 0b0000_0001; + const VALID_MASK = Self::DMTF_MEL_SPEC.bits; + } +} + +impl Codec for SpdmMelSpecification { + fn encode(&self, bytes: &mut Writer) -> Result { + self.bits().encode(bytes) + } + + fn read(r: &mut Reader) -> Option { + let bits = u8::read(r)?; + + SpdmMelSpecification::from_bits(bits & SpdmMelSpecification::VALID_MASK.bits) + } +} + +impl SpdmMelSpecification { + pub fn prioritize(&mut self, peer: SpdmMelSpecification) { + let prio_table = [SpdmMelSpecification::DMTF_MEL_SPEC]; + + *self &= peer; + for v in prio_table.iter() { + if self.bits() & v.bits() != 0 { + *self = *v; + return; + } + } + *self = SpdmMelSpecification::empty(); + } + + /// return true if no more than one is selected + /// return false if two or more is selected + pub fn is_no_more_than_one_selected(&self) -> bool { + self.bits() == 0 || self.bits() & (self.bits() - 1) == 0 + } + + pub fn is_valid(&self) -> bool { + (self.bits & Self::VALID_MASK.bits) != 0 + } + + pub fn is_valid_one_select(&self) -> bool { + self.is_no_more_than_one_selected() && self.is_valid() + } +} + enum_builder! { @U8 EnumName: SpdmStandardId; diff --git a/spdmlib/src/requester/negotiate_algorithms_req.rs b/spdmlib/src/requester/negotiate_algorithms_req.rs index dc0d410..d0497a8 100644 --- a/spdmlib/src/requester/negotiate_algorithms_req.rs +++ b/spdmlib/src/requester/negotiate_algorithms_req.rs @@ -60,6 +60,13 @@ impl RequesterContext { } } + let mel_specification = + if self.common.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion13 { + self.common.config_info.mel_specification + } else { + SpdmMelSpecification::empty() + }; + let mut alg_struct_count = 0; let mut alg_struct: [SpdmAlgStruct; MAX_SUPPORTED_ALG_STRUCTURE_COUNT] = gen_array_clone(SpdmAlgStruct::default(), MAX_SUPPORTED_ALG_STRUCTURE_COUNT); @@ -100,6 +107,7 @@ impl RequesterContext { other_params_support, base_asym_algo: self.common.config_info.base_asym_algo, base_hash_algo: self.common.config_info.base_hash_algo, + mel_specification, alg_struct_count: alg_struct_count as u8, alg_struct, }, @@ -263,6 +271,31 @@ impl RequesterContext { } } + if self.common.negotiate_info.spdm_version_sel + >= SpdmVersion::SpdmVersion13 + { + if self.common.config_info.mel_specification + != SpdmMelSpecification::empty() + && self + .common + .negotiate_info + .rsp_capabilities_sel + .contains(SpdmResponseCapabilityFlags::MEL_CAP) + { + if algorithms.mel_specification_sel + != SpdmMelSpecification::DMTF_MEL_SPEC + { + return Err(SPDM_STATUS_INVALID_MSG_FIELD); + } + } else if algorithms.mel_specification_sel + != SpdmMelSpecification::empty() + { + return Err(SPDM_STATUS_INVALID_MSG_FIELD); + } + self.common.negotiate_info.mel_specification_sel = + algorithms.mel_specification_sel; + } + self.common.append_message_a(send_buffer)?; self.common.append_message_a(&receive_buffer[..used])?; diff --git a/spdmlib/src/responder/algorithm_rsp.rs b/spdmlib/src/responder/algorithm_rsp.rs index 7e58896..63c208b 100644 --- a/spdmlib/src/responder/algorithm_rsp.rs +++ b/spdmlib/src/responder/algorithm_rsp.rs @@ -131,6 +131,18 @@ impl ResponderContext { } self.common.negotiate_info.base_hash_sel = negotiate_algorithms.base_hash_algo; self.common.negotiate_info.base_asym_sel = negotiate_algorithms.base_asym_algo; + if self.common.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion13 + && self + .common + .config_info + .rsp_capabilities + .contains(SpdmResponseCapabilityFlags::MEL_CAP) + { + self.common.negotiate_info.mel_specification_sel = + negotiate_algorithms.mel_specification; + } else { + self.common.negotiate_info.mel_specification_sel = SpdmMelSpecification::empty(); + } for alg in negotiate_algorithms .alg_struct .iter() @@ -239,6 +251,10 @@ impl ResponderContext { .negotiate_info .base_asym_sel .prioritize(self.common.config_info.base_asym_algo); + self.common + .negotiate_info + .mel_specification_sel + .prioritize(self.common.config_info.mel_specification); self.common .negotiate_info .dhe_sel @@ -316,6 +332,7 @@ impl ResponderContext { measurement_hash_algo: self.common.negotiate_info.measurement_hash_sel, base_asym_sel: self.common.negotiate_info.base_asym_sel, base_hash_sel: self.common.negotiate_info.base_hash_sel, + mel_specification_sel: self.common.negotiate_info.mel_specification_sel, alg_struct_count: 4, alg_struct: [ SpdmAlgStruct { diff --git a/test/spdmlib-test/src/common/util.rs b/test/spdmlib-test/src/common/util.rs index 9c969ae..d9ee28a 100644 --- a/test/spdmlib-test/src/common/util.rs +++ b/test/spdmlib-test/src/common/util.rs @@ -87,6 +87,7 @@ pub fn create_info() -> (SpdmConfigInfo, SpdmProvisionInfo) { Some(SecuredMessageVersion::try_from(0x10u8).unwrap()), Some(SecuredMessageVersion::try_from(0x11u8).unwrap()), ], + mel_specification: SpdmMelSpecification::DMTF_MEL_SPEC, ..Default::default() }; @@ -215,6 +216,7 @@ pub fn req_create_info() -> (SpdmConfigInfo, SpdmProvisionInfo) { Some(SecuredMessageVersion::try_from(0x10u8).unwrap()), Some(SecuredMessageVersion::try_from(0x11u8).unwrap()), ], + mel_specification: SpdmMelSpecification::DMTF_MEL_SPEC, ..Default::default() }; @@ -354,6 +356,7 @@ pub fn rsp_create_info() -> (SpdmConfigInfo, SpdmProvisionInfo) { Some(SecuredMessageVersion::try_from(0x10u8).unwrap()), Some(SecuredMessageVersion::try_from(0x11u8).unwrap()), ], + mel_specification: SpdmMelSpecification::DMTF_MEL_SPEC, ..Default::default() }; diff --git a/test/spdmlib-test/src/requester_tests/negotiate_algorithms_req.rs b/test/spdmlib-test/src/requester_tests/negotiate_algorithms_req.rs index a66dc03..3f09ddd 100644 --- a/test/spdmlib-test/src/requester_tests/negotiate_algorithms_req.rs +++ b/test/spdmlib-test/src/requester_tests/negotiate_algorithms_req.rs @@ -8,7 +8,8 @@ use crate::common::transport::PciDoeTransportEncap; use crate::common::util::create_info; use spdmlib::common::SpdmConnectionState; use spdmlib::protocol::{ - SpdmAlgoOtherParams, SpdmRequestCapabilityFlags, SpdmResponseCapabilityFlags, SpdmVersion, + SpdmAlgoOtherParams, SpdmMelSpecification, SpdmRequestCapabilityFlags, + SpdmResponseCapabilityFlags, SpdmVersion, }; use spdmlib::requester::RequesterContext; use spdmlib::{responder, secret}; @@ -113,11 +114,20 @@ fn test_case1_send_receive_spdm_algorithm() { .negotiate_info .rsp_capabilities_sel .insert(SpdmResponseCapabilityFlags::MULTI_KEY_CAP_ONLY); + requester + .common + .negotiate_info + .rsp_capabilities_sel + .insert(SpdmResponseCapabilityFlags::MEL_CAP); let status = requester.send_receive_spdm_algorithm().await.is_ok(); assert!(status); assert_eq!(requester.common.negotiate_info.multi_key_conn_req, true); assert_eq!(requester.common.negotiate_info.multi_key_conn_rsp, true); + assert_eq!( + requester.common.negotiate_info.mel_specification_sel, + SpdmMelSpecification::DMTF_MEL_SPEC + ); }; executor::block_on(future); } @@ -168,6 +178,11 @@ fn test_case2_send_receive_spdm_algorithm() { .config_info .rsp_capabilities .insert(SpdmResponseCapabilityFlags::MULTI_KEY_CAP_CONN_SEL); + responder + .common + .config_info + .rsp_capabilities + .remove(SpdmResponseCapabilityFlags::MEL_CAP); let pcidoe_transport_encap2 = Arc::new(Mutex::new(PciDoeTransportEncap {})); let shared_buffer = SharedBuffer::new(); @@ -209,6 +224,10 @@ fn test_case2_send_receive_spdm_algorithm() { assert!(status); assert_eq!(requester.common.negotiate_info.multi_key_conn_req, false); assert_eq!(requester.common.negotiate_info.multi_key_conn_rsp, false); + assert_eq!( + requester.common.negotiate_info.mel_specification_sel, + SpdmMelSpecification::empty() + ); }; executor::block_on(future); } diff --git a/test/spdmlib-test/src/responder_tests/algorithm_rsp.rs b/test/spdmlib-test/src/responder_tests/algorithm_rsp.rs index c3715f8..858a4d0 100644 --- a/test/spdmlib-test/src/responder_tests/algorithm_rsp.rs +++ b/test/spdmlib-test/src/responder_tests/algorithm_rsp.rs @@ -70,6 +70,7 @@ fn test_case0_handle_spdm_algorithm() { | SpdmAlgoOtherParams::MULTI_KEY_CONN, base_asym_algo: SpdmBaseAsymAlgo::TPM_ALG_ECDSA_ECC_NIST_P384, base_hash_algo: SpdmBaseHashAlgo::TPM_ALG_SHA_384, + mel_specification: SpdmMelSpecification::DMTF_MEL_SPEC, alg_struct_count: 4, alg_struct: [ SpdmAlgStruct { @@ -148,6 +149,10 @@ fn test_case0_handle_spdm_algorithm() { spdm_sturct_data.base_hash_algo, SpdmBaseHashAlgo::TPM_ALG_SHA_384 ); + assert_eq!( + spdm_sturct_data.mel_specification, + SpdmMelSpecification::DMTF_MEL_SPEC + ); assert_eq!(spdm_sturct_data.alg_struct_count, 4); assert_eq!( spdm_sturct_data.alg_struct[0].alg_type, @@ -222,6 +227,14 @@ fn test_case0_handle_spdm_algorithm() { ); assert_eq!(payload.base_hash_sel, SpdmBaseHashAlgo::TPM_ALG_SHA_384); assert_eq!(payload.alg_struct_count, 4); + assert_eq!( + payload.mel_specification_sel, + SpdmMelSpecification::DMTF_MEL_SPEC + ); + assert_eq!( + context.common.negotiate_info.mel_specification_sel, + SpdmMelSpecification::DMTF_MEL_SPEC + ); assert_eq!(payload.alg_struct[0].alg_type, SpdmAlgType::SpdmAlgTypeDHE); assert_eq!(