Commit Graph

1710 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
52b7965226 Skip RenewOnLicenseLoad test when not viable
The feature RenewOnLicenseLoad is not expected to work for an offline
license when the device has no usage table.

Bug: 310498829
Merged from https://widevine-internal-review.googlesource.com/190789

Change-Id: I601c332ed6cd17f9682082ea6acda7e67492b381
2024-02-19 01:03:30 -08:00
Geoffrey Alexander
62ba0133cf Create general certificate provisioning tests
Creates parameterized certificate provisioning tests to prepare for DRM
reprovisioning implementation.
- Create parameterized certificate provisioning test suite.
- Change RETURN_IF_NOT_OPEN macro to call IsOpen instead of checking
  the |open_| variable to make mocking of CryptoSession methods easier.

Bug: b/305093063
Merged from https://widevine-internal-review.googlesource.com/188051

Change-Id: Ic1c344af64073a8ff5626530a0864bfeea90fc6e
2024-02-19 01:01:31 -08:00
Geoffrey Alexander
442ee78db1 Create new token types for DRM reprovisioning
Creates new token types for the DRM reprovisioning scheme that will be
used by L3 CDMs with baked-in certificates to allow for use of unique
serial numbers.

- Create new `CdmClientTokenType` for DRM reprovisioning in the CDM
  core.
- Create a new `ProvisioningType` for DRM reprovisioning in the
  provisioning message proto.
- Create new enum value for `DEVICE_EMBEDDED` in DrmCertificate type.
- Update uses of the above to include the new token types.

Bug: b/305093063
Merged from https://widevine-internal-review.googlesource.com/186934

Change-Id: I7e6cc8744b80cbbb624d31e5be1eab1be8a9680f
2024-02-19 01:01:31 -08:00
Ian Benz
2fabef5bc9 Fix code health issues in the CDM identified by Coverity
Bug: 323331064
Change-Id: Ic87b32c1f7996bd5bb31e99a5fc117c59e94a42c
2024-02-19 01:01:31 -08:00
Rahul Frias
54162b07c5 Add feature flag to change the CDM version to 18.0.2
[ Merge of http://go/wvgerrit/191139 ]

Adding an initial flag that include identifiable differences when
the feature is enabled or disabled.

This is the same commit as ag/25837302. It was reverted due to
memory size issues. A follow on CL will address that issue to
ease review.

Bug: 311951236
Test: WVTS tests
Change-Id: I995fb8f4158b3529c2d19a2ee5fd8beec0019f7c
2024-02-15 10:11:44 -08:00
Ronish Kalia
d0f454d91c [DON'T BLOCK] Test ownership migration rules
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.

For more details please refer to the link below,
<add g3 doc link>

Bug: 304529413
Test: N/A
Change-Id: I204c137da43a021bcebe316759d1aadaec99fe2a
2024-02-14 14:19:08 +00:00
Rahul Frias
e92b739407 Revert "Add feature flag to change the CDM version to 18.0.2"
This reverts commit 10f6252e4d.

Reason for revert: Increase in memory size for android.hardware.drm-service.widevine

Bug: 324438957
Change-Id: I39c9ca1ebc1da6b9997f63082530fc258974c5ec
2024-02-12 08:39:23 +00:00
Rahul Frias
10f6252e4d Add feature flag to change the CDM version to 18.0.2
[ Merge of http://go/wvgerrit/191139 ]

Adding an initial flag that include identifiable differences when
the feature is enabled or disabled.

Bug: 311951236
Test: WVTS tests
Change-Id: I57a8e05d3b7c0cb6b43cbef022b436330985fe11
2024-02-07 21:33:22 -08:00
Fred Gylys-Colwell
f8e8efe1d6 Log more license information
This CL logs some extra policy information from a license.

Bug: 305794515
Bug: 311529487

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

Change-Id: I707afbb01b5467d2551c68a9152ca078815544eb
2024-02-01 13:40:52 -08:00
Alex Dale
95917053f3 Added test printer for std::future_status.
Bug: 297082009
Test: run_zimperium_dev
Change-Id: I65904821de45a7d5bd515388dcaf9cace53a4893
(cherry picked from commit 61dd2b7951ace38a0710909928028144462db165)
2024-02-01 13:40:52 -08:00
John "Juce" Bruce
3316870a0a Sony Patch to LicenseKeys::GetAllowedUsage()
Sony has identified a 5-year-old copy-and-paste error in
LicenseKeys::GetAllowedUsage(). For entitled keys, it was calling
CanDecryptContent() instead of GetAllowedUsage() on the entitlement key
session. This meant that for entitled keys, the allowed_usage parameter
was never updated and the return value of the function was indicating
something different than intended.

Bug: 280902715
Test: x86-64
Merged from https://widevine-internal-review.googlesource.com/174671

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

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

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

Change-Id: Ic6f34a5110c7144778d5773d5c1cc5768f953e41
2024-02-01 13:40:52 -08:00
Geoffrey Alexander
17a1de8d2d Apply string obfuscation to license and provisioning strings
String obfuscation hides string literals from static analysis but
requires string literals be used inside protected functions.

- Enable string obfuscation for all function groups.
- Change some global `std::string` to `const char[]` to ensure that
  the `std::string` is constructed inside a protected function so
  that string obfuscation correctly applies to the string literal.

Bug: 270566889
Merged from https://widevine-internal-review.googlesource.com/168485

Merge conflicts were caused by formating changes. Resolved by taking
the newer version.

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

Change-Id: Ie7f3e94f89671a34e4792efa174f96a17d713f9e
2024-02-01 13:40:52 -08:00
Robert Shih
f3e9794a00 Use updated ProvisioningHolder ctor in test
Bug: 323289757
Test: core_integration_test
Change-Id: I1403b4779c434ce23f98fae3e1c061b06fdd4008
2024-02-01 13:40:52 -08:00
Robert Shih
fd90f4bc76 Find odk_serialize.h in Android integration test builds
Bug: 290252845
Test: cdm integration tests
Change-Id: Ie904543ea3df143a17845202cb01089fee7eb5f6
2024-02-01 13:40:52 -08:00
Cong Lin
6327211db6 WVDrmPlugin changes to query device CSR payload for prov 4
Plugin to provide getPropertyByteArray("deviceSignedCsrPayload")
which returns the signed CSR payload for device registration. It
queries both BCC and device info to be set in plugin before calling this
getPropertyByteArray("deviceSignedCsrPayload") method. The returned csr
payload will be used by assemble the device CSR by the caller for device
registration.

Bug: 286556950
Test: build WV DRM plugin
Merged from https://widevine-internal-review.googlesource.com/178891

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

Change-Id: I65d89ed998dd292fc656af2f91f4472c1b5ec33c
2024-02-01 13:40:52 -08:00
Ian Benz
a0f6b99cbe Fix TestSleep integer overflows identified by Coverity
Change-Id: Ibbc218100ea8a58c201bc6812cabc88dfd16f36e
2024-02-01 13:40:52 -08:00
John "Juce" Bruce
c232299f78 Allow CE CDM integrators to specify their own logging
This patch adds a new interface that partners must provide to
Cdm::initialize(), ILogger. ILogger replaces stderr as the sink to which
logging messages are sent. For partners that still want to log to
stderr, a reference implementation that logs to stderr is provided.

As a side-effect of this, many test-related source files had to be
updated to thread the new parameter to Cdm::initialize() through them.
This also necessitated adding a new variant of FormatString() that can
be called with a va_list directly so it can be called from other
functions that take varargs.

Bug: 201446862
Merged from https://widevine-internal-review.googlesource.com/177270

Change-Id: Ie31a10162773883b337f3a6144cf180a2b100139
2024-02-01 13:40:52 -08:00
Vicky Min
e7017475b7 Use GTEST_SKIP for generic crypto tests
Bug: 251240681
Merged from https://widevine-internal-review.googlesource.com/180050

Change-Id: I5aebcf10f9c8bad5ff21c22bc882040ecd0b390a
2024-02-01 13:40:51 -08:00
Vicky Min
afbbad9aa5 Use GTEST_SKIP for session tests
Bug: 251240681
Merged from https://widevine-internal-review.googlesource.com/180010

Change-Id: I39e5c0365a5e0c2ddf62e6f68426f6baa3ddd1a1
2024-02-01 13:40:50 -08:00
Ian Benz
44e21cb9c2 Remove extra copy operations identified by Coverity
Change-Id: I5e900082d3b17300f3a4ef95561d04c0228aba4f
2024-02-01 13:40:49 -08:00
Jacob Trimble
a457c2a14d Make IV const in privacy_crypto
Merged from https://widevine-internal-review.googlesource.com/188677

Change-Id: I17346b54259ca1929ef40a8d61aef38969800159
2024-02-01 13:40:49 -08:00
Alex Dale
8429693866 Added skip test flags to test_base
Flags are to be used in new tests when creating tests that potentially
take a long time to run.  Certain test suites are intended to be quick
and may skip certain long running tests.

New slow tests should check these flags and skip using GTEST_SKIP().

Bug: 311273599
Test: ./build.py x86-64 --debug
Change-Id: I4fc5a026f23f489bf2ad8b8a11dc467f550f0c5e
2024-02-01 13:40:49 -08:00
Alex Dale
151a0e1a76 Include client_version in license requests.
"client_version" is an optional, information field in the protocol for
license requests.  It was requested that the CE CDM includes this
information in the license request.  It does not hurt to include this
information in the Android license requests too.

If, for some reason, the client cannot provide this information, the
request is still sent out as normal.  No reason to prevent an otherwise
valid license request due to a missing optional field.

Note: This field is directly in the LicenseRequest message and not the
ClientIdentification message.

Bug: 253013596
Test: license_unittest
Change-Id: I9dc342301fffdc174122088af39406150b34562e
2024-02-01 13:40:49 -08:00
nihardamar
a4158f16ad Refactor common code in generic_crypto_unittest.cpp
Bug: 220056143

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

Change-Id: I767c57eaa6e24990b83805490cf8b1ec51903324
2024-02-01 13:40:49 -08:00
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