Fix Entitlement Licenses
(This is a merge of http://go/wvgerrit/97083.) The switch from LoadKeys to LoadLicense broke entitlement licenses entirely because the LoadLicense path in CryptoSession didn't include any affordances for updating the KeySession, unlike the LoadKeys path. This patch adds code to handle this. Bug: 152814106 Test: CE CDM Unit Tests Test: Android Unit Tests Change-Id: Id0c33a566e17e6be8da04e12be4b0fc87559aa8f
This commit is contained in:
committed by
John Bruce
parent
bab44e0ad4
commit
4444ba3b47
@@ -135,7 +135,8 @@ class CryptoSession {
|
||||
// V16 licenses.
|
||||
virtual CdmResponseType LoadLicense(const std::string& signed_message,
|
||||
const std::string& core_message,
|
||||
const std::string& signature);
|
||||
const std::string& signature,
|
||||
CdmLicenseKeyType key_type);
|
||||
|
||||
// Renewal request/responses
|
||||
virtual CdmResponseType PrepareAndSignRenewalRequest(
|
||||
|
||||
@@ -952,11 +952,17 @@ CdmResponseType CryptoSession::LoadKeys(
|
||||
|
||||
CdmResponseType CryptoSession::LoadLicense(const std::string& signed_message,
|
||||
const std::string& core_message,
|
||||
const std::string& signature) {
|
||||
const std::string& signature,
|
||||
CdmLicenseKeyType key_type) {
|
||||
LOGV("Loading license: id = %u", oec_session_id_);
|
||||
const std::string combined_message = core_message + signed_message;
|
||||
OEMCryptoResult sts;
|
||||
WithOecSessionLock("LoadLicense", [&] {
|
||||
if (key_type == kLicenseKeyTypeEntitlement &&
|
||||
key_session_->Type() != KeySession::kEntitlement) {
|
||||
key_session_.reset(new EntitlementKeySession(oec_session_id_, metrics_));
|
||||
}
|
||||
|
||||
M_TIME(sts = OEMCrypto_LoadLicense(
|
||||
oec_session_id_,
|
||||
reinterpret_cast<const uint8_t*>(combined_message.data()),
|
||||
|
||||
@@ -1099,7 +1099,8 @@ CdmResponseType CdmLicense::HandleContentKeyResponse(
|
||||
}
|
||||
CdmResponseType resp;
|
||||
if (supports_core_messages()) {
|
||||
resp = crypto_session_->LoadLicense(msg, core_message, signature);
|
||||
resp = crypto_session_->LoadLicense(msg, core_message, signature,
|
||||
kLicenseKeyTypeContent);
|
||||
} else {
|
||||
resp = crypto_session_->LoadKeys(
|
||||
msg, signature, mac_key_iv, mac_key, key_array, provider_session_token_,
|
||||
@@ -1128,7 +1129,8 @@ CdmResponseType CdmLicense::HandleEntitlementKeyResponse(
|
||||
}
|
||||
CdmResponseType resp;
|
||||
if (supports_core_messages()) {
|
||||
resp = crypto_session_->LoadLicense(msg, core_message, signature);
|
||||
resp = crypto_session_->LoadLicense(msg, core_message, signature,
|
||||
kLicenseKeyTypeEntitlement);
|
||||
} else {
|
||||
resp = crypto_session_->LoadKeys(
|
||||
msg, signature, mac_key_iv, mac_key, key_array, provider_session_token_,
|
||||
|
||||
Reference in New Issue
Block a user