XilinxProcessorIPLib/drivers/hdcp22_rx/src/xhdcp22_rx_crypt.c
int  XHdcp22Rx_RsaesOaepDecrypt(XHdcp22_Rx *InstancePtr, const XHdcp22_Rx_KprivRx *KprivRx,
	u8 *EncryptedMessage, u8 *Message, int *MessageLen)
{
	/* Verify arguments */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(KprivRx != NULL);
	Xil_AssertNonvoid(EncryptedMessage != NULL);
	Xil_AssertNonvoid(Message != NULL);

	u8  em[XHDCP22_RX_N_SIZE];
	u32 Status;

	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_RSA);

	/* Step 1: Length checking, Skip */

	/* Step 2: RSA decryption */
	Status = XHdcp22Rx_Pkcs1Rsadp(InstancePtr, KprivRx, EncryptedMessage, em);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/* Step 3: EME-OAEP decoding */
	Status = XHdcp22Rx_Pkcs1EmeOaepDecode(em, Message, MessageLen);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_RSA_DONE);

	return XST_SUCCESS;
}
/****************************************************************************/
/**
* This function implements the RSAES-OAEP-Decrypt operation. The message is
* 	decrypted using RSADP and then decoded using EME-OAEP.
*
* Reference: PKCS#1 v2.1, Section 7.1.2
*
* @param	InstancePtr is a pointer to the MMULT instance.
* @param	KprivRx is the RSA private key structure containing the quintuple.
* @param	EncryptedMessage is the 128 byte octet string to be decrypted.
* @param	Message is the octet string after decryption.
* @param	MessageLen is the length of the message octet string after decryption.
*
* @return	XST_SUCCESS or XST_FAILURE.
*
* @note		None.
*****************************************************************************/
This function implements the RSAES-OAEP-Decrypt operation. The message is
decrypted using RSADP and then decoded using EME-OAEP.


This function implements the RSAES - OAEP - Decrypt operation . The message is decrypted using RSADP and then decoded using EME - OAEP .
int  XHdcp22Rx_RsaesOaepDecrypt(XHdcp22_Rx *InstancePtr, const XHdcp22_Rx_KprivRx *KprivRx,
	u8 *EncryptedMessage, u8 *Message, int *MessageLen)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(KprivRx != NULL);
	Xil_AssertNonvoid(EncryptedMessage != NULL);
	Xil_AssertNonvoid(Message != NULL);
	u8  em[XHDCP22_RX_N_SIZE];
	u32 Status;
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_RSA);
	Status = XHdcp22Rx_Pkcs1Rsadp(InstancePtr, KprivRx, EncryptedMessage, em);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Status = XHdcp22Rx_Pkcs1EmeOaepDecode(em, Message, MessageLen);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_DEBUG, XHDCP22_RX_LOG_DEBUG_COMPUTE_RSA_DONE);
	return XST_SUCCESS;
}
int XHdcp22Rx_RsaesOaepDecrypt ( XHdcp22_Rx * InstancePtr , const XHdcp22_Rx_KprivRx * KprivRx , u8 * EncryptedMessage , u8 * Message , int * MessageLen ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( KprivRx != NULL ) ; Xil_AssertNonvoid ( EncryptedMessage != NULL ) ; Xil_AssertNonvoid ( Message != NULL ) ; u8 em [ XHDCP22_RX_N_SIZE ] ; u32 Status ; XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_DEBUG , XHDCP22_RX_LOG_DEBUG_COMPUTE_RSA ) ; Status = XHdcp22Rx_Pkcs1Rsadp ( InstancePtr , KprivRx , EncryptedMessage , em ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Status = XHdcp22Rx_Pkcs1EmeOaepDecode ( em , Message , MessageLen ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_DEBUG , XHDCP22_RX_LOG_DEBUG_COMPUTE_RSA_DONE ) ; return XST_SUCCESS ; }
This function implements the RSAES-OAEP-Decrypt operation.
This function implements the RSAES - OAEP - Decrypt operation .
/* Verify arguments */ /* Step 1: Length checking, Skip */ /* Step 2: RSA decryption */ /* Step 3: EME-OAEP decoding */