UnitTest/TestSpdmResponder/TestSpdmResponderVersion.c
/**
  Test 7: receiving a SPDM message with a VERSION 0x04 RequestResponseCode instead
  of a GET_VERSION 0x84 one.
  Expected behavior: the responder refuses the VERSION message and produces an
  ERROR message indicating the InvalidRequest.
**/
Test 7: receiving a SPDM message with a VERSION 0x04 RequestResponseCode instead
of a GET_VERSION 0x84 one.
Expected behavior: the responder refuses the VERSION message and produces an
ERROR message indicating the InvalidRequest.
Test 7 : receiving a SPDM message with a VERSION 0x04 RequestResponseCode instead of a GET_VERSION 0x84 one . Expected behavior : the responder refuses the VERSION message and produces an ERROR message indicating the InvalidRequest .
void TestSpdmResponderVersionCase7(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 = 0x6;
  ResponseSize = sizeof(Response);
  Status = SpdmGetResponseVersion (SpdmContext, mSpdmGetVersionRequest3Size, &mSpdmGetVersionRequest3, &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_INVALID_REQUEST);
  assert_int_equal (SpdmResponse->Header.Param2, 0);
}
void TestSpdmResponderVersionCase7 ( 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 = 0x6 ; ResponseSize = sizeof ( Response ) ; Status = SpdmGetResponseVersion ( SpdmContext , mSpdmGetVersionRequest3Size , & mSpdmGetVersionRequest3 , & 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_INVALID_REQUEST ) ; assert_int_equal ( SpdmResponse -> Header . Param2 , 0 ) ; }
Test 7: receiving a SPDM message with a VERSION 0x04 RequestResponseCode instead
of a GET_VERSION 0x84 one.
Test 7 : receiving a SPDM message with a VERSION 0x04 RequestResponseCode instead of a GET_VERSION 0x84 one .