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

	int Size;
	int Status = XST_SUCCESS;
	XHdcp22_Rx_Message *MsgPtr = (XHdcp22_Rx_Message*)InstancePtr->MessageBuffer;

	/* Log message read completion */
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_INFO_MESSAGE, XHDCP22_RX_MSG_ID_AKENOSTOREDKM);

	/* Check message size */
	if(InstancePtr->MessageSize != sizeof(XHdcp22_Rx_AKENoStoredKm))
	{
		XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR, XHDCP22_RX_ERROR_FLAG_MESSAGE_SIZE);
		return XST_FAILURE;
	}

	/* Compute Km, Perform RSA decryption */
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_KM);
	Status = XHdcp22Rx_RsaesOaepDecrypt(InstancePtr, (XHdcp22_Rx_KprivRx *)(InstancePtr->PrivateKeyPtr),
										MsgPtr->AKENoStoredKm.EKpubKm, InstancePtr->Params.Km, &Size);
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_KM_DONE);

	return (Status == XST_SUCCESS && Size == XHDCP22_RX_KM_SIZE) ? XST_SUCCESS : XST_FAILURE;
}
/*****************************************************************************/
/**
* This function processes the AKE_No_Stored_km message received from the
* transmitter. The RSAES-OAEP operation decrypts Km with the receiver
* private key.
*
* @param    InstancePtr is a pointer to the XHdcp22_Rx core instance.
*
* @return   - XST_SUCCESS if message processed successfully.
*           - XST_FAILURE if message size is incorrect or Km
*             decryption failed.
*
* @note     None.
******************************************************************************/
This function processes the AKE_No_Stored_km message received from the
transmitter. The RSAES-OAEP operation decrypts Km with the receiver
private key.
This function processes the AKE_No_Stored_km message received from the transmitter . The RSAES - OAEP operation decrypts Km with the receiver private key .
static int XHdcp22Rx_ProcessMessageAKENoStoredKm(XHdcp22_Rx *InstancePtr)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	int Size;
	int Status = XST_SUCCESS;
	XHdcp22_Rx_Message *MsgPtr = (XHdcp22_Rx_Message*)InstancePtr->MessageBuffer;
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_INFO_MESSAGE, XHDCP22_RX_MSG_ID_AKENOSTOREDKM);
	if(InstancePtr->MessageSize != sizeof(XHdcp22_Rx_AKENoStoredKm))
	{
		XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR, XHDCP22_RX_ERROR_FLAG_MESSAGE_SIZE);
		return XST_FAILURE;
	}
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_KM);
	Status = XHdcp22Rx_RsaesOaepDecrypt(InstancePtr, (XHdcp22_Rx_KprivRx *)(InstancePtr->PrivateKeyPtr),
										MsgPtr->AKENoStoredKm.EKpubKm, InstancePtr->Params.Km, &Size);
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_KM_DONE);
	return (Status == XST_SUCCESS && Size == XHDCP22_RX_KM_SIZE) ? XST_SUCCESS : XST_FAILURE;
}
static int XHdcp22Rx_ProcessMessageAKENoStoredKm ( XHdcp22_Rx * InstancePtr ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; int Size ; int Status = XST_SUCCESS ; XHdcp22_Rx_Message * MsgPtr = ( XHdcp22_Rx_Message * ) InstancePtr -> MessageBuffer ; XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_INFO_MESSAGE , XHDCP22_RX_MSG_ID_AKENOSTOREDKM ) ; if ( InstancePtr -> MessageSize != sizeof ( XHdcp22_Rx_AKENoStoredKm ) ) { XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_ERROR , XHDCP22_RX_ERROR_FLAG_MESSAGE_SIZE ) ; return XST_FAILURE ; } XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_DEBUG , XHDCP22_RX_LOG_DEBUG_COMPUTE_KM ) ; Status = XHdcp22Rx_RsaesOaepDecrypt ( InstancePtr , ( XHdcp22_Rx_KprivRx * ) ( InstancePtr -> PrivateKeyPtr ) , MsgPtr -> AKENoStoredKm . EKpubKm , InstancePtr -> Params . Km , & Size ) ; XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_DEBUG , XHDCP22_RX_LOG_DEBUG_COMPUTE_KM_DONE ) ; return ( Status == XST_SUCCESS && Size == XHDCP22_RX_KM_SIZE ) ? XST_SUCCESS : XST_FAILURE ; }
This function processes the AKE_No_Stored_km message received from the
transmitter.
This function processes the AKE_No_Stored_km message received from the transmitter .
/* Verify arguments */ /* Log message read completion */ /* Check message size */ /* Compute Km, Perform RSA decryption */