Remove Sub-Licenses and Sub-Sessions
(This is a merge of http://go/wvgerrit/66643) The sub-license feature has been removed from the server and packager. So that we do not have to continue maintaining the code that supports this feature that never shipped, I am removing it from the CDM as well. Bug: 113165466 Test: CE CDM Unit Tests Test: Android Unit Tests Change-Id: I5d25844b161e74aa19adf19a29c56e4881aa7304
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include "properties.h"
|
||||
#include "pst_report.h"
|
||||
#include "string_conversions.h"
|
||||
#include "sublicense_key_session.h"
|
||||
#include "usage_table_header.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
|
||||
@@ -772,7 +771,6 @@ CdmResponseType CryptoSession::Open(SecurityLevel requested_security_level) {
|
||||
metrics_->oemcrypto_usage_table_support_.SetError(result);
|
||||
}
|
||||
|
||||
// TODO(gmorgan, jfore): resolve handling of usage records in sublicenses
|
||||
key_session_.reset(new ContentKeySession(oec_session_id_, metrics_));
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -944,7 +942,6 @@ bool CryptoSession::LoadCertificatePrivateKey(std::string& wrapped_key) {
|
||||
LOGE("LoadCertificatePrivateKey: OEMCrypto_LoadDeviceRSAKey error=%d", sts);
|
||||
return false;
|
||||
}
|
||||
wrapped_key_ = wrapped_key;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2316,73 +2313,6 @@ bool CryptoSession::GetAnalogOutputCapabilities(bool* can_support_output,
|
||||
return true;
|
||||
}
|
||||
|
||||
CdmResponseType CryptoSession::AddSubSession(
|
||||
const std::string& sub_session_key_id,
|
||||
const std::string& group_master_key_id) {
|
||||
size_t exists = sub_license_oec_sessions_.count(sub_session_key_id);
|
||||
if (exists > 0) {
|
||||
// TODO(jfore): Should this be an error if the key exists? If so add a new
|
||||
// error. If not, perhaps this should just print info message.
|
||||
LOGE("AddSubSession: SubSession already exists for id: %s",
|
||||
sub_session_key_id.c_str());
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
CryptoSessionId sid;
|
||||
OEMCryptoResult sts = OEMCrypto_OpenSession(&sid, requested_security_level_);
|
||||
if (OEMCrypto_ERROR_TOO_MANY_SESSIONS == sts) {
|
||||
LOGE("OEMCrypto_Open failed: %d, open sessions: %ld, initialized: %d", sts,
|
||||
session_count_, (int)initialized_);
|
||||
return INSUFFICIENT_CRYPTO_RESOURCES;
|
||||
} else if (OEMCrypto_SUCCESS != sts) {
|
||||
LOGE("OEMCrypto_Open failed: %d, open sessions: %ld, initialized: %d", sts,
|
||||
session_count_, (int)initialized_);
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
M_TIME(sts = OEMCrypto_LoadDeviceRSAKey(
|
||||
sid, reinterpret_cast<const uint8_t*>(wrapped_key_.data()),
|
||||
wrapped_key_.size()),
|
||||
metrics_, oemcrypto_load_device_rsa_key_, sts);
|
||||
|
||||
if (OEMCrypto_SUCCESS != sts) {
|
||||
LOGE("LoadDeviceRSAKey failed: %d", sts);
|
||||
return NEED_PROVISIONING;
|
||||
}
|
||||
|
||||
sub_license_oec_sessions_[sub_session_key_id] = sid;
|
||||
if (key_session_->Type() != KeySession::kSubLicense) {
|
||||
key_session_.reset(new SubLicenseKeySession(
|
||||
sub_license_oec_sessions_, metrics_, wrapped_key_,
|
||||
requested_security_level_, group_master_key_id));
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
bool CryptoSession::GenerateSubSessionNonce(
|
||||
const std::string& sub_session_key_id, bool* exists, uint32_t* nonce) {
|
||||
if (!exists || !nonce) {
|
||||
LOGE("input parameter is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
LOGV("CryptoSession::GenerateSubSessionNonce: Lock");
|
||||
AutoLock auto_lock(crypto_lock_);
|
||||
|
||||
SubLicenseSessionMap::iterator it =
|
||||
sub_license_oec_sessions_.find(sub_session_key_id);
|
||||
if (it == sub_license_oec_sessions_.end()) {
|
||||
// A subsession does not exist. Indicate that and return success.
|
||||
*exists = false;
|
||||
return false;
|
||||
}
|
||||
*exists = true;
|
||||
|
||||
OEMCryptoResult result;
|
||||
result = OEMCrypto_GenerateNonce(it->second, nonce);
|
||||
return OEMCrypto_SUCCESS == result;
|
||||
}
|
||||
|
||||
OEMCrypto_Algorithm CryptoSession::GenericSigningAlgorithm(
|
||||
CdmSigningAlgorithm algorithm) {
|
||||
if (kSigningAlgorithmHmacSha256 == algorithm) {
|
||||
|
||||
Reference in New Issue
Block a user