XilinxProcessorIPLib/drivers/hdcp22_tx_dp/src/xhdcp22_tx.c
static int XHdcp22Tx_WriteAKENoStoredKm(XHdcp22_Tx *InstancePtr,
                                         const XHdcp22_Tx_PairingInfo *PairingInfoPtr,
                                         const XHdcp22_Tx_CertRx *CertificatePtr)
{
	XHdcp22_Tx_DDCMessage* MsgPtr = (XHdcp22_Tx_DDCMessage*)InstancePtr->MessageBuffer;
	u8 MaskingSeed[XHDCP22_TX_KM_MSK_SEED_SIZE];
	u8 EKpubKm[XHDCP22_TX_E_KPUB_KM_SIZE];

	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
	                XHDCP22_TX_LOG_DBG_ENCRYPT_KM_DONE);

	MsgPtr->DdcAddress = XHDCP22_TX_HDCPPORT_WRITE_MSG_OFFSET;
	MsgPtr->Message.MsgId = XHDCP22_TX_AKE_NO_STORED_KM;

	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
	                XHDCP22_TX_LOG_DBG_ENCRYPT_KM);

	/* Get the seed for the masking RSA-OEAP masking function */
	XHdcp22Tx_GenerateKmMaskingSeed(InstancePtr, MaskingSeed);

	/* Encrypt, pass certificate (1st value is messageId) */
	XHdcp22Tx_EncryptKm(CertificatePtr, PairingInfoPtr->Km, MaskingSeed, EKpubKm);
	memcpy(MsgPtr->Message.AKENoStoredKm.EKpubKm, EKpubKm,
	       sizeof(MsgPtr->Message.AKENoStoredKm.EKpubKm));

	/* Execute write */
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
	                XHDCP22_TX_LOG_DBG_TX_NOSTOREDKM);
	if (InstancePtr->Config.Protocol == XHDCP22_TX_DP) {
		xdbg_printf(XDBG_DEBUG_GENERAL,
				"HDCP22TX: Writing AKE_NO_STORED_KM\n\r");
		return XHdcp22Tx_Dp_Write_Dpcd_Msg(InstancePtr);

	} else {
		return InstancePtr->DdcWrite(XHDCP22_TX_DDC_BASE_ADDRESS,
				sizeof(XHdcp22_Tx_AKENoStoredKm)+1, (u8 *)MsgPtr,
				(TRUE), InstancePtr->DdcHandlerRef);
	}
}
/*****************************************************************************/
/**
*
* This function issues a AKE_No_Stored_km message
*
* @param  InstancePtr is a pointer to the XHdcp22Tx core instance.
* @param  MsgBufferPtr the buffer containing the certificate and re-used
*         for sending the message.
*
* @return
*         - XST_SUCCESS if writing succeeded
*         - XST_FAILURE if failed to write
*
* @note   None.
*
******************************************************************************/
This function issues a AKE_No_Stored_km message
This function issues a AKE_No_Stored_km message
static int XHdcp22Tx_WriteAKENoStoredKm(XHdcp22_Tx *InstancePtr,
                                         const XHdcp22_Tx_PairingInfo *PairingInfoPtr,
                                         const XHdcp22_Tx_CertRx *CertificatePtr)
{
	XHdcp22_Tx_DDCMessage* MsgPtr = (XHdcp22_Tx_DDCMessage*)InstancePtr->MessageBuffer;
	u8 MaskingSeed[XHDCP22_TX_KM_MSK_SEED_SIZE];
	u8 EKpubKm[XHDCP22_TX_E_KPUB_KM_SIZE];
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
	                XHDCP22_TX_LOG_DBG_ENCRYPT_KM_DONE);
	MsgPtr->DdcAddress = XHDCP22_TX_HDCPPORT_WRITE_MSG_OFFSET;
	MsgPtr->Message.MsgId = XHDCP22_TX_AKE_NO_STORED_KM;
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
	                XHDCP22_TX_LOG_DBG_ENCRYPT_KM);
	XHdcp22Tx_GenerateKmMaskingSeed(InstancePtr, MaskingSeed);
	XHdcp22Tx_EncryptKm(CertificatePtr, PairingInfoPtr->Km, MaskingSeed, EKpubKm);
	memcpy(MsgPtr->Message.AKENoStoredKm.EKpubKm, EKpubKm,
	       sizeof(MsgPtr->Message.AKENoStoredKm.EKpubKm));
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG,
	                XHDCP22_TX_LOG_DBG_TX_NOSTOREDKM);
	if (InstancePtr->Config.Protocol == XHDCP22_TX_DP) {
		xdbg_printf(XDBG_DEBUG_GENERAL,
				"HDCP22TX: Writing AKE_NO_STORED_KM\n\r");
		return XHdcp22Tx_Dp_Write_Dpcd_Msg(InstancePtr);
	} else {
		return InstancePtr->DdcWrite(XHDCP22_TX_DDC_BASE_ADDRESS,
				sizeof(XHdcp22_Tx_AKENoStoredKm)+1, (u8 *)MsgPtr,
				(TRUE), InstancePtr->DdcHandlerRef);
	}
}
static int XHdcp22Tx_WriteAKENoStoredKm ( XHdcp22_Tx * InstancePtr , const XHdcp22_Tx_PairingInfo * PairingInfoPtr , const XHdcp22_Tx_CertRx * CertificatePtr ) { XHdcp22_Tx_DDCMessage * MsgPtr = ( XHdcp22_Tx_DDCMessage * ) InstancePtr -> MessageBuffer ; u8 MaskingSeed [ XHDCP22_TX_KM_MSK_SEED_SIZE ] ; u8 EKpubKm [ XHDCP22_TX_E_KPUB_KM_SIZE ] ; XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_ENCRYPT_KM_DONE ) ; MsgPtr -> DdcAddress = XHDCP22_TX_HDCPPORT_WRITE_MSG_OFFSET ; MsgPtr -> Message . MsgId = XHDCP22_TX_AKE_NO_STORED_KM ; XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_ENCRYPT_KM ) ; XHdcp22Tx_GenerateKmMaskingSeed ( InstancePtr , MaskingSeed ) ; XHdcp22Tx_EncryptKm ( CertificatePtr , PairingInfoPtr -> Km , MaskingSeed , EKpubKm ) ; memcpy ( MsgPtr -> Message . AKENoStoredKm . EKpubKm , EKpubKm , sizeof ( MsgPtr -> Message . AKENoStoredKm . EKpubKm ) ) ; XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_TX_NOSTOREDKM ) ; if ( InstancePtr -> Config . Protocol == XHDCP22_TX_DP ) { xdbg_printf ( XDBG_DEBUG_GENERAL , " \n \r " ) ; return XHdcp22Tx_Dp_Write_Dpcd_Msg ( InstancePtr ) ; } else { return InstancePtr -> DdcWrite ( XHDCP22_TX_DDC_BASE_ADDRESS , sizeof ( XHdcp22_Tx_AKENoStoredKm ) + 1 , ( u8 * ) MsgPtr , ( TRUE ) , InstancePtr -> DdcHandlerRef ) ; } }
This function issues a AKE_No_Stored_km message
This function issues a AKE_No_Stored_km message
/* Get the seed for the masking RSA-OEAP masking function */ /* Encrypt, pass certificate (1st value is messageId) */ /* Execute write */