Commit Graph

1786 Commits

Author SHA1 Message Date
Ian Benz
b1ac15d021 Remove unnecessary copies identified by clang-tidy
Change-Id: Iee57c8dfbefdfce6f785f4ae936084f62fc32836
2024-02-01 13:40:49 -08:00
Fred Gylys-Colwell
1548fe5c98 Fix url parsing in test code
Bug: 300696974
Change-Id: Ic9a158ed0c2e7434d3a4b669a7d301999f29449e
2024-02-01 13:40:49 -08:00
Alex Dale
386ca20974 New CE CDM error for device revocation.
Devices may be revoked by the provisioning server resulting in an
error message contained within the provisioning response.  The CDM
core currently returns an error, but the CE CDM would map this to
an kUnexpectedError, which does not provide the information to the
CE client to react.  This situation is not immediately recoverable,
but may provide certain apps to use a different DRM plugin if they
support such a thing.

Documentation and tests are needed.

Bug: 179650038
Test: None
Change-Id: I892a23839758264ddd7b29fb739cb00d41d953f8
2024-02-01 13:40:49 -08:00
Vicky Min
269d1527cb Filter keybox tests with GTEST_SKIP
Bug: 288404945, 251240681
Merged from https://widevine-internal-review.googlesource.com/183630

Merged from https://widevine-internal-review.googlesource.com/183730

Change-Id: I9f6a4045f9b554589e25338accecb0d338fad5ce
2024-02-01 13:40:49 -08:00
Vicky Min
a012466156 Use GTEST_SKIP for non keybox devices
Bug: 251240681
Merged from https://widevine-internal-review.googlesource.com/179090

Change-Id: I8c539bfbccde7f22fb732951a95715935935858f
2024-01-30 16:09:41 -08:00
Cong Lin
30669a7b67 Cdm to expose GetDeviceInformation() and GetDeviceSignedCsrPayload()
GetDeviceInformation() and GetDeviceSignedCsrPayload() are added to
cdm_engine and crypto_session, so that they can be queried by DRM
plugin. This is to allow the wv drm HAL to be able to extract BCC and
CSR payload to build CSR for prov 4 device registration, such that we
don't need a separate RKP HAL to do this job.

Changes to the DRM plugin to use the exposed methods will be in the
coming CL.

Bug: 286556950
Test: request_license_test
Merged from https://widevine-internal-review.googlesource.com/178890

Merged from https://widevine-internal-review.googlesource.com/179730

Change-Id: Ibafa3a58c99fbb8f1f25f8951d3749110bd32176
2024-01-30 16:09:41 -08:00
Kyle Zhang
c600ccb741 Add Cdm support for Cast provision 4.0 flow
Bug: 259455235
Test: CorePIGTest.CastReceiverProvisioning*
Merged from https://widevine-internal-review.googlesource.com/174150

Change-Id: I8d546a73a64a71a4d61225d9c6d14d893decce22
2024-01-30 16:09:41 -08:00
Fred Gylys-Colwell
f6c1879b4c Add OEMCrypto_FactoryInstallBCCSignature API
This was requested by OEM and SOCs to support Prov 4 signing
model in the factory.

Bug: 275567037
Merged from https://widevine-internal-review.googlesource.com/176310

Change-Id: I2907841c4a16f37ae9a2241a6c9eaad73ff616af
2024-01-30 16:09:41 -08:00
Ian Benz
85357db81b Fix policy engine unittest issues from clang-tidy
Merged from https://widevine-internal-review.googlesource.com/177661

Bug: 290112507
Change-Id: Iddf6889640a335d2f6bb7af78790f4a36baaab03
2024-01-29 10:36:34 -08:00
Fred Gylys-Colwell
e9b0196a23 Generate golden data tests for ODK
Generate core message request and responses for
golden data tests.

This CL does not have any golden data. The golden data
will be added to a google3 CL.

To turn on dumping of golden data, set the environment
variable DUMP_GOLDEN_DATA to "yes".

Merged from https://widevine-internal-review.googlesource.com/171750

Change-Id: I7ae2d76ec7330d9131aae98dfd07b7909d10f726
2024-01-29 10:36:15 -08:00
Ian Benz
cebd90e300 Add clang-tidy support for the CDM
Bug: 256230932
Change-Id: Id3fcf024cd7dcf95218876b81359d6418f5aa067
2024-01-29 10:26:54 -08:00
Fred Gylys-Colwell
b7b423aca3 Reduce clock skew in flaky duration tests
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
2024-01-26 17:46:49 -08:00
Kyle Zhang
8fcaa04eab Revise cdm signing api and test
Bug: 279671867
Bug: 279672538
Change-Id: If2e2c6d250c0379c217b3f9b21efb197c9ae4fd6
2024-01-26 17:06:09 -08:00
Kyle Zhang
5070a7b949 Exposing the Cast Signing Algorithm
1. Exposing the Cast Signing Algorithm in cdm core.
2. Update core Cast tests to use new core CDM Cast signing API.

Bug: 279671867
Bug: 279672538
Change-Id: Ia73c4b5e6dd61edf790bca97a321881d310e7a99
2024-01-26 17:05:58 -08:00
Kyle Alexander
163db3777f Remove unnecessary test dependency on libmedia_omx
Test: ./build_and_run_all_unit_tests.sh

Bug: 312063280
Change-Id: Id8c8c4d3d778599c4c418b667497ff7f50f8152e
2023-12-21 20:55:58 +00:00
Kyle Zhang
6b60fc3a76 Add property to check if user forces L3
[ Merge of go/wvgerrit/186611 ]

Android user can set the property using the developer option.

Bug: 301669353
Change-Id: I730b635f6cc28dfb0471c1d679627c94b9e16af1
2023-11-09 19:59:46 +00:00
Kyle Zhang
45d8b38b43 Do not fall back to L3 if L1 has test keybox
[ Merged of go/wvgerrit/186370 ]

CDM by default allows test keybox from device side.

Bug: 299987160
Bug: 301669353
Change-Id: I06f1936ccd068eb71364a5a8931970954233b686
2023-11-09 00:26:17 +00:00
Treehugger Robot
05f045d802 Merge "Correct stability issues for SPOIDs for provisioning 4.0" into udc-qpr-dev 2023-09-20 20:15:28 +00:00
Rahul Frias
2f83cd0e49 Correct stability issues for SPOIDs for provisioning 4.0
[ Merge of http://go/wvgerrit/183472 ]

For provisioning 4.0 devices, the DRM certificate serial number
was changing on a reprovisioning attempt or factory reset. The
app parameters sent up in the client identification name-value
pair field were being filtered out in provisioning requests.
This has been corrected for provisioning 4.0 stage 2
(DRM certificate request). There is no need to include them for
stage 1 (OEM certificate request).

The test case WvCdmRequestLicenseTest.ProvisioningSpoidTest
was created earlier to ensure that SPOIDs and DRM certificates are
stable. Unfortunately due to another bug b/250099615, the RKP service
was holding a connection to the Widevine TA for provisioning 4.0
devices. When native tests ran as their own process, L1 would fail
to load due to a connection failure and the test would run as L3.
The tests passed for provisioning 4.0 devices Pixel 7 and 8 when
they should have failed. This gave us a false sense of confidence
that the SPOIDs were stable.

For now a workaround is to run a shell command to kill the widevine
TA before running native tests.

$ adb shell pkill -f -9 widevine

New tests have been introduced to provide integration coverage
WVPluginTest at the WV plugin level and CoreIntegrationTest
for core. GTS tests are also being written in b/295538002.

Bug: 294451432
Bug: 293950895
Test: WVPluginTest.ProvisioningStableSpoidTestL1, WVTS tests
Change-Id: Ib9ace4387866ea38bb1840feb69cea78d2d2c09c
2023-09-19 09:39:13 -07:00
Robert Shih
d81cdbae42 Update Widevine apex min_sdk_version to 34
Bug: 287567070
Bug: 294568360
Test: v2/widevine-eng/drm_compliance_apex
Change-Id: Iad45bf7a66ff0217724376aa8648ecd613af32c1
2023-08-28 12:30:36 -07:00
Alex Dale
310c028965 Merge "Close session during capacity check." into udc-qpr-dev 2023-08-07 22:32:28 +00:00
Alex Dale
75d3ade093 Close session during capacity check.
[ Merge of http://go/wvgerrit/181151 ]
[ Cherry-pick of http://ag/24103737 ]

For devices with a large number of usage entries, when restoring the
usage table a capacity check is performed.  This checks that a new
entry can be created.  This test was originally added as some devices
might enter a "stuck" state the table cannot be initialized.

To perform this test, a temporary crypto session is created and an
entry is created for that session.  After successfully creating that
entry, the entry is deleted.  However, because the session was left
open, the entry could not be deleted.

This change closes the capacity-check-session before deleting the
entry, as well as includes additional logs for helping future debugs.

Bug: 286176947
Bug: 291351287
Test: usage_table_header_unittest
Test: Android GTS R11 on oriole
Change-Id: I6923de00175f70b2392bfe581ca5f9ae60c4af25
(cherry picked from commit 8b4bbeeb6f440c48a3250b961f7a7dab2472d7e9)
(cherry picked from commit bb925c46e5)
2023-08-07 20:50:18 +00:00
Alex Dale
3ea91f35dd Add HDCP cap logging on HDCP-based failures.
[ Merge of http://go/wvgerrit/181152 ]
[ Cherry-pick of http://ag/24137228 ]

Partners have requested that we log HDCP information during certain
operation:
1) Current and max HDCP capability when calls to decrypt or select
   key failure due to insufficient or mixed HDCP levels.
2) Current, desired and default HDCP level when video contraints
   are not met.

To avoid spamming the logs, decrypt failures are only logged on their
first occurrence, and unmet video constrains when one of the
requirements change.

Bug: 276686656
Bug: 292005982
Test: license_keys_unittest
Test: Android WVTS on oriole
Change-Id: I98b18e66d7ce1c474a018ae83af4f1c0b03308df
(cherry picked from commit c84b9afd38)
2023-08-05 09:21:50 +00:00
Vicky Min
74a9f80790 Fix oec session id in dynamic adpater
[ Merge of http://go/wvgerrit/175310 ]

Pass the real oemcrypto session id from `pair.session` instead of
`session` for LoadEntitledContentKeys, since `session` can be
changed when L1 and L3 are running in parallel and `session` in
that case may not be the correct oemcrypto session id any more.

Bug: 279967915, 282180589
Test: wvts
Change-Id: I127ff37abf8b618dfbcb623f59bc999e58e7a028
2023-05-15 18:40:21 +00:00
Rahul Frias
75c1b88603 Merge changes I5cbfcc73,I3070b3f3 into udc-dev
* changes:
  Indicate support for initial_renewal_delay_base
  Fixes for renew on license load
2023-05-13 04:08:22 +00:00
Rahul Frias
0c288c1cda Indicate support for initial_renewal_delay_base
[ Merge of http://go/wvgerrit/174555 ]

This is only announced if OEMCrypto is v18+

Bug: 278751387
Test: Duration use case tests, wvts tests
Change-Id: I5cbfcc733ed2af2c940fde381b40a5be850e7e88
2023-05-12 15:05:44 -07:00
Rahul Frias
669fc9c7af Fixes for renew on license load
[ Merge of http://go/wvgerrit/173290 ]

* Renew timer offset from when license is loaded verifies that the
  rental duration has not expired and begins decryption.
* Renew timer offset from first decrypt bugfix
* Feature is enabled based on oemcrypto v18 presence
* Renewal logic verifies that |can_renew| is enabled
* Unit tests were added to reflect use cases from duration
  and renewal documentation

Bug: 278751387
Test: policy unittests, CdmUseCase tests, wvts tests
Change-Id: I3070b3f31b316e150c28ebe38d0440ab1eeb89b9
2023-05-12 15:02:32 -07:00
Vicky Min
5026c50ebc Fix oec session id in dynamic adpater
[ Merge of http://go/wvgerrit/175058 ]

Pass the real oemcrypto session id from `pair.session` instead of
`session` for LoadEntitledContentKeys, since `session` can be
changed when L1 and L3 are running in parallel and `session` in
that case may not be the correct oemcrypto session id any more.

Bug: 279967915, 282180589
Test: wvts
Change-Id: Iad0ac5e505d3b38d220f1484d4cf5f8bc3b5337f
2023-05-12 21:17:58 +00:00
Rahul Frias
d50b9031c9 Test refactoring to support load on renewal tests
[ Merge of http://go/wvgerrit/174470 ]

There are two sets of changes
* Mocking CryptoSession so that OEMCrypto API version can be queried
* Creating a PolicyEngineTestV16 so that API version expectations
  can be set and V18 can be accommodated.

Bug: 278751387
Test: policy_engine_unittest
Change-Id: Ied664ce87e22f697b6a45d3c573e22273e65e37f
2023-05-11 16:16:20 -07:00
Rahul Frias
f0e546d703 Fix formatting of renew on license load integration tests
[ Merge of http://go/wvgerrit/174270 ]

Bug: 240995342
Test: Duration use case tests
Change-Id: I900040256b4accf2b695a6da0827033eadb4f2e4
2023-05-11 01:52:08 -07:00
Kyle Zhang
1a42aed25b Merge changes Icd280b53,I6eed117e into udc-dev
* changes:
  Cast Receiver integration test
  Combine provisioning code for tests and improve logging
2023-05-10 18:40:30 +00:00
Fred Gylys-Colwell
d211195f92 Cast Receiver integration test
Merge from Widevine repo of http://go/wvgerrit/169471

Remove the test in android tests and add it to the
core tests.

Bug: 276464340
Test: GTEST_FILTER="CorePIGTest.CastReceiverProvisioning*" jenkins/run_fake_l1_tests
Change-Id: Icd280b532ddae274f66b2fab3e65520e96adb7cb
2023-05-10 18:40:21 +00:00
Fred Gylys-Colwell
836b1a30a6 Combine provisioning code for tests and improve logging
Merge from Widevine repo of http://go/wvgerrit/169018

This CL adds a provisioning holder that attempts to
provision and logs the request and response for
failures. The server team can replay the request to debug
problems on their end.

Bug: 276464340
Test: ran cast and ota tests
Change-Id: I6eed117e504ae3287f2ba16c3c507cfdc7456f8d
2023-05-10 18:38:50 +00:00
Rahul Frias
09d7572ece Fix oec session id in dynamic adpater
[ Merge of http://go/wvgerrit/174572 ]

Pass the real oemcrypto session id from `pair.session` instead of
`session` for CopyBuffer, since `session` can be changed when L1
and L3 are running in parallel and `session` in that case may not
be the correct oemcrypto session id any more.

Bug: 279967915
Test: wvts
Change-Id: Ic5e21ccb227d4c4992ef500435fa3b68812c4d9b
2023-05-08 23:21:47 -07:00
Treehugger Robot
24c3bbb783 Merge "Skip RenewOnLicenseLoad tests for v17 OEMCrypto" into udc-dev 2023-05-08 20:38:47 +00:00
Treehugger Robot
6511d44f3c Merge "Expect failure on license load for expired LDL license" into udc-dev 2023-05-08 19:03:33 +00:00
Rahul Frias
fa4f9ca07d Skip RenewOnLicenseLoad tests for v17 OEMCrypto
[ Merge of http://go/wvgerrit/173950 ]

Bug: 280641992
Test: duration use case tests
Change-Id: If81df367c9359592b1ba797f6192d413afe55273
2023-05-08 11:55:40 -07:00
Alex Dale
f2bf164914 Updated usage test to expect v16 duration values.
[ Merge of http://go/wvgerrit/174431 ]

It is possible that the initial license duration was limited due to
the finit rental duration; however, if the license has a soft rental
duration, it will be considered unlimited after playback has begun.

The *.UsageTest* have been updated to ignore cases where initial
license durations are finit, but later report as unlimited.

Bug: 275651559
Test: cdm_extended_duration_test
Change-Id: I689163b1066b2bc9f9345e2279e9373010f844cc
2023-05-05 17:30:13 -07:00
Fred Gylys-Colwell
65d52908af Expect failure on license load for expired LDL license
Merge from Widevine repo of http://go/wvgerrit/170970

RenewOnLicenseLoad.Case2 tests are failing because they
are expecting to load an expired license. However, the spec
says that the license should return KEY_EXPIRED. The test is
being updated.

Some other RenewOnLicenseLoad tests were failing because
they forgot to request the renewal.

Bug: 278750980
Test: Run tests on Luci
Change-Id: I7196db11fcf43859ba9310b87fd8ccb609e47039
2023-05-04 21:18:06 -07:00
Alex Dale
2e84e8b5f7 Merge "Exclude the default CDM from metrics history." into udc-dev 2023-05-03 18:44:06 +00:00
Treehugger Robot
c77b0a6bf2 Merge "Piped CdmEngine's generic crypto operations to Android CDM." into udc-dev 2023-05-03 01:16:23 +00:00
Rahul Frias
a4dc63581f Merge "Add error details when offline license is not found" into udc-dev 2023-05-02 23:41:30 +00:00
Alex Dale
37f125a491 Piped CdmEngine's generic crypto operations to Android CDM.
[ Merge of http://go/wvgerrit/172010 ]

The CdmEngine provides an API for generic crypto operations that are
already used for the CE CDM.  This API is being exposed in the Android
CDM.  The parameter order of the Android CDM is modified to match the
existing generic crypto parameters used in the media DRM plugin.

Bug: 274984456
Bug: 29400687
Test: build x86-64 and Android
Change-Id: I3b286ebb011bd58754b7b8ea814ed46daf1f62f9
2023-05-01 15:50:39 -07:00
Alex Dale
da6437fe5e Exclude the default CDM from metrics history.
[ Merge of http://go/wvgerrit/173410 ]

The DRM plugin opens and closes many CDMs using the default identifier.
These metrics are not needed when checking the metric history and will
no longer be stored.  Default CDM metrics will continue to appear in
the live metrics list.

Bug: 239462891
Bug: 270166158
Test: adb shell dumpsys android.hardware.drm.IDrmFactory/widevine -m
Change-Id: I64662a44e9c084cc0f08c5a3f013dbf86374ac2d
2023-05-01 15:37:34 -07:00
Cong Lin
9651c61e25 Fix session id in dynamic adapter and re-generate L3
Merge of https://widevine-internal-review.googlesource.com/c/cdm/+/173330

Skipping files that are not in android from the CL above.

Original commit message:

Pass the real oemcrypto session id from `pair.session` instead of
`session`, since `session` can be changed when L1 and L3 are running in parallel and `session` in that case may not be the correct oemcrypto session id any more.

Also adding a few missing v18 L3 functions pointers to the dynamic
adapter.

Need to re-generate L3 since the L3 sources changed.

Test: L3 unit tests
Test: GTS dash policy tests and Dexter tests
Bug: 271290471
Bug: 279967915
Change-Id: Idc44d57ca38eb1de24c0038917800e37c25b9afc
2023-05-01 19:25:27 +00:00
Rahul Frias
9d1c9ca76a Add error details when offline license is not found
[ 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
2023-04-28 02:38:35 -07:00
Alex Dale
4b267e37f9 Allow metrics history to outlive the Android CDM.
[ Merge of http://go/wvgerrit/172910 ]

The lifecycle of the Android CDM is controlled by Android's strong/
weak pointer functionality.  Unfortunately, it does not provide an
easily predictable point in the code where the CDM is to be deleted
along with the saved metrics.  In order to allow the CDM to keep a
list of metrics that are persistent with the life of the service, a
global thread safe queue is provided which is created when the first
CDM is created, but will out live the CDM.

The metrics will still be deleted when the DRM service is terminated.

Bug: 270166158
Test: adb shell dumpsys android.hardware.drm.IDrmFactory/widevine -m
Change-Id: Id98676d8b5278798b4de332cc272cd5b85024244
2023-04-27 15:31:39 -07:00
Alex Dale
c42627a23e Added metrics history for WV CDM for Android.
[ Merge of http://go/wvgerrit/171271 ]

There is a need to maintain a short history of metrics from CDMs which
have been deleted.  This CL adds this ability to the Android version
of the WV CDM.  The history cannot yet be maintained for long, as the
WV CDM instance is destroyed if unused.

Further changes are required to the plugin to maintain the history
beyond the life-cycle of the CDM instance, and to properly format
its output.

Bug: 239462891
Bug: 270166158
Test: adb shell dumpsys android.hardware.drm.IDrmFactory/widevine -m
Test: atest GtsMediaTestCases
Change-Id: I81c0996602722a9795fc3951030d20bb39b5816b
2023-04-27 14:54:17 -07:00
Cong Lin
5ccb147bb8 Fix spurious wake up in dynamic adapter
The predicate version of wait_for() to avoid spurious wake up by
checking running_ status.

This is a fix to ag/21439870

Test: build widevine
Bug: 272424659
Bug: 271811708
Change-Id: I446fef8f4c8c58bcd47b885dba50643b3e5e1185
2023-04-20 19:16:19 +00:00
Rahul Frias
333fe249e4 Merge "Force a reprovisioning on device renewal" into udc-dev 2023-04-14 05:49:14 +00:00