From b90f88072f25ed14095444f45382f52e38f953ad Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Fri, 17 Jul 2020 23:45:54 -0700 Subject: [PATCH] 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 --- libwvdrmengine/cdm/core/src/cdm_session.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libwvdrmengine/cdm/core/src/cdm_session.cpp b/libwvdrmengine/cdm/core/src/cdm_session.cpp index 9dd23530..8e1ccf34 100644 --- a/libwvdrmengine/cdm/core/src/cdm_session.cpp +++ b/libwvdrmengine/cdm/core/src/cdm_session.cpp @@ -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;