Usage license handling corrections

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

Validate that offline licenses that do not contain a provider session
token are not handled by the TEE.

b/38490468

Test: WV Unit/integration tests, GtsMediaTestCases,
      WvCdmRequestLicenseTest.ReleaseRetryL3OfflineKeySessionUsageDisabledTest

Change-Id: Idaf62f2a882ae933c1a3e108d791943034780a46
This commit is contained in:
Rahul Frias
2017-06-12 20:03:57 -07:00
parent 4228e2327e
commit db05f1e01c
2 changed files with 83 additions and 4 deletions

View File

@@ -635,7 +635,8 @@ CdmResponseType CdmSession::GenerateReleaseRequest(
if (KEY_MESSAGE != status) return status;
if (usage_support_type_ == kUsageEntrySupport) {
if (has_provider_session_token() &&
usage_support_type_ == kUsageEntrySupport) {
status = usage_table_header_->UpdateEntry(crypto_session_.get(),
&usage_entry_);
if (status != NO_ERROR) {
@@ -666,7 +667,8 @@ CdmResponseType CdmSession::ReleaseKey(const CdmKeyResponse& key_response) {
if (is_offline_ || has_provider_session_token()) {
DeleteLicense();
if (usage_support_type_ == kUsageEntrySupport) {
if (usage_support_type_ == kUsageEntrySupport &&
has_provider_session_token()) {
sts = DeleteUsageEntry(usage_entry_number_);
if (NO_ERROR != sts) return sts;
}
@@ -675,7 +677,8 @@ CdmResponseType CdmSession::ReleaseKey(const CdmKeyResponse& key_response) {
}
CdmResponseType CdmSession::DeleteUsageEntry(uint32_t usage_entry_number) {
if (usage_support_type_ != kUsageEntrySupport) {
if (usage_support_type_ != kUsageEntrySupport ||
!has_provider_session_token()) {
LOGE("CdmSession::DeleteUsageEntry: Unexpected usage type supported: %d",
usage_support_type_);
return INCORRECT_USAGE_SUPPORT_TYPE_1;
@@ -876,7 +879,8 @@ CdmResponseType CdmSession::UpdateUsageTableInformation() {
}
CdmResponseType CdmSession::UpdateUsageEntryInformation() {
if (usage_support_type_ != kUsageEntrySupport) {
if (usage_support_type_ != kUsageEntrySupport ||
!has_provider_session_token()) {
LOGE("CdmSession::UpdateUsageEntryInformation: Unexpected usage type "
"supported: %d", usage_support_type_);
return INCORRECT_USAGE_SUPPORT_TYPE_2;