XilinxProcessorIPLib/drivers/hdcp22_rx/src/xhdcp22_rx_crypt.c
void XHdcp22Rx_ComputeKs(const u8* Rrx, const u8* Rtx, const u8 *Km, const u8 *Rn,
	     const u8 *Eks, u8 *Ks)
{
	u8 Dkey2[XHDCP22_RX_KS_SIZE];
	u8 Ctr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02};

	/* Verify arguments */
	Xil_AssertVoid(Rrx != NULL);
	Xil_AssertVoid(Rtx != NULL);
	Xil_AssertVoid(Km != NULL);
	Xil_AssertVoid(Rn != NULL);
	Xil_AssertVoid(Eks != NULL);
	Xil_AssertVoid(Ks != NULL);

	/* Generate derived key dkey2 */
	XHdcp22Rx_ComputeDKey(Rrx, Rtx, Km, Rn, Ctr, Dkey2);

	/* Compute Ks = EKs xor (Dkey2 xor Rrx) */
	memcpy(Ks, Dkey2, XHDCP22_RX_KS_SIZE);
	XHdcp22Rx_Xor(Ks+XHDCP22_RX_RRX_SIZE, Ks+XHDCP22_RX_RRX_SIZE, Rrx, XHDCP22_RX_RRX_SIZE);
	XHdcp22Rx_Xor(Ks, Ks, Eks, XHDCP22_RX_KS_SIZE);
}
/*****************************************************************************/
/**
* This function computes the Ks used during HDCP 2.2 session key exchange.
*
* Reference: HDCP v2.2, section 2.4
*
* @param	Rrx is the Rx random generated value.
* @param	Rtx is the Tx random generated value.
* @param	Km is the master key generated by the transmitter.
* @param	Rn is the 64-bit psuedo-random nonce generated by the transmitter.
* @param	Eks is the encrypted session generated by the transmitter.
* @param	Ks is the decrypted session key.
*
* @return	None.
*
* @note		None.
******************************************************************************/
This function computes the Ks used during HDCP 2.2 session key exchange.
This function computes the Ks used during HDCP 2 . 2 session key exchange .
void XHdcp22Rx_ComputeKs(const u8* Rrx, const u8* Rtx, const u8 *Km, const u8 *Rn,
	     const u8 *Eks, u8 *Ks)
{
	u8 Dkey2[XHDCP22_RX_KS_SIZE];
	u8 Ctr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02};
	Xil_AssertVoid(Rrx != NULL);
	Xil_AssertVoid(Rtx != NULL);
	Xil_AssertVoid(Km != NULL);
	Xil_AssertVoid(Rn != NULL);
	Xil_AssertVoid(Eks != NULL);
	Xil_AssertVoid(Ks != NULL);
	XHdcp22Rx_ComputeDKey(Rrx, Rtx, Km, Rn, Ctr, Dkey2);
	memcpy(Ks, Dkey2, XHDCP22_RX_KS_SIZE);
	XHdcp22Rx_Xor(Ks+XHDCP22_RX_RRX_SIZE, Ks+XHDCP22_RX_RRX_SIZE, Rrx, XHDCP22_RX_RRX_SIZE);
	XHdcp22Rx_Xor(Ks, Ks, Eks, XHDCP22_RX_KS_SIZE);
}
void XHdcp22Rx_ComputeKs ( const u8 * Rrx , const u8 * Rtx , const u8 * Km , const u8 * Rn , const u8 * Eks , u8 * Ks ) { u8 Dkey2 [ XHDCP22_RX_KS_SIZE ] ; u8 Ctr [ ] = { 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x02 } ; Xil_AssertVoid ( Rrx != NULL ) ; Xil_AssertVoid ( Rtx != NULL ) ; Xil_AssertVoid ( Km != NULL ) ; Xil_AssertVoid ( Rn != NULL ) ; Xil_AssertVoid ( Eks != NULL ) ; Xil_AssertVoid ( Ks != NULL ) ; XHdcp22Rx_ComputeDKey ( Rrx , Rtx , Km , Rn , Ctr , Dkey2 ) ; memcpy ( Ks , Dkey2 , XHDCP22_RX_KS_SIZE ) ; XHdcp22Rx_Xor ( Ks + XHDCP22_RX_RRX_SIZE , Ks + XHDCP22_RX_RRX_SIZE , Rrx , XHDCP22_RX_RRX_SIZE ) ; XHdcp22Rx_Xor ( Ks , Ks , Eks , XHDCP22_RX_KS_SIZE ) ; }
This function computes the Ks used during HDCP 2.2 session key exchange.
This function computes the Ks used during HDCP 2 . 2 session key exchange .
/* Verify arguments */ /* Generate derived key dkey2 */ /* Compute Ks = EKs xor (Dkey2 xor Rrx) */