Commit Graph

6654 Commits

Author SHA1 Message Date
Cong Lin
1f4385424e Fix the length of the extracted BCC
After a successful extraction, the vector of BCC should be resized to
the correct value.

Test: build and run extraction tool
Bug: 237029566
Change-Id: I41f39cb72bb1dc27d6d40f3c5ace5265271aab0e
2022-07-06 09:50:04 -07:00
Alex Dale
1c96d290bd Update cdm provision tests to work with prov 4
[ Merge of http://go/wvgerrit/150810 ]

This CL changes the call "Provision()" in some tests to use
"EnsureProvisioned()". The latter can actually call "Provision()" twice
in case of Prov 4 being used: first call to get oemcert.bin and second
call to get drm cert.bin.

Also added a file clean up during test tear-down.

Test: opk_ta with prov2 and prov4
Bug: 180530495
Bug: 236317198
Change-Id: I37c8708ead7f18e8b4d619bf6a080424e45406ee
2022-06-21 15:34:12 -07:00
Alex Dale
577ce88cbc Fix close entited key session in oemcrypto adaptor
[ Merge of http://go/wvgerrit/153290 ]

Currently OEMCrypto_Close will be called for entitled key sessions as
well upon destroying, while only OEMCrypto sessions should be called.
This CL adds a session type to the oemcrypto adaptor.

Bug: 232225911
Bug: 236317198
Test: request_license_test
Change-Id: I323fff80139ce949f801cf0df5aa2bd3171dfb51
2022-06-21 15:16:26 -07:00
Alex Dale
4fbc410346 Merge "Clang-formatted properties_android.cpp with new CDM properties." 2022-06-21 20:54:44 +00:00
Alex Dale
9b04109b60 Merge "Updated OEMCrypto tests to use DRM key objects." 2022-06-21 20:52:08 +00:00
TreeHugger Robot
a2cd76506f Merge "Downgrade benign error logs in device_files.cpp to warnings" 2022-06-21 19:16:44 +00:00
TreeHugger Robot
bb9a167038 Merge "Sync OEM_ENTITLEMENT in license_protocol.proto" 2022-06-21 19:16:40 +00:00
John Bruce
44aa794a68 Merge "Defer creation of default_config_" 2022-06-21 17:47:42 +00:00
TreeHugger Robot
6ba729940f Merge "Add flag to disable CDM logging" 2022-06-18 23:32:27 +00:00
Cong Lin
decb9d32f4 Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324 am: b363f54f9e am: e483932fb0 am: 6d2b371b65
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: I1bd377bf8cefe7a760251267e42bde1b8dc5bf98
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 09:08:43 +00:00
Cong Lin
a4174f78da Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324 am: 7588d0baa1 am: 395251bd90 am: a3ad7f2719
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: If4fe2c8fd3275272067a6444a1db0ea620588f10
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 09:07:58 +00:00
Cong Lin
87198e8f1e Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324 am: b363f54f9e am: 0698bcdefe am: 7b52695632
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: I92875386804868c45cda907cb420656387290c96
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 09:07:21 +00:00
Cong Lin
6d2b371b65 Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324 am: b363f54f9e am: e483932fb0
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: I0fcf8b89af94d6db4b69bdf7db4bb65b5c21d45d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 08:50:16 +00:00
Cong Lin
a3ad7f2719 Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324 am: 7588d0baa1 am: 395251bd90
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: I5111003ccd9181e601bcdff1abcb3761cd3d6ef3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 08:49:44 +00:00
Cong Lin
7b52695632 Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324 am: b363f54f9e am: 0698bcdefe
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: I60680a436ee8133ebef3c57f37afaa2b55851162
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 08:49:10 +00:00
Cong Lin
0698bcdefe Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324 am: b363f54f9e
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: Id78fb4d41f4d7a9b7e090dec2a1d00952e65ebb5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 08:26:41 +00:00
Cong Lin
e483932fb0 Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324 am: b363f54f9e
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: Ib560ed98055a97ccaed658097b12c12577a9449f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 08:26:39 +00:00
Cong Lin
395251bd90 Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324 am: 7588d0baa1
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: If6f3ef93b5e626ebac886ea9606e3e90967da02e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 08:26:34 +00:00
Cong Lin
f529e0d563 Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324 am: 154a1db776
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: I0224f6540925ad4b16988afd8e2bd76a12771c49
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 08:26:02 +00:00
Cong Lin
b363f54f9e Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: Ibcdf7c29ad2392a2ee49873aacd5a8f831dbc251
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 08:10:52 +00:00
Cong Lin
154a1db776 Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: I59e227877aee30a0f0d1e755234f1913cf1903c6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 08:09:35 +00:00
Cong Lin
7588d0baa1 Add unit test for clear KCB in LS SDK 16.4 response am: 8c4c238324
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18973819

Change-Id: I85897585bd72d28afbd11edfcdf4854e758560bd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-18 08:08:58 +00:00
Alex Dale
6c35b9e67a Clang-formatted properties_android.cpp with new CDM properties.
The CL http://ag/16988980 introduced new Adnroid property queries to
the CDM; however, the file was not of the correct format for the CDM
repo.  This CL simply ran clang-format on the file.

Bug: 197771575
Bug: 236317198
Test: none
Change-Id: I5293864f84d1297efb7aef2a96a71794217c5203
2022-06-17 19:57:43 -07:00
Alex Dale
68b5146a06 Downgrade benign error logs in device_files.cpp to warnings
[ Merge of http://go/wvgerrit/152650 ]

There are two LOGEs in device_files.cpp that would frequently trigger
during testing despite the condition they were logging being totally
normal. The files were not present because the device had never had to
write them yet. This patch downgrades these bengin errors to warnings
to reduce log spam.

Test: build_and_run_all_unit_tests.sh
Bug: 236317198
Change-Id: I56f9d477f8a6b26635f0eb4a6b7c636e866381d3
2022-06-17 19:47:26 -07:00
Alex Dale
729f2f6fb5 Sync OEM_ENTITLEMENT in license_protocol.proto
[ Merge of http://go/wvgerrit/148729 ]

A recent merge from google3 of the ODK code broke builds on the
oemcrypto-v17 branch because it depended on a license_protocol.proto
change that had not been brought over yet. This patch brings over the
missing line to fix the build.

Test: build_and_run_all_unit_tests.sh
Bug: 236317198
Change-Id: Ia8133696f3156c16ef4bd1382358be5da6159820
2022-06-17 19:43:49 -07:00
Alex Dale
b9ad36763a Add flag to disable CDM logging
[ Merge of http://go/wvgerrit/151570 ]

Bug: 215590138
Bug: 236317198
Change-Id: I5e90d2813252ca5ff5d9ba62316e2ee5545c71bf
2022-06-17 19:10:34 -07:00
John "Juce" Bruce
6b19df3268 Defer creation of default_config_
(This is a merge of http://go/wvgerrit/152969.)

C++ makes absolutely no guarantees about the order of initialization of
global variables in different compilation units. The class-scope static
WvCdmTestBase::default_config_ in test_base.cpp invokes the
ConfigTestEnv constructor on creation, which depends on the prior
initialization of several file-scope static variables in
config_test_env.cpp. Since those are different compilation units, there
is no guarantee that they will initialize in the correct order to avoid
referencing uninitialized memory. This is one of the reasons Google
Style really encourages people not to have global-scope variables with
complex types.

As it happens, on all our internal platforms, these files get linked in
such a way that the variables get initialized in the right order and
there is no crash. But that's not guaranteed, and some partners have
reported crashes here. In at least one case, the "right" linker order
was platform-dependent, and the partner ended up having to maintain
separate linker orders for separate platforms.

This patch defers default_config_ initialization until
WvCdmTestBase::Initialize() is called. By that time, all static
variables will be initialized, so it will be safe to reference them.

Bug: 173252165
Test: x86-64
Test: build_and_run_all_unit_tests.sh
Change-Id: If31128a999c7d6945f47293ca57f08e43d8274de
2022-06-17 15:55:44 -07:00
Cong Lin
8c4c238324 Add unit test for clear KCB in LS SDK 16.4 response
This is a merge from:
https://widevine-internal-review.googlesource.com/c/cdm/+/152897
and http://go/wvgerrit/153709

Adding a new OEMCrypto unit test will allow partners to correct a
problem earlier in their integration.

Verifies current oemcrypto implementation handles clear KCB in a
mocked 16.4 license response.

Unit test release date updated to 2022-06-17.

Test: run_x86_64_tests; opk_ta
Bug: 235870170
Bug: 234645065
Change-Id: I59fef2c25f5c007624447d4f46147d96adeddad9
2022-06-17 15:02:09 -07:00
Alex Dale
bfa2d782bd Updated OEMCrypto tests to use DRM key objects.
[ Merge of http://go/wvgerrit/147275 ]

Swapped out use of OpenSSL/BoringSSL RSA and EC_KEY to use OEMCrypto
reference utility classes RsaPublicKey/EccPublicKey.  This enables
further test development with ECC keys, and removes duplicate OpenSSL/
BoringSSL code.

For Android makefiles, only the minimally required files have been
added.

Bug: 205902021
Bug: 236317198
Test: run_prov30_test run_prov40_test oemcrypto_test
Change-Id: I64491018e8ffb69bf986083e3aae446eb9e5cf39
2022-06-16 21:13:22 -07:00
Alex Dale
2a371dce54 Remove duplicate wvcrc files
[ Merge of http://go/wvgerrit/150789 ]

We had two copies of the wvcrc32.h and wvcrc.cpp files: One in
oemcrypto/util/ and one in oemcrypto/test/. The two were identical
except for the namespaces used. However, this setup created confusion if
the compiler could see both files, as the wrong one could get included.
This patch removes the set from test/ in favor of the more-widely-used
set from util/ and updates the one piece of code using the old
namespace.

Update Android oemcrypto_test makefile for wvcrc32.

[ Merge of http://go/wvgerrit/153657 ]

Duplicated wvcrc files were removed in http://go/wvgerrit/150632,
however, the Android-specific makefile for oemcrypto_test was not
updated with the new source and include directory.  This CL makes
the necessary changes to the makefile to build with the OEC ref util
version of wvcrc32.

Bug: 229160397
Bug: 236317198
Test: oemcrypto_test
Change-Id: I0b53255122172fb514e7e0602b59f3ab704e52da
2022-06-16 20:53:57 -07:00
Alex Dale
dd2f063254 Change ERROR_INVALID_RSA_KEY to ERROR_INVALID_KEY
[ Merge of http://go/wvgerrit/149269 ]

This mostly affects tests and documentation.

Bug: 201581141
Bug: 236317198
Change-Id: I1bc0ec4c3767106c01dfac9956f83ccfbffc49b7
2022-06-16 18:12:16 -07:00
Alex Dale
173b230588 High-level wrapper around HMAC-SHA256 algorithm.
[ Merge of http://go/wvgerrit/152950 ]

This CL introduces several functions for computing a HMAC-SHA256
signature.  The functions wrap the OpenSSL/BoringSSL implementation
of HMAC(), allowing for common C++ types to be passed in.  Several
of the functions follow several OEMCrypto conventions for generating
signatures (ex. returning OEMCrypto_ERROR_SHORT_BUFFER if signature
buffer is too small).

Also provided limited wrappers for HMAC-SHA-1, which are used for
a limited number of operations within OEMCrypto.

Bug: 154055871
Bug: 145026434
Bug: 236317198
Test: hmac_unittest
Change-Id: I4a9e56066a7c3f14c7159270503225cd794c1bb6
2022-06-16 18:00:19 -07:00
Edwin Wong
a3453e8bf5 Merge "Add missing properties in query test." 2022-06-16 16:55:23 +00:00
Edwin Wong
83a72425bf Add missing properties in query test.
[Merged from: http://go/wvgerrit/153549]

Test: adb shell LD_LIBRARY_PATH=/vendor/lib64 /data/nativetest/libwvdrmdrmplugin_hal_test
Bug: 235885663
Change-Id: Ie2885d4f2a54d0bb7c58ed4657a3d7b7c779b0da
2022-06-15 23:59:33 +00:00
Alex Dale
6024987733 Return null system ID for built-in DRM cert devices.
[ Merge of http://go/wvgerrit/153489 ]

OEMCrypto does not provide an API for retrieving the system ID when
the TEE uses a built-in DRM certificate (provisioning 1.0).  New OEMs
and Android devices do not use prov 1.0; however, the Zimperium CDM
(at least the tests) use a built-in certificate and are failing
certain tests because of the missing system ID.  To address this
failure; the CDM SystemIdExtractor has been updated to return a null
system ID.

Bug: 235879962
Test: system_id_extractor_unittest
Change-Id: Ib4c2bd75a7825967b0aa9e31e144184ae18fe8fb
2022-06-15 14:11:50 -07:00
Vicky Min
eb711ea0ec Fix out of bounds buffer error in CreateCoreLicenseResponse()
In CreateCoreLicenseResponse(), there seems to be an out of bounds
potential error due to a missing check that the index used for
license_response.parsed_license->key_array is valid. Adding a check
for this here.

Bug: 217677571
Test: fuzz tests
Change-Id: I37f7228f87992ba5284c553d7b07ef97d6a66ab3
2022-05-31 21:01:20 +00:00
Edwin Wong
8651e9a47c Declare class for drmFactory, crypto/drmPlugins
[ Merged from http://go/wvgerrit/152493 ]

Replace struct with class for WVDrmFactory, WVCryptoPlugin
and WVDrmPlugin.

Also fix build_all_unit_tests.sh, hidl_metrics_adapter_unittest
has been renamed to hal_metrics_adapter_unittest.

Test: unit tests
Test: Google TV and Netflix
Test: atest GtsMediaTestCases

Bug: 216717460
Change-Id: I92b15510267e8f37058845be760a6ec6241bc5d7
2022-05-30 15:30:23 +00:00
Automerger Merge Worker
f735b263ab Merge "Allow provisioning model to be queried am: cd593979e9 am: f66cc64bea" into tm-d1-dev-plus-aosp am: 35c95c66c2 am: 393df20ca9
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: Ib61b59392c420c0d0f69e926fb71ba3571c4194c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:55:17 +00:00
Rahul Frias
22a631acbe Allow provisioning model to be queried am: cd593979e9 am: 0b780a412f am: 1c3d21f645 am: 3fb8fa19d2
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: I6f3863d35db37f517f639e95e613807bce3b606d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:55:09 +00:00
Rahul Frias
766fbac8cf Allow provisioning model to be queried am: cd593979e9 am: f66cc64bea am: d1d77a58ba am: bf55b83f5a
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: Ifd46dd6ddb85501676ff93ab90965ecdb5ca25e5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:55:01 +00:00
Automerger Merge Worker
393df20ca9 Merge "Allow provisioning model to be queried am: cd593979e9 am: f66cc64bea" into tm-d1-dev-plus-aosp am: 35c95c66c2
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: I73c278333abd11159e7086536a351e0e23cc8177
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:39:42 +00:00
Rahul Frias
3fb8fa19d2 Allow provisioning model to be queried am: cd593979e9 am: 0b780a412f am: 1c3d21f645
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: I65709af91703ecb47743f8e5a61a44f6704736b3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:39:22 +00:00
Rahul Frias
bf55b83f5a Allow provisioning model to be queried am: cd593979e9 am: f66cc64bea am: d1d77a58ba
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: I0ca1252956f10b1957c04e5f1e900fd64a069f63
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:38:54 +00:00
Automerger Merge Worker
35c95c66c2 Merge "Allow provisioning model to be queried am: cd593979e9 am: f66cc64bea" into tm-d1-dev-plus-aosp 2022-05-27 04:23:49 +00:00
Rahul Frias
1c3d21f645 Allow provisioning model to be queried am: cd593979e9 am: 0b780a412f
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: If83cb6a96a3473cf50c1222adf66ceb981bf2e07
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:23:46 +00:00
Rahul Frias
d4a52f47ab Allow provisioning model to be queried am: cd593979e9 am: f66cc64bea
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: I9d01324dc469a3c72be419b7385f93d5f9e3d23d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:23:46 +00:00
Rahul Frias
d1d77a58ba Allow provisioning model to be queried am: cd593979e9 am: f66cc64bea
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: I7fa6a53743aa8757ab66edf3e1a75d20dbab15bd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:23:45 +00:00
Rahul Frias
6c3a62ba32 Allow provisioning model to be queried am: cd593979e9 am: 09a31762a1
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: I14f8dbe23f37c93593dace0e036d8531f49785ae
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:23:15 +00:00
Rahul Frias
f66cc64bea Allow provisioning model to be queried am: cd593979e9
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: I68d1a67f4b98b74ea7f543101e9a321486ebb22d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:07:58 +00:00
Rahul Frias
09a31762a1 Allow provisioning model to be queried am: cd593979e9
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/18624153

Change-Id: Ied2ef9132c5e92149407d1e68091d570d73896ae
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 04:06:42 +00:00