XilinxProcessorIPLib/drivers/hdcp22_tx_dp/src/xhdcp22_tx.c
static XHdcp22_Tx_StateType Xhdcp22Tx_StateA1_Sk0(XHdcp22_Tx *InstancePtr)
{
	int Result = XST_SUCCESS;
	u8 HPrime[XHDCP22_TX_H_PRIME_SIZE];

	XHdcp22_Tx_PairingInfo *PairingInfoPtr =
						(XHdcp22_Tx_PairingInfo *)InstancePtr->Info.StateContext;
	XHdcp22_Tx_DDCMessage *MsgPtr = (XHdcp22_Tx_DDCMessage *)InstancePtr->MessageBuffer;

	/* Wait for the receiver to respond within 1 second.
	 * If the receiver has timed out we go to state A0.
	 * If the receiver is busy, we stay in this state (return from polling).
	 * If the receiver has finished, but the message was not handled yet,
	 * we handle the message.*/
	Result = XHdcp22Tx_WaitForReceiver(InstancePtr, sizeof(XHdcp22_Tx_AKESendHPrime), FALSE);
	if (Result != XST_SUCCESS) {
		return XHDCP22_TX_STATE_A0;
	}
	if (InstancePtr->Info.MsgAvailable == (FALSE)) {
		return XHDCP22_TX_STATE_A1_SK0;
	}

	/* Log after waiting */
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_STATE,
	(u16)XHDCP22_TX_STATE_A1_SK0);

	/* Receive the expected message */
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_RX_H1);
	Result = XHdcp22Tx_ReceiveMsg(InstancePtr, XHDCP22_TX_AKE_SEND_H_PRIME,
									sizeof(XHdcp22_Tx_AKESendHPrime));
	if (Result != XST_SUCCESS) {
		return XHDCP22_TX_STATE_A0;
	}

	xdbg_printf(XDBG_DEBUG_GENERAL,"HDCP22TX: Reading Done for H'\n\r");

	/* Verify the received H' */
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
								 XHDCP22_TX_LOG_DBG_COMPUTE_H);
	XHdcp22Tx_ComputeHPrime(InstancePtr->Info.Rrx, PairingInfoPtr->RxCaps,
							InstancePtr->Info.Rtx, XHdcp22_Tx_TxCaps,
							PairingInfoPtr->Km, HPrime);
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
								 XHDCP22_TX_LOG_DBG_COMPUTE_H_DONE);

	if(memcmp(MsgPtr->Message.AKESendHPrime.HPrime, HPrime, sizeof(HPrime)) != 0) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
		                XHDCP22_TX_LOG_DBG_COMPARE_H_FAIL);
		XHdcp22Tx_InvalidatePairingInfo(InstancePtr, PairingInfoPtr->ReceiverId);
		return XHDCP22_TX_STATE_A0;
	}
	return XHDCP22_TX_STATE_A2;
}
/******************************************************************************/
/**
*
* This function executes a part of the A1 state functionality of the HDCP2.2
* TX protocol.
* It handles a part of the  'Stored Km' scenario and receives and verifies
* H'.
*
* @param  InstancePtr is a pointer to the XHdcp22Tx core instance.
*
* @return
*         - XHDCP22_TX_STATE_A0 on errors.
*         - XHDCP22_TX_STATE_A1_SK0 if busy waiting for the
*         - XHDCP22_TX_AKE_SEND_H_PRIME message.
*         - XHDCP22_TX_STATE_A2 if authentication is done.
*
* @note   None.
*
******************************************************************************/
This function executes a part of the A1 state functionality of the HDCP2.2
TX protocol.
It handles a part of the  'Stored Km' scenario and receives and verifies
H'.
This function executes a part of the A1 state functionality of the HDCP2 . 2 TX protocol . It handles a part of the ' Stored Km ' scenario and receives and verifies H ' .
static XHdcp22_Tx_StateType Xhdcp22Tx_StateA1_Sk0(XHdcp22_Tx *InstancePtr)
{
	int Result = XST_SUCCESS;
	u8 HPrime[XHDCP22_TX_H_PRIME_SIZE];
	XHdcp22_Tx_PairingInfo *PairingInfoPtr =
						(XHdcp22_Tx_PairingInfo *)InstancePtr->Info.StateContext;
	XHdcp22_Tx_DDCMessage *MsgPtr = (XHdcp22_Tx_DDCMessage *)InstancePtr->MessageBuffer;
	Result = XHdcp22Tx_WaitForReceiver(InstancePtr, sizeof(XHdcp22_Tx_AKESendHPrime), FALSE);
	if (Result != XST_SUCCESS) {
		return XHDCP22_TX_STATE_A0;
	}
	if (InstancePtr->Info.MsgAvailable == (FALSE)) {
		return XHDCP22_TX_STATE_A1_SK0;
	}
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_STATE,
	(u16)XHDCP22_TX_STATE_A1_SK0);
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_RX_H1);
	Result = XHdcp22Tx_ReceiveMsg(InstancePtr, XHDCP22_TX_AKE_SEND_H_PRIME,
									sizeof(XHdcp22_Tx_AKESendHPrime));
	if (Result != XST_SUCCESS) {
		return XHDCP22_TX_STATE_A0;
	}
	xdbg_printf(XDBG_DEBUG_GENERAL,"HDCP22TX: Reading Done for H'\n\r");
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
								 XHDCP22_TX_LOG_DBG_COMPUTE_H);
	XHdcp22Tx_ComputeHPrime(InstancePtr->Info.Rrx, PairingInfoPtr->RxCaps,
							InstancePtr->Info.Rtx, XHdcp22_Tx_TxCaps,
							PairingInfoPtr->Km, HPrime);
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
								 XHDCP22_TX_LOG_DBG_COMPUTE_H_DONE);
	if(memcmp(MsgPtr->Message.AKESendHPrime.HPrime, HPrime, sizeof(HPrime)) != 0) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
		                XHDCP22_TX_LOG_DBG_COMPARE_H_FAIL);
		XHdcp22Tx_InvalidatePairingInfo(InstancePtr, PairingInfoPtr->ReceiverId);
		return XHDCP22_TX_STATE_A0;
	}
	return XHDCP22_TX_STATE_A2;
}
static XHdcp22_Tx_StateType Xhdcp22Tx_StateA1_Sk0 ( XHdcp22_Tx * InstancePtr ) { int Result = XST_SUCCESS ; u8 HPrime [ XHDCP22_TX_H_PRIME_SIZE ] ; XHdcp22_Tx_PairingInfo * PairingInfoPtr = ( XHdcp22_Tx_PairingInfo * ) InstancePtr -> Info . StateContext ; XHdcp22_Tx_DDCMessage * MsgPtr = ( XHdcp22_Tx_DDCMessage * ) InstancePtr -> MessageBuffer ; Result = XHdcp22Tx_WaitForReceiver ( InstancePtr , sizeof ( XHdcp22_Tx_AKESendHPrime ) , FALSE ) ; if ( Result != XST_SUCCESS ) { return XHDCP22_TX_STATE_A0 ; } if ( InstancePtr -> Info . MsgAvailable == ( FALSE ) ) { return XHDCP22_TX_STATE_A1_SK0 ; } XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_STATE , ( u16 ) XHDCP22_TX_STATE_A1_SK0 ) ; XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_RX_H1 ) ; Result = XHdcp22Tx_ReceiveMsg ( InstancePtr , XHDCP22_TX_AKE_SEND_H_PRIME , sizeof ( XHdcp22_Tx_AKESendHPrime ) ) ; if ( Result != XST_SUCCESS ) { return XHDCP22_TX_STATE_A0 ; } xdbg_printf ( XDBG_DEBUG_GENERAL , " \n \r " ) ; XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_COMPUTE_H ) ; XHdcp22Tx_ComputeHPrime ( InstancePtr -> Info . Rrx , PairingInfoPtr -> RxCaps , InstancePtr -> Info . Rtx , XHdcp22_Tx_TxCaps , PairingInfoPtr -> Km , HPrime ) ; XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_COMPUTE_H_DONE ) ; if ( memcmp ( MsgPtr -> Message . AKESendHPrime . HPrime , HPrime , sizeof ( HPrime ) ) != 0 ) { XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_COMPARE_H_FAIL ) ; XHdcp22Tx_InvalidatePairingInfo ( InstancePtr , PairingInfoPtr -> ReceiverId ) ; return XHDCP22_TX_STATE_A0 ; } return XHDCP22_TX_STATE_A2 ; }
This function executes a part of the A1 state functionality of the HDCP2.2
TX protocol.
This function executes a part of the A1 state functionality of the HDCP2 . 2 TX protocol .
/* Wait for the receiver to respond within 1 second.
	 * If the receiver has timed out we go to state A0.
	 * If the receiver is busy, we stay in this state (return from polling).
	 * If the receiver has finished, but the message was not handled yet,
	 * we handle the message.*/ /* Log after waiting */ /* Receive the expected message */ /* Verify the received H' */