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
@@ -125,6 +125,13 @@ uint32_t htonl_fnc(uint32_t x);
|
||||
// Prints error string from BoringSSL
|
||||
void dump_boringssl_error();
|
||||
|
||||
// Given a message and field, returns an OEMCrypto_Substring with the field's
|
||||
// offset into the message and its length. If |set_zero| is true, both the
|
||||
// offset and length will be zero.
|
||||
OEMCrypto_Substring GetSubstring(const std::string& message = "",
|
||||
const std::string& field = "",
|
||||
bool set_zero = false);
|
||||
|
||||
class Session {
|
||||
public:
|
||||
Session();
|
||||
@@ -205,6 +212,11 @@ class Session {
|
||||
// is just signed. The signature is computed in RefreshTestKeys, above.
|
||||
void FillRefreshMessage(size_t key_count, uint32_t control_bits,
|
||||
uint32_t nonce);
|
||||
// Sets the OEMCrypto_Substring parameters of the LoadKeys method.
|
||||
// Specifically, it sets the |enc_mac_keys_iv|, |enc_mac_keys|, |pst|, and
|
||||
// |srm_restriction_data| in that order. For testing purposes,
|
||||
// |srm_restriction_data| will always be NULL.
|
||||
void SetLoadKeysSubstringParams();
|
||||
// This copies data from license_ to encrypted_license_, and then encrypts
|
||||
// each field in the key array appropriately. It then signes the buffer with
|
||||
// the server mac keys. It then fills out the key_array_ so that pointers in
|
||||
@@ -386,6 +398,19 @@ class Session {
|
||||
// The size of the encrypted message.
|
||||
size_t message_size() { return message_size_; }
|
||||
|
||||
// The OEMCrypto_Substrings associated with the encrypted license that are
|
||||
// passed to LoadKeys.
|
||||
vector<OEMCrypto_Substring> load_keys_params() { return load_keys_params_; }
|
||||
OEMCrypto_Substring enc_mac_keys_iv_substr() { return load_keys_params_[0]; }
|
||||
OEMCrypto_Substring enc_mac_keys_substr() { return load_keys_params_[1]; }
|
||||
OEMCrypto_Substring pst_substr() { return load_keys_params_[2]; }
|
||||
OEMCrypto_Substring srm_restriction_data_substr() {
|
||||
return load_keys_params_[3];
|
||||
}
|
||||
|
||||
// Pointer to buffer holding |encrypted_entitled_message_|
|
||||
const uint8_t* encrypted_entitled_message_ptr();
|
||||
|
||||
private:
|
||||
// Generate mac and enc keys give the master key.
|
||||
void DeriveKeys(const uint8_t* master_key,
|
||||
@@ -410,6 +435,7 @@ class Session {
|
||||
} padded_message_;
|
||||
size_t message_size_; // How much of the padded message to use.
|
||||
OEMCrypto_KeyObject key_array_[kMaxNumKeys];
|
||||
vector<OEMCrypto_Substring> load_keys_params_;
|
||||
std::vector<uint8_t> signature_;
|
||||
unsigned int num_keys_;
|
||||
vector<uint8_t> encrypted_usage_entry_;
|
||||
@@ -419,8 +445,11 @@ class Session {
|
||||
// Clear Entitlement key data. This is the backing data for
|
||||
// |entitled_key_array_|.
|
||||
EntitledContentKeyData entitled_key_data_[kMaxNumKeys];
|
||||
// Message containing data from |key_array| and |entitled_key_data_|.
|
||||
std::string entitled_message_;
|
||||
// Entitled key object. Pointers are backed by |entitled_key_data_|.
|
||||
OEMCrypto_EntitledContentKeyObject entitled_key_array_[kMaxNumKeys];
|
||||
std::string encrypted_entitled_message_;
|
||||
};
|
||||
|
||||
} // namespace wvoec
|
||||
|
||||
Reference in New Issue
Block a user