Update OEMCrypto calls to use substrings
Merge from master branch of Widevine repo of http://go/wvgerrit/66073 Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64083 As part of the update to v15, LoadKeys, RefreshKeys, and LoadEntitledContentKeys should all use offsets and lengths into the message rather than a pointer for its parameters. The CDM, tests, adapters, and OEMCrypto implementations are changed to reflect this. Test: tested as part of http://go/ag/5501993 Bug: 115874964 Change-Id: I981fa322dec7c565066fd163ca5775dbff71fccf
This commit is contained in:
committed by
Fred Gylys-Colwell
parent
4550979f22
commit
e6439255ba
@@ -32,6 +32,9 @@ void GenerateMacContext(const std::string& input_context,
|
||||
void GenerateEncryptContext(const std::string& input_context,
|
||||
std::string* deriv_context);
|
||||
size_t GetOffset(std::string message, std::string field);
|
||||
OEMCrypto_Substring GetSubstring(const std::string& message = "",
|
||||
const std::string& field = "",
|
||||
bool set_zero = false);
|
||||
OEMCryptoCipherMode ToOEMCryptoCipherMode(CdmCipherMode cipher_mode);
|
||||
|
||||
class CryptoSessionFactory;
|
||||
|
||||
@@ -38,11 +38,11 @@ class EntitlementKeySession : public ContentKeySession {
|
||||
CdmCipherMode cipher_mode) override;
|
||||
|
||||
private:
|
||||
// The object returned by this function contains raw pointers to the passed-in
|
||||
// CryptoKey object. Care should be taken that it does not outlive the
|
||||
// CryptoKey.
|
||||
// The message is populated with the fields of the provided CryptoKey and the
|
||||
// returned object reflects the offsets and lengths into that message for each
|
||||
// field.
|
||||
OEMCrypto_EntitledContentKeyObject MakeOecEntitledKey(
|
||||
const CryptoKey& input_key);
|
||||
const CryptoKey& input_key, std::string& message);
|
||||
|
||||
std::map<std::string, CryptoKey> entitled_keys_;
|
||||
};
|
||||
|
||||
@@ -63,7 +63,17 @@ uint32_t OEMCrypto_ResourceRatingTier(SecurityLevel level);
|
||||
*/
|
||||
extern "C" {
|
||||
|
||||
struct OEMCrypto_KeyObject_V13 { // Used for backwards compatibility.
|
||||
typedef struct { // Used for backwards compatibility.
|
||||
const uint8_t* key_id;
|
||||
size_t key_id_length;
|
||||
const uint8_t* key_data_iv;
|
||||
const uint8_t* key_data;
|
||||
size_t key_data_length;
|
||||
const uint8_t* key_control_iv;
|
||||
const uint8_t* key_control;
|
||||
} OEMCrypto_KeyObject_V10;
|
||||
|
||||
typedef struct { // Used for backwards compatibility.
|
||||
const uint8_t* key_id;
|
||||
size_t key_id_length;
|
||||
const uint8_t* key_data_iv;
|
||||
@@ -72,16 +82,26 @@ struct OEMCrypto_KeyObject_V13 { // Used for backwards compatibility.
|
||||
const uint8_t* key_control_iv;
|
||||
const uint8_t* key_control;
|
||||
OEMCryptoCipherMode cipher_mode;
|
||||
};
|
||||
} OEMCrypto_KeyObject_V13;
|
||||
|
||||
typedef struct {
|
||||
const uint8_t* key_id;
|
||||
size_t key_id_length;
|
||||
const uint8_t* key_data_iv;
|
||||
const uint8_t* key_data;
|
||||
size_t key_data_length;
|
||||
const uint8_t* key_control_iv;
|
||||
const uint8_t* key_control;
|
||||
} OEMCrypto_KeyObject_V14;
|
||||
|
||||
// Backwards compitiblity between v14 and v13.
|
||||
OEMCryptoResult OEMCrypto_LoadKeys_Back_Compat(
|
||||
OEMCrypto_SESSION session, const uint8_t* message, size_t message_length,
|
||||
const uint8_t* signature, size_t signature_length,
|
||||
const uint8_t* enc_mac_keys_iv, const uint8_t* enc_mac_keys,
|
||||
size_t num_keys, const OEMCrypto_KeyObject_V13* key_array,
|
||||
const uint8_t* pst, size_t pst_length, const uint8_t* srm_requirement,
|
||||
OEMCrypto_LicenseType license_type);
|
||||
OEMCrypto_Substring enc_mac_keys_iv, OEMCrypto_Substring enc_mac_keys,
|
||||
size_t num_keys, const OEMCrypto_KeyObject* key_array,
|
||||
OEMCrypto_Substring pst, OEMCrypto_Substring srm_restriction_data,
|
||||
OEMCrypto_LicenseType license_type, OEMCryptoCipherMode* cipher_modes);
|
||||
|
||||
OEMCryptoResult OEMCrypto_UpdateUsageTable();
|
||||
|
||||
@@ -94,6 +114,46 @@ OEMCryptoResult OEMCrypto_DeleteUsageEntry(
|
||||
|
||||
OEMCryptoResult OEMCrypto_ForceDeleteUsageEntry(const uint8_t* pst,
|
||||
size_t pst_length);
|
||||
|
||||
typedef struct {
|
||||
const uint8_t* entitlement_key_id;
|
||||
size_t entitlement_key_id_length;
|
||||
const uint8_t* content_key_id;
|
||||
size_t content_key_id_length;
|
||||
const uint8_t* content_key_data_iv;
|
||||
const uint8_t* content_key_data;
|
||||
size_t content_key_data_length;
|
||||
} OEMCrypto_EntitledContentKeyObject_V14;
|
||||
|
||||
typedef struct {
|
||||
const uint8_t* key_id;
|
||||
size_t key_id_length;
|
||||
const uint8_t* key_control_iv;
|
||||
const uint8_t* key_control;
|
||||
} OEMCrypto_KeyRefreshObject_V14;
|
||||
|
||||
OEMCryptoResult OEMCrypto_LoadKeys_V14(
|
||||
OEMCrypto_SESSION session, const uint8_t* message, size_t message_length,
|
||||
const uint8_t* signature, size_t signature_length,
|
||||
const uint8_t* enc_mac_keys_iv, const uint8_t* enc_mac_keys,
|
||||
size_t num_keys, const OEMCrypto_KeyObject_V14* key_array,
|
||||
const uint8_t* pst, size_t pst_length, const uint8_t* srm_requirement,
|
||||
OEMCrypto_LicenseType license_type);
|
||||
|
||||
OEMCryptoResult OEMCrypto_LoadEntitledContentKeys_V14(
|
||||
OEMCrypto_SESSION session, size_t num_keys,
|
||||
const OEMCrypto_EntitledContentKeyObject_V14* key_array);
|
||||
|
||||
OEMCryptoResult OEMCrypto_RefreshKeys_V14(
|
||||
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_V14* key_array);
|
||||
|
||||
OEMCryptoResult OEMCrypto_CopyBuffer_V14(const uint8_t* data_addr,
|
||||
size_t data_length,
|
||||
OEMCrypto_DestBufferDesc* out_buffer,
|
||||
uint8_t subsample_flags);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // WVCDM_CORE_OEMCRYPTO_ADAPTER_H_
|
||||
|
||||
Reference in New Issue
Block a user