Start rental clock when nonce-free offline license loaded

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

When an offline license is reloaded, if it does not have a usage entry
to indicate when the rental clock was started, the start time defaults
to 0 in the ODK library (in OEMCrypto). This CL changes the code to
start the rental clock in this case. It does this by signing a dummy
message, which triggers the ODK library to start the rental clock.

Bug: 161585265
Bug: 161023174
Test: GTS tests. http://go/forrest-run/L55100000642199761
Change-Id: I4cf555b2fb43009ffb62e7b2c1a37265c3f70bfe
This commit is contained in:
Fred Gylys-Colwell
2020-07-17 23:45:54 -07:00
parent 0db8b90cdb
commit b90f88072f

View File

@@ -286,6 +286,15 @@ CdmResponseType CdmSession::RestoreOfflineSession(const CdmKeySetId& key_set_id,
key_response_, &provider_session_token) ||
usage_table_header_ == nullptr) {
provider_session_token.clear();
// TODO(b/161023174): remove this code in v17.
std::string fake_message("empty message");
std::string core_message;
std::string license_request_signature;
// Sign a fake message so that OEMCrypto will start the rental clock. The
// signature and generated core message are ignored.
CdmResponseType status = crypto_session_->PrepareAndSignLicenseRequest(
fake_message, &core_message, &license_request_signature);
if (status != NO_ERROR) return status;
} else if (!VerifyOfflineUsageEntry()) {
LOGE("License usage entry is invalid, cannot restore");
return LICENSE_USAGE_ENTRY_MISSING;