Commit Graph

3658 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
d4dae79a0e Clean up some test docs
Some tests were not in a doxygen group, so they were not
showing up on the dev site.

Bug: 298719677
Change-Id: Ic86b7999ac7ab324eb40a30023b74897f87d97e5
2024-02-22 14:56:27 -08:00
Googler
05926646f0 Fully-qualify using-declaration (in the SDK) that refers to a top-level name, per go/c-readability-advice#fully-qualify-using
Steps
- `google3/video/widevine/export$ find . -type f -name "*.cc" -exec sed -i -E 's/^using ([a-zA-Z]+)/using ::\1/g' {} +`
- `google3/video/widevine/export$ find . -type f -name "*.h" -exec sed -i -E 's/^using ([a-zA-Z]+)/using ::\1/g' {} +`
- Review and revert changes to some files

PiperOrigin-RevId: 584441667
Change-Id: I90b23801b804d3975ac99eb62e6307918175f503
2024-02-22 14:46:43 -08:00
Vicky Min
726f2d51e9 ODK unit tests for release request
PiperOrigin-RevId: 584427947
Change-Id: I7a131739c5ea0d27c2f9e9c5ecb7b138176ce049
2024-02-22 14:46:43 -08:00
Cong Lin
91e573f574 Add signature verification to BCC validator
Each entry in BCC is signed by its parent. BCC validator should be able to
validate the signature along the chain.

In OPK reference, EdDSA is used. Also adding functions to support ECDSA
in oemcrypto_ecc_key module.

Test: opk_ta_p40
Bug: 300310163
Bug: 307968622
Change-Id: Ibed895933eeb71b18c467604588cca449cac1af9
2024-02-22 14:46:43 -08:00
Cong Lin
64124a7832 Add BCC validation to oemcrypto unit tests
The returned BCC from OEMCrypto_GetBootCertificateChain() can be
validated by unit tests with BccValidator.

Test: run_fake_l1_tests, opk_ta_p40
Bug: 300304834
Bug: 307968622
Change-Id: I6312cb45548f5d8a711c13ea0356d6ec8db51082
2024-02-22 14:46:30 -08:00
Fred Gylys-Colwell
8d77db54d0 Update version number in OEMCrypto header
Bug: 298719677
Change-Id: Icae24704cdb8bdd801635d879c34f917fb3d4468
2024-02-22 14:46:07 -08:00
Cong Lin
dbb0bea701 Add Bcc validator to oemcrypto util and unit tests
A Bcc validator that can parse and validate BCC. This is to support better
prov40 unit tests regarding OEMCrypto_GetBootCertificateChain() later.

Test: opk_ta_p40
Bug: 300304834
Bug: 307968622
Change-Id: I3cfdad9f1891c6abc83051af1d80a20e0adeb58b
2024-02-22 14:43:11 -08:00
Matt Feddersen
c36826607e Add CDM integration test for MoveUsageEntry bug
Test: GTEST_FILTER="*PIG*Defrag*" ./jenkins/opk_ta
Bug: 307750348

Change-Id: I5cc1ffb32311d6e46a956e11fc400b6f9510e6d6
2024-02-22 14:34:00 -08:00
Vicky Min
c8ac9c5cd7 Fix empty struct error
I added an empty ODK_ParsedRelease struct in ODK in case we want to add fields for release requests in the future but this is causing an error in C. Removing it for now. Will add it if needed for future unit tests.

PiperOrigin-RevId: 581059171
Change-Id: Ic547cf3cef3cf89f503f39cff27888d77056eddc
2024-02-22 14:34:00 -08:00
Vicky Min
4d7025e517 ODK implementation for license release
PiperOrigin-RevId: 580643396
Change-Id: I588ef20587acc347b510dfb7fd9e372d221100a0
2024-02-22 14:34:00 -08:00
Jacob Trimble
692cb259f3 Fix dynamic adapter with provisioning
Bug: 302721191
Change-Id: Icdc003ed903142129eb1f89d109f447ea6dc2079
2024-02-22 14:34:00 -08:00
Googler
de3cac4f90 Remove the words All rights reserved. from Widevine's existing copyright headers, under google3/video/widevine/export/common/oemcrypto_core_message/
For context, see cl/578224540

This CL is produced via
- Do the removal
    - `$ /google/src/head/depot/google3/devtools/scripts/csearch_apply --includefile 'video/widevine/export/common/oemcrypto_core_message/' --search='Copyright \d{4} Google LLC. All rights reserved.' --apply='s,\ All rights reserved\.,,g'`
- Manually deleted a few periods. I.e., for cases where the comment is ONLY "Copyright <year> Google LLC.", I removed the period at the end.

PiperOrigin-RevId: 580020267
Change-Id: I4b2f647d6e3bbb34868e1822591bc953a94cca42
2024-02-22 14:33:58 -08:00
Vicky Min
9e76fdfb5f Add run_dynamic_oemcrypto_v19 test script
Also removed L3 function pointers to the function headers added in
go/wvgerrit/186010 because they weren't stubbed out and was causing the
new script to fail.

Bug: 293359147
Change-Id: I15606bb636a8bd2637bcf48c421a85d82044762b
2024-02-22 14:33:47 -08:00
Cong Lin
dbab54191b Fix OEMCrypto_GetBCCType() in dynamic adapter
Correct a typo that breaks the build.

Test: run_dynamic_oemcrypto_v18
Bug: 307812015
Change-Id: I0c5defcd933258ccf927657baa28d8546ae5303c
2024-02-22 14:33:26 -08:00
Alex Dale
1daf69dc6f Update widevine apex min_sdk_version to 34
Change is based on http://go/wvgerrit/186390

PiperOrigin-RevId: 576682220
Change-Id: Ic0fa38982ba1bb83577e01d3d579367c8bda2019
2024-02-22 14:33:25 -08:00
Vicky Min
159aeeecf4 Add integration test for license release
Bug: 258816489
Change-Id: I315eefeb479146de2563aefa75303633341d86f0
2024-02-22 14:33:25 -08:00
Cong Lin
df6d73f021 Add header functions for GetBCCType
Add new OEMCrypto_GetBCCType() function in v19.
Re-generate serialization and test files.

Test: opk_ta, opk_linux_ipc_ta, run_fake_l1_tests
Bug: 297918188
Change-Id: Id5f422776cd50c71ab483c06bbe3ac399461fb31
2024-02-22 14:33:12 -08:00
Vicky Min
417a9c7b77 Add header functions for license release
Bug: 295956275
Change-Id: I223937ea25544cfb562bc063e75b359e4d908984
2024-02-22 14:33:03 -08:00
Vicky Min
51c537e265 Fix potential signed integer overflow in ODK
PiperOrigin-RevId: 573265338
Change-Id: I33dbced572941c9646f7496e20b8d9a49bca5811
2024-02-22 14:32:51 -08:00
Cong Lin
e0e625b3f2 Update build files to use C++17 standard
Updated compiler flags from c++14 to c++17 everywhere.
L3 haystack still uses c++14 and needs more testing.

Bug: 254108623
Test: Build and run CE CDM unit tests
Change-Id: I3883c466705aeb239d22c178605029fec7d46bff
2024-02-22 14:32:49 -08:00
Jacob Trimble
078e1f6555 Add utility for generating KDF contexts
Starting in v19, OEMCrypto implementers will need to implement KDF generation in OEMCrypto.  To make it easier, this adds a utility to generate them based on the request context.

PiperOrigin-RevId: 572693987
Change-Id: Ife382bf35ceede508499e3677de115ef12999dcc
2024-02-22 14:32:00 -08:00
Fred Gylys-Colwell
e85a6b9616 Allow entitlement and entitled session to be the same
For DRM, but not for CAS, we allow the entitlement session
and the entitled session to be the same.

Bug: 301462149
Change-Id: Ib830484be8437b1c4ce34500ae912e6c119dcfc3
(cherry picked from commit c1ec1c248d3ca1d3bc414c71cc9222c77d56f043)
2024-02-22 14:31:56 -08:00
Vicky Min
54da9e91cd Create function header for ODK_PrepareCoreLicenseRelease
PiperOrigin-RevId: 571975120
Change-Id: Ie9eac57389298b03348137078b5c63432a3d50d8
2024-02-22 14:31:56 -08:00
Jacob Trimble
4b32cb4b10 Implement license protocol 2.2 for OEMCrypto v19
This updates the code and tests to allow for using license protocol 2.2
when using OEMCrypto v19.

Issue: 80428549
Issue: 121031064
Issue: 232464183
Change-Id: Ib6bb61f86dd310b566227462658530bca5940b88
2024-02-22 14:31:54 -08:00
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