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:
Rahul Frias
2018-12-04 23:46:47 -08:00
parent caa8c99752
commit 5f96a20d99
8 changed files with 43 additions and 0 deletions

View File

@@ -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,

View File

@@ -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";

View File

@@ -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());

View File

@@ -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,

View File

@@ -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) {