[ Merge of http://go/wvgerrit/210651 ]
The Android FileSystem implementation for List() would return an error
if the directory does not exist. This creates an issue for the case
where the CDM attempts to list offline licenses after clearing all
data. This typically won't effect a regular user, it causes
integration tests which re-provision to fail.
Bug: 372105842
Test: file_store_unittest on Oriole
Change-Id: I121b52ab95e36249ae5b196e987bc950a278131f
[ Merge of http://go/wvgerrit/209871 ]
The filestore unit tests have not been updated in a while, and
contained several test statements which could crash the test
when failed (accessing elements in a vector or characters in a
string without proper size checks). Other parts of the tests
had non-obvious purposes without detailed knowledge of how the
file system works on the different platforms.
Significant parts of the tests have been refactored to include
better checking and to add error messages to explain the
expectations. Several of the tests have been documented, and the
FileSystem header has been updated to explain what the API does.
Bug: 376533901
Test: file_store_unittest on Oriole
Change-Id: I5af9fd2a2ed01aa6186026761c9e0814604ec610
(cherry picked from commit bc4382b075)
There are three changes here that should help reduce the
amount of duration test failures caused by clock skew.
First, we reported some skew when the test expected playback
to start immediately after loading the license. However,
with round-off, this could easily be more than 1 second. So
this does not warrent even a warning.
Second, the fake and real clocks were only synced after
computing how long to sleep. This is fixed by moving
SleepUntil to the TestSleep class and having it sync before
computing the delta and after doing the sleep.
Third, I am guessing that some failures due to unexpected
lenience were caused by the rental or playback clock being
started at the end of signing the license or the end of the
first decrypt instead of the beginning. We work around this
by recording how long these operations take, and then adding
this extra time at the end of the check for FailDecrypt.
Bug: 275003529
Bug: 279249646
Bug: 207500749
Merged from https://widevine-internal-review.googlesource.com/176070
Change-Id: I6a973565edfbebca53ee7f239b4b93f8f73d1e0a
[ Merge of http://go/wvgerrit/171310 ]
Offline license not found errors are identified by CdmResponseEnum
347 (KEYSET_ID_NOT_FOUND_4). No addition file system information
is shared.
Checks for file existance use the stat command. The stat call can
return error codes from errno.h when the command fails.
These are now converted into sub error codes and returned along with
the offline license file not found error.
This also includes a change to log stat errors other than
ENOENT (no such file or directory) as a warning rather than verbose.
Bug: 276225520
Test: file_store_unittest, file_utils_unittest, GtsMediaTestCases
Change-Id: Ic09d036549582cd65783b49fa96ffefc4bf562c7
(Merged from http://go/wvgerrit/160042.)
Since we don't have access to std::format yet, this patch adds a
function to wvutil to format text into a std::string.
Bug: 255466913
Test: x86-64
Test: raven
Change-Id: I28043da76af5b4772a29fa7e7241343caf9b54a1
[ Merge of http://go/wvgerrit/154593 ]
This CL updates the initial time used for reboot tests to be
within the valid range used by OPK. Also, the fake clock is
now synced with every use of the TestHost's clock function.
Also, the OPK's system clock is no longer initialized to 0
because this caused some tests to set initial playback time
to 0. That broke code that assumed a time of 0 mean "never".
I also removed some log spam in the WTPI code.
Bug: 222353528
Bug: 236317198
Change-Id: Ibdbdb2440454b9cf561cd9ec65ca3e40cf5a8d93
[ Merge of http://go/wvgerrit/143630 ]
When we run a test with the fake clock, the clock had been initialized
to the current time, or to 0. This causes a problem for reboot tests
because the clock might go backwards over the reboot. With this
change, we monitor the clock at the end of one reboot pass and
initialize the clock for the next pass based on the previous value.
Bug: 26163469
Test: GtsMediaTestCases on sunfish
Change-Id: Ibd0024f963634382af70553fced38da6e1d857d2
Because the fake clock is getting out of sync with the real clock
for the nonce flood tests, add a call to TestSleep::SyncFakeClock()
in Clock::GetCurrentTime() to force a sync.
Merged from http://go/wvgerrit/133223
Test: duration_use_case_test and nonce flood tests on bonito
Bug: 198329759
Change-Id: Idfd92c6cc57750a52477189461220c682b302082
[ Merge of http://go/wvgerrit/119805 ]
This change adds 3 new functions for encoding binary data from a C++
string to a base64 encoded ASCII string.
The CDM and protobuf generated code use C++ strings to store binary
data. These binary strings are commonly converted into a base64
encoded ASCII string for logging and for returning to the app.
This change also cleans up some of the internal components of the
string_conversions library to use several standard library C++11
method.
Bug: 181732604
Test: CE CDM unittests
Change-Id: I547568c6402e011344260f2df2a06e972122ab8a
[ Merge of http://go/wvgerrit/120445 ]
Switch TestHost and FakeClock to use chrono::system_clock (wall time)
rather than chrono::steady_clock (ticks since boot time).
Bug: 183160800
Test: CE CDM tests
Change-Id: I6ef4c02c01ff96453847ee8f42e6037c298866b5
[ Merge of http://go/wvgerrit/119684 ]
This allows for a default DRM certificate that includes an expiration
time and a legacy one without for each app+origin specific identifier.
Existing offline licenses/secure stops are not associated with a
certificate, and so we cannot delete legacy certificates even after
fetching a new one. New offline licenses/secure stops will be associated
with certificate information, so we will not have this problem going
forward.
Bug: 169740403
Test: WV unit/integration tests
Change-Id: I0f08f6bf98775fd43927243dc4a9f75f21bfbbcc
[ Merge of http://go/wvgerrit/117203 ]
clock_settime isn't available on iOS (even though settimeofday is). But
we can't change the system time on iOS anyway, so this just disallows
iOS.
Bug: 182058081
Test: WV unit/integration tests
Change-Id: I96e5b6634803bd4e6aaf5cc6d64f4441296247d4
[ Merge of http://go/wvgerrit/108103 ]
The Widevine License Agreement has been renamed to use inclusive
language. This covers files in the cdm, linux, platform, util directory
in addition to some other files.
Bug: 168562298
Test: verified compilation (comment only change)
Change-Id: I9a4977fd4c2ad951769b6be84263f81bd0f22678
[ Merge of http://go/wvgerrit/108084 ]
The Widevine License Agreement has been renamed to use inclusive
language. This covers files in the android directory.
Bug: 168562298
Test: verified compilation (comment only change)
Change-Id: I0f9e6445e0168ebe85425baeb81371e182e5a39c
(This is a merge of http://go/wvgerrit/107243.)
This code is based on a bug report and patch from Sony.
The TimeRollbackPrevention test was failing when run with CE CDM and the
OEC Ref, although it passed in some other configurations. The cause was
twofold:
1) The test sleep code was not accounting for rollback when calculating
the clock drift, causing incorrect time values to elapse.
2) Fixing the previous exposed a bug in the CE CDM test host where it
did not handle negative time passing correctly.
This patch expands Sony's fix with additional comments and some code
cleanup to try to make the code clearer and more robust against future
errors, particularly in the error-prone TestHost code.
Bug: 169942369
Test: jenkins/ce_cdm_tests
Test: build_and_run_all_unit_tests.sh
Test: x86-64, all CE CDM unit tests
Change-Id: Id52b8c38255f70b04bc2735c4e309fb90992f53e
Merge from Widevine repo of http://go/wvgerrit/100110
The unit test TimeRollbackPrevention was broken for several
reasons. This CL reduces the test to its most basic functionality and
updates it to be compatible with a v16 oemcrypto.
This CL also adjusts the fake clock used by the buildbot to fake
sleeping backwards, so that the TimeRollbackPrevention test can also
be run on the buildbot.
Bug: 155773482
Bug: 79422351
Test: unit tests on buildbot, and on flame w/v16 modmock
Change-Id: I3027018b17b738281989e63ae6b0729757217d05
[ Merge of http://go/wvgerrit/93505 ]
During the merge process there were a few CL comments (ag/10122083)
that were not able to be addressed. Most changes in the CL are
spelling / grammar corrections.
Bug: 148907684
Bug: 141247171
Test: CDM unit tests
Change-Id: I9a8648525bbe5ed319521ebf01741a958ab69ae2
Merge of http://go/wvgerrit/93404
This CL updates the Widevine CDM to support OEMCrypto v16.1
Test: Tested in 16.2 CL
Bug: 141247171
Change-Id: I69bd993500f6fb63bf6010c8b0250dc7acc3d71b
[ Merge of http://go/wvgerrit/89766 ]
Certain C++11 (and newer) standard library functions and classes which
utilize random number generators require that the random number
generators meet the specifications of C++11's UniformRandomBitGenerator
name requirements. This is especially important as C++17 will remove
support non-compliant alternatives.
This change updates CdmRandomGenerator to meet these requirements.
Bug: 143494945
Test: Linux and Android unit tests
Change-Id: Ib6df44da4969ad7596b16d447c3f8bd9864698f6
[ Merge of http://go/wvgerrit/87143 ]
Certain android files have yet to be formated since we introduced
clang-formatting.
Test: Android unit tests
Bug: 134365840
Change-Id: I0e58fb7e5b5525f1e2885ce89b222561a971ab27
[ Merge of http://go/wvgerrit/85804 ]
This moves file_utils_unittest.cpp, file_store_unittest.cpp and
base64_test.cpp from core/test to utils/test.
Bug: 140639279
Test: Android unit/integration
Change-Id: I1c31e5a716a925478fc1efe9fe68b93b1514e89c
[ Merge of http://go/wvgerrit/84607 ]
[ Merge of http://go/wvgerrit/84608 ]
The primary goal is to replace the use of `rand()` with the random
number generators provided with the C++11 standard.
This simplified generator wraps some of the technical aspects of the
<random> library and provides an interface for uniformly distributed
integers.
As part of the `rand()` purge in the CDM, all uses of the C random int
function in `core()` have been removed. Places that previously used
`rand()` now use `CdmRandom` facilities.
Test: Linux unittest and Android unittest
Bug: 130680365
Change-Id: Ica383870536ed462dbb80e630c2d66845e38b937