Allow querying of OEMCrypto build information
[ Merge of http://go/wvgerrit/67503 ] Bug: 117118184 Test: WV unit/integration tests Change-Id: I8db90c1617e068a4711eb41a5852d15b5e228f2f
This commit is contained in:
@@ -149,6 +149,8 @@ class CryptoSession {
|
||||
virtual bool IsSrmUpdateSupported();
|
||||
virtual bool LoadSrm(const std::string& srm);
|
||||
|
||||
virtual bool GetBuildInformation(std::string* info);
|
||||
|
||||
virtual CdmResponseType GenericEncrypt(const std::string& in_buffer,
|
||||
const std::string& key_id,
|
||||
const std::string& iv,
|
||||
|
||||
@@ -71,6 +71,8 @@ static const std::string QUERY_KEY_CURRENT_SRM_VERSION = "CurrentSRMVersion";
|
||||
static const std::string QUERY_KEY_SRM_UPDATE_SUPPORT = "SRMUpdateSupport";
|
||||
// whether OEM supports SRM update
|
||||
static const std::string QUERY_KEY_WVCDM_VERSION = "WidevineCdmVersion";
|
||||
static const std::string QUERY_KEY_OEMCRYPTO_BUILD_INFORMATION =
|
||||
"OemCryptoBuildInformation";
|
||||
|
||||
static const std::string QUERY_VALUE_TRUE = "True";
|
||||
static const std::string QUERY_VALUE_FALSE = "False";
|
||||
|
||||
@@ -642,6 +642,11 @@ CdmResponseType CdmEngine::QueryStatus(SecurityLevel security_level,
|
||||
}
|
||||
|
||||
*query_response = cdm_version;
|
||||
} else if (query_token == QUERY_KEY_OEMCRYPTO_BUILD_INFORMATION) {
|
||||
if (!crypto_session->GetBuildInformation(query_response)) {
|
||||
LOGW("CdmEngine::QueryStatus: GetBuildInformation failed");
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
} else {
|
||||
LOGW("CdmEngine::QueryStatus: Unknown status requested, token = %s",
|
||||
query_token.c_str());
|
||||
|
||||
@@ -1773,6 +1773,24 @@ bool CryptoSession::LoadSrm(const std::string& srm) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CryptoSession::GetBuildInformation(std::string* info) {
|
||||
LOGV("GetBuildInformation");
|
||||
if (!initialized_) return false;
|
||||
if (info == nullptr) {
|
||||
LOGE("CryptoSession::GetBuildInformation: |info| cannot be empty");
|
||||
return false;
|
||||
}
|
||||
const char* build_information =
|
||||
OEMCrypto_BuildInformation(requested_security_level_);
|
||||
if (build_information == nullptr) {
|
||||
LOGE("CryptoSession::GetBuildInformation: returned null");
|
||||
return false;
|
||||
}
|
||||
|
||||
info->assign(build_information);
|
||||
return true;
|
||||
}
|
||||
|
||||
CdmResponseType CryptoSession::GenericEncrypt(const std::string& in_buffer,
|
||||
const std::string& key_id,
|
||||
const std::string& iv,
|
||||
|
||||
@@ -4137,6 +4137,12 @@ TEST_F(WvCdmRequestLicenseTest, QueryStatus) {
|
||||
ASSERT_FALSE(ss.fail());
|
||||
EXPECT_TRUE(ss.eof());
|
||||
EXPECT_LE(10u, api_version);
|
||||
|
||||
EXPECT_EQ(wvcdm::NO_ERROR,
|
||||
decryptor_.QueryStatus(
|
||||
kLevelDefault, wvcdm::QUERY_KEY_OEMCRYPTO_BUILD_INFORMATION,
|
||||
&value));
|
||||
EXPECT_TRUE(!value.empty());
|
||||
}
|
||||
|
||||
TEST_F(WvCdmRequestLicenseTest, QueryStatusL3) {
|
||||
|
||||
Reference in New Issue
Block a user