Commit Graph

3594 Commits

Author SHA1 Message Date
Rahul Frias
a798692e4e Unit tests for forbidden RSA key usage
[ Partial merge of http://go/wvgerrit/188279 ]

This CL adds unit tests to verify that the following
forbidden uses of an RSA private key do not work:

- ForbidPrepAndSign -- A cast cert key cannot sign a license
  request.
- ForbidUseAsDRMCert -- A cast cert cannot be used with the
  DRM cert's padding scheme and it cannot be used to derive
  keys from a session key.
- *ForbidRSASignatureForDRMKey* -- A DRM cert key cannot be
  used with GenerateRSASignature.
- *OEMCertForbidGenerateRSASignature* -- An OEM cert key
  cannot be used with GenerateRSASignature.

Bug: 251875110
Test: WVTS
Change-Id: I55b1eb04465023352edea55ba4ef532d1cd07231
2024-03-20 23:59:55 -07:00
Rahul Frias
b3157f2328 Add DRM reprovisioning request generation
[ Merge of http://go/wvgerrit/192010 ]

Adding files not merged in ag/26501922

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: I839db69a48c1add196f9b56e6ee3812f549f814d
2024-03-20 23:30:26 -07:00
Rahul Frias
8046719c10 Correct copyright header
[ Merge of http://go/wvgerrit/186825 ]

Remove the words ` All rights reserved.` from Widevine's
existing copyright headers.

For context, see cl/578224540

Bug: 330655176
Test: WVTS

PiperOrigin-RevId: 580020267
Change-Id: I43e845b83f438e4ef7f0f542c2f4e427a188ab06
2024-03-20 23:24:17 -07:00
Cong Lin
5e186dcfa6 Fix bcc length for printing
[ Merge of http://go/wvgerrit/194310 ]

Resize bcc to the correct length to eliminate the trailing zeros.

Bug: 330645490
Test: core unit tests

Change-Id: I56b6d30120735a4d7a0f39f29a9f255bd2d2d18c
2024-03-20 21:41:15 -07:00
Vicky Min
882c80783b Update ODK version to 18.4
[ Merge of http://go/wvgerrit/192493 ]

Bug: 311951236
Test: WVTS

Change-Id: Ia59bfacf91d812f36f7a198632f7fa3462d0b8df
2024-03-20 20:45:43 -07:00
Fred Gylys-Colwell
38243aca4c Adjust skipping tests when provisioning skipped
[ Merge of http://go/wvgerrit/194254 ]

For some platforms, we cannot provision. In this case, any
test that needs provisioning is skipped. However, when a
test is skipped in a subroutine, the rest of SetUp is still
run. Any failures in SetUp will cause the test to be marked
as a failure.

This CL duplicates the check for skipping the test in SetUp
and in TearDown.

Bug: 329467151
Test: WV and unit/integration tests

Change-Id: I0087b12a3f26b52ecf62bf7b0e7bcf4fa2c6c763
2024-03-20 14:55:42 -07:00
Jacob Trimble
428586b0eb Change test storage to use protobuf
[ Merge of http://go/wvgerrit/193190 ]

This changes the persistent test storage to use protobufs instead of
manual parsing.  This simplifies the code but makes the files less
"human readable".  Files can be read using 'gqui' if needed.

Bug: 312529037
Test: unit/integration tests
Change-Id: I1b025eac96458c0061e0883e1e4fd05484842ff2
2024-03-20 13:59:14 -07:00
Fred Gylys-Colwell
d3b869c0ab Remove WvCdmEnginePreProvTestStaging
[ Merge of http://go/wvgerrit/194370 ]

This test explicitly provisions against the staging server,
which we do not require from partners.

Bug: 329293570
Test: WV unit/integration tests

Change-Id: Id88840f188ec99b386837d83f69844b0990594a9
2024-03-20 13:30:23 -07:00
Geoffrey Alexander
e9e4b76817 Rename and clarify Drm Reprovisioning token types
[ Merge of http://go/wvgerrit/194374 ]

Renames and adds clarifying comments to Drm Reprovisioning token types.
All provisioning methods can be forced to reprovision by apps which can
cause reprovisioning to be an overloaded term. Renaming token types
used by the Drm Reprovisioning method to more clearly state they are
used for Drm Certificate Reprovisioning should help to avoid confusion.
This change also adds comments to help clarify when and where Drm
Reprovisioning is used as a provisioning type.

Bug: b/305093063
Test: WVTS

* Added dependency to dynamic perf tests to fix missing header build
  error.

Change-Id: I158eb5672ad9e655a60bc68e0f4f2f7a0d464b4e
2024-03-20 11:15:58 -07:00
Rahul Frias
7cc19077ca Merge "Add DRM reprovisioning request generation" into main 2024-03-20 17:24:36 +00:00
Rahul Frias
fb795b7946 Merge "Call CopyBuffer in Decrypt if key handle is empty" into main 2024-03-19 21:22:30 +00:00
Android Build Coastguard Worker
a3b869c5c7 Make change and version bump to ZV1A.240319.001
Snap for 11596472 from f6b1fb288a to trunk-widevine-release

Change-Id: I2823562afba6096ceb6f65bbf9a2a83356dc09cd
2024-03-19 19:19:53 +00:00
Alex Dale
a5393206b1 Merge "Reset crypto session pointers on RemoveKeys." into main 2024-03-19 19:07:28 +00:00
Robert Shih
f6b1fb288a WVCdm version stamping
First, version.txt will be stamped by Android CI with a release
candidate name like "ZV1A.240307.001".

Next, a genrule will read version.txt and embed the release candidate
name inside the Widevine CDM binary.

See also:
- go/wv-trunk "Versioning"
- cl/616721723

Bug: 327241925
Test: Coastguard
Change-Id: I892ee957c058ac5f624912a38a048781af5f3487
2024-03-18 21:32:04 -07: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
Rahul Frias
6499e7063d Merge "Re-generate Android L3 after merging oemcrypto-v19 to master" into main 2024-03-14 22:24:42 +00: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
Kyle Zhang
5c175ad151 Merge "Add new dev apex set 11546836" into main 2024-03-13 17:21:17 +00:00
Rahul Frias
72077acec6 Re-generate Android L3 after merging oemcrypto-v19 to master
[ Merge of http://go/wvgerrit/192271 ]

Test: L3 unit tests and GTS on pixel 7
Bug: 324147162
Test: WVTS
Change-Id: I5d94b0c9b3f681774e32623463b0d689f5bacc8c
2024-03-11 22:48:46 +00:00
Kyle Zhang
1324d5954b Add new dev apex set 11546836
Bug: 324294223
Change-Id: If74e9cffebb5b2aa05824973449dbebd8de269f1
2024-03-11 18:33:30 +00:00
Kyle Zhang
cbc38ca085 Drop Widevine apex prebuilt files for dev 11546836
The following files have been updated as part of this change:

libwvdrmengine/apex/prebuilt/dev/com.google.android.widevine.lazy-11546836.apks[standalones/standalone-arm64_v8a.apex]
package: name=com.google.android.widevine.lazy
versionCode=11546836
versionName=
platformBuildVersionName=UpsideDownCake
compileSdkVersion=34
compileSdkVersionCodename=UpsideDownCake
sdkVersion:34
targetSdkVersion:10000

libwvdrmengine/apex/prebuilt/dev/com.google.android.widevine.lazy-11546836.apks[standalones/standalone-armeabi_v7a.apex]
package: name=com.google.android.widevine.lazy
versionCode=11546836
versionName=
platformBuildVersionName=UpsideDownCake
compileSdkVersion=34
compileSdkVersionCodename=UpsideDownCake
sdkVersion:34
targetSdkVersion:10000

libwvdrmengine/apex/prebuilt/dev/com.google.android.widevine.lazy-11546836.apks[standalones/standalone-x86.apex]
package: name=com.google.android.widevine.lazy
versionCode=11546836
versionName=
platformBuildVersionName=UpsideDownCake
compileSdkVersion=34
compileSdkVersionCodename=UpsideDownCake
sdkVersion:34
targetSdkVersion:10000

libwvdrmengine/apex/prebuilt/dev/com.google.android.widevine.lazy-11546836.apks[standalones/standalone-x86_64.apex]
package: name=com.google.android.widevine.lazy
versionCode=11546836
versionName=
platformBuildVersionName=UpsideDownCake
compileSdkVersion=34
compileSdkVersionCodename=UpsideDownCake
sdkVersion:34
targetSdkVersion:10000

libwvdrmengine/apex/prebuilt/dev/com.google.android.widevine.nonupdatable-11546836.apks[standalones/standalone-arm64_v8a.apex]
package: name=com.google.android.widevine.nonupdatable
versionCode=11546836
versionName=
platformBuildVersionName=UpsideDownCake
compileSdkVersion=34
compileSdkVersionCodename=UpsideDownCake
sdkVersion:34
targetSdkVersion:10000

libwvdrmengine/apex/prebuilt/dev/com.google.android.widevine.nonupdatable-11546836.apks[standalones/standalone-armeabi_v7a.apex]
package: name=com.google.android.widevine.nonupdatable
versionCode=11546836
versionName=
platformBuildVersionName=UpsideDownCake
compileSdkVersion=34
compileSdkVersionCodename=UpsideDownCake
sdkVersion:34
targetSdkVersion:10000

libwvdrmengine/apex/prebuilt/dev/com.google.android.widevine.nonupdatable-11546836.apks[standalones/standalone-x86.apex]
package: name=com.google.android.widevine.nonupdatable
versionCode=11546836
versionName=
platformBuildVersionName=UpsideDownCake
compileSdkVersion=34
compileSdkVersionCodename=UpsideDownCake
sdkVersion:34
targetSdkVersion:10000

libwvdrmengine/apex/prebuilt/dev/com.google.android.widevine.nonupdatable-11546836.apks[standalones/standalone-x86_64.apex]
package: name=com.google.android.widevine.nonupdatable
versionCode=11546836
versionName=
platformBuildVersionName=UpsideDownCake
compileSdkVersion=34
compileSdkVersionCodename=UpsideDownCake
sdkVersion:34
targetSdkVersion:10000

Built here: ab/11546836

The change is generated with prebuilt drop tool.

Change-Id: I646e410011c4168987e7ced0101a3ae7c442ab8f
2024-03-11 18:17:15 +00:00
Rahul Frias
e7a96ec47a Merge "Run unit tests if verity has already been disabled" into main 2024-03-08 22:30:45 +00:00
Rahul Frias
925b52e133 Merge "Add a flag to enable Rikers" into main 2024-03-08 05:20:06 +00: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
Priyanka Advani
543c875b55 Merge "Revert "Widevine version genrules"" into main 2024-03-06 18:44:57 +00:00
Rahul Frias
54e0514767 Merge "Add /system/lib[64] to LD_LIBRARY_PATH" into main 2024-03-06 17:17:05 +00: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
Rahul Frias
b0203576c4 Run unit tests if verity has already been disabled
[ Merge of http://go/wvgerrit/192930 ]

The script to run unit/integration tests aborts if an adb remount
command indicates that verity needs to be run. This just checks
for presence of the string "verity" in the output. Some devices
output "Verity is already disabled". The test script should not
abort the run in this scenario.

Bug: 327421750
Test: ./build_and_run_all_tests.sh
Change-Id: Ic953f25aba31be0ca527bc000f433d8c9076effa
2024-02-28 09:44:13 -08:00
Rahul Frias
72ad929dc8 Add /system/lib[64] to LD_LIBRARY_PATH
[ Merge of http://go/wvgerrit/192851 ]

When running widevine unit/integration tests the script sets
the LD_LIBRARY_PATH to include /vendor/lib[64] and
/system/lib[64]/vndk-R so that shared libraries can be found.

/system/lib[64] also needs to be included so that
libbinder.so and libbinder_ndk.so are also picked up.

Bug: 325595891
Test: ./build_and_run_all_tests
Change-Id: I411bb98474eb7e65bf9070c029869a9d4d220673
2024-02-28 08:16:07 -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
02fbb0adcd Re-generate Android L3 after L3 fixes
Build L3 after
https://widevine-internal-review.git.corp.google.com/c/cdm/+/186593

Test: run_dynamic_level3
Bug: 323957284
Change-Id: Ica4974d4ed941174e43d4898771ffe004f9cf8db
2024-02-23 08:47:28 -08:00
Cong Lin
55ff31629f Add -DHAS_HAYSTACK flag to Android L3 build
Using Haystack L3 for now.

Test: build widevine apex
Bug: 324147162
Change-Id: I6421b2cd6f48efc32b7067c7dfd31203181c1e84
2024-02-23 08:47:28 -08:00
Cong Lin
2ba9667dee Update L3 with new SystemIDs for Android V
ID     Description
33097  Android Arm L3 Provisioning 3.0 2024
33098  Android Aarch64 L3 Provisioning 3.0 2024
33099  Android X86 L3 Provisioning 3.0 2024
33100  Android X86 64 L3 Provisioning 3.0 2024

Test: L3 playback tests on pixel
Change-Id: I74a377fa52e1cb8f4c3ae1c7c1edf70086b3fd14
2024-02-23 08:47:27 -08:00
Cong Lin
d81b8f97b2 Add OEMCrypto_GetBCCType() in L3
It is used by prov4 only. So L3 will just return
OEMCrypto_ERROR_NOT_IMPLEMENTED.

Test: build L3
Bug: 307969500
Change-Id: Iff6c79a3fb0220a6c995186f5923ce5ad6bc256f
2024-02-23 08:47:26 -08:00
Cong Lin
0e165f6d54 L3 v19: Rebuild Android L3 and update .bp files
Regenerate L3 after fixes and add new source to .bp files.

Test: Build Widevine apex in Android main
Change-Id: I93fd5cf22437a2c8e6d2b60d9994dbf97f4ba213
2024-02-23 08:47:13 -08:00
Cong Lin
47ef97c747 L3 v19: Add missing v19 function declarations
OEMCrypto_PrepAndSignReleaseRequest() and OEMCrypto_LoadRelease()
declarations are needed for L3 static adapter to build.

Test: run_level3_static_tests
Bug: 323957284
Change-Id: I9ccb4e51fd404b6a49e865545e9a5b4f22169cf7
2024-02-23 08:41:07 -08:00
Cong Lin
3ab4591953 L3 v19: Fix OEMCrypto_SetDecryptHash signature
OEMCrypto_SetDecryptHash() is refactored in v19 to take less parameters.
The implemention of this function has been done here:
https://widevine-internal-review.git.corp.google.com/c/cdm/+/180670

Function signature in the leve3_adapter needs to be updated.

Test: run_dynamic_level3
Bug: 320525541
Change-Id: Ieb3f3868f1753c246d1d5c36d069f8ef59fafdea
2024-02-23 08:40:08 -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
Jacob Trimble
955c89315e Add basic Level3 adapter
As part of the new L3, we need to select between the new Zimperium-based
CDM and Haystack.  This will happen with an adapter; this adds a
basic adapter that only calls to haystack directly.

Bug: 315358872
Change-Id: I970646d687dadbe4ae04bdf0da00730fd882cd65
2024-02-23 08:35:26 -08:00
Cong Lin
13dab7dd61 Fix oemcrypto v19 android test and cppbor dependency
OEMCrypto_LoadProvisioning() has changed signature in v19.
Added lipcppbor library and utils to Android tests.

Test: build_all_unit_tests.sh
Bug: 324147162
Change-Id: Id890f97602f684e38d6e42cace9d5dc225958bec
2024-02-22 17:14:19 -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
Fred Gylys-Colwell
7491e5e486 Add odk golden tests to Android.bp
Bug: 323289757
Test: Android TreeHugger

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

PiperOrigin-RevId: 605786801
Change-Id: Iceb495308cf1942ef916120d2fed059366e897ec
2024-02-22 17:12:41 -08:00