Add rollback-prevention time methods to ref
Merge from master branch of Widevine repo of http://go/wvgerrit/66077 Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64562 Bug: b/78357351 b/62058202 addressed issues with the Level 3 OEMCrypto in guarding against rollback. This change does something similar for the ref, so that OEMCrypto vendors have rollback-prevention code they can refer to. Test: linux/ce cdm unit tests Test: tested as part of http://go/ag/5501993 Change-Id: I76128c5def2615ecbdbe94e3af1fec4a025be8c1
This commit is contained in:
committed by
Fred Gylys-Colwell
parent
b7e4b56934
commit
0ee5214b92
@@ -31,16 +31,21 @@
|
||||
|
||||
namespace wvoec_ref {
|
||||
|
||||
OldUsageTableEntry::OldUsageTableEntry(const std::vector<uint8_t> &pst_hash)
|
||||
OldUsageTableEntry::OldUsageTableEntry(OldUsageTable *old_usage_table,
|
||||
const std::vector<uint8_t> &pst_hash)
|
||||
: pst_hash_(pst_hash),
|
||||
time_of_license_received_(time(NULL)),
|
||||
old_usage_table_(old_usage_table),
|
||||
time_of_license_received_(
|
||||
old_usage_table_->ce_->RollbackCorrectedOfflineTime()),
|
||||
time_of_first_decrypt_(0),
|
||||
time_of_last_decrypt_(0),
|
||||
status_(kUnused) {}
|
||||
|
||||
OldUsageTableEntry::~OldUsageTableEntry() {}
|
||||
|
||||
OldUsageTableEntry::OldUsageTableEntry(const OldStoredUsageEntry *buffer) {
|
||||
OldUsageTableEntry::OldUsageTableEntry(OldUsageTable *old_usage_table,
|
||||
const OldStoredUsageEntry *buffer)
|
||||
: old_usage_table_(old_usage_table) {
|
||||
pst_hash_.assign(buffer->pst_hash, buffer->pst_hash + SHA256_DIGEST_LENGTH);
|
||||
time_of_license_received_ = buffer->time_of_license_received;
|
||||
time_of_first_decrypt_ = buffer->time_of_first_decrypt;
|
||||
@@ -157,7 +162,7 @@ OldUsageTable::OldUsageTable(CryptoEngine *ce) {
|
||||
// entries.
|
||||
for (uint64_t i = 0; i < stored_table->count; i++) {
|
||||
OldUsageTableEntry *entry =
|
||||
new OldUsageTableEntry(&stored_table->entries[i].entry);
|
||||
new OldUsageTableEntry(this, &stored_table->entries[i].entry);
|
||||
table_[entry->pst_hash()] = entry;
|
||||
}
|
||||
}
|
||||
@@ -188,7 +193,7 @@ OldUsageTableEntry *OldUsageTable::CreateEntry(
|
||||
LOGE("OldUsageTable: Could not compute hash of pst.");
|
||||
return NULL;
|
||||
}
|
||||
OldUsageTableEntry *entry = new OldUsageTableEntry(pst_hash);
|
||||
OldUsageTableEntry *entry = new OldUsageTableEntry(this, pst_hash);
|
||||
wvcdm::AutoLock lock(lock_);
|
||||
table_[pst_hash] = entry;
|
||||
return entry;
|
||||
|
||||
Reference in New Issue
Block a user