Remove Stale Licenses on Reprovisioning
Merges change 267713c (Remove stale licenses on reprovisioning) from the Widevine CDM repository. This change removes licenses belonging to the previous provisioning when provisioning changes. Bug: 9761923 Change-Id: I473816dd11dd950f4fb009b5b004630bd2d2b579
This commit is contained in:
@@ -35,7 +35,9 @@ bool CryptoSession::initialized_ = false;
|
||||
int CryptoSession::session_count_ = 0;
|
||||
|
||||
CryptoSession::CryptoSession()
|
||||
: open_(false), is_destination_buffer_type_valid_(false) {
|
||||
: open_(false),
|
||||
is_destination_buffer_type_valid_(false),
|
||||
security_level_(kSecurityLevelUninitialized) {
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -101,12 +103,22 @@ bool CryptoSession::GetToken(std::string* token) {
|
||||
return true;
|
||||
}
|
||||
|
||||
CryptoSession::SecurityLevel CryptoSession::GetSecurityLevel() {
|
||||
CdmSecurityLevel CryptoSession::GetSecurityLevel() {
|
||||
LOGV("CryptoSession::GetSecurityLevel: Lock");
|
||||
AutoLock auto_lock(crypto_lock_);
|
||||
if (!initialized_) {
|
||||
return kSecurityLevelUninitialized;
|
||||
}
|
||||
|
||||
switch (security_level_) {
|
||||
case kSecurityLevelL1:
|
||||
case kSecurityLevelL2:
|
||||
case kSecurityLevelL3:
|
||||
return security_level_;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
std::string security_level = OEMCrypto_SecurityLevel();
|
||||
|
||||
if ((security_level.size() != 2) || (security_level.at(0) != 'L')) {
|
||||
@@ -115,16 +127,20 @@ CryptoSession::SecurityLevel CryptoSession::GetSecurityLevel() {
|
||||
|
||||
switch (security_level.at(1)) {
|
||||
case '1':
|
||||
return kSecurityLevelL1;
|
||||
security_level_ = kSecurityLevelL1;
|
||||
break;
|
||||
case '2':
|
||||
return kSecurityLevelL2;
|
||||
security_level_ = kSecurityLevelL2;
|
||||
break;
|
||||
case '3':
|
||||
return kSecurityLevelL3;
|
||||
security_level_ = kSecurityLevelL3;
|
||||
break;
|
||||
default:
|
||||
return kSecurityLevelUnknown;
|
||||
security_level_ = kSecurityLevelUnknown;
|
||||
break;
|
||||
}
|
||||
|
||||
return kSecurityLevelUnknown;
|
||||
return security_level_;
|
||||
}
|
||||
|
||||
bool CryptoSession::GetDeviceUniqueId(std::string* device_id) {
|
||||
@@ -552,7 +568,8 @@ CdmResponseType CryptoSession::Decrypt(const CdmDecryptionParameters& params) {
|
||||
switch (buffer_descriptor.type) {
|
||||
case OEMCrypto_BufferType_Clear:
|
||||
buffer_descriptor.buffer.clear.address =
|
||||
static_cast<uint8_t*>(params.decrypt_buffer) + params.decrypt_buffer_offset;
|
||||
static_cast<uint8_t*>(params.decrypt_buffer) +
|
||||
params.decrypt_buffer_offset;
|
||||
buffer_descriptor.buffer.clear.max_length = params.decrypt_buffer_length;
|
||||
break;
|
||||
case OEMCrypto_BufferType_Secure:
|
||||
@@ -567,14 +584,9 @@ CdmResponseType CryptoSession::Decrypt(const CdmDecryptionParameters& params) {
|
||||
}
|
||||
|
||||
OEMCryptoResult sts = OEMCrypto_DecryptCTR(
|
||||
oec_session_id_,
|
||||
params.encrypt_buffer,
|
||||
params.encrypt_length,
|
||||
params.is_encrypted,
|
||||
&(*params.iv).front(),
|
||||
params.block_offset,
|
||||
&buffer_descriptor,
|
||||
params.subsample_flags);
|
||||
oec_session_id_, params.encrypt_buffer, params.encrypt_length,
|
||||
params.is_encrypted, &(*params.iv).front(), params.block_offset,
|
||||
&buffer_descriptor, params.subsample_flags);
|
||||
|
||||
if (OEMCrypto_ERROR_INSUFFICIENT_RESOURCES == sts) {
|
||||
return INSUFFICIENT_CRYPTO_RESOURCES;
|
||||
@@ -598,7 +610,7 @@ bool CryptoSession::GenerateNonce(uint32_t* nonce) {
|
||||
|
||||
bool CryptoSession::SetDestinationBufferType() {
|
||||
if (Properties::oem_crypto_use_secure_buffers()) {
|
||||
if (GetSecurityLevel() == CryptoSession::kSecurityLevelL1) {
|
||||
if (GetSecurityLevel() == kSecurityLevelL1) {
|
||||
destination_buffer_type_ = OEMCrypto_BufferType_Secure;
|
||||
} else {
|
||||
destination_buffer_type_ = OEMCrypto_BufferType_Clear;
|
||||
|
||||
Reference in New Issue
Block a user