Do not convert the protection scheme to network byte order
[ Merge of http://go/wvgerrit/19960 ] Protections schemes are specified using a 4CC code {"cbc1", "cbcs", "cenc", "cens"}. A host to network conversion was performed when the PSSH was created and inserted into the license request. A reverse conversion was performed when the code was extracted from the license response. These conversions are problematic if the PSSH is created externally and passed into mediaDrm. To address this, the conversions have been removed and allow protobuf to handle byte ordering. For backward compatibility we allow codes in either ordering. b/30713238 Change-Id: I25f01ecc621549fd3c13b443e4c8b89168463249
This commit is contained in:
@@ -65,6 +65,8 @@ const unsigned char kServiceCertificateCAPublicKey[] = {
|
||||
}
|
||||
const uint32_t kFourCcCbc1 = 0x63626331;
|
||||
const uint32_t kFourCcCbcs = 0x63626373;
|
||||
const uint32_t kFourCcLittleEndianCbc1 = 0x31636263;
|
||||
const uint32_t kFourCcLittleEndianCbcs = 0x73636263;
|
||||
const uint32_t kFourCcCenc = 0x63656e63;
|
||||
const uint32_t kFourCcCens = 0x63656e73;
|
||||
|
||||
@@ -115,12 +117,23 @@ static std::vector<CryptoKey> ExtractContentKeys(const License& license) {
|
||||
}
|
||||
uint32_t four_cc = kFourCcCenc;
|
||||
if (license.has_protection_scheme()) {
|
||||
four_cc = ntohl(license.protection_scheme());
|
||||
four_cc = license.protection_scheme();
|
||||
}
|
||||
switch (four_cc) {
|
||||
// b/30713238: Android N assumed that the "protection scheme" Four
|
||||
// CC code, after being extracted from the protobuf, was host byte
|
||||
// order dependent. Later versions do not assume this, and thus,
|
||||
// for backwards compatibility, must support both byte orders.
|
||||
case kFourCcCbc1:
|
||||
case kFourCcCbcs:
|
||||
case kFourCcLittleEndianCbc1:
|
||||
case kFourCcLittleEndianCbcs:
|
||||
key.set_cipher_mode(kCipherModeCbc);
|
||||
break;
|
||||
default:
|
||||
key.set_cipher_mode(kCipherModeCtr);
|
||||
break;
|
||||
}
|
||||
if (four_cc == kFourCcCbc1 || four_cc == kFourCcCbcs)
|
||||
key.set_cipher_mode(kCipherModeCbc);
|
||||
else
|
||||
key.set_cipher_mode(kCipherModeCtr);
|
||||
key_array.push_back(key);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user