DMTF / SPDM-Responder-Validator

BSD 3-Clause "New" or "Revised" License
10 stars 14 forks source link

conformance_test2_capabilities: fixup cap flags #86

Closed twilfredo closed 1 year ago

twilfredo commented 1 year ago

Problem

When running the test suite against a libspdm responder, I noticed a failure at:

  test case 2.5 (spdm_test_case_capabilities_success_12) - start 
    test assertion 2.5.1 - FAIL response size - 4

I think the error is caught here: https://github.com/DMTF/libspdm/blob/1444a7863bd4bcd114f35904d56b6578bc9bc387/library/spdm_responder_lib/libspdm_rsp_capabilities.c#L186

But I'm not sure why the test does not see an error return status in from libspdm_send_receive_data(), instead it fails later at checking the response size. Any ideas?

Fix

Alternatively, if chunk isn't preferred, I think we need to assert that spdm_request.data_transfer_size == spdm_request.max_spdm_msg_size

With this change, the test will now pass.

test case 2.5 (spdm_test_case_capabilities_success_12) - setup enter
  test case 2.5 (spdm_test_case_capabilities_success_12) - setup exit (1)
  test case 2.5 (spdm_test_case_capabilities_success_12) - start
    test assertion 2.5.1 - PASS response size - 20 
    test assertion 2.5.2 - PASS response code - 0x61
    test assertion 2.5.3 - PASS response version - 0x12
    test assertion 2.5.4 - PASS response flags - 0x003e02d6
    test assertion 2.5.5 - PASS response flags - 0x003e02d6
    test assertion 2.5.6 - PASS response flags - 0x003e02d6
    test assertion 2.5.7 - PASS response flags - 0x003e02d6
    test assertion 2.5.8 - PASS response flags - 0x003e02d6
    test assertion 2.5.13 - PASS response data_transfer_size - 0x00001fdd
    test assertion 2.5.14 - PASS response max_spdm_msg_size - 0x00002000, data_transfer_size - 0x00001fdd
    test assertion 2.5.15 - PASS response flags - 0x003e02d6
  test case 2.5 (spdm_test_case_capabilities_success_12) - stop
  test case 2.5 (spdm_test_case_capabilities_success_12) - teardown enter
steven-bellock commented 1 year ago

The documentation (https://github.com/DMTF/SPDM-Responder-Validator/blob/main/doc/2.Capabilities.md) also says that the Requester's CHUNK_CAP is set.

Requester -> GET_CAPABILITIES {SPDMVersion=0x12, Param1=0, Param2=0, CTExponent, Flags=CERT_CAP|CHAL_CAP|ENCRYPT_CAP|MAC_CAP|MUT_AUTH_CAP|KEY_EX_CAP|PSK_CAP=1|ENCAP_CAP|HBEAT_CAP|KEY_UPD_CAP|CHUNK_CAP, DataTransferSize, MaxSPDMmsgSize}