Commit Graph

3634 Commits

Author SHA1 Message Date
Vicky Min
5f3bc77c52 Remove RestrictFilter() function and RSAPerformance test
Since we want to migrate to using GTEST_SKIP to skip unit tests instead
of GTEST_FILTER, we can remove the RestrictFilter() function which
filters the tests out using GTEST_FILTER. To do this, the RSAPerformance
test needs to be removed, which is acceptable since no one uses this
test anymore. However, b/299135804 is being used to track a new way to
either execute/track permance.

Bug: 251240681, 299135804
Change-Id: Ife59c468ee127f4c39d3be91707ca38a061b7895
2024-02-22 14:31:29 -08:00
Jacob Trimble
488a4647db Merge OEMCrypto KDF and usage functions
Since KDF functions are only used right before specific functions, this
merges them to simplify internal state within OEMCrypto.

Fixes: 299527712
Change-Id: I426cfcdc102bd73cf65cd809b213da2474f44b34
2024-02-22 14:24:35 -08:00
Vicky Min
b04fda2908 Skip API and time rollback tests with GTEST_SKIP
Bug: 251240681
Change-Id: Ie1cee828f239ddca03ad18aac4139e2e42038df3
2024-02-22 13:54:52 -08:00
Vicky Min
065d4d151e Update C function/field documentation to match behavior in ODK
PiperOrigin-RevId: 560780563
Change-Id: Ibd88398b06cca7a51d152fb6da95afd40cdd5a8b
2024-02-22 13:52:28 -08:00
Vicky Min
3933be3650 Update OEMCrypto_PrepAndSignLicenseRequest() documentation
OEMCrypto_PrepAndSignLicenseRequest() documentation needs to be updated
to match the current behavior.

Bug: 296608852
Change-Id: Ib76dc2f1afa705b5f71e654afa2889b2dcca36ce
2024-02-22 13:52:28 -08:00
Jacob Trimble
660a20ed5c Always use static_assert on MSVC
MSVC supports static_assert but won't always set __STDC_VERSION__ correctly.  So we just assume it is supported.

PiperOrigin-RevId: 559166904
Change-Id: I9a62094686405c58fe9be202bce0f4fefb764d48
2024-02-22 13:52:28 -08:00
Alex Dale
165e41e008 SetDecryptHash() backwards compatibility.
In v19, SetDecryptHash() was updated to only work with CRC-32.
While updating OEMCrypto, L1 (opk, intertrust, etc.) and L3, the
V18 version was not added to the dynamic adapter.  This change
adds the backwards compatible call for L1s running V18 and earlier.

Bug: 296918528
Test: run_dynamic_oemcrypto_v18
Change-Id: I8f3efc1ffac4fa7a87e029166ee866567829897d
2024-02-22 13:52:28 -08:00
Vicky Min
18369730b9 Refactor OEMCrypto_SetDecryptHash
The current implementation of OEMCrypto_SetDecryptHash gives developers
flexibility to use different types of hashes. However, all the
implementations we have seen thus far use crc32. Because of this, crc32
should be sufficient and we can refactor OEMCrypto_SetDecryptHash to
only use the crc32 hash.

Bug: 287706586
Change-Id: I4aaa253b2656dfd9c984f77dfb08fe160b23b47c
2024-02-22 13:52:26 -08:00
Vicky Min
c26d6d3c97 Update core_message_util_test LicenseResponse18 unit test for variable max num keys change
PiperOrigin-RevId: 557685272
Change-Id: Ib9e1b6c38d1f135c757e734c1c9f36d3913a21ca
2024-02-22 13:52:11 -08:00
Vicky Min
5c718ecb0d Update OEMCrypto to match ODK version updates
Bug: 293154424
Change-Id: Ie22bc48e043f2a88090a2601d5d5c96953e73015
2024-02-22 13:49:25 -08:00
Vicky Min
41942e1014 Roll ODK version number to 19.0
PiperOrigin-RevId: 551966786
Change-Id: Ib3eb3423112a340abb25cddfdc2d6d43ad2ce6f1
2024-02-22 13:44:51 -08:00
Matt Feddersen
6c7988f8c9 Don't force decrypt count to increase for bypass
Bug: 324261677

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

Change-Id: I371fc22ad330402aed0e10cb3cba8641abe00bea
2024-02-19 14:58:49 -08:00
Junfeng Yang
65abd1deb7 Remove the extra call to OEMCrypto_GenerateNonce
The extra call to OEMCrypto_GenerateNonce is not needed. And it would
also lead to failure when the fuzzers are linked with the OPK
serialization layer.

Bug: 324666282
Change-Id: I43941fd5ee1f15f7106e6f0be2b65dce206225cf
2024-02-19 01:15:57 -08:00
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
Ian Benz
858d66a12c Fix code health issues in OEMCrypto testbed identified by Coverity
Change-Id: I518f753d9d716415d2fe62d3bf54fc9f816f044c
2024-02-19 01:01:48 -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
Junfeng Yang
93c19cd8de Fix the parameter direction
The output_descriptor parameter of OEMCrypto_FreeSecureBuffer should be
marked as [in,out].

Bug: 321346771
Change-Id: I4ba1a7f0b0f12a068d655a0d0b8b43a0818980dc
2024-02-19 01:01:26 -08:00
Matt Feddersen
8ac74f2d68 Skip some cast tests if not supported
Merged from https://widevine-internal-review.googlesource.com/190072

Change-Id: I4134b3f090e3f47c80601ae30262d0587808e88a
2024-02-19 01:00:47 -08:00
Rahul Frias
7fc518220f Link dependencies dynamically
An attempt to add feature flags to the widevine service
(b/311951236) caused a memory regression (b/324438957).
Using the static library for feature flags results
in SIGSEGV due to possible clobbering of static libraries
(b/311951236 comment18).

An alternate option is to make libcutils and libc++ shared

Bug: 325483378
Test: WVTS
Change-Id: Id37f80bf8990554fcdd16c1a6401e877231390cb
2024-02-15 11:33:24 -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
78451da9a3 Merge "Revert "Add feature flag to change the CDM version to 18.0.2"" into main 2024-02-12 17:40:17 +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
Treehugger Robot
041254d802 Merge "Adding missing tests to run_all_unit_tests.sh" into main 2024-02-08 23:40:48 +00:00
Kyle Alexander
213e66d6c2 Adding missing tests to run_all_unit_tests.sh
Merge of go/wvgerrit/191191

Test: ./build_and_run_all_unit_tests.sh

Bug: 324304830
Change-Id: I0fb65acbfde8a98c060fce03c2a0f83b1a10b55c
2024-02-08 21:43:32 +00:00
Rahul Frias
735476e96b Add a flag to enable Rikers
[ Merge of http://go/wvgerrit/191113 ]

Rikers will replace haystack for L3 protection. Haystack will still
be present to support offline licenses that were downloaded using
haystack in prior releases.

Bug: 262635528
Test: WVTS and unit tests
Change-Id: Idffa0002b2c7694df595fa9cac694806673377b8
2024-02-07 21:54:35 -08: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
Robert Shih
35d09f3f00 Move wv service relative_install_path to defaults
Bug: 323289757
Test: TreeHugger
Change-Id: I4dfd8836527f4c2d376ee9dd7f3dbf04a058a233
2024-02-01 13:40:53 -08:00
Alex Dale
57d231db1b Check if license exists before calling remove.
[ Partial cherry-pick of http://go/wvgerrit/186230 ]

The removeOfflineLicense() API in the Media DRM plug would attempt
to remove the specified license from L1, then retry L3 if L1 failed
for any reason.  This causes error emitted by L1 to be masked by
errors emitted from L3.  In particular, if an internal error occurs
on L1 when removing the license, because the plugin would then
try L3 which does not contain the license, the app will receive either
a "does not exist" or "needs provisioning" error from L3.

This CL changes the plugin to first determines which security level
the license exists for.  Then only attempts removal on that security
level.

Bug: 301910628
Bug: 291181955
Bug: 296300842
Bug: 302612540
Test: MediaDrmParameterizedTests GTS on bluejay
Merged from https://widevine-internal-review.googlesource.com/187611

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

Change-Id: I3d3975f945d2e97cfa9d866baf6ca5cf901f8af5
2024-02-01 13:40:53 -08:00
Alex Dale
1183ae813f Filter out key set IDs based on ATSC mode.
[ Partial cherry-pick of http://go/wvgerrit/185854 ]

Certain GTS tests do not fully consider restrictions on ATSC devices.
In particular, GTS assumes if there are any key set IDs returned to
the app via the MediaDrm API, then the device must already be
provisioned.  ATSC license are special in that they may be available,
but the CDM is not provisioned while outside of ATCS mode.

To work around this assumption made by GTS, we filter out ATSC licenses
returned by getOfflineLicenseKeySetIds() when the device is not in
ATSC mode, and filter out non-ATSC license when it is in ATSC mode.

This is only a soft enforcement mechanism as calling the API with a
valid ATSC license while outside ATSC mode (or a non-TSC license in
ATSC mode) will continue to result in the failures experienced by
certain OEMs.

Bug: 301910628
Bug: 291181955
Bug: 296300842
Bug: 302612540
Test: MediaDrmParameterizedTests GTS on oriole
Merged from https://widevine-internal-review.googlesource.com/187610

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

Change-Id: Id1508571ebb5c466f43bca99a2d79dc402a2134f
2024-02-01 13:40:53 -08:00
Matt Feddersen
c02de3f0e6 Update CHANGELOG link for v17.2
Merged from https://widevine-internal-review.googlesource.com/183778

In addition to the merge from oemcrypto-v17, this CL fixes a few header
indents and v18 tag links.

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

Change-Id: I781aa69314acdeb48bff1af3c291c847f6a664ea
2024-02-01 13:40:53 -08:00
Cong Lin
5d72262eda Update OEMCrypto CHANGELOG for v18.4
Bug: 294440012
Merged from https://widevine-internal-review.googlesource.com/181191

Change-Id: I4d0726058b938a7d9767bbecd8553c92e81841da
2024-02-01 13:40:52 -08:00
Cong Lin
2db837bce4 Update OEMCrypto CHANGELOG.md for v17.2
Bug: 241146324
Merged from https://widevine-internal-review.googlesource.com/178978

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

Change-Id: I385cab041e795d9ef2a5cb01e7ee71fe3290c84d
2024-02-01 13:40:52 -08:00
Matt Feddersen
5715fb527a Update changelog for 18.3
Merged from https://widevine-internal-review.googlesource.com/178050

Change-Id: Id4417754bdb9acabbbdbebbf913e4de87c933054
2024-02-01 13:40:52 -08:00
Matt Feddersen
6243410069 Remove WTPI_MaxBufferSizeForDecrypt and WTPI_ApplyCGMS
Bug: 277115746

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

Change-Id: I744f4fe1837b776b50693a40535484e8fae092c4
2024-02-01 13:40:52 -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
Robert Shih
7abdd4d0ae Misc formatting fix
Bug: 323289757
Test: TreeHugger
Change-Id: I26ec60855bf19a3ef87ca7bc86f3cb024e393c2b
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
Fred Gylys-Colwell
c53047bd1b Document huge buffer tests in separate group
Explain how the huge buffer tests work. In particular, state
that we expect that OEMCrypto returns an error on huge
buffers.

Staged here:
https://developers.devsite.corp.google.com/widevine/drm/client/oemcrypto/v18/oemcrypto-test/group/security

Bug: 300645748
Merged from https://widevine-internal-review.googlesource.com/188034

Change-Id: Iba9d652dfe57df6786b0ab60931f02f8ce9b8180
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
dff87f04a9 Use LOGW when membarrier_function is not present in L3
membarrier_function() for clearing cache in L3 is optional and good to
have. Currently we log it as error if it is not available, which caused
some confusion for CE CDM L3 partners building their own L3.

Also corrected a typo in the function name.

Test: build L3 and run dynamic level3 tests
Change-Id: If20bcb1fe2bace33c43aa178af699f3b190a1fd2
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
Ian Benz
8e48e36554 Fix uninitialized variable in Provisioning40CastRoundTrip
- Initialize allowed_schemes_ since it is used by CreateDefaultResponse.
- Issue was detected by Coverity.

Change-Id: I368c4773f6316b65196aaa39e23e70717299c570
2024-02-01 13:40:51 -08:00