Check security-level during OpenSession.
[ Merge of http://go/wvgerrit/140934 ] It was assumed that L1 would be tried before first reverting to L3 when performing OTA keybox provisioning. If an app automatically defaults to L3, it may get into a provisioning loop if the device wants to perform keybox provisioning. Now, OpenSession() will check the security level before suggesting OTA keybox provisioning back to the app. Bug: 187646550 Test: Manual tests on Android Change-Id: Icd8f0915b0cc0d06c545b43bf8c1ccac793ce0b2
This commit is contained in:
@@ -121,41 +121,50 @@ CdmResponseType CdmEngine::OpenSession(const CdmKeySystem& key_system,
|
|||||||
}
|
}
|
||||||
LOGD("forced_session_id = %s", IdPtrToString(forced_session_id));
|
LOGD("forced_session_id = %s", IdPtrToString(forced_session_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SecurityLevel requested_security_level = kLevelDefault;
|
||||||
|
if (property_set &&
|
||||||
|
property_set->security_level() == QUERY_VALUE_SECURITY_LEVEL_L3) {
|
||||||
|
requested_security_level = kLevel3;
|
||||||
|
}
|
||||||
|
|
||||||
bool forced_level3 = false;
|
bool forced_level3 = false;
|
||||||
if (OkpCheck()) {
|
if (requested_security_level == kLevelDefault) {
|
||||||
bool okp_provisioned = false;
|
if (OkpCheck()) {
|
||||||
bool fallback = false;
|
bool okp_provisioned = false;
|
||||||
{
|
bool fallback = false;
|
||||||
std::unique_lock<std::mutex> lock(okp_mutex_);
|
{
|
||||||
if (!okp_provisioner_) {
|
std::unique_lock<std::mutex> lock(okp_mutex_);
|
||||||
// Very rare race condition. Possible if two calls to OpenSession
|
if (!okp_provisioner_) {
|
||||||
// occur the same time. Cleanup would have been performed.
|
// Very rare race condition. Possible if two calls to OpenSession
|
||||||
if (okp_fallback_) {
|
// occur the same time. Cleanup would have been performed.
|
||||||
fallback = true;
|
if (okp_fallback_) {
|
||||||
} else {
|
fallback = true;
|
||||||
|
} else {
|
||||||
|
okp_provisioned = true;
|
||||||
|
}
|
||||||
|
} else if (okp_provisioner_->IsProvisioned()) {
|
||||||
okp_provisioned = true;
|
okp_provisioned = true;
|
||||||
|
} else if (okp_provisioner_->IsInFallbackMode()) {
|
||||||
|
fallback = true;
|
||||||
}
|
}
|
||||||
} else if (okp_provisioner_->IsProvisioned()) {
|
|
||||||
okp_provisioned = true;
|
|
||||||
} else if (okp_provisioner_->IsInFallbackMode()) {
|
|
||||||
fallback = true;
|
|
||||||
}
|
}
|
||||||
}
|
if (okp_provisioned) {
|
||||||
if (okp_provisioned) {
|
// OKP not required, engine may assume normal operations.
|
||||||
// OKP not required, engine may assume normal operations.
|
OkpCleanUp();
|
||||||
OkpCleanUp();
|
} else if (fallback) {
|
||||||
} else if (fallback) {
|
LOGD("Engine is falling back to L3");
|
||||||
LOGD("Engine is falling back to L3");
|
OkpTriggerFallback();
|
||||||
OkpTriggerFallback();
|
forced_level3 = true;
|
||||||
forced_level3 = true;
|
} else {
|
||||||
|
// OKP is required.
|
||||||
|
return NEED_PROVISIONING;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// OKP is required.
|
std::unique_lock<std::mutex> lock(okp_mutex_);
|
||||||
return NEED_PROVISIONING;
|
// |okp_fallback_| would have been set previously if required.
|
||||||
|
if (okp_fallback_) forced_level3 = true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
std::unique_lock<std::mutex> lock(okp_mutex_);
|
|
||||||
// |okp_fallback_| would have been set previously if required.
|
|
||||||
if (okp_fallback_) forced_level3 = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseExpiredReleaseSessions();
|
CloseExpiredReleaseSessions();
|
||||||
|
|||||||
Reference in New Issue
Block a user