hv_hdcp2x_Common.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * @file hv_hdcp2x_Common.h
  3. * @brief This file contains common functions shared between HDCP2X drivers.
  4. * @verbatim
  5. * ==============================================================================
  6. * ##### How to use this driver #####
  7. * ==============================================================================
  8. * (+) Use AesEncrypt(...) to Encrypt the Data with AES.
  9. * (+) Use AesKeySetup(...) to Setup the key of AES.
  10. * (+) Use AesDecrypt(...) to Decrypt the Data with AES.
  11. * @endverbatim
  12. *
  13. * @author HiView SoC Software Team
  14. * @version 0.0.1
  15. * @date 2022-08-22
  16. */
  17. #ifndef HV_HDCP2X_COMMON_H_
  18. #define HV_HDCP2X_COMMON_H_
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /***************************** Include Files ********************************/
  23. #include "hv_vos_Comm.h"
  24. #include "hv_hdcp_BigDigits.h"
  25. /************************** Constant Definitions ****************************/
  26. /**************************** Type Definitions ******************************/
  27. #define Hv_Hdcp2x_RxMpSizeof(A) (sizeof(A)/sizeof(UINT32))
  28. /***************** Macros (Inline Functions) Definitions ********************/
  29. /************************** Function Prototypes *****************************/
  30. /* Cryptographic functions */
  31. void Hv_Hdcp2x_CmnSha256Hash(const UCHAR8 *Data, UINT32 DataSize, UCHAR8 *HashedData);
  32. int Hv_Hdcp2x_CmnHmacSha256Hash(const UCHAR8 *Data, int DataSize, const UCHAR8 *Key, int KeySize, UCHAR8 *HashedData);
  33. void Hv_Hdcp2x_CmnAes128Encrypt(const UCHAR8 *Data, const UCHAR8 *Key, UCHAR8 *Output);
  34. void Hv_Hdcp2x_CmnAes128Decrypt(const UCHAR8 *Data, const UCHAR8 *Key, UCHAR8 *Output);
  35. void AesDecrypt(const UCHAR8 In[], UCHAR8 Out[], const UINT32 Key[], int KeySize);
  36. void AesEncrypt(const UCHAR8 In[], UCHAR8 Out[], const UINT32 Key[], int KeySize);
  37. void AesKeySetup(const UCHAR8 Key[], UINT32 W[], int KeySizeBits);
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif /* XHDCP2X_COMMON_H_ */