Skip to content

Commit

Permalink
add SpdmVersion13 enum value.
Browse files Browse the repository at this point in the history
Signed-off-by: Yang, Longlong <[email protected]>
  • Loading branch information
longlongyang committed Jan 22, 2024
1 parent 48c79b2 commit 798d607
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spdmlib/src/protocol/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub enum SpdmVersion {
SpdmVersion10,
SpdmVersion11,
SpdmVersion12,
SpdmVersion13,
}

impl Default for SpdmVersion {
Expand All @@ -27,6 +28,8 @@ impl TryFrom<u8> for SpdmVersion {
Ok(SpdmVersion::SpdmVersion11)
} else if untrusted_spdm_version == 0x12 {
Ok(SpdmVersion::SpdmVersion12)
} else if untrusted_spdm_version == 0x13 {
Ok(SpdmVersion::SpdmVersion13)
} else {
Err(())
}
Expand All @@ -39,6 +42,7 @@ impl From<SpdmVersion> for u8 {
SpdmVersion::SpdmVersion10 => 0x10,
SpdmVersion::SpdmVersion11 => 0x11,
SpdmVersion::SpdmVersion12 => 0x12,
SpdmVersion::SpdmVersion13 => 0x13,
}
}
}
Expand All @@ -60,7 +64,7 @@ impl Codec for SpdmVersion {
}
}

pub const MAX_SPDM_VERSION_COUNT: usize = 3;
pub const MAX_SPDM_VERSION_COUNT: usize = 4;

//SPDM V1.2 signing prefix context
pub const SPDM_VERSION_1_2_SIGNING_PREFIX_CONTEXT: [u8; 64] = [
Expand Down
2 changes: 2 additions & 0 deletions test/spdm-requester-emu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ async fn test_spdm(
Some(SpdmVersion::SpdmVersion10),
Some(SpdmVersion::SpdmVersion11),
Some(SpdmVersion::SpdmVersion12),
None,
],
req_capabilities,
req_ct_exponent: 0,
Expand Down Expand Up @@ -460,6 +461,7 @@ async fn test_idekm_tdisp(
Some(SpdmVersion::SpdmVersion10),
Some(SpdmVersion::SpdmVersion11),
Some(SpdmVersion::SpdmVersion12),
None,
],
req_capabilities,
req_ct_exponent: 0,
Expand Down
1 change: 1 addition & 0 deletions test/spdm-responder-emu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ async fn handle_message(
Some(SpdmVersion::SpdmVersion10),
Some(SpdmVersion::SpdmVersion11),
Some(SpdmVersion::SpdmVersion12),
None,
],
rsp_capabilities,
rsp_ct_exponent: 0,
Expand Down

0 comments on commit 798d607

Please sign in to comment.