Resize mac_key string to 2 * MAC_KEY_SIZE
Merge from master branch of Widevine repo of http://go/wvgerrit/66074 Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/65102 Currently, the string only contains the mac_key_server, which isn't an issue currently because we just get the offset into the message for the enc_mac_keys pointer when calling LoadKeys, and rely on OEMCrypto to read the 64 bytes. However, v15 will need the length of the enc_mac_keys to reflect the true size. Test: tested as part of http://go/ag/5501993 Bug: 115874964 Change-Id: Id76e91feb176755467c0433e6b0e87d2bb221033
This commit is contained in:
committed by
Fred Gylys-Colwell
parent
e6439255ba
commit
926a780397
@@ -617,22 +617,23 @@ CdmResponseType CdmLicense::HandleKeyResponse(
|
||||
|
||||
// Extract mac key
|
||||
std::string mac_key_iv;
|
||||
std::string mac_key;
|
||||
std::string mac_keys;
|
||||
for (int i = 0; i < license.key_size(); ++i) {
|
||||
if (license.key(i).type() == License_KeyContainer::SIGNING) {
|
||||
mac_key_iv.assign(license.key(i).iv());
|
||||
|
||||
// Strip off PKCS#5 padding
|
||||
mac_key.assign(license.key(i).key().data(), MAC_KEY_SIZE);
|
||||
mac_keys.assign(license.key(i).key().data(), 2 * MAC_KEY_SIZE);
|
||||
}
|
||||
}
|
||||
if (license.policy().can_renew() ||
|
||||
(mac_key_iv.size() != 0 || mac_key.size() != 0)) {
|
||||
if (mac_key_iv.size() != KEY_IV_SIZE || mac_key.size() != MAC_KEY_SIZE) {
|
||||
(mac_key_iv.size() != 0 || mac_keys.size() != 0)) {
|
||||
if (mac_key_iv.size() != KEY_IV_SIZE ||
|
||||
mac_keys.size() != 2 * MAC_KEY_SIZE) {
|
||||
LOGE(
|
||||
"CdmLicense::HandleKeyResponse: mac key/iv size error"
|
||||
"(key/iv size expected: %d/%d, actual: %d/%d",
|
||||
MAC_KEY_SIZE, KEY_IV_SIZE, mac_key.size(), mac_key_iv.size());
|
||||
2 * MAC_KEY_SIZE, KEY_IV_SIZE, mac_keys.size(), mac_key_iv.size());
|
||||
return KEY_SIZE_ERROR_1;
|
||||
}
|
||||
}
|
||||
@@ -675,11 +676,11 @@ CdmResponseType CdmLicense::HandleKeyResponse(
|
||||
entitlement_key_array_ = key_array;
|
||||
resp = HandleEntitlementKeyResponse(signed_response.msg(),
|
||||
signed_response.signature(), mac_key_iv,
|
||||
mac_key, key_array, license);
|
||||
mac_keys, key_array, license);
|
||||
} else if (kLicenseKeyTypeContent == key_type) {
|
||||
resp = HandleContentKeyResponse(signed_response.msg(),
|
||||
signed_response.signature(), mac_key_iv,
|
||||
mac_key, key_array, license);
|
||||
mac_keys, key_array, license);
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user