Merge "Address review comments and sync branches"
This commit is contained in:
committed by
Android (Google) Code Review
commit
6a0cc01e0f
@@ -810,14 +810,17 @@ CdmResponseType CryptoSession::PrepareAndSignLicenseRequest(
|
||||
OEMCryptoResult sts;
|
||||
size_t signature_length = 0;
|
||||
size_t core_message_length = 0;
|
||||
*core_message = "";
|
||||
std::string combined_message = *core_message + message;
|
||||
// First call is intended to determine the required size of the
|
||||
// output buffers.
|
||||
WithOecSessionLock("PrepareAndSignLicenseRequest", [&] {
|
||||
M_TIME(
|
||||
sts = OEMCrypto_PrepAndSignLicenseRequest(
|
||||
M_TIME(sts = OEMCrypto_PrepAndSignLicenseRequest(
|
||||
oec_session_id_,
|
||||
reinterpret_cast<uint8_t*>(const_cast<char*>(message.data())),
|
||||
message.size(), &core_message_length, nullptr, &signature_length),
|
||||
reinterpret_cast<uint8_t*>(
|
||||
const_cast<char*>(combined_message.data())),
|
||||
combined_message.size(), &core_message_length, nullptr,
|
||||
&signature_length),
|
||||
metrics_, oemcrypto_prep_and_sign_license_request_, sts);
|
||||
});
|
||||
|
||||
@@ -830,7 +833,7 @@ CdmResponseType CryptoSession::PrepareAndSignLicenseRequest(
|
||||
core_message->resize(core_message_length);
|
||||
signature->resize(signature_length);
|
||||
|
||||
std::string combined_message = *core_message + message;
|
||||
combined_message = *core_message + message;
|
||||
WithOecSessionLock("PrepareAndSignLicenseRequest", [&] {
|
||||
M_TIME(sts = OEMCrypto_PrepAndSignLicenseRequest(
|
||||
oec_session_id_,
|
||||
@@ -940,14 +943,17 @@ CdmResponseType CryptoSession::PrepareAndSignRenewalRequest(
|
||||
OEMCryptoResult sts;
|
||||
size_t signature_length = 0;
|
||||
size_t core_message_length = 0;
|
||||
*core_message = "";
|
||||
std::string combined_message = *core_message + message;
|
||||
// First call is intended to determine the required size of the
|
||||
// output buffers.
|
||||
WithOecSessionLock("PrepareAndSignRenewalRequest", [&] {
|
||||
M_TIME(
|
||||
sts = OEMCrypto_PrepAndSignRenewalRequest(
|
||||
M_TIME(sts = OEMCrypto_PrepAndSignRenewalRequest(
|
||||
oec_session_id_,
|
||||
reinterpret_cast<uint8_t*>(const_cast<char*>(message.data())),
|
||||
message.size(), &core_message_length, nullptr, &signature_length),
|
||||
reinterpret_cast<uint8_t*>(
|
||||
const_cast<char*>(combined_message.data())),
|
||||
combined_message.size(), &core_message_length, nullptr,
|
||||
&signature_length),
|
||||
metrics_, oemcrypto_prep_and_sign_renewal_request_, sts);
|
||||
});
|
||||
|
||||
@@ -960,7 +966,7 @@ CdmResponseType CryptoSession::PrepareAndSignRenewalRequest(
|
||||
core_message->resize(core_message_length);
|
||||
signature->resize(signature_length);
|
||||
|
||||
std::string combined_message = *core_message + message;
|
||||
combined_message = *core_message + message;
|
||||
WithOecSessionLock("PrepareAndSignRenewalRequest", [&] {
|
||||
M_TIME(sts = OEMCrypto_PrepAndSignRenewalRequest(
|
||||
oec_session_id_,
|
||||
@@ -1059,14 +1065,17 @@ CdmResponseType CryptoSession::PrepareAndSignProvisioningRequest(
|
||||
OEMCryptoResult sts;
|
||||
size_t signature_length = 0;
|
||||
size_t core_message_length = 0;
|
||||
*core_message = "";
|
||||
std::string combined_message = *core_message + message;
|
||||
// First call is intended to determine the required size of the
|
||||
// output buffers.
|
||||
WithOecSessionLock("PrepareAndSignProvisioningRequest", [&] {
|
||||
M_TIME(
|
||||
sts = OEMCrypto_PrepAndSignProvisioningRequest(
|
||||
M_TIME(sts = OEMCrypto_PrepAndSignProvisioningRequest(
|
||||
oec_session_id_,
|
||||
reinterpret_cast<uint8_t*>(const_cast<char*>(message.data())),
|
||||
message.size(), &core_message_length, nullptr, &signature_length),
|
||||
reinterpret_cast<uint8_t*>(
|
||||
const_cast<char*>(combined_message.data())),
|
||||
combined_message.size(), &core_message_length, nullptr,
|
||||
&signature_length),
|
||||
metrics_, oemcrypto_prep_and_sign_provisioning_request_, sts);
|
||||
});
|
||||
|
||||
@@ -1079,7 +1088,7 @@ CdmResponseType CryptoSession::PrepareAndSignProvisioningRequest(
|
||||
core_message->resize(core_message_length);
|
||||
signature->resize(signature_length);
|
||||
|
||||
std::string combined_message = *core_message + message;
|
||||
combined_message = *core_message + message;
|
||||
WithOecSessionLock("PrepareAndSignProvisioningRequest", [&] {
|
||||
M_TIME(sts = OEMCrypto_PrepAndSignProvisioningRequest(
|
||||
oec_session_id_,
|
||||
|
||||
@@ -827,7 +827,7 @@ class RenewalTest : public ODKTimerTest {
|
||||
if (cutoff > 0) ASSERT_LE(stop, cutoff);
|
||||
// We'll fake instantaneous renewal requests. Flight time not important.
|
||||
clock_values_.time_of_renewal_request = start;
|
||||
OEMCryptoResult result = ODK_ComputeRenewalDuration(
|
||||
const OEMCryptoResult result = ODK_ComputeRenewalDuration(
|
||||
&timer_limits_, &clock_values_, start, renewal_duration_seconds,
|
||||
timer_value_pointer);
|
||||
// After first playback, the license is active.
|
||||
@@ -899,7 +899,7 @@ class RenewalTest : public ODKTimerTest {
|
||||
// We'll fake instantaneous renewal requests. Flight time not important.
|
||||
clock_values_.time_of_renewal_request = start;
|
||||
uint64_t timer_value;
|
||||
OEMCryptoResult result =
|
||||
const OEMCryptoResult result =
|
||||
ODK_ComputeRenewalDuration(&timer_limits_, &clock_values_, start,
|
||||
renewal_duration_seconds, &timer_value);
|
||||
EXPECT_EQ(clock_values_.time_when_timer_expires, cutoff);
|
||||
@@ -1062,9 +1062,9 @@ TEST_P(ODKUseCase_LicenseWithRenewal, Case5) {
|
||||
next_renewal, // stop: expect play allowed.
|
||||
next_renewal + kGracePeriod, // cutoff: when timer expires.
|
||||
timer_limits_.initial_renewal_duration_seconds);
|
||||
} while (next_renewal + renewal_interval_ + kGracePeriod <
|
||||
} while ((next_renewal + renewal_interval_ + kGracePeriod) <
|
||||
playback_end_restriction());
|
||||
// Attemt playing beyond the playback window.
|
||||
// Attempt playing beyond the playback window.
|
||||
const uint64_t current_renewal = next_renewal;
|
||||
next_renewal = current_renewal + renewal_interval_;
|
||||
RenewAndTerminate(current_renewal, // start: when renewal is loaded.
|
||||
@@ -1087,7 +1087,7 @@ TEST_P(ODKUseCase_LicenseWithRenewal, Case6) {
|
||||
renewal_interval_ += 100;
|
||||
} while (next_renewal + renewal_interval_ + kGracePeriod <
|
||||
playback_end_restriction());
|
||||
// Attemt playing beyond the playback window:
|
||||
// Attempt playing beyond the playback window:
|
||||
const uint64_t current_renewal = next_renewal;
|
||||
next_renewal = current_renewal + renewal_interval_;
|
||||
RenewAndTerminate(current_renewal, // start: when renewal is loaded.
|
||||
@@ -1171,7 +1171,6 @@ TEST_F(ODKUseCase_LimitedDurationLicense, Case1) {
|
||||
// Playback started after rental duration.
|
||||
TEST_F(ODKUseCase_LimitedDurationLicense, Case2) {
|
||||
start_of_playback_ = EndOfRentalWindow() + 1;
|
||||
EXPECT_NEAR(start_of_playback_, GetSystemTime(150), 5);
|
||||
ForbidPlayback(start_of_playback_);
|
||||
}
|
||||
|
||||
@@ -1181,7 +1180,8 @@ TEST_F(ODKUseCase_LimitedDurationLicense, Case3) {
|
||||
LoadAndTerminatePlayback(start_of_playback_, time_of_renewal_ + kGracePeriod);
|
||||
}
|
||||
|
||||
// Playback started within rental window and continues.
|
||||
// Playback started within rental window, renewal is received, and playback
|
||||
// continues.
|
||||
TEST_F(ODKUseCase_LimitedDurationLicense, Case4) {
|
||||
// Allow playback within the initial renewal window.
|
||||
LoadAndAllowPlayback(start_of_playback_, time_of_renewal_,
|
||||
@@ -1204,8 +1204,11 @@ TEST_F(ODKUseCase_LimitedDurationLicense, Case5) {
|
||||
EndOfPlaybackWindow(), // cutoff: when timer expires.
|
||||
renewal_duration);
|
||||
|
||||
uint64_t reload_time = play_for_one_hour + 100;
|
||||
const uint64_t reload_time = play_for_one_hour + 100;
|
||||
ReloadLicense(reload_time);
|
||||
// Simulate reloading the license, and then reloading the renewal, and then
|
||||
// restarting playback. That is allowed, and playback shall be terminated at
|
||||
// the end of the original playback window.
|
||||
RenewAndStart(reload_time, EndOfPlaybackWindow(), EndOfPlaybackWindow(),
|
||||
renewal_duration);
|
||||
// But not one second more.
|
||||
|
||||
Reference in New Issue
Block a user