Add decrypt hash support

[ Merge of http://go/wvgerrit/68083 ]

Add ability to query decrypt hash support, set a hash computed over a frame
and retrieve the last error at a later point.

Bug: 34080802
Test: WV unit/integration tests. New tests added to cdm_engine_test,
      libwvdrmdrmplugin_hidl_test and request_license_test.

Change-Id: I7548c8798c873a6af3e1cfc0df57c117e1e474a6
This commit is contained in:
Rahul Frias
2018-12-12 02:04:26 -08:00
parent d44a8016ad
commit 589a3cf27e
21 changed files with 601 additions and 10 deletions

View File

@@ -528,6 +528,14 @@ status_t WVDrmPlugin::getPropertyString(const String8& name,
return queryProperty(QUERY_KEY_RESOURCE_RATING_TIER, value);
} else if (name == "oemCryptoBuildInformation") {
return queryProperty(QUERY_KEY_OEMCRYPTO_BUILD_INFORMATION, value);
} else if (name == "decryptHashSupport") {
return queryProperty(QUERY_KEY_DECRYPT_HASH_SUPPORT, value);
} else if (name == "decryptHashError") {
std::string hash_error_string;
CdmResponseType res =
mCDM->GetDecryptHashError(mDecryptHashSessionId, &hash_error_string);
value = hash_error_string.c_str();
return mapCdmResponseType(res);
} else {
ALOGE("App requested unknown string property %s", name.string());
return android::ERROR_DRM_CANNOT_HANDLE;
@@ -630,6 +638,16 @@ status_t WVDrmPlugin::setPropertyString(const String8& name,
} else {
mCdmIdentifier.origin = value.string();
}
} else if (name == "decryptHash") {
CdmSessionId sessionId;
CdmResponseType res =
mCDM->SetDecryptHash(value.string(), &sessionId);
if (wvcdm::NO_ERROR == res) mDecryptHashSessionId = sessionId;
return mapCdmResponseType(res);
} else if (name == "decryptHashSessionId") {
mDecryptHashSessionId = value.string();
} else {
ALOGE("App set unknown string property %s", name.string());
return android::ERROR_DRM_CANNOT_HANDLE;