Add InactiveUnused to Usage Report status

Merge from Widevine repo of http://go/wvgerrit/22963

This change kInactive to kInactiveUsed and adds kInactiveUnused to the
possible values for the status field in the Usage Report.  This CL
updates the header, the unit tests, and haystack and reference code.

b/32714323

Change-Id: If8d8e32ea1e3dc18da34e5fae35f578b027de9c7
This commit is contained in:
Fred Gylys-Colwell
2017-01-20 18:52:02 -08:00
parent b2a3921b37
commit a494eeafdc
8 changed files with 36 additions and 22 deletions

View File

@@ -381,13 +381,13 @@ bool SessionContext::CheckNonceOrEntry(const KeyControlBlock& key_control_block,
if (!usage_entry_) {
usage_entry_ = ce_->usage_table()->FindEntry(pst);
if (usage_entry_) {
if (usage_entry_->status() == kInactive) return false;
if (usage_entry_->inactive()) return false;
} else {
if (!CheckNonce(key_control_block.nonce())) return false;
usage_entry_ = ce_->usage_table()->CreateEntry(pst, this);
}
} else {
if (usage_entry_->status() == kInactive) return false;
if (usage_entry_->inactive()) return false;
}
break; // Usage table not required. Look at nonce enabled bit.
default:

View File

@@ -66,7 +66,11 @@ void UsageTableEntry::SaveToBuffer(StoredUsageEntry *buffer) {
}
void UsageTableEntry::Deactivate() {
status_ = kInactive;
if (status_ == kUnused) {
status_ = kInactiveUnused;
} else if (status_ == kActive) {
status_ = kInactiveUsed;
}
if (session_) {
session_->ReleaseUsageEntry();
session_ = NULL;
@@ -85,6 +89,8 @@ bool UsageTableEntry::UpdateTime() {
time_of_last_decrypt_ = now;
return true;
case kInactive:
case kInactiveUsed:
case kInactiveUnused:
return false;
}
return false;

View File

@@ -50,6 +50,7 @@ class UsageTableEntry {
~UsageTableEntry();
void SaveToBuffer(StoredUsageEntry *buffer);
OEMCrypto_Usage_Entry_Status status() const { return status_; }
bool inactive() const { return status_ >= kInactive; }
void Deactivate();
bool UpdateTime();
OEMCryptoResult ReportUsage(SessionContext *session,