Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPDM 1.3 Add Capability Support #159

Merged

Conversation

IntelCaisui
Copy link
Contributor

@IntelCaisui IntelCaisui commented Dec 23, 2024

Fix: #136

This Patch Adds:

  1. Definitions of get_capacity_req and capacity_rep added in spdm
    1.3.
  2. Capability Violation checks for newly added flags.
  3. Unit test cases for capability 1.3 fields.
  4. Error Response if responder does not support Large SPDM message
    transfer mechanism while Requester set bit0 of param1 in capability
    request message. (Spec requested).

Remains:

  1. Config info of capability as 1.2 since relative 1.3 features not
    implemented.
  2. Supported Algorithms extend capability bit (Param 1 Bit 0) as
    unimplemented. Will track this feature in another issue.

@IntelCaisui IntelCaisui force-pushed the 241224_spdm13_capability_support branch from 44fbb38 to 6470b22 Compare December 25, 2024 18:14
{
return None;
}
if context.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion13
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capabilities Flags checks are aligned with spdm spec 1.3 and libspdm implementation.

This Patch Adds:
1. Definitions of get_capacity_req and capacity_rep added in spdm
  1.3.
2. Capability Violation checks for newly added flags.
3. Unit test cases for capability 1.3 fields.
4. Error Response if responder does not support Large SPDM message
  transfer mechanism while Requester set bit0 of param1 in capability
  request message. (Spec requested).

Remains:
1. Config info of capability as 1.2 since relative 1.3 features not
  implemented.
2. Supported Algorithms extend capability bit (Param 1 Bit 0) as
  unimplemented. Will track this feature in another issue.
@IntelCaisui IntelCaisui force-pushed the 241224_spdm13_capability_support branch from 6470b22 to 057be89 Compare December 25, 2024 18:19
@@ -54,7 +54,19 @@ impl SpdmCodec for SpdmGetCapabilitiesRequestPayload {
context: &mut common::SpdmContext,
r: &mut Reader,
) -> Option<SpdmGetCapabilitiesRequestPayload> {
u8::read(r)?; // param1
if context.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion13 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the GET_CAPABILITIES request sets Bit 0 of Param1 to a value of 1 and the Responder
does not support the Large SPDM message transfer mechanism ( CHUNK_CAP=0 ), the Responder shall send an
ERROR message of ErrorCode=InvalidRequest .

@@ -43,3 +43,135 @@ fn test_capability_struct() {
let res = SpdmCapabilitiesResponsePayload::spdm_read(&mut context, &mut reader);
assert!(res.is_none());
}

#[test]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spdm 1.3 capacity test cases.

@@ -51,7 +51,12 @@ pub fn create_info() -> (SpdmConfigInfo, SpdmProvisionInfo) {
| SpdmResponseCapabilityFlags::HBEAT_CAP
| SpdmResponseCapabilityFlags::KEY_UPD_CAP
| SpdmResponseCapabilityFlags::MUT_AUTH_CAP
| SpdmResponseCapabilityFlags::ENCAP_CAP,
| SpdmResponseCapabilityFlags::EP_INFO_CAP_NO_SIG
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enable the capacity settings in unit tests.
Could change this configuration based on implementation in the future.

@@ -51,7 +51,12 @@ pub fn create_info() -> (SpdmConfigInfo, SpdmProvisionInfo) {
| SpdmResponseCapabilityFlags::HBEAT_CAP
| SpdmResponseCapabilityFlags::KEY_UPD_CAP
| SpdmResponseCapabilityFlags::MUT_AUTH_CAP
| SpdmResponseCapabilityFlags::ENCAP_CAP,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated with line 50. Delete it.

@@ -111,3 +137,23 @@ impl Codec for SpdmResponseCapabilityFlags {
SpdmResponseCapabilityFlags::from_bits(bits & SpdmResponseCapabilityFlags::VALID_MASK.bits)
}
}

bitflags! {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get_capacity_req/ capacity_rsp param1 definition structure.

if context.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion13
&& flags.contains(SpdmRequestCapabilityFlags::EP_INFO_CAP_SIG)
{
return None;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align with libspdm implementation.
Cannot support ep info signature without certificate or public key capabilities.

if context.negotiate_info.spdm_version_sel >= SpdmVersion::SpdmVersion13
&& flags.contains(SpdmRequestCapabilityFlags::EVENT_CAP)
{
return None;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align with libspdm implementation.
Cannot support event without key exchange capabilities.

@jyao1 jyao1 merged commit 857fe55 into ccc-spdm-tools:main Dec 26, 2024
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SPDM 1.3 add capability support
2 participants