XilinxProcessorIPLib/drivers/hdcp22_tx_dp/src/xhdcp22_tx.c
static XHdcp22_Tx_StateType XHdcp22Tx_StateA3(XHdcp22_Tx *InstancePtr)
{
	int Result;
	u8 Riv[XHDCP22_TX_RIV_SIZE];
	u8 Ks[XHDCP22_TX_KS_SIZE];
	u8 EdkeyKs[XHDCP22_TX_EDKEY_KS_SIZE];
	XHdcp22_Tx_PairingInfo *PairingInfoPtr =
	                       (XHdcp22_Tx_PairingInfo *)InstancePtr->Info.StateContext;

	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_STATE,
	                (u16)XHDCP22_TX_STATE_A3);


	XHdcp22Tx_GenerateRiv(InstancePtr, Riv);

	/* Set Riv in the cipher */
	XHdcp22Cipher_SetRiv(&InstancePtr->Cipher, Riv, XHDCP22_TX_RIV_SIZE);
	XHdcp22Tx_GenerateKs(InstancePtr, Ks);

	/* Set Ks in the cipher */
	XHdcp22Cipher_SetKs(&InstancePtr->Cipher, Ks, XHDCP22_TX_KS_SIZE);
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
	                XHDCP22_TX_LOG_DBG_COMPUTE_EDKEYKS);
	XHdcp22Tx_ComputeEdkeyKs(InstancePtr->Info.Rn, PairingInfoPtr->Km, Ks,
	                         InstancePtr->Info.Rrx, InstancePtr->Info.Rtx, EdkeyKs);
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
	                XHDCP22_TX_LOG_DBG_COMPUTE_EDKEYKS_DONE);

	/* Write encrypted sesssion key */
	Result = XHdcp22Tx_WriteSkeSendEks(InstancePtr, EdkeyKs, Riv);

	if (Result != XST_SUCCESS) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_MSG_WRITE_FAIL);
		return XHDCP22_TX_STATE_A0;
	}

	/* Write Type Value */
	Result = XHdcp22Tx_WriteTypeValue(InstancePtr);

	if (Result != XST_SUCCESS) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_MSG_WRITE_FAIL);
		return XHDCP22_TX_STATE_A0;
	}

	return XHDCP22_TX_STATE_A4;
}
/*****************************************************************************/
/**
*
* This function executes the A3 state of the HDCP2.2 TX protocol.
*
* @param  InstancePtr is a pointer to the XHdcp22Tx core instance.
*
* @return The next state to execute.
*
* @note   None.
*
******************************************************************************/
This function executes the A3 state of the HDCP2.2 TX protocol.
This function executes the A3 state of the HDCP2 . 2 TX protocol .
static XHdcp22_Tx_StateType XHdcp22Tx_StateA3(XHdcp22_Tx *InstancePtr)
{
	int Result;
	u8 Riv[XHDCP22_TX_RIV_SIZE];
	u8 Ks[XHDCP22_TX_KS_SIZE];
	u8 EdkeyKs[XHDCP22_TX_EDKEY_KS_SIZE];
	XHdcp22_Tx_PairingInfo *PairingInfoPtr =
	                       (XHdcp22_Tx_PairingInfo *)InstancePtr->Info.StateContext;
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_STATE,
	                (u16)XHDCP22_TX_STATE_A3);
	XHdcp22Tx_GenerateRiv(InstancePtr, Riv);
	XHdcp22Cipher_SetRiv(&InstancePtr->Cipher, Riv, XHDCP22_TX_RIV_SIZE);
	XHdcp22Tx_GenerateKs(InstancePtr, Ks);
	XHdcp22Cipher_SetKs(&InstancePtr->Cipher, Ks, XHDCP22_TX_KS_SIZE);
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
	                XHDCP22_TX_LOG_DBG_COMPUTE_EDKEYKS);
	XHdcp22Tx_ComputeEdkeyKs(InstancePtr->Info.Rn, PairingInfoPtr->Km, Ks,
	                         InstancePtr->Info.Rrx, InstancePtr->Info.Rtx, EdkeyKs);
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
	                XHDCP22_TX_LOG_DBG_COMPUTE_EDKEYKS_DONE);
	Result = XHdcp22Tx_WriteSkeSendEks(InstancePtr, EdkeyKs, Riv);
	if (Result != XST_SUCCESS) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_MSG_WRITE_FAIL);
		return XHDCP22_TX_STATE_A0;
	}
	Result = XHdcp22Tx_WriteTypeValue(InstancePtr);
	if (Result != XST_SUCCESS) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_MSG_WRITE_FAIL);
		return XHDCP22_TX_STATE_A0;
	}
	return XHDCP22_TX_STATE_A4;
}
static XHdcp22_Tx_StateType XHdcp22Tx_StateA3 ( XHdcp22_Tx * InstancePtr ) { int Result ; u8 Riv [ XHDCP22_TX_RIV_SIZE ] ; u8 Ks [ XHDCP22_TX_KS_SIZE ] ; u8 EdkeyKs [ XHDCP22_TX_EDKEY_KS_SIZE ] ; XHdcp22_Tx_PairingInfo * PairingInfoPtr = ( XHdcp22_Tx_PairingInfo * ) InstancePtr -> Info . StateContext ; XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_STATE , ( u16 ) XHDCP22_TX_STATE_A3 ) ; XHdcp22Tx_GenerateRiv ( InstancePtr , Riv ) ; XHdcp22Cipher_SetRiv ( & InstancePtr -> Cipher , Riv , XHDCP22_TX_RIV_SIZE ) ; XHdcp22Tx_GenerateKs ( InstancePtr , Ks ) ; XHdcp22Cipher_SetKs ( & InstancePtr -> Cipher , Ks , XHDCP22_TX_KS_SIZE ) ; XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_COMPUTE_EDKEYKS ) ; XHdcp22Tx_ComputeEdkeyKs ( InstancePtr -> Info . Rn , PairingInfoPtr -> Km , Ks , InstancePtr -> Info . Rrx , InstancePtr -> Info . Rtx , EdkeyKs ) ; XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_COMPUTE_EDKEYKS_DONE ) ; Result = XHdcp22Tx_WriteSkeSendEks ( InstancePtr , EdkeyKs , Riv ) ; if ( Result != XST_SUCCESS ) { XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_MSG_WRITE_FAIL ) ; return XHDCP22_TX_STATE_A0 ; } Result = XHdcp22Tx_WriteTypeValue ( InstancePtr ) ; if ( Result != XST_SUCCESS ) { XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_MSG_WRITE_FAIL ) ; return XHDCP22_TX_STATE_A0 ; } return XHDCP22_TX_STATE_A4 ; }
This function executes the A3 state of the HDCP2.2 TX protocol.
This function executes the A3 state of the HDCP2 . 2 TX protocol .
/* Set Riv in the cipher */ /* Set Ks in the cipher */ /* Write encrypted sesssion key */ /* Write Type Value */