UnitTest/TestSpdmResponder/TestSpdmResponderVersion.c
/**
  Test 3: receiving a correct GET_VERSION from the requester, but the responder is in
  a Busy state.
  Expected behavior: the responder accepts the request, but produces an ERROR message
  indicating the Buse state.
**/
Test 3: receiving a correct GET_VERSION from the requester, but the responder is in
a Busy state.
Expected behavior: the responder accepts the request, but produces an ERROR message
indicating the Buse state.
Test 3 : receiving a correct GET_VERSION from the requester but the responder is in a Busy state . Expected behavior : the responder accepts the request but produces an ERROR message indicating the Buse state .
void TestSpdmResponderVersionCase3(void **state) {
  RETURN_STATUS        Status;
  SPDM_TEST_CONTEXT    *SpdmTestContext;
  SPDM_DEVICE_CONTEXT  *SpdmContext;
  UINTN                ResponseSize;
  UINT8                Response[MAX_SPDM_MESSAGE_BUFFER_SIZE];
  SPDM_VERSION_RESPONSE *SpdmResponse;
  SpdmTestContext = *state;
  SpdmContext = SpdmTestContext->SpdmContext;
  SpdmTestContext->CaseId = 0x3;
  SpdmContext->ResponseState = SpdmResponseStateBusy;
  ResponseSize = sizeof(Response);
  Status = SpdmGetResponseVersion (SpdmContext, mSpdmGetVersionRequest1Size, &mSpdmGetVersionRequest1, &ResponseSize, Response);
  assert_int_equal (Status, RETURN_SUCCESS);
  assert_int_equal (ResponseSize, sizeof(SPDM_ERROR_RESPONSE));
  SpdmResponse = (VOID *)Response;
  assert_int_equal (SpdmResponse->Header.RequestResponseCode, SPDM_ERROR);
  assert_int_equal (SpdmResponse->Header.Param1, SPDM_ERROR_CODE_BUSY);
  assert_int_equal (SpdmResponse->Header.Param2, 0);
  assert_int_equal (SpdmContext->ResponseState, SpdmResponseStateBusy);
}
void TestSpdmResponderVersionCase3 ( void * * state ) { RETURN_STATUS Status ; SPDM_TEST_CONTEXT * SpdmTestContext ; SPDM_DEVICE_CONTEXT * SpdmContext ; UINTN ResponseSize ; UINT8 Response [ MAX_SPDM_MESSAGE_BUFFER_SIZE ] ; SPDM_VERSION_RESPONSE * SpdmResponse ; SpdmTestContext = * state ; SpdmContext = SpdmTestContext -> SpdmContext ; SpdmTestContext -> CaseId = 0x3 ; SpdmContext -> ResponseState = SpdmResponseStateBusy ; ResponseSize = sizeof ( Response ) ; Status = SpdmGetResponseVersion ( SpdmContext , mSpdmGetVersionRequest1Size , & mSpdmGetVersionRequest1 , & ResponseSize , Response ) ; assert_int_equal ( Status , RETURN_SUCCESS ) ; assert_int_equal ( ResponseSize , sizeof ( SPDM_ERROR_RESPONSE ) ) ; SpdmResponse = ( VOID * ) Response ; assert_int_equal ( SpdmResponse -> Header . RequestResponseCode , SPDM_ERROR ) ; assert_int_equal ( SpdmResponse -> Header . Param1 , SPDM_ERROR_CODE_BUSY ) ; assert_int_equal ( SpdmResponse -> Header . Param2 , 0 ) ; assert_int_equal ( SpdmContext -> ResponseState , SpdmResponseStateBusy ) ; }
Test 3: receiving a correct GET_VERSION from the requester, but the responder is in
a Busy state.
Test 3 : receiving a correct GET_VERSION from the requester but the responder is in a Busy state .