/**
 * @file hv_hdcp2x_Common.h
 * @brief This file contains common functions shared between HDCP2X drivers.
 * @verbatim
 * ==============================================================================
 *                        ##### How to use this driver #####
 * ==============================================================================
 * (+) Use AesEncrypt(...) to Encrypt the Data with AES.
 * (+) Use AesKeySetup(...) to Setup the key of AES.
 * (+) Use AesDecrypt(...) to Decrypt the Data with AES. 
 * @endverbatim
 *
 * @author HiView SoC Software Team
 * @version 0.0.1
 * @date 2022-08-22
 */

#ifndef HV_HDCP2X_COMMON_H_
#define HV_HDCP2X_COMMON_H_

#ifdef __cplusplus
extern "C" {
#endif

/***************************** Include Files ********************************/
#include "hv_vos_Comm.h"
#include "hv_hdcp_BigDigits.h"

/************************** Constant Definitions ****************************/

/**************************** Type Definitions ******************************/

#define Hv_Hdcp2x_RxMpSizeof(A) (sizeof(A)/sizeof(UINT32))

/***************** Macros (Inline Functions) Definitions ********************/

/************************** Function Prototypes *****************************/

/* Cryptographic functions */
void Hv_Hdcp2x_CmnSha256Hash(const UCHAR8 *Data, UINT32 DataSize, UCHAR8 *HashedData);
int  Hv_Hdcp2x_CmnHmacSha256Hash(const UCHAR8 *Data, int DataSize, const UCHAR8 *Key, int KeySize, UCHAR8  *HashedData);
void Hv_Hdcp2x_CmnAes128Encrypt(const UCHAR8 *Data, const UCHAR8 *Key, UCHAR8 *Output);
void Hv_Hdcp2x_CmnAes128Decrypt(const UCHAR8 *Data, const UCHAR8 *Key, UCHAR8 *Output);
void AesDecrypt(const UCHAR8 In[], UCHAR8 Out[], const UINT32 Key[], int KeySize);
void AesEncrypt(const UCHAR8 In[], UCHAR8 Out[], const UINT32 Key[], int KeySize);
void AesKeySetup(const UCHAR8 Key[], UINT32 W[], int KeySizeBits);

#ifdef __cplusplus
}
#endif

#endif /* XHDCP2X_COMMON_H_ */
