UnitTest/TestSpdmResponder/TestSpdmResponderVersion.c
/**
  Test 5: receiving a correct GET_VERSION from the requester, but the responder could not
  produce the response in time.
  TODO: As from version 1.0.0, a GET_VERSION message should not receive an ERROR message
  indicating the ResponseNotReady. No timing parameters have been agreed yet.
**/
Test 5: receiving a correct GET_VERSION from the requester, but the responder could not
produce the response in time.
TODO: As from version 1.0.0, a GET_VERSION message should not receive an ERROR message
indicating the ResponseNotReady. No timing parameters have been agreed yet.
Test 5 : receiving a correct GET_VERSION from the requester but the responder could not produce the response in time . TODO : As from version 1 . 0 . 0 a GET_VERSION message should not receive an ERROR message indicating the ResponseNotReady . No timing parameters have been agreed yet .
void TestSpdmResponderVersionCase5(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;
  SPDM_ERROR_DATA_RESPONSE_NOT_READY *ErrorData;
  SpdmTestContext = *state;
  SpdmContext = SpdmTestContext->SpdmContext;
  SpdmTestContext->CaseId = 0x5;
  SpdmContext->ResponseState = SpdmResponseStateNotReady;
  ResponseSize = sizeof(Response);
  Status = SpdmGetResponseVersion (SpdmContext, mSpdmGetVersionRequest1Size, &mSpdmGetVersionRequest1, &ResponseSize, Response);
  assert_int_equal (Status, RETURN_SUCCESS);
  assert_int_equal (ResponseSize, sizeof(SPDM_ERROR_RESPONSE) + sizeof(SPDM_ERROR_DATA_RESPONSE_NOT_READY));
  SpdmResponse = (VOID *)Response;
  ErrorData = (SPDM_ERROR_DATA_RESPONSE_NOT_READY*)(&SpdmResponse->Reserved);
  assert_int_equal (SpdmResponse->Header.RequestResponseCode, SPDM_ERROR);
  assert_int_equal (SpdmResponse->Header.Param1, SPDM_ERROR_CODE_RESPONSE_NOT_READY);
  assert_int_equal (SpdmResponse->Header.Param2, 0);
  assert_int_equal (SpdmContext->ResponseState, SpdmResponseStateNotReady);
  assert_int_equal (ErrorData->RequestCode, SPDM_GET_VERSION);
}
void TestSpdmResponderVersionCase5 ( 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 ; SPDM_ERROR_DATA_RESPONSE_NOT_READY * ErrorData ; SpdmTestContext = * state ; SpdmContext = SpdmTestContext -> SpdmContext ; SpdmTestContext -> CaseId = 0x5 ; SpdmContext -> ResponseState = SpdmResponseStateNotReady ; ResponseSize = sizeof ( Response ) ; Status = SpdmGetResponseVersion ( SpdmContext , mSpdmGetVersionRequest1Size , & mSpdmGetVersionRequest1 , & ResponseSize , Response ) ; assert_int_equal ( Status , RETURN_SUCCESS ) ; assert_int_equal ( ResponseSize , sizeof ( SPDM_ERROR_RESPONSE ) + sizeof ( SPDM_ERROR_DATA_RESPONSE_NOT_READY ) ) ; SpdmResponse = ( VOID * ) Response ; ErrorData = ( SPDM_ERROR_DATA_RESPONSE_NOT_READY * ) ( & SpdmResponse -> Reserved ) ; assert_int_equal ( SpdmResponse -> Header . RequestResponseCode , SPDM_ERROR ) ; assert_int_equal ( SpdmResponse -> Header . Param1 , SPDM_ERROR_CODE_RESPONSE_NOT_READY ) ; assert_int_equal ( SpdmResponse -> Header . Param2 , 0 ) ; assert_int_equal ( SpdmContext -> ResponseState , SpdmResponseStateNotReady ) ; assert_int_equal ( ErrorData -> RequestCode , SPDM_GET_VERSION ) ; }
Test 5: receiving a correct GET_VERSION from the requester, but the responder could not
produce the response in time.
Test 5 : receiving a correct GET_VERSION from the requester but the responder could not produce the response in time .