Merge changes Ic7459870,I655babf1,I463642fb,Iccdbcc0b,I2ebbd8f7, ... into sc-dev

* changes:
  Fix another typo
  Update license comment
  Update Version Compatibility Document
  Modify OEMCrypto unit tests to allow 16.3 or 16.4
  Update OEMCrypto test comments and logs
  Update OEMCryptoCENC.h header to obfuscate missing functions
  Clean up duration tests
  Use either spelling of AllocateSecureBuffer in dynamic adapter
  Update ODK library for OPK compatibility
This commit is contained in:
TreeHugger Robot
2021-04-16 03:10:10 +00:00
committed by Android (Google) Code Review
109 changed files with 1261 additions and 526 deletions

View File

@@ -885,6 +885,16 @@ class Adapter {
LOOKUP_ALL(16, MinorAPIVersion, OEMCrypto_MinorAPIVersion);
// clang-format on
// There was a mistake in version 16.3 of the header that did not rename
// OEMCrypto_AllocateSecureBuffer or OEMCrypto_FreeSecureBuffer
if (level1_.AllocateSecureBuffer == NULL ||
level1_.FreeSecureBuffer == NULL) {
level1_.AllocateSecureBuffer = (L1_AllocateSecureBuffer_t)dlsym(
level1_library_, "OEMCrypto_AllocateSecureBuffer");
level1_.FreeSecureBuffer = (L1_FreeSecureBuffer_t)dlsym(
level1_library_, "OEMCrypto_FreeSecureBuffer");
}
// TODO(119830252): make the code below available to a static adapter.
// Check if the keybox or oem certificate is valid, if so, we are finished
// with initialization.

View File

@@ -468,7 +468,7 @@ class CdmDurationTest : public WvCdmTestBaseWithEngine,
//
// In the document, we use realistic rental times in hours or days. In these
// tests, we will use round numbers so that it is easier to read. For example,
// instead of a seven day rental duration, we will use a 200 rental duration.
// instead of a seven day rental duration, we will use a 100 rental duration.
/*****************************************************************************/
/*****************************************************************************/
@@ -477,8 +477,6 @@ class CdmDurationTest : public WvCdmTestBaseWithEngine,
class CdmUseCase_Streaming : public CdmDurationTest {
public:
CdmUseCase_Streaming() : CdmDurationTest("CDM_Streaming") {
// Rental duration = 3 hours hard. (use 300 for readability)
// Playback duration = 0 (unlimited)
timer_limits_.soft_enforce_rental_duration = false;
timer_limits_.rental_duration_seconds = 40;
timer_limits_.total_playback_duration_seconds = 0;
@@ -1055,11 +1053,11 @@ class RenewalTest : public CdmDurationTest {
void LoadRenewal(uint64_t time_of_load, const RenewalPolicy& renewal_policy) {
ASSERT_NE(renewal_in_flight_, nullptr);
std::string http_response;
// TODO(fredgc): Tune this. Most of the network latency will probably show
// up in the next few commands. I think the tests have enough slop to
// account for reasonable latency with the current value of
// kRoundTripTime. But We'll know I made a mistake if we see errors about
// "Test Clock skew..." in the SleepUntil call below.
// Most of the network latency will probably show up in the next few
// commands. I think the tests have enough slop to account for reasonable
// latency with the current value of kRoundTripTime. But We'll know I made a
// mistake if we see errors about "Test Clock skew..." in the SleepUntil
// call below.
ASSERT_TRUE(renewal_in_flight_->GetResponse(&http_response));
int status_code = renewal_in_flight_->GetStatusCode(http_response);
ASSERT_EQ(kHttpOk, status_code);
@@ -1683,9 +1681,9 @@ INSTANTIATE_TEST_CASE_P(Both, CdmUseCase_UnlimitedStreaming,
class CdmUseCase_LicenseDuration : public CdmDurationTest {
public:
CdmUseCase_LicenseDuration() : CdmDurationTest("CDM_LicenseDuration") {
// Rental duration = 3 hours hard. (use 300 for readability)
// Playback duration = 0 (unlimited)
timer_limits_.soft_enforce_rental_duration = true;
// The policy does not specify a rental duration, but the server adjusts it
// so that it looks like this to a v16 device.
timer_limits_.rental_duration_seconds = 40u;
timer_limits_.soft_enforce_playback_duration = false;
timer_limits_.total_playback_duration_seconds = 40u;
@@ -1695,13 +1693,18 @@ class CdmUseCase_LicenseDuration : public CdmDurationTest {
// Playback within rental duration.
TEST_P(CdmUseCase_LicenseDuration, Case1) {
// Allow playback within the playback window.
LoadAndAllowPlayback(start_of_playback_, EndOfPlaybackWindow());
LoadAndAllowPlayback(start_of_playback_, EndOfRentalWindow());
}
// Playback exceeds rental duration.
TEST_P(CdmUseCase_LicenseDuration, Case2) {
// Allow playback within the playback window, but not beyond.
LoadAndTerminatePlayback(start_of_playback_, EndOfPlaybackWindow());
LoadAndAllowPlayback(start_of_playback_, EndOfRentalWindow());
// Do not allow playback after playback window. For a v16 CDM with a v15
// OEMCrypto, playback is cutoff at the rental window, and for a v16 CDM with
// a v16 OEMCrypto, playback is allowed a little longer. In both cases,
// playback is not allowed after the end of the playback window.
SleepUntil(EndOfPlaybackWindow() + kFudge);
FailDecrypt();
}
// Playback with stops/restarts within rental duration, last one exceeds
@@ -1713,8 +1716,12 @@ TEST_P(CdmUseCase_LicenseDuration, Case3) {
start_of_playback_ + 3 * kPlayDuration);
UnloadLicense();
AllowLenience();
LoadAndTerminatePlayback(start_of_playback_ + 4 * kPlayDuration,
EndOfPlaybackWindow());
LoadAndAllowPlayback(start_of_playback_ + 4 * kPlayDuration,
EndOfRentalWindow());
// As above, do not allow playback after playback window.
AllowLenience();
SleepUntil(EndOfPlaybackWindow() + kFudge);
FailDecrypt();
}
// Playback within rental duration, restart exceeds playback duration.