/********************************************************************* * L3CryptoCENC.h * * (c) Copyright 2013 Google, Inc. * * Reference APIs needed to support Widevine's crypto algorithms. *********************************************************************/ #ifndef L3CRYPTO_CENC_H_ #define L3CRYPTO_CENC_H_ #include "OEMCryptoCENC.h" #ifdef __cplusplus extern "C" { #endif #define L3CRYPTO_VERSION "5.0" static const char l3c_version[] = L3CRYPTO_VERSION; typedef uint32_t OEMCrypto_SESSION; #define L3Crypto_Initialize _l3cc01 #define L3Crypto_Terminate _l3cc02 #define L3Crypto_InstallKeybox _l3cc03 #define L3Crypto_GetKeyData _l3cc04 #define L3Crypto_IsKeyboxValid _l3cc05 #define L3Crypto_GetRandom _l3cc06 #define L3Crypto_GetDeviceID _l3cc07 #define L3Crypto_WrapKeybox _l3cc08 #define L3Crypto_OpenSession _l3cc09 #define L3Crypto_CloseSession _l3cc10 #define L3Crypto_DecryptCTR _l3cc11 #define L3Crypto_GenerateDerivedKeys _l3cc12 #define L3Crypto_GenerateSignature _l3cc13 #define L3Crypto_GenerateNonce _l3cc14 #define L3Crypto_LoadKeys _l3cc15 #define L3Crypto_RefreshKeys _l3cc16 #define L3Crypto_SelectKey _l3cc17 OEMCryptoResult L3Crypto_Initialize(void); OEMCryptoResult L3Crypto_Terminate(void); OEMCryptoResult L3Crypto_OpenSession(OEMCrypto_SESSION *session); OEMCryptoResult L3Crypto_CloseSession(OEMCrypto_SESSION session); OEMCryptoResult L3Crypto_GenerateDerivedKeys( OEMCrypto_SESSION session, const uint8_t *mac_key_context, uint32_t mac_key_context_length, const uint8_t *enc_key_context, uint32_t enc_key_context_length); OEMCryptoResult L3Crypto_GenerateNonce( OEMCrypto_SESSION session, uint32_t* nonce); OEMCryptoResult L3Crypto_GenerateSignature( OEMCrypto_SESSION session, const uint8_t* message, size_t message_length, uint8_t* signature, size_t* signature_length); OEMCryptoResult L3Crypto_LoadKeys(OEMCrypto_SESSION session, const uint8_t* message, size_t message_length, const uint8_t* signature, size_t signature_length, const uint8_t* enc_mac_key_iv, const uint8_t* enc_mac_key, size_t num_keys, const OEMCrypto_KeyObject* key_array); OEMCryptoResult L3Crypto_RefreshKeys(OEMCrypto_SESSION session, const uint8_t* message, size_t message_length, const uint8_t* signature, size_t signature_length, size_t num_keys, const OEMCrypto_KeyRefreshObject* key_array); OEMCryptoResult L3Crypto_SelectKey(const OEMCrypto_SESSION session, const uint8_t* key_id, size_t key_id_length); OEMCryptoResult L3Crypto_DecryptCTR(OEMCrypto_SESSION session, const uint8_t *data_addr, size_t data_length, bool is_encrypted, const uint8_t *iv, size_t offset, const OEMCrypto_DestBufferDesc* out_buffer); OEMCryptoResult OEMCrypto_InstallKeybox(const uint8_t *keybox, size_t keyBoxLength); OEMCryptoResult L3Crypto_IsKeyboxValid(void); OEMCryptoResult L3Crypto_GetDeviceID(uint8_t* deviceID, size_t *idLength); OEMCryptoResult L3Crypto_GetKeyData(uint8_t* keyData, size_t *keyDataLength); OEMCryptoResult L3Crypto_GetRandom(uint8_t* randomData, size_t dataLength); OEMCryptoResult L3Crypto_WrapKeybox(const uint8_t *keybox, size_t keyBoxLength, uint8_t *wrappedKeybox, size_t *wrappedKeyBoxLength, const uint8_t *transportKey, size_t transportKeyLength); #ifdef __cplusplus } #endif #endif // L3CRYPTO_CENC_H_