Commit Graph

1796 Commits

Author SHA1 Message Date
Rahul Frias
fb795b7946 Merge "Call CopyBuffer in Decrypt if key handle is empty" into main 2024-03-19 21:22:30 +00:00
Vicky Min
6577f6f212 Call CopyBuffer in Decrypt if key handle is empty
(Merged from go/wvgerrit/193672)

Bug: 320785945
Test: GTS + unit tests
Change-Id: I4a0c7568bf8323187f1156874ea98718511120f4
2024-03-15 14:50:02 -07:00
Rahul Frias
af2ffca5fa Add DRM reprovisioning request generation
[ Merge of http://go/wvgerrit/192010 ]

Updates the CDM to add support for DRM reprovisioning request creation.
- Load the baked-in certificate for use as the client token.
- Add functions to build and sign a drm reprovisioning request.
- Update the Rikers L3 OEMCrypto implementation to support signing
  provisioning requests and getting embedded certificate.
- Update client id token to handle DRM reprovisioning.
- Add OEMCrypto function to load the baked-in device certificate in
  Rikers CDMs and stubs for non-Rikers CDMs.
- Add dynamic adapter support for getting embedded device certificate
  only on L3.

Bug: 305093063
Test: WVTS
Change-Id: I9a0ecf95e27213b046f03baa0781fb164179323b
2024-03-15 10:22:35 -07:00
Alex Dale
b1fad7f4cb Reset crypto session pointers on RemoveKeys.
[ Merge of http://go/wvgerrit/189590 ]
[ Cherry-pick of http://ag/26541307 ]

The CDM session shares its CryptoSession instance with a few additional
member objects (CdmLicense and PolicyEngine).  When the CDM session's
crypto session is reset, it must also reset the CdmLicense and
PolicyEngine otherwise, a potential stale pointer reference may occur.

Test: request_license_test on Oriole
Test: run_x86_64_tests
Bug: 311239278
Change-Id: Ie175513ae652dcd96e12e5e1def574a8a56d5863
2024-03-14 00:19:25 -07:00
Alex Dale
67393a2cb6 Update support for HDCP levels on Android and CE CDM.
[ Merge of http://go/wvgerrit/194050 ]

OEMCrypto v17 introduced higher granularity in the device's HDCP V1
levels.  Previously, all HDCP v1.x were group together.  The change
was aimed towards server policy enforcement, not device enforcement.

Core code was updated, and could then be reflected in license
requests; however, reporting the new v1.x subversions was never
exposed to the higher app layers.

It is likely that devices which attempted to use specific 1.x versions
encountered test failures (for both CE CDM and Android CDM) as neither
implementations could handle such versions when communicating with
the app.

This change updates both CE CDM and Android CDM:
1) The CE CDM now uses the same subversion version comparisons as
   performed by the core code.
2) The Android CDM will now recognize new HDCP levels, and not return
   unexpected values.

Bug: 329155501
Test: run_x86_64_tests
Test: request_license_test on Oriole
Change-Id: I61fc0f11808f594456bd00210fd9b2bb5ed16c0e
2024-03-13 23:02:26 -07:00
Robert Shih
179c197464 Bump kWVAndroidCdmVersion to v19
Bug: 323289757
Bug: 328438268
Change-Id: I634752312c4567aa3703f4f35c1d1457baa2021b
2024-03-06 11:18:11 -08:00
Robert Shih
6f03887937 Widevine version genrules (2nd attempt)
Bug: 327241925
Bug: 328438268
Test: dumpsys android.hardware.drm.IDrmFactory/widevine
Change-Id: I0336f366910de9c4ea8903b09d64c32b8d68c977
2024-03-06 11:18:07 -08:00
Vaibhav Devmurari
8aef692798 Revert "Widevine version genrules"
This reverts commit 9f32150e5f.

Reason for revert: Potential cause for b/328364975

Change-Id: I3d1411cb183bf3faf04dee51f8a191ec796517f4
2024-03-06 11:50:38 +00:00
Robert Shih
9f32150e5f Widevine version genrules
Bug: 327241925
Test: dumpsys android.hardware.drm.IDrmFactory/widevine
Change-Id: Ice412cd2739f0c8a95af488cf565a3abf484200a
2024-03-05 14:36:52 -08:00
Robert Shih
fc8d793682 Fix certificate_provisioning_unittest after KDF change
KDF change: ag/26339839

Bug: 299527712
Change-Id: Ibfff3c13b10615e71f60fc69a811a3119881ea80
2024-02-23 10:41:49 -08:00
Jacob Trimble
649640709f Remove OEMCrypto_GetRandom from dynamic adapter
This is no longer used in v18, so we no longer need it in the dynamic
adapter or in the L3.

Change-Id: I0dc584252344bf7e271b282c26bc48d0b6618458
2024-02-23 09:47:26 -08:00
Cong Lin
5f7bbf0013 Update L3 LoadLicense() and LoadProvisioning() to work with new KDF
functions

In CL https://widevine-internal-review.git.corp.google.com/c/cdm/+/183531
KDF was merged into new OEMCrypto_LoadLicense() and
OEMCrypto_LoadProvisioning().

This change renames L3 existing old functions with suffix _V18, and adds
the two new functions.

Note: jenkins/run_dynamic_level3 and jenkis/run_level3_static_tests
can't be enabled util https://b.corp.google.com/issues/320525541 is
resolved.

Test: the generated L3 from this CL can pass static and dynamic adapter
tests with commit ID 567069f2fb800c4ec4e844e03273d1924ae6673b. More
updates may be need to L3 source for it to work with the latest
oemcrypto-v19 branch.
Bug: 299333403

Change-Id: If6dec630c00b65468d4194196f3ff6f308c6dbe8
2024-02-23 08:39:49 -08:00
Jacob Trimble
c5d06cb7c7 Remove namespace from Level3 aliases
Since the L3 functions are meant to alias the OEMCrypto functions,
they shouldn't appear in a namespace.

Change-Id: I8d11279ff86c5b5c9eab0598d134f6904f0021ad
2024-02-23 08:39:35 -08:00
Ian Benz
6d56eed754 Fix oemcrypto-v19 issues identified by Coverity
Change-Id: Idd79f02337640047979f5a41dd922d14c78c3b2e
2024-02-22 17:13:42 -08:00
Cong Lin
4638259a0c Add X509 BCC type to protobuf and update oemcrypto adapter
BCC supports two types of format: CBOR and X509. The latter will be
used by Chrome OS. In case of Prov4, BCC type will be queried by
OEMCrypto_GetBCCType() and the returned value is populated in the
provisioning request.

This CL adds X509 type to protobuf, a call from CDM to query BCC type
and OEMCrypto adapter changes for this call.

Test: run_fake_l1_tests, opk_ta_p40
Bug: 307969500
Change-Id: I88acc36da6cb413d537a9ea9dfd2a150d4557595
2024-02-22 17:13:30 -08:00
Cong Lin
baedda469b Fix GenerateDerivedKeys_V18 call in dynamic adpater for prov4
The deprecated GenerateDerivedKeys_V18() should only be called by
OEMCrypto_PrepAndSignProvisioningRequest() in case of prov2.

Test: run_dynamic_oemcrypto_v18_p40
Bug: 317900423
Change-Id: Iff75c26a3ea107fb01e636c53528e845e24193bd
2024-02-22 17:12:41 -08:00
Cong Lin
cd104160bd Fix session id in dynamic adapter for OEMCrypto_LoadLicense()
Missing "pair." for a few spots.

Test: oemcrypto unit tests
Bug: 299333403
Change-Id: I99ecb7fc42f88b431d293b3edeb5903b8f24e1e7
2024-02-22 15:17:12 -08:00
Matt Feddersen
4626fa18ce Check provisioning method in LoadProvisioningCast v18 dynamic adapter
Test:GTEST_FILTER="*TestSignaturePKCS1*" ./jenkins/run_dynamic_oemcrypto_v18
Bug: 317900212

Change-Id: I9829cf59b13320d69fddadaaba0a013e241f0b16
2024-02-22 15:16:59 -08:00
Fred Gylys-Colwell
34ac11b187 Document OEMCrypto_LoadProvisioningCast
Bug: 314222872
Change-Id: I05031d1eacefceb73931b979ef69e69fdba871a7
2024-02-22 15:16:09 -08:00
Vicky Min
4c9a8e32a5 OPK implementation for license release
Bug: 295956275
Change-Id: I68dda02997f8897043c13ae261dde45276e66cc9
2024-02-22 15:14:07 -08:00
Vicky Min
3f48387e1c Fix dynamic adapter for license release
Bug: 315186308
Change-Id: If80760d8db4929f1c23917b0e3a86ed38309b487
2024-02-22 15:12:39 -08:00
Vicky Min
d5157c536d OEMCrypto unit tests for license release
Bug: 295956275
Change-Id: I3c8fc5fcadeae051cc734a64378e473492437c34
2024-02-22 15:10:08 -08:00
Vicky Min
d2963a8cc5 Update dynamic adapter for license release
Bug: 295956275
Change-Id: Ia166becdd519c8bb21f1f8d132dee2c6bb97e06b
2024-02-22 15:09:47 -08:00
Vicky Min
9e26c42882 OEMCrypto implementation of OEMCrypto_PrepAndSignReleaseRequest
Bug: 295956275
Change-Id: I1f3e7f83c644c16419cc99862c9147d321cfdb5f
2024-02-22 15:09:05 -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
Jacob Trimble
692cb259f3 Fix dynamic adapter with provisioning
Bug: 302721191
Change-Id: Icdc003ed903142129eb1f89d109f447ea6dc2079
2024-02-22 14:34:00 -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
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
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
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
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