CDM Core: Removed support for v15 licenses.
[ Merge of http://go/wvgerrit/160000 ] OEMCrypto v15 licenses made use of several now-obsolete API functions of OEMCrypto (mainly LoadKeys and RefreshKeys). All license handled by the CDM must be v16 or newer. The CDM can now rely on all license requests/responses containing a core message, using v16 policy timers, and requires loading using LoadLicense() / LoadRenewal(). Bug: 252670759 Test: run_x86_64_tests and policy_engine_unittest Change-Id: I3f65a6ec0326b4c89d1919b8911e065079cb90d2
This commit is contained in:
@@ -966,6 +966,7 @@ CdmResponseType CryptoSession::PrepareAndSignLicenseRequest(
|
||||
LOGV("Preparing and signing license request: id = %u", oec_session_id_);
|
||||
RETURN_IF_NULL(signature, PARAMETER_NULL);
|
||||
RETURN_IF_NULL(core_message, PARAMETER_NULL);
|
||||
RETURN_IF_NOT_OPEN(CRYPTO_SESSION_NOT_OPEN);
|
||||
|
||||
OEMCryptoResult sts;
|
||||
size_t signature_length = 0;
|
||||
@@ -1045,45 +1046,6 @@ CdmResponseType CryptoSession::UseSecondaryKey(bool dual_key) {
|
||||
#endif
|
||||
}
|
||||
|
||||
CdmResponseType CryptoSession::LoadKeys(
|
||||
const std::string& message, const std::string& signature,
|
||||
const std::string& mac_key_iv, const std::string& mac_key,
|
||||
const std::vector<CryptoKey>& keys,
|
||||
const std::string& provider_session_token,
|
||||
const std::string& srm_requirement, CdmLicenseKeyType key_type) {
|
||||
LOGV("Loading keys: id = %u", oec_session_id_);
|
||||
OEMCryptoResult sts;
|
||||
WithOecSessionLock("LoadKeys", [&] {
|
||||
if (key_type == kLicenseKeyTypeEntitlement &&
|
||||
key_session_->Type() != KeySession::kEntitlement) {
|
||||
key_session_.reset(new EntitlementKeySession(oec_session_id_, metrics_));
|
||||
}
|
||||
|
||||
LOGV("Loading key: id = %u", oec_session_id_);
|
||||
sts = key_session_->LoadKeys(message, signature, mac_key_iv, mac_key, keys,
|
||||
provider_session_token, srm_requirement);
|
||||
});
|
||||
|
||||
if (sts != OEMCrypto_SUCCESS) {
|
||||
LOGE("OEMCrypto_LoadKeys failed: status = %d", static_cast<int>(sts));
|
||||
}
|
||||
|
||||
switch (sts) {
|
||||
case OEMCrypto_SUCCESS:
|
||||
if (!provider_session_token.empty())
|
||||
update_usage_table_after_close_session_ = true;
|
||||
return KEY_ADDED;
|
||||
case OEMCrypto_ERROR_TOO_MANY_KEYS:
|
||||
return INSUFFICIENT_CRYPTO_RESOURCES;
|
||||
case OEMCrypto_ERROR_USAGE_TABLE_UNRECOVERABLE:
|
||||
// Handle vendor specific error
|
||||
return NEED_PROVISIONING;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return MapOEMCryptoResult(sts, LOAD_KEY_ERROR, "LoadKeys");
|
||||
}
|
||||
|
||||
CdmResponseType CryptoSession::LoadLicense(const std::string& signed_message,
|
||||
const std::string& core_message,
|
||||
const std::string& signature,
|
||||
@@ -1183,36 +1145,6 @@ CdmResponseType CryptoSession::PrepareAndSignRenewalRequest(
|
||||
"PrepareAndSignRenewalRequest");
|
||||
}
|
||||
|
||||
CdmResponseType CryptoSession::RefreshKeys(
|
||||
const std::string& message, const std::string& signature,
|
||||
const std::vector<CryptoKey>& key_array) {
|
||||
const uint8_t* msg = reinterpret_cast<const uint8_t*>(message.data());
|
||||
std::vector<OEMCrypto_KeyRefreshObject> load_key_array(key_array.size());
|
||||
for (size_t i = 0; i < key_array.size(); ++i) {
|
||||
const CryptoKey* ki = &key_array[i];
|
||||
OEMCrypto_KeyRefreshObject* ko = &load_key_array[i];
|
||||
ko->key_id = GetSubstring(message, ki->key_id());
|
||||
bool has_key_control = ki->HasKeyControl();
|
||||
ko->key_control_iv =
|
||||
GetSubstring(message, ki->key_control_iv(), !has_key_control);
|
||||
ko->key_control =
|
||||
GetSubstring(message, ki->key_control(), !has_key_control);
|
||||
}
|
||||
LOGV("Refreshing keys: id = %u", oec_session_id_);
|
||||
OEMCryptoResult refresh_sts;
|
||||
WithOecSessionLock("RefreshKeys", [&] {
|
||||
M_TIME(refresh_sts = OEMCrypto_RefreshKeys(
|
||||
oec_session_id_, msg, message.size(),
|
||||
reinterpret_cast<const uint8_t*>(signature.data()),
|
||||
signature.size(), key_array.size(), &load_key_array[0]),
|
||||
metrics_, oemcrypto_refresh_keys_, refresh_sts);
|
||||
});
|
||||
|
||||
if (refresh_sts == OEMCrypto_SUCCESS) return KEY_ADDED;
|
||||
|
||||
return MapOEMCryptoResult(refresh_sts, REFRESH_KEYS_ERROR, "RefreshKeys");
|
||||
}
|
||||
|
||||
CdmResponseType CryptoSession::LoadRenewal(const std::string& signed_message,
|
||||
const std::string& core_message,
|
||||
const std::string& signature) {
|
||||
|
||||
Reference in New Issue
Block a user