UnitTest/TestSpdmResponder/TestSpdmResponderVersion.c
/**
  Test 4: receiving a correct GET_VERSION from the requester, but the responder requires
  resynchronization with the requester.
  Expected behavior: the requester resets the communication upon receiving the GET_VERSION
  message, fulfilling the resynchronization. A valid VERSION message is produced.
**/
Test 4: receiving a correct GET_VERSION from the requester, but the responder requires
resynchronization with the requester.
Expected behavior: the requester resets the communication upon receiving the GET_VERSION
message, fulfilling the resynchronization. A valid VERSION message is produced.
Test 4 : receiving a correct GET_VERSION from the requester but the responder requires resynchronization with the requester . Expected behavior : the requester resets the communication upon receiving the GET_VERSION message fulfilling the resynchronization . A valid VERSION message is produced .
void TestSpdmResponderVersionCase4(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 = 0x4;
  SpdmContext->ResponseState = SpdmResponseStateNeedResync;
  ResponseSize = sizeof(Response);
  Status = SpdmGetResponseVersion (SpdmContext, mSpdmGetVersionRequest1Size, &mSpdmGetVersionRequest1, &ResponseSize, Response);
  assert_int_equal (Status, RETURN_SUCCESS);
  assert_int_equal (ResponseSize, sizeof(SPDM_VERSION_RESPONSE) + DEFAULT_SPDM_VERSION_ENTRY_COUNT * sizeof(SPDM_VERSION_NUMBER));
  SpdmResponse = (VOID *)Response;
  assert_int_equal (SpdmResponse->Header.RequestResponseCode, SPDM_VERSION);
  assert_int_equal (SpdmContext->ResponseState, SpdmResponseStateNormal);
}
void TestSpdmResponderVersionCase4 ( 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 = 0x4 ; SpdmContext -> ResponseState = SpdmResponseStateNeedResync ; ResponseSize = sizeof ( Response ) ; Status = SpdmGetResponseVersion ( SpdmContext , mSpdmGetVersionRequest1Size , & mSpdmGetVersionRequest1 , & ResponseSize , Response ) ; assert_int_equal ( Status , RETURN_SUCCESS ) ; assert_int_equal ( ResponseSize , sizeof ( SPDM_VERSION_RESPONSE ) + DEFAULT_SPDM_VERSION_ENTRY_COUNT * sizeof ( SPDM_VERSION_NUMBER ) ) ; SpdmResponse = ( VOID * ) Response ; assert_int_equal ( SpdmResponse -> Header . RequestResponseCode , SPDM_VERSION ) ; assert_int_equal ( SpdmContext -> ResponseState , SpdmResponseStateNormal ) ; }
Test 4: receiving a correct GET_VERSION from the requester, but the responder requires
resynchronization with the requester.
Test 4 : receiving a correct GET_VERSION from the requester but the responder requires resynchronization with the requester .