am fd482527: L1 System Lowered to L3 Still Requires Secure Decoders
* commit 'fd482527e4b07c6664bd463785a3ec8ba554a788': L1 System Lowered to L3 Still Requires Secure Decoders
This commit is contained in:
@@ -65,6 +65,10 @@ class CdmEngine : public TimerHandler {
|
|||||||
// Query system information
|
// Query system information
|
||||||
virtual CdmResponseType QueryStatus(CdmQueryMap* info);
|
virtual CdmResponseType QueryStatus(CdmQueryMap* info);
|
||||||
|
|
||||||
|
// Query session information
|
||||||
|
virtual CdmResponseType QuerySessionStatus(const CdmSessionId& session_id,
|
||||||
|
CdmQueryMap* key_info);
|
||||||
|
|
||||||
// Query license information
|
// Query license information
|
||||||
virtual CdmResponseType QueryKeyStatus(const CdmSessionId& session_id,
|
virtual CdmResponseType QueryKeyStatus(const CdmSessionId& session_id,
|
||||||
CdmQueryMap* key_info);
|
CdmQueryMap* key_info);
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ class CdmSession {
|
|||||||
// CancelKeyRequest() - Cancel session.
|
// CancelKeyRequest() - Cancel session.
|
||||||
CdmResponseType CancelKeyRequest();
|
CdmResponseType CancelKeyRequest();
|
||||||
|
|
||||||
|
// Query session status
|
||||||
|
CdmResponseType QueryStatus(CdmQueryMap* key_info);
|
||||||
|
|
||||||
// Query license information
|
// Query license information
|
||||||
CdmResponseType QueryKeyStatus(CdmQueryMap* key_info);
|
CdmResponseType QueryKeyStatus(CdmQueryMap* key_info);
|
||||||
|
|
||||||
|
|||||||
@@ -401,6 +401,18 @@ CdmResponseType CdmEngine::QueryStatus(CdmQueryMap* key_info) {
|
|||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CdmResponseType CdmEngine::QuerySessionStatus(const CdmSessionId& session_id,
|
||||||
|
CdmQueryMap* key_info) {
|
||||||
|
LOGI("CdmEngine::QuerySessionStatus");
|
||||||
|
CdmSessionMap::iterator iter = sessions_.find(session_id);
|
||||||
|
if (iter == sessions_.end()) {
|
||||||
|
LOGE("CdmEngine::QuerySessionStatus: session_id not found = %s",
|
||||||
|
session_id.c_str());
|
||||||
|
return KEY_ERROR;
|
||||||
|
}
|
||||||
|
return iter->second->QueryStatus(key_info);
|
||||||
|
}
|
||||||
|
|
||||||
CdmResponseType CdmEngine::QueryKeyStatus(
|
CdmResponseType CdmEngine::QueryKeyStatus(
|
||||||
const CdmSessionId& session_id,
|
const CdmSessionId& session_id,
|
||||||
CdmQueryMap* key_info) {
|
CdmQueryMap* key_info) {
|
||||||
|
|||||||
@@ -239,6 +239,37 @@ CdmResponseType CdmSession::AddKey(const CdmKeyResponse& key_response,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CdmResponseType CdmSession::QueryStatus(CdmQueryMap* key_info) {
|
||||||
|
if (crypto_session_.get() == NULL) {
|
||||||
|
LOGW("CdmSession::QueryStatus: Invalid crypto session");
|
||||||
|
return UNKNOWN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!crypto_session_->IsOpen()) {
|
||||||
|
LOGW("CdmSession::QueryStatus: Crypto session not open");
|
||||||
|
return UNKNOWN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (crypto_session_->GetSecurityLevel()) {
|
||||||
|
case kSecurityLevelL1:
|
||||||
|
(*key_info)[QUERY_KEY_SECURITY_LEVEL] = QUERY_VALUE_SECURITY_LEVEL_L1;
|
||||||
|
break;
|
||||||
|
case kSecurityLevelL2:
|
||||||
|
(*key_info)[QUERY_KEY_SECURITY_LEVEL] = QUERY_VALUE_SECURITY_LEVEL_L2;
|
||||||
|
break;
|
||||||
|
case kSecurityLevelL3:
|
||||||
|
(*key_info)[QUERY_KEY_SECURITY_LEVEL] = QUERY_VALUE_SECURITY_LEVEL_L3;
|
||||||
|
break;
|
||||||
|
case kSecurityLevelUninitialized:
|
||||||
|
case kSecurityLevelUnknown:
|
||||||
|
(*key_info)[QUERY_KEY_SECURITY_LEVEL] = QUERY_VALUE_SECURITY_LEVEL_Unknown;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return KEY_ERROR;
|
||||||
|
}
|
||||||
|
return NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
CdmResponseType CdmSession::QueryKeyStatus(CdmQueryMap* key_info) {
|
CdmResponseType CdmSession::QueryKeyStatus(CdmQueryMap* key_info) {
|
||||||
return policy_engine_.Query(key_info);
|
return policy_engine_.Query(key_info);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ class WvContentDecryptionModule {
|
|||||||
// Query system information
|
// Query system information
|
||||||
virtual CdmResponseType QueryStatus(CdmQueryMap* key_info);
|
virtual CdmResponseType QueryStatus(CdmQueryMap* key_info);
|
||||||
|
|
||||||
|
// Query session information
|
||||||
|
virtual CdmResponseType QuerySessionStatus(const CdmSessionId& session_id,
|
||||||
|
CdmQueryMap* key_info);
|
||||||
|
|
||||||
// Query license information
|
// Query license information
|
||||||
virtual CdmResponseType QueryKeyStatus(const CdmSessionId& session_id,
|
virtual CdmResponseType QueryKeyStatus(const CdmSessionId& session_id,
|
||||||
CdmQueryMap* key_info);
|
CdmQueryMap* key_info);
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ CdmResponseType WvContentDecryptionModule::QueryStatus(CdmQueryMap* key_info) {
|
|||||||
return cdm_engine_->QueryStatus(key_info);
|
return cdm_engine_->QueryStatus(key_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CdmResponseType WvContentDecryptionModule::QuerySessionStatus(
|
||||||
|
const CdmSessionId& session_id, CdmQueryMap* key_info) {
|
||||||
|
return cdm_engine_->QuerySessionStatus(session_id, key_info);
|
||||||
|
}
|
||||||
|
|
||||||
CdmResponseType WvContentDecryptionModule::QueryKeyStatus(
|
CdmResponseType WvContentDecryptionModule::QueryKeyStatus(
|
||||||
const CdmSessionId& session_id, CdmQueryMap* key_info) {
|
const CdmSessionId& session_id, CdmQueryMap* key_info) {
|
||||||
return cdm_engine_->QueryKeyStatus(session_id, key_info);
|
return cdm_engine_->QueryKeyStatus(session_id, key_info);
|
||||||
|
|||||||
@@ -715,6 +715,40 @@ TEST_F(WvCdmRequestLicenseTest, OfflineLicenseRenewal) {
|
|||||||
decryptor_.CloseSession(session_id_);
|
decryptor_.CloseSession(session_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(WvCdmRequestLicenseTest, QuerySessionStatus) {
|
||||||
|
// Test that the global value is returned when no properties are modifying it.
|
||||||
|
CdmQueryMap system_query_info;
|
||||||
|
CdmQueryMap::iterator system_itr;
|
||||||
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_.QueryStatus(&system_query_info));
|
||||||
|
system_itr = system_query_info.find(wvcdm::QUERY_KEY_SECURITY_LEVEL);
|
||||||
|
ASSERT_TRUE(system_itr != system_query_info.end());
|
||||||
|
|
||||||
|
decryptor_.OpenSession(g_key_system, NULL, &session_id_);
|
||||||
|
CdmQueryMap unmodified_query_info;
|
||||||
|
CdmQueryMap::iterator unmodified_itr;
|
||||||
|
ASSERT_EQ(wvcdm::NO_ERROR,
|
||||||
|
decryptor_.QuerySessionStatus(session_id_, &unmodified_query_info));
|
||||||
|
unmodified_itr = unmodified_query_info.find(wvcdm::QUERY_KEY_SECURITY_LEVEL);
|
||||||
|
ASSERT_TRUE(unmodified_itr != unmodified_query_info.end());
|
||||||
|
EXPECT_EQ(system_itr->second, unmodified_itr->second);
|
||||||
|
decryptor_.CloseSession(session_id_);
|
||||||
|
|
||||||
|
// Test that L3 is returned when properties downgrade security.
|
||||||
|
TestWvCdmClientPropertySet property_set_L3;
|
||||||
|
property_set_L3.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L3);
|
||||||
|
|
||||||
|
decryptor_.OpenSession(g_key_system, &property_set_L3, &session_id_);
|
||||||
|
CdmQueryMap modified_query_info;
|
||||||
|
CdmQueryMap::iterator modified_itr;
|
||||||
|
ASSERT_EQ(wvcdm::NO_ERROR,
|
||||||
|
decryptor_.QuerySessionStatus(session_id_, &modified_query_info));
|
||||||
|
modified_itr = modified_query_info.find(wvcdm::QUERY_KEY_SECURITY_LEVEL);
|
||||||
|
ASSERT_TRUE(modified_itr != modified_query_info.end());
|
||||||
|
EXPECT_EQ(QUERY_VALUE_SECURITY_LEVEL_L3, modified_itr->second);
|
||||||
|
decryptor_.CloseSession(session_id_);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(WvCdmRequestLicenseTest, QueryKeyStatus) {
|
TEST_F(WvCdmRequestLicenseTest, QueryKeyStatus) {
|
||||||
decryptor_.OpenSession(g_key_system, NULL, &session_id_);
|
decryptor_.OpenSession(g_key_system, NULL, &session_id_);
|
||||||
GenerateKeyRequest(g_key_system, g_key_id, kLicenseTypeStreaming);
|
GenerateKeyRequest(g_key_system, g_key_id, kLicenseTypeStreaming);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ bool WVCryptoPlugin::requiresSecureDecoderComponent(const char* mime) const {
|
|||||||
// Type is video, so query CDM to see if we require a secure decoder.
|
// Type is video, so query CDM to see if we require a secure decoder.
|
||||||
CdmQueryMap status;
|
CdmQueryMap status;
|
||||||
|
|
||||||
CdmResponseType res = mCDM->QueryStatus(&status);
|
CdmResponseType res = mCDM->QuerySessionStatus(mSessionId, &status);
|
||||||
|
|
||||||
if (!isCdmResponseTypeSuccess(res)) {
|
if (!isCdmResponseTypeSuccess(res)) {
|
||||||
ALOGE("Error querying CDM status: %u", res);
|
ALOGE("Error querying CDM status: %u", res);
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ class MockCDM : public WvContentDecryptionModule {
|
|||||||
MOCK_METHOD2(Decrypt, CdmResponseType(const CdmSessionId&,
|
MOCK_METHOD2(Decrypt, CdmResponseType(const CdmSessionId&,
|
||||||
const CdmDecryptionParameters&));
|
const CdmDecryptionParameters&));
|
||||||
|
|
||||||
MOCK_METHOD1(QueryStatus, CdmResponseType(CdmQueryMap*));
|
MOCK_METHOD2(QuerySessionStatus, CdmResponseType(const CdmSessionId&,
|
||||||
|
CdmQueryMap*));
|
||||||
};
|
};
|
||||||
|
|
||||||
class WVCryptoPluginTest : public Test {
|
class WVCryptoPluginTest : public Test {
|
||||||
@@ -55,10 +56,10 @@ TEST_F(WVCryptoPluginTest, CorrectlyReportsSecureBuffers) {
|
|||||||
CdmQueryMap l3Map;
|
CdmQueryMap l3Map;
|
||||||
l3Map[QUERY_KEY_SECURITY_LEVEL] = QUERY_VALUE_SECURITY_LEVEL_L3;
|
l3Map[QUERY_KEY_SECURITY_LEVEL] = QUERY_VALUE_SECURITY_LEVEL_L3;
|
||||||
|
|
||||||
EXPECT_CALL(cdm, QueryStatus(_))
|
EXPECT_CALL(cdm, QuerySessionStatus(_, _))
|
||||||
.WillOnce(DoAll(SetArgPointee<0>(l1Map),
|
.WillOnce(DoAll(SetArgPointee<1>(l1Map),
|
||||||
Return(wvcdm::NO_ERROR)))
|
Return(wvcdm::NO_ERROR)))
|
||||||
.WillOnce(DoAll(SetArgPointee<0>(l3Map),
|
.WillOnce(DoAll(SetArgPointee<1>(l3Map),
|
||||||
Return(wvcdm::NO_ERROR)));
|
Return(wvcdm::NO_ERROR)));
|
||||||
|
|
||||||
EXPECT_TRUE(plugin.requiresSecureDecoderComponent("video/mp4")) <<
|
EXPECT_TRUE(plugin.requiresSecureDecoderComponent("video/mp4")) <<
|
||||||
|
|||||||
Reference in New Issue
Block a user