XilinxProcessorIPLib/drivers/hdcp22_rx/src/xhdcp22_rx.c
static int XHdcp22Rx_SendMessageAKESendPairingInfo(XHdcp22_Rx *InstancePtr)
{
	/* Verify arguments */
	Xil_AssertNonvoid(InstancePtr != NULL);

	u8 M[XHDCP22_RX_RTX_SIZE+XHDCP22_RX_RRX_SIZE];
	u8 EKhKm[XHDCP22_RX_EKH_SIZE];
	XHdcp22_Rx_Message *MsgPtr = (XHdcp22_Rx_Message*)InstancePtr->MessageBuffer;
	u32 Offset;

	/* Concatenate M = (Rtx || Rrx) */
	memcpy(M, InstancePtr->Params.Rtx, XHDCP22_RX_RTX_SIZE);
	memcpy(M+XHDCP22_RX_RTX_SIZE, InstancePtr->Params.Rrx, XHDCP22_RX_RRX_SIZE);

	/* Compute Ekh */
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_EKH);
	XHdcp22Rx_ComputeEkh(InstancePtr->PrivateKeyPtr, InstancePtr->Params.Km, M, EKhKm);
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_EKH_DONE);

	/* Generate AKE_Send_Pairing_Info message */
	MsgPtr->AKESendPairingInfo.MsgId = XHDCP22_RX_MSG_ID_AKESENDPAIRINGINFO;
	memcpy(MsgPtr->AKESendPairingInfo.EKhKm, EKhKm, XHDCP22_RX_EKH_SIZE);

	/* Write message to buffer */
	InstancePtr->Handles.DdcSetAddressCallback(InstancePtr->Handles.DdcSetAddressCallbackRef,
		XHDCP22_RX_DDC_READ_REG);
	for(Offset = 0; Offset < sizeof(XHdcp22_Rx_AKESendPairingInfo); Offset++)
	{
		InstancePtr->Handles.DdcSetDataCallback(InstancePtr->Handles.DdcSetDataCallbackRef,
			InstancePtr->MessageBuffer[Offset]);
	}

	/* Write message size signaling completion */
	XHdcp22Rx_SetRxStatus(InstancePtr, sizeof(XHdcp22_Rx_AKESendPairingInfo),
		InstancePtr->Info.ReauthReq, InstancePtr->Info.TopologyReady);

	/* Record Ekh */
	memcpy(InstancePtr->Params.EKh, EKhKm, XHDCP22_RX_EKH_SIZE);

	/* Log message write completion */
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_INFO_MESSAGE, XHDCP22_RX_MSG_ID_AKESENDPAIRINGINFO);

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
* This function computes Ekh(Km), generates AKE_Send_Pairing_Info message,
* and writes it into the read message buffer. After the complete message
* has been written to the buffer the MessageSize is set in the DDC RxStatus
* register signaling the transmitter that the message is available for
* reading.
*
* @param    InstancePtr is a pointer to the XHdcp22_Rx core instance.
*
* @return   XST_SUCCESS.
*
* @note     The AKESendPairingInfo message is sent only in response to
*           receiving AKENoStoredKm message. This message must be
*           available for the transmitter within 200ms after sending
*           AKESendHPrime.
******************************************************************************/
This function computes Ekh(Km), generates AKE_Send_Pairing_Info message,
and writes it into the read message buffer. After the complete message
has been written to the buffer the MessageSize is set in the DDC RxStatus
register signaling the transmitter that the message is available for
reading.
This function computes Ekh ( Km ) generates AKE_Send_Pairing_Info message and writes it into the read message buffer . After the complete message has been written to the buffer the MessageSize is set in the DDC RxStatus register signaling the transmitter that the message is available for reading .
static int XHdcp22Rx_SendMessageAKESendPairingInfo(XHdcp22_Rx *InstancePtr)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	u8 M[XHDCP22_RX_RTX_SIZE+XHDCP22_RX_RRX_SIZE];
	u8 EKhKm[XHDCP22_RX_EKH_SIZE];
	XHdcp22_Rx_Message *MsgPtr = (XHdcp22_Rx_Message*)InstancePtr->MessageBuffer;
	u32 Offset;
	memcpy(M, InstancePtr->Params.Rtx, XHDCP22_RX_RTX_SIZE);
	memcpy(M+XHDCP22_RX_RTX_SIZE, InstancePtr->Params.Rrx, XHDCP22_RX_RRX_SIZE);
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_EKH);
	XHdcp22Rx_ComputeEkh(InstancePtr->PrivateKeyPtr, InstancePtr->Params.Km, M, EKhKm);
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_EKH_DONE);
	MsgPtr->AKESendPairingInfo.MsgId = XHDCP22_RX_MSG_ID_AKESENDPAIRINGINFO;
	memcpy(MsgPtr->AKESendPairingInfo.EKhKm, EKhKm, XHDCP22_RX_EKH_SIZE);
	InstancePtr->Handles.DdcSetAddressCallback(InstancePtr->Handles.DdcSetAddressCallbackRef,
		XHDCP22_RX_DDC_READ_REG);
	for(Offset = 0; Offset < sizeof(XHdcp22_Rx_AKESendPairingInfo); Offset++)
	{
		InstancePtr->Handles.DdcSetDataCallback(InstancePtr->Handles.DdcSetDataCallbackRef,
			InstancePtr->MessageBuffer[Offset]);
	}
	XHdcp22Rx_SetRxStatus(InstancePtr, sizeof(XHdcp22_Rx_AKESendPairingInfo),
		InstancePtr->Info.ReauthReq, InstancePtr->Info.TopologyReady);
	memcpy(InstancePtr->Params.EKh, EKhKm, XHDCP22_RX_EKH_SIZE);
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_INFO_MESSAGE, XHDCP22_RX_MSG_ID_AKESENDPAIRINGINFO);
	return XST_SUCCESS;
}
static int XHdcp22Rx_SendMessageAKESendPairingInfo ( XHdcp22_Rx * InstancePtr ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; u8 M [ XHDCP22_RX_RTX_SIZE + XHDCP22_RX_RRX_SIZE ] ; u8 EKhKm [ XHDCP22_RX_EKH_SIZE ] ; XHdcp22_Rx_Message * MsgPtr = ( XHdcp22_Rx_Message * ) InstancePtr -> MessageBuffer ; u32 Offset ; memcpy ( M , InstancePtr -> Params . Rtx , XHDCP22_RX_RTX_SIZE ) ; memcpy ( M + XHDCP22_RX_RTX_SIZE , InstancePtr -> Params . Rrx , XHDCP22_RX_RRX_SIZE ) ; XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_DEBUG , XHDCP22_RX_LOG_DEBUG_COMPUTE_EKH ) ; XHdcp22Rx_ComputeEkh ( InstancePtr -> PrivateKeyPtr , InstancePtr -> Params . Km , M , EKhKm ) ; XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_DEBUG , XHDCP22_RX_LOG_DEBUG_COMPUTE_EKH_DONE ) ; MsgPtr -> AKESendPairingInfo . MsgId = XHDCP22_RX_MSG_ID_AKESENDPAIRINGINFO ; memcpy ( MsgPtr -> AKESendPairingInfo . EKhKm , EKhKm , XHDCP22_RX_EKH_SIZE ) ; InstancePtr -> Handles . DdcSetAddressCallback ( InstancePtr -> Handles . DdcSetAddressCallbackRef , XHDCP22_RX_DDC_READ_REG ) ; for ( Offset = 0 ; Offset < sizeof ( XHdcp22_Rx_AKESendPairingInfo ) ; Offset ++ ) { InstancePtr -> Handles . DdcSetDataCallback ( InstancePtr -> Handles . DdcSetDataCallbackRef , InstancePtr -> MessageBuffer [ Offset ] ) ; } XHdcp22Rx_SetRxStatus ( InstancePtr , sizeof ( XHdcp22_Rx_AKESendPairingInfo ) , InstancePtr -> Info . ReauthReq , InstancePtr -> Info . TopologyReady ) ; memcpy ( InstancePtr -> Params . EKh , EKhKm , XHDCP22_RX_EKH_SIZE ) ; XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_INFO_MESSAGE , XHDCP22_RX_MSG_ID_AKESENDPAIRINGINFO ) ; return XST_SUCCESS ; }
This function computes Ekh(Km), generates AKE_Send_Pairing_Info message,
and writes it into the read message buffer.
This function computes Ekh ( Km ) generates AKE_Send_Pairing_Info message and writes it into the read message buffer .
/* Verify arguments */ /* Concatenate M = (Rtx || Rrx) */ /* Compute Ekh */ /* Generate AKE_Send_Pairing_Info message */ /* Write message to buffer */ /* Write message size signaling completion */ /* Record Ekh */ /* Log message write completion */