Commit Graph

3410 Commits

Author SHA1 Message Date
TreeHugger Robot
b8570949e4 Merge "Update tests for license release" into rvc-dev 2020-03-10 08:49:47 +00:00
Fred Gylys-Colwell
037918aa49 Update tests for license release
Merge from Widevine repo of http://go/wvgerrit/95403

This updates the test code CreateDefaultResponse to make sure that
license releases do not have a core message, and that the key control
block is correctly set for renewals.

Also, the unit test OEMCryptoUsageTableTest.TimingTest is changed to
only a license release when the license is inactive. If the license is
still active, then the license is loaded before generating a usage
report.

Test: Ran full unit tests
Bug: 151092673
Change-Id: I7c01fd17f9b66e88ab3c57aa0f3d40740f13507c
2020-03-09 20:11:23 -07:00
TreeHugger Robot
2356842fd2 Merge "Treat the (0,0) Pattern as 'cbcs'" into rvc-dev 2020-03-09 21:22:37 +00:00
TreeHugger Robot
7da5b8be92 Merge "Remove ODK from unused makefiles" into rvc-dev 2020-03-09 21:05:22 +00:00
TreeHugger Robot
0bd6a38096 Merge "Cache Max Subsample Size" into rvc-dev 2020-03-09 21:03:52 +00:00
TreeHugger Robot
bf5c819046 Merge "Unit test for OEMCrypto_LoadUsageEntry in multiple sessions" into rvc-dev 2020-03-09 19:20:55 +00:00
Fred Gylys-Colwell
bfde826763 Unit test for OEMCrypto_LoadUsageEntry in multiple sessions
Merge from Widevine repo of http://go/wvgerrit/95283

If an entry is loaded in a second session, the error should be
OEMCrypto_ERROR_INVALID_SESSION.

Bug: 150647218
Test: ran unit tests
  Change-Id: I4e666ce6626303a36b16997f0a012d57a7039697
Change-Id: Id0e73dec5879ec9ec4e8ab8ebe1590c568e7f0af
2020-03-07 10:58:50 -08:00
Fred Gylys-Colwell
a11d764d8d Filter out nonrequired tests for v15 devices
Merge from Widevine repo of http://go/wvgerrit/95263

Some OEMCrypto unit tests are not expected to pass on a v15 device, so
they are being filtered out.

Bug: 149861744
Test: unit tests on taimen
Change-Id: Iadff592f4a0005ab7e5613b315a714e737d7e5e0
2020-03-06 15:49:17 -08:00
Fred Gylys-Colwell
96dc665cd5 Remove ODK from unused makefiles
Merge from Widevine repo of http://go/wvgerrit/95087

The ODK library is used in OEMCrypto, and in test code, but it is not
needed in the CDM layer. As such, it can be removed from the
Android.mk for cdm libraries.

Bug: 150809634
Test: unit tests
Change-Id: If29458e7d3d940f9a383d77e5082e7388e19c32f
2020-03-06 18:58:50 +00:00
Fred Gylys-Colwell
174c57bb59 Merge "Update ODK Library and add license release unit test" into rvc-dev 2020-03-05 21:16:55 +00:00
Fred Gylys-Colwell
c5b7a01ab5 Update ODK Library and add license release unit test
Merge from Widevine repo of two CLs.

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

A license release should not have a core message. This CL adjusts the
existing unit tests to verify this. There is also a new unit test called
SecureStop that explicitly tests sending a secure stop in a new
session without first loading the license.

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

This CL has the following changes copied from google3:
http://cr/298871728 Remove odk_static_assert for Message size temporarily
http://cr/298755935 Fix a compiling error during macro expansion
http://cr/298481745 Add missing header for android
http://cr/298448142 Fix odk_test gyp file
http://cr/298419641 Remove header from Android.bp
http://cr/298402053 Separate sizeOf(args) bytes in fuzz tests
http://cr/297730316 No core messages for license release
http://cr/297714346 Add copybara_test and piper_sot_to_gerrit
http://cr/297636713 Adding some comments around boolean conversion code
http://cr/297420679 Autofuzzer when ran with address sanitizer ...
http://cr/296513584 Minor fix with fuzzing odk clock values
http://cr/296322024 Fixing errors in code with how request ...
http://cr/296313159 Fuzzing ODK clock values by setting aside ...
http://cr/295763207 Add more odk tests and move helper functions to test helper
http://cr/294524098 Adding a Build Rule for ODK_KDO_Fuzzer and updating
http://cr/294492213 Address a few review comments of ODK
http://cr/293674368 odk_fuzz: add TODOs & comments
http://cr/293492806 Fix spelling

Bug: 150243585
Bug: 150020278
Bug: 150095506
Bug: 147297226
Bug: 148290294
Bug: 148907684
Bug: 150608451
Test: unit tests
Change-Id: I25fd406f29f4eba40f5cb27e9a1317dce4ffc2f5
2020-03-05 19:06:31 +00:00
Rahul Frias
d0d3216eda Merge "Correct log messages" into rvc-dev 2020-03-05 00:01:37 +00:00
John W. Bruce
1f1ba94a61 Cache Max Subsample Size
(This is a merge of http://go/wvgerrit/95003.)

To reduce the number of OEMCrypto calls on the decrypt path, the maximum
subsample size will now be cached after the first call to retrieve it.

Bug: 150018606
Test: Android Unit Tests
Test: CE CDM Unit Tests
Test: ExoPlayer high-bitrate playback on OEC v15
Change-Id: I0b5d38d8a082c0a127d2a47f112b76c64085bddb
2020-03-04 12:20:58 -08:00
John W. Bruce
82951b01ef Treat the (0,0) Pattern as 'cbcs'
(This is a merge of http://go/wvgerrit/94928.)

In OEMCrypto v16, we dropped support for 'cens' and 'cbc1'. However, we
did not redefine the pattern (0,0) to be a valid pattern for 'cbcs', even
though it was no longer being used to signal 'cbc1'. Instead, we made
the CDM reject CTR with a pattern ('cens') and CBC with a (0,0) pattern
('cbc1') to mirror the behavior of OEMCrypto v16.

However, some apps have been using 'cbc1' mode to decrypt audio in
'cbcs' content. This is normally not possible but is possible for a
subset of content. Furthermore, it is easy to do by accident because of
the way most packagers package 'cbcs' audio and the special significance
Widevine has historically given the (0,0) pattern.

This patch updates the CDM to not reject CBC with a (0,0) pattern but
instead treat it as 'cbcs' content. To decrypt it correctly, the pattern
is treated specially inside the CDM core and converted to the
recommended equivalent pattern — (10,0) — before passing the content to
OEMCrypto.

For more specifics, please see the design doc: http://go/vclfg

Bug: 150219982
Test: ExoPlayer Demo App 'cbcs' Content
Test: GTS 'cbcs' Content
Change-Id: I334ff15db5f7b7d62040a036ba6d17515c3caee4
2020-03-04 12:11:29 -08:00
Automerger Merge Worker
23c1be8cee hidl WVDrmPlugin openSession: set securityLevel correctly am: 9a530b7f1e
Change-Id: I7dbc26be06ae0fdfa0013dd65a57c169b21f4bdc
2020-03-04 19:33:38 +00:00
Robert Shih
9a530b7f1e hidl WVDrmPlugin openSession: set securityLevel correctly
Merge of http://go/wvgerrit/94827

Bug: 149035295
Bug: 150103154
Bug: 150407639
Test: VtsHalDrmV1_2TargetTest
Change-Id: I3687b2305eb413112f7fbd0d5127d2168cdf376d
2020-03-04 18:44:44 +00:00
Alex Dale
d3f10ece7c Merge "CDM handles mixed output warnings." into rvc-dev 2020-03-02 18:35:13 +00:00
Fred Gylys-Colwell
b73c015557 Merge "Use staging provisioning server even more" into rvc-dev 2020-02-29 01:44:38 +00:00
Alex Dale
fb5c67929f CDM handles mixed output warnings.
[ Merge of http://go/wvgerrit/94483 ]

With OEMCrypto V16 comes a new potential error code from calls to
DecryptCENC().  WARNING_MIXED_OUTPUT_PROTECTION may be returned by
supporting devices if one of the output devices does not meet the
required HDCP level for the decryption key/license; however the output
is instead restricted (by OEMCrypto) to devices that are secure. This
warning is informative to the CDM; but no action can/should be taken
by the CDM.

In addition, if DecryptCENC() returns an error/warning, it is likely
that the same status code will be returned on subsequent calls to
decrypt within the same crypto session.  To reduce the number of logs
the CDM produces within the same crypto session only changes in error
codes are logged.

Bug: 140825538
Change-Id: Iaf9da3f0c88889525f73f3153a5977c8416286bb
(cherry picked from commit d9c703ef9e)
Merged-In: Iaf9da3f0c88889525f73f3153a5977c8416286bb
2020-02-29 01:24:12 +00:00
Fred Gylys-Colwell
1c8fac32d3 Use staging provisioning server even more
Merge from Widevine repo of http://go/wvgerrit/94745

I missed a few in http://go/wvgerrit/94067

Test: ran unit tests
Bug: 149622735
Change-Id: I2289adb05bbd41376528e09bbaa62430644a3e20
2020-02-29 00:50:04 +00:00
Rahul Frias
951ec2c6f5 Correct log messages
[ Merge of http://go/wvgerrit/94903 ]

Prefixes are no longer needed now that file and line number are
being logged.

Bug: 149829271
Test: wv unit/integration tests
Change-Id: I0ba701fc262cdb59056dca139c38ed76035bcbb8
2020-02-28 15:19:36 -08:00
TreeHugger Robot
5ebb430af7 Merge "Add odk_test to platform tests" into rvc-dev 2020-02-28 02:26:50 +00:00
Rahul Frias
6373ff35ca Merge "Search for test executables in odk_test" into rvc-dev 2020-02-27 23:47:56 +00:00
Robert Shih
b1ee517ff1 Add odk_test to platform tests
Bug: 150158890
Test: build & inspect platform_tests.zip
Change-Id: I06c0acd0f7fed168e8e2ad876a58983b11d9b43f
2020-02-27 21:35:30 +00:00
Fred Gylys-Colwell
0947bd185b Fix nonce problem in license renewal
Merge from Widevine repo of http://go/wvgerrit/94523

For OEMCrypto v16, a renewal does not get a new nonce.

Bug: 149856581
Test: WvCdmRequestLicenseTest.StreamingLicenseRenewal
Change-Id: I258f0bcb9c9a417310785f130d32d66fa7430185
2020-02-26 14:32:24 -08:00
Rahul Frias
19605579d5 Search for test executables in odk_test
[ Merge of http://go/wvgerrit/94507 ]

./build_and_run_all_tests.sh runs all WV unit/integration tests.
It searches for unit/integration tests in $OUT/data/nativetest/ .
ODK tests are in $OUT/data/nativetest/vendor/odk_test. Adding this
path to the list of directories that the script searches through.

Bug: 150158890
Test: Run ./build_and_run_all_tests.sh
Change-Id: Ib3b7d247a5cb86f9972157c13ad60b7f3cbbb7dc
2020-02-26 13:51:14 -08:00
Fred Gylys-Colwell
7f006997cb Change some test EXPECT to ASSERT to avoid segfaults
Merge from Widevine repo of http://go/wvgerrit/94505

Some tests use an EXPECT when checking an array size or to verify a
pointer is not null. Then they access the pointer or array. When they
use an EXPECT, this access results in a segfault.

I also removed a compiler warning about unused parameters.

Bug: 149856581
Test: request_license_test (now lists failed tests)
Change-Id: I08ac11250921245c89ed5c0c43cc5f4321e0a9cc
2020-02-26 13:11:25 -08:00
Alex Dale
9c60d1e1ae Adding app package name to license request.
[ Merge of http://go/wvgerrit/94323 ]

Content providers wish to know the application package name that is
requesting a license from the content server.  The app package name that
is provided to the CDM during initialization is provided to the client
identification message as a key-value pair during license request
generation.  App packages names are keyed under 'application_name'.

This feature was tested manually by scraping the content of the license
request for YouTube TV.

Bug: 148689078
Test: manual
Change-Id: I6b65f2ab9845dbea37aaaab76ecea25c228bde5b
2020-02-20 13:23:16 -08:00
TreeHugger Robot
f13cbff0cd Merge "Adjust provisioning retry" 2020-02-20 04:36:48 +00:00
Robert Shih
838788cf00 Merge "wv hidl: only mediashell/mediadrmserver can call signRSA" 2020-02-20 00:46:35 +00:00
Fred Gylys-Colwell
18da273c42 Adjust provisioning retry
Merge from Widevine repo of http://go/wvgerrit/94243

When generating a second provisioning request, a new session should be
opened because a session can only have one nonce for v16.

For Provisioning 3.0 devices, the OEM Cert's private key must be
loaded in the new session.

Test: WvCdmRequestLicenseTest.ProvisioningInterposedRetryTest
Bug: 135288420 Nonce reuse
Bug: 141655126 Cert reload
Change-Id: I8a96566142c4d4380e2bdd571e8d363a7a1f74d4
2020-02-19 13:42:55 -08:00
Robert Shih
be7b89e155 wv hidl: only mediashell/mediadrmserver can call signRSA
Merge of go/wvgerrit/93524

Bug: 134787536
Bug: 148895349
Test: VtsHalDrmV1_3TargetTest
Change-Id: I48fb63d044271243fa1d290443d437f0697994d3
2020-02-19 13:38:23 -08:00
John W. Bruce
a62886b925 Combined Decrypt Calls
(This is a merge of http://go/wvgerrit/93829,
http://go/wvgerrit/93830, http://go/wvgerrit/93832,
http://go/wvgerrit/93833, and http://go/wvgerrit/93834 from the
Widevine repo.)

This implements the CDM code changes necessary to take advantage of
Combined Decrypt Calls on OEMCrypto v16. The result of this is that
WVCryptoPlugin is much lighter now because it can pass the full sample
down to the core in one call, but CryptoSession is heavier, as it now
has to handle more complex fallback logic when devices can't handle
multiple subsamples at once.

This patch also removes support for the 'cens' and 'cbc1' schema, which
are being dropped in OEMCrypto v16. This fixes an overflow in the code
for handling those schemas by removing it entirely.

This patch also fixes the "in chunks" legacy decrypt path to use larger
chunk sizes on devices with higher resource rating tiers.

Bug: 135285640
Bug: 123435824
Bug: 138584971
Bug: 139257871
Bug: 78289910
Bug: 149361893
Test: no new CE CDM Unit Test failures
Test: Google Play plays
Test: Netflix plays
Test: no new GTS failures
Change-Id: Ic4952c9fa3bc7fd5ed08698e88254380a7a18514
2020-02-19 11:44:35 -08:00
Rahul Frias
3708c4d53f Merge changes I442b7919,Ie5b4ff75
* changes:
  Improve android MediaDrm property latency
  Delay OEMCrypto Termination
2020-02-19 15:51:14 +00:00
Rahul Frias
0e02d6a1f6 Merge changes Iacbbd51a,Id925ddcc
* changes:
  Add policy handling for v16
  More policy engine/timers refactoring
2020-02-19 15:37:35 +00:00
Rahul Frias
c033892f2a Add policy handling for v16
[ Merge of http://go/wvgerrit/93865 ]

This allows for handling of timer and clock values as supported when both
the license service and the OEMCrypto on the device support v16.
A flag based on a value in the SignedResponse license indicates
whether this support should be enabled. A new class PolicyTimerV16
performs the duration value evaluation.

Bug: 139372190
Test: Android WV unit/integration tests
Change-Id: Iacbbd51ad26c9f29cb5418ff832f8822982644b7
2020-02-18 22:33:47 -08:00
Rahul Frias
68587be8a0 More policy engine/timers refactoring
[ Merge of http://go/wvgerrit/93838 ]

Some more rework of policy engine/policy timers code to support
timer and clock value handling introduced by OEMCrypto v16.

Changes are
* renamed methods to include rental duration since policies for v16 use
  rental and playback duration for all licenses. Previously rental and
  playback durations enforced timing for persistent licenses and license
  duration was used for streaming licenses.
* Moved some common code to the base PolicyTimer class from
  PolicyTimerV15.
* Corrected data member naming (policy_timers -> policy_timers_)
* Updated comments

Bug: 139372190
Test: Android WV unit/integration tests
Change-Id: Id925ddcc14608a8500f30c2c68486d91608a9abe
2020-02-18 22:29:49 -08:00
TreeHugger Robot
5a08937110 Merge "Remove unused parameters" 2020-02-19 05:52:39 +00:00
Alex Dale
c1cb64a0dc Merge "LRU algorithm adapts to usage table capacity." 2020-02-19 02:18:03 +00:00
Fred Gylys-Colwell
3012ff29bd Use staging provisioning server
Merge from Widevine repo of http://go/wvgerrit/94067

The android tests should use the staging provisioning server until
production is able to support core messages.

Test: ran WvCdmRequestLicenseTest.ProvisioningTest with v16 mod mock
Bug: 149622735
Change-Id: I4ec0cc8e8474dc4250e092473fef90d7358260de
2020-02-18 14:26:29 -08:00
Alex Dale
4a8aeb29ef LRU algorithm adapts to usage table capacity.
[ Merge of http://go/wvgerrit/93564 ]

OEMCrypto v16 introduced the ability to report the maximum possible
size of the usage table to the CDM.  The LRU algorithm will take the
table capacity into account when deciding which entry is removed.

Bug: 148795097
Bug: 135298906
Test: CDM unit tests
Change-Id: Ibba88813618c13a9bf1121e560b8cc02b1c7e7a6
2020-02-18 12:22:23 -08:00
Rahul Frias
78d2fa5e9e Improve android MediaDrm property latency
[ Merge of http://go/wvgerrit/89848 ]

Apps query a number of properties at initialization. The mediaDrm
API getProperty allows the query of a single property at a time.
This causes a series of requests. If no crypto
sessions are concurrently open, a series of expensive OEMCrypto
Initialization and Termination calls will occur.

In this change OEMCrypto termination is delayed. If an OEMCrypto
Terminate is followed in close succession by an Initialize, neither
will occur avoiding the overhead. A timer enables a countdown process.
If no session activity occurs, the timer will eventually terminate
OEMCrypto and exit.

Bug: 136282358
Test: Android unit/integration tests
Change-Id: I442b7919b4e7835c52583516c8bc64d0c150241d
2020-02-17 20:50:32 -08:00
Rahul Frias
ea2e110213 Log test name
[ Merge of http://go/wvgerrit/94083 ]

Logs the test case and test name when widevine android unit/integration
tests are run.

Bug: 149664134
Test: wv unit/integration tests
Change-Id: I446b88aa2954a386765e4559358d386b1a263913
2020-02-16 23:30:26 -08:00
Fred Gylys-Colwell
2446b85322 Remove unused parameters
Merge from Widevine repo of http://go/wvgerrit/94043

Remove some unused parameters from test code. These had been
generating compiler warnings.

Bug: 149592532
Test: built and ran unit tests on crosshatch
Change-Id: If1325edc3418f77d620ce3765496ef17156bc624
2020-02-15 12:15:06 -08:00
Rahul Frias
068035140b Delay OEMCrypto Termination
[ Merge of http://go/wvgerrit/89847 ]

This adds a platform specific property that allows OEMCrypto Termination
calls to be delayed. On android this allows a way to avoid
expensive back to back OEMCrypto_Terminate followed by Initialize
calls.

Bug: 136282358
Test: wv unit/integration tests
Change-Id: Ie5b4ff7503dafe77d974caac9c52fc1f169dec89
2020-02-15 01:34:02 -08:00
Fred Gylys-Colwell
d7492082c6 Fix logging for buildbot
Merge from Widevine repo of http://go/wvgerrit/93686

This CL changes some test logging so that it is always on a single
line, even if verbose logging is turned on.

Test: unit tests
Bug: 149119926

Change-Id: I9473f6e559ff543ced47a7fa3900615866a25688
2020-02-14 23:00:28 +00:00
Alex Dale
c9f586f81a Updated expected resource rating for integration tests.
[ Merge of http://go/wvgerrit/93603 ]

When the new "very high" resource rating tier was introduced, the
Android integration test was not updated to accept this value.  The
integration test has now been updated to use "min" and "max" instead
of fixed levels.  This will make future updates easier.

Bug: 140831533
Test: Android integration test (on master)
Change-Id: Ib92bf0afbfbfd81b46c90243651396dfcb74b91f
2020-02-14 10:08:32 -08:00
Rahul Frias
2068fa4a2b Merge "Query Usage Table Size bug" 2020-02-14 17:51:17 +00:00
Rahul Frias
a85a0726a3 Merge changes I420fb181,Id0c38b45
* changes:
  Policy Engine refactoring
  Update license proto
2020-02-14 01:47:59 +00:00
Fred Gylys-Colwell
eeeb0304ed Don't use empty core message
Merge from Widevine repo of http://go/wvgerrit/93824

This treats an empty core message as not having a core message.

Bug: 149110740
Change-Id: Icacfc5d9a5bdce9b136c25c59205eee575cfba72
Tests: Ran ExoPlayer on taimen
2020-02-12 14:36:45 -08:00