XilinxProcessorIPLib/drivers/dp14txss/examples/src/zcu_pt_dp14_hdcp/xdp_hdcp_keys.c
static void Decrypt(u8 *CipherBufferPtr, u8 *PlainBufferPtr, u8 *Key, u16 Length)
{
    u8 i;
    u8 *AesBufferPtr;
    u16 AesLength;
    aes256_context ctx;

    // Assign local Pointer
    AesBufferPtr = CipherBufferPtr;

    // Initialize AES256
    aes256_init(&ctx, Key);

    AesLength = Length/16;
    if (Length % 16) {
	AesLength++;
    }

    for (i=0; i<AesLength; i++)
    {
	// Decrypt
	aes256_decrypt_ecb(&ctx, AesBufferPtr);

		// Increment pointer
	AesBufferPtr += 16;	// The aes always encrypts 16 bytes
    }

    // Done
    aes256_done(&ctx);

   // Clear Buffer
    memset(PlainBufferPtr, 0x00, Length);

    // Copy buffers
    memcpy(PlainBufferPtr, CipherBufferPtr, Length);
}
/*****************************************************************************/
/**
 *
 * This function decrypts the HDCP keys
 *
 *
 * @return
 *  - XST_SUCCESS if action was successful
 *  - XST_FAILURE if action was not successful
 *
 ******************************************************************************/
This function decrypts the HDCP keys
@return
- XST_SUCCESS if action was successful
- XST_FAILURE if action was not successful
This function decrypts the HDCP keys @return - XST_SUCCESS if action was successful - XST_FAILURE if action was not successful
static void Decrypt(u8 *CipherBufferPtr, u8 *PlainBufferPtr, u8 *Key, u16 Length)
{
    u8 i;
    u8 *AesBufferPtr;
    u16 AesLength;
    aes256_context ctx;
    AesBufferPtr = CipherBufferPtr;
    aes256_init(&ctx, Key);
    AesLength = Length/16;
    if (Length % 16) {
	AesLength++;
    }
    for (i=0; i<AesLength; i++)
    {
	aes256_decrypt_ecb(&ctx, AesBufferPtr);
	AesBufferPtr += 16;	
    }
    aes256_done(&ctx);
    memset(PlainBufferPtr, 0x00, Length);
    memcpy(PlainBufferPtr, CipherBufferPtr, Length);
}
static void Decrypt ( u8 * CipherBufferPtr , u8 * PlainBufferPtr , u8 * Key , u16 Length ) { u8 i ; u8 * AesBufferPtr ; u16 AesLength ; aes256_context ctx ; AesBufferPtr = CipherBufferPtr ; aes256_init ( & ctx , Key ) ; AesLength = Length / 16 ; if ( Length % 16 ) { AesLength ++ ; } for ( i = 0 ; i < AesLength ; i ++ ) { aes256_decrypt_ecb ( & ctx , AesBufferPtr ) ; AesBufferPtr += 16 ; } aes256_done ( & ctx ) ; memset ( PlainBufferPtr , 0x00 , Length ) ; memcpy ( PlainBufferPtr , CipherBufferPtr , Length ) ; }
This function decrypts the HDCP keys
 @return
  - XST_SUCCESS if action was successful
  - XST_FAILURE if action was not successful
This function decrypts the HDCP keys @return - XST_SUCCESS if action was successful - XST_FAILURE if action was not successful
// Assign local Pointer // Initialize AES256 // Decrypt // Increment pointer // The aes always encrypts 16 bytes // Done // Clear Buffer // Copy buffers