Update comments on copying old usage entries

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

CopyOldUsageEntry currently needs the old usage table to be loaded via
CreateOldUsageEntry. The CDM uses a workaround by creating a dummy old
entry, but the OEMCrypto code should be responsible for this. However,
since there have been several versions released with the current
OEMCrypto spec, the CDM code would have to still exist to support
implementations of that spec. Therefore, in order to avoid having to
support both a CDM with this workaround removed (as well as updating
the spec) and a CDM with it still in place, this workaround should be
canonicalized.

b/65730828
Test: tested as part of http://go/ag/4674759
Change-Id: I4619c551b79a53746683519d284663bf513ec38d
This commit is contained in:
Fred Gylys-Colwell
2018-07-01 17:22:06 -07:00
parent 8639842ff5
commit d17199fb83

View File

@@ -505,8 +505,8 @@ bool UsageTableHeader::UpgradeLicensesFromUsageTable(
DeviceFiles* handle, metrics::CryptoMetrics* metrics) {
// Fetch the key set IDs for each offline license. For each license
// * retrieve the provider session token,
// * create a new usage entry
// * copy over the entry from the usage table
// * load the old usage table by creating a new dummy entry
// * copy over the entry from the old usage table and
// * update the usage header table and entry numbers
// * save the usage table header and store the usage entry number and
// usage entry along with the license to persistent memory
@@ -554,7 +554,8 @@ bool UsageTableHeader::UpgradeLicensesFromUsageTable(
if (status != NO_ERROR) continue;
// TODO(fredgc): remove when b/65730828 is addressed
// We create this entry since OEMCrypto_CopyOldUsageEntry needs the old
// usage table to be loaded in order to copy an entry.
if (!CreateDummyOldUsageEntry(&crypto_session)) continue;
status = AddEntry(&crypto_session, true /* persistent license */,
@@ -597,8 +598,8 @@ bool UsageTableHeader::UpgradeUsageInfoFromUsageTable(
DeviceFiles* handle, metrics::CryptoMetrics* metrics) {
// Fetch all usage files. For each file retrieve all the usage info records
// within the file. For each piece of usage information
// * create a new usage entry
// * copy over the entry from the usage table and
// * load the old usage table by creating a new dummy entry
// * copy over the entry from the old usage table and
// * update the usage header table and entry numbers
// * save the usage table header
// * once done processing all the usage records from a file, save the usage
@@ -635,7 +636,8 @@ bool UsageTableHeader::UpgradeUsageInfoFromUsageTable(
if (status != NO_ERROR) continue;
// TODO(fredgc): remove when b/65730828 is addressed
// We create this entry since OEMCrypto_CopyOldUsageEntry needs the old
// usage table to be loaded in order to copy an entry.
if (!CreateDummyOldUsageEntry(&crypto_session)) continue;
// TODO(rfrias): We need to fill in the app id, but it is hashed
@@ -676,7 +678,6 @@ bool UsageTableHeader::UpgradeUsageInfoFromUsageTable(
return NO_ERROR;
}
// TODO(fredgc): remove when b/65730828 is addressed
bool UsageTableHeader::CreateDummyOldUsageEntry(CryptoSession* crypto_session) {
return crypto_session->CreateOldUsageEntry(
kOldUsageEntryTimeSinceLicenseReceived,