Commit Graph

2721 Commits

Author SHA1 Message Date
Edwin Wong
0f3c297250 Replace _hidl_ with _hal_ in test names
[ Merged from http://go/wvgerrit/148451 ]

This step is a prelude in adding Widevine unit tests that
use AIDL interface.

Test: ./build_and_run_all_unit_tests.sh
Bug: 217247987
Change-Id: I449050819e6c9b0261066997dd45a6103b3a9a7a
2022-03-23 07:16:27 -07:00
TreeHugger Robot
dddd1142de Merge "Enable Widevine Aidl service." into tm-dev 2022-03-22 23:17:15 +00:00
Edwin
253a804c57 Enable Widevine Aidl service.
Merged from http://go/wvgerrit/146409

The original http://go/ag/16984707 was reverted due a
merge conflict from tm-dev to master, which
is now fixed by http://go/ag/17035190.

Bug: 219538389
Test: atest GtsMediaTestCases
Test: ./build_and_run_all_unit_tests
Change-Id: I95b639cf7ec138e809540db7a3fc0a234c7f4b2a
2022-03-22 10:17:01 +00:00
Rahul Frias
587516dfa2 Return error first if the returned status is not ok
[ Merge of http://go/wvgerrit/148249 ]

Bug: 224375138
Test: GtsMediaDrmTests
Change-Id: I10f0c1bc28342d6cd5ae7d373ef554321bb6d3c8
2022-03-21 14:43:54 -07:00
Rahul Frias
b07523f4c6 Constrain the generated key type in testing
[ Merge of http://go/wvgerrit/148157 ]

Fail the test if the returned type is other values.

Bug: 224375138
Test: GtsMediaDrmTests
Change-Id: I4abad9d69865cac99654d3dedd443463dd728a58
2022-03-21 14:41:01 -07:00
Rahul Frias
a6a99c416f Free EC key in test session destructor
[ Merged from http://go/wvgerrit/148030 ]

Bug: 224375138
Test: GtsMediaDrmTests
Change-Id: Ic1d42756cb1a03fa52d90c5fb0bd496e87a43c65
2022-03-21 14:37:58 -07:00
Rahul Frias
cff6103321 Merge changes from topics "presubmit-am-0d92e9728c2d40da892bd450843310cb", "presubmit-am-11f8881adcb544ca8682231293b0f1c7", "presubmit-am-30bc14671b7b4b309e57b8600f46b32b", "presubmit-am-35012549d66140dd9d446b5eedf6e274", "presubmit-am-374672395de04b7b8f697a54e16be928", "presubmit-am-48d77602d3694ced89dd6e82a89fa646", "presubmit-am-4f8d5681247e4064a298d1e5263c41be", "presubmit-am-89930436636343d5a779bc06ccc307dc", "presubmit-am-904492a27e4449e78cf21dd9f4ab8ff0", "presubmit-am-90646715a3284730bf356bb6f4634729", "presubmit-am-a1ae313a0fde4696b7fb8c4390d3a94c", "presubmit-am-ae051fae1d06485ca7f12bcf265e8328", "presubmit-am-b4e6ace5be72409aab8e328c6f2a0288", "presubmit-am-dd16b680e0454031b2213179b22df7d7", "presubmit-am-e249264532da4839841f4cab3675fa61", "presubmit-am-e3a2f43ba2f84f429536270e16d0d251", "presubmit-am-e5f2e7a319d04b89950c63471d7f2458", "presubmit-am-ea47ff378925466c8c92e2ed9b58c461", "presubmit-am-f582c497c3274c7e84606cf3da4b09df" into tm-dev
* changes:
  Change the signature format requirement of OEMCrypto_GenerateCertificateKeyPair
  Fix EnsureProvisioned for double provisioning
  Update fuzz tests to match output desriptor struct
  Use default url to inform app of prov40 stages
  Fix key_control_iv in OEMCrypto tests
  Fix jenkins/opk_optee after v17 merge
  Remove old test license holder
  Generic crypto tests: use license holder
  Reboot tests: verify offline license is valid after reboot
  Policy integration tests: use license holder
  Integration tests: add license holder
  Reboot test: Initialize fake clock
  Reboot test: save large files
  Test max number of DRM private keys
  Merge oemcrypto-v17 to master
  Update cipher mode elsewhere
  Fix 1 ClangTidyBuild finding:
  Add out of bounds testing for LoadKeys()
  Separate invalid session test for ReuseUsageEntry
2022-03-17 16:39:36 +00:00
Rahul Frias
85310dfbf6 Change the signature format requirement of OEMCrypto_GenerateCertificateKeyPair
[ Merge of http://go/wvgerrit/147593 ]

As we have decided to use hw_bcc service in Trusty to generate BCC and
sign the generated certificate public key, we need to change the
signature format to cose-sign1, which is defined by hw_bcc API.

Bug: 221496117
Test: GtsMediaTestCase on sunfish
Change-Id: I30739a0f0ae49291d343db46ad9e898663985cc8
2022-03-16 01:39:00 -07:00
Rahul Frias
1ab6872f82 Fix EnsureProvisioned for double provisioning
[ Merge of http://go/vwvgerrit/147459 ]

Bug: 222355942
Bug: 166849552
Test: GtsMediaTestCases on sunfish
Change-Id: Ia14cad535425af814927b14df8f1ee839ac7dee2
2022-03-16 01:38:40 -07:00
Rahul Frias
d6362f6e6b Update fuzz tests to match output desriptor struct
[ Merge of http://go/wvgerrit/147110 ]

The OEMCrypto_DestBufferDesc had fields address/address_length renamed
to clear_buffer/clear_buffer_length in v17. However this was not updated
for the fuzz tests thus causing some code coverage errors. This should
fix those errors.

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

Bug: 220946359, 220946990
Test: GtsMediaTestCases on sunfish
Change-Id: I2837de2f79c0e731d072e3712d6b769df17a1c7e
2022-03-16 01:38:19 -07:00
Rahul Frias
e64dd05e25 Use default url to inform app of prov40 stages
[ Merge of http://go/wvgerrit/147457 ]

For the first stage of provisioning 4, the default url is appended with
"&preProvisioning=true" as an indicator to the app that the current
stage is the first stage.

Design doc:https://docs.google.com/document/d/1NZVKCsBtaMJdTjj2C9FzW8s-s4eEj2niu5SPlw7EvRM/edit

Bug: 224375138
Test: GtsMediaTestCase on sunfish
Change-Id: I49ba6f799b51b042461a32c51e4e20c6071227b8
2022-03-16 01:37:58 -07:00
Rahul Frias
139310fd05 Fix key_control_iv in OEMCrypto tests
[ Merge of http://go/wvgerrit/145989 ]

The key_control_iv field is used with an encrypted KCB.  With v17, the
KCB is in the clear and this field should have a length of 0.  This
updates the tests to set the field correctly.

Bug: 224375138
Test: GtsMediaTestCases on sunfish
Change-Id: I2973bc064705557c878bb1fe943e5fde92977dcc
2022-03-16 01:37:32 -07:00
Rahul Frias
b448a70645 Fix jenkins/opk_optee after v17 merge
[ Merge of http://go/wvgerrit/145349 ]

- Remove wvcdm namespace from test_clock.cpp

Bug: 224375138
Test: GtsMediaTestCases on sunfish
Change-Id: I239b692fd2103bd3d0626a145e99fc688c446256
2022-03-16 01:37:07 -07:00
Rahul Frias
fd00a8af24 Remove old test license holder
[ Merged from http://go/wvgerrit/143750 ]

The old test license holder would generate a minimal license response,
but could not correctly mimic important server logic introduced in the
v16 server. Since all integration tests now have policies on the UAT
server, we do not need these minimalist license responses anymore.

Bug: 192700112
Test: GtsMediaTestCases on sunfish
Change-Id: I78c1b6085a6d0239840a11f2b904902210e5e61c
2022-03-16 01:36:38 -07:00
Rahul Frias
13da693dd6 Generic crypto tests: use license holder
[ Merged from http://go/wvgerrit/143635 ]

Use a license holder for the generic crypto tests.

Bug: 192700112
Test: GtsMediaTestCases on sunfish
Change-Id: Ia2c802263562b11845e55ae0a24254ea54e364c7
2022-03-16 01:36:17 -07:00
Rahul Frias
41b5bd18de Reboot tests: verify offline license is valid after reboot
[ Merge of http://go/wvgerrit/143749 ]

Tests are added to verify that the policy durations are enforced for
an offline license after a device has been rebooted.

Bug: 26163469
Test: GtsMediaTestCases on sunfish
Change-Id: I54e65d7abc5e59eae7c150555b2244dbf96da3f5
2022-03-16 01:35:50 -07:00
Rahul Frias
3fd20d9b28 Policy integration tests: use license holder
[ Merge of http://go/wvgerrit/143634 ]

Refactor the policy integration tests to use the license holder.

Bug: 195691232
Test: GtsMediaTestCases on sunfish
Change-Id: I58ffa64caec05c617065e4781657e85914f8369e
2022-03-16 01:35:26 -07:00
Edwin
3da1d24a1d Integration tests: add license holder
Merged from http://go/wvgerrit/146154

Many integration tests require a license from a license server. This
CL creates a helper class to fetch, load, and hold a license.

Test: ./build_and_run_all_unit_tests.sh

Bug: 194342800
Bug: 194342778
Change-Id: I0de7bcab4db1b365f074bad29fc157a5eca135d8
2022-03-16 01:35:01 -07:00
Rahul Frias
6cda6717a9 Reboot test: Initialize fake clock
[ Merge of http://go/wvgerrit/143630 ]

When we run a test with the fake clock, the clock had been initialized
to the current time, or to 0. This causes a problem for reboot tests
because the clock might go backwards over the reboot. With this
change, we monitor the clock at the end of one reboot pass and
initialize the clock for the next pass based on the previous value.

Bug: 26163469
Test: GtsMediaTestCases on sunfish
Change-Id: Ibd0024f963634382af70553fced38da6e1d857d2
2022-03-16 01:34:36 -07:00
Rahul Frias
520368cea2 Reboot test: save large files
[ Merge of http://go/wvgerrit/143629 ]

The standard b2a_hex only saves about 2k, so we need a special version
that can handle larger strings. This is needed because a license file
is about 7k.

Bug: 194342751
Test: GtsMediaTestCases on sunfish
Change-Id: I6a6ac3f8f4fa6d9cd8a0119fc64fc8f3cc5f3ae8
2022-03-16 01:34:12 -07:00
Rahul Frias
57353b4941 Test max number of DRM private keys
[ Merge of http://go/wvgerrit/143909 ]

The max. number of DRM keys that can be loaded depends on the resource
rating.

Add a test to verify:
1. We can load up to MAX. drm keys
2. Loading the MAX+1 key can fail
3. The loaded keys should work even if loading other keys failed

Bug: 209084113
Test: opk_ta, run_x86_64_tests, run_level3_static_tests,
run_fake_l1_tests
Test: GtsMediaTestCases on sunfish

Change-Id: Ib9821e8a1994d41d3e9c2063440c109a2332ba89
2022-03-16 01:33:48 -07:00
Rahul Frias
5f45485175 Merge oemcrypto-v17 to master
[ Merge of http://go/wvgerrit/144530 ]

It's time to copy all the v17 work to our main branch.
I had to re-run clang-format to match local style.

Merge from commit b14f08374f9a48aed49850cc230daf384725b15f
Fix allow_null for key control iv in L3 v17

Bug: 161477208
Test: GtsMediaTestCases on sunfish
Change-Id: I97caa851e9e65eb0e42034d2f4a28dfb7499df0d
2022-03-16 01:33:23 -07:00
Rahul Frias
83a4100d11 Update cipher mode elsewhere
[ Merge of http://go/wvgerrit/144696 ]

In v17,
OEMCrypto_CipherMode_CTR renamed to OEMCrypto_CipherMode_CENC
OEMCrypto_CipherMode_CBC renamed to OEMCrypto_CipherMode_CBCS

Bug: 224375138
Test: GtsMediaTestCases on sunfish
Change-Id: I2d96e9c6d22a9d9e2fbbd15a8aea3f2d5dac6dcb
2022-03-16 01:33:02 -07:00
Rahul Frias
4532802ea0 Fix 1 ClangTidyBuild finding:
[ Merge of http://go/wvgerrit/145289 ]

* missing #include <string> for 'std::string' For more info see go/clang_tidy/checks/google3-build-missing-std-includes

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/clang-tidy-bug for category ClangTidyBuild if the change looks generally problematic.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

Tested:
    Local presubmit tests passed.

Bug: 224375138
Test: GtsTestCases on sunfish

PiperOrigin-RevId: 426761099
Merged from https://widevine-internal-review.googlesource.com/145250

Change-Id: I5a66b6eccc2b08ee11f92f90ce3b725f24c8d33c
2022-03-16 01:31:53 -07:00
Rahul Frias
bc6e841ccd Add out of bounds testing for LoadKeys()
[ Merge of http://go/wvgerrit/146249 ]

Update the OEMCryptoMemoryLoadLicense* tests so they cover LoadKeys()
for v15 and prior and LoadLicense() for v16 and later versions.

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

Bug: 190749256
Test: GtsMediaTestCases on sunfish
Change-Id: If90f7afd82819375f52a2fe619675bf0c4c4dd3a
2022-03-16 01:30:39 -07:00
Rahul Frias
8350badbb5 Separate invalid session test for ReuseUsageEntry
[ Merge of http://go/wvgerrit/144729 ]

Since OEMCrypto_ReuseUsageEntry() was introduced in v17, splitting the
test case for an invalid session from the other usage entry methods
since they were implemented in v15/16 as well.

Bug: 216193739
Test: GtsMediaTestCases on a sunfish
Change-Id: I7f4399c07a19227495a15807228b930066f6a794
2022-03-16 01:20:02 -07:00
Edwin Wong
9361eb803b Merge "Build both AIDL and HIDL targets." into tm-dev 2022-03-14 20:31:42 +00:00
Edwin
77f1fedde2 Build both AIDL and HIDL targets.
Merged from http://go/wvgerrit/147689

The default is to build for AIDL Widevine service.
Use "-t hidl" in build_and_run_all_unit_tests.sh or
build_all_unit_tests.sh to build for HIDL service.

Test: ./build_all_unit_tests -t hidl
Test: ./build_and_run_all_unit_tests -t hidl
Test: ./build_all_unit_tests
Test: ./build_and_run_all_unit_tests

Bug: 217247987
Change-Id: Ie7c51033f4aba341c829ccc8f846a6cfeab76df3
2022-03-11 15:36:55 -08:00
TreeHugger Robot
6eb5161dc1 Merge "wv aidl: fix native handle memory leak 2" into tm-dev 2022-03-11 05:20:59 +00:00
Edwin
28feb283f3 Add lazy service for Widevine AIDL HAL.
Merged from http://go/wvgerrit/147329

Test: atest VtsAidlHalDrmTargetTest
Test: atest GtsMediaTestCases

Bug: 221078453
Change-Id: I4345816f18c44de4187f03a087d58e890a6d6b01
2022-03-09 23:30:31 +00:00
Edwin
b5284c5376 Update dump() for Aidl HALs.
Merged from http://go/wvgerrit/146589

lshal is for hidl HALs only, dumpsys is for aidl HALs.
Add option "-a" to dump both CDM metrics and properties
because adb bugreport calls dump() with option "-a".

Test: adb bugreport

Bug: 220996660
Change-Id: Ib2a73f3f9f353b8435735dd019a547b62b066725
2022-02-25 14:00:31 -08:00
Robert Shih
c5aa870dbd wv aidl: fix native handle memory leak 2
[ Merge of go/wvgerrit/146369 ]

Bug: 219754570
Test: atest GtsMediaTestCases
Change-Id: Id3e443d5e39ae416d6e566a129ebed423e19e98d
2022-02-23 09:40:15 +00:00
Robert Shih
3fa23b250b Merge "aidl drm: independent min/max SecurityLevel for each supported mime" into tm-dev 2022-02-23 02:08:46 +00:00
Robert Shih
06587fd100 Merge "wv aidl: fix native handle memory leak" into tm-dev 2022-02-22 20:23:44 +00:00
Robert Shih
7b3a37fa2f Merge "Update cipher mode enumeration in AIDL WvDrmPlugin" into tm-dev 2022-02-22 20:22:11 +00:00
Robert Shih
f2d89aaf77 aidl drm: independent min/max SecurityLevel for each supported mime
Interface change 16873294

[Merge of go/wvgerrit/145969]

Bug: 219528925
Test: atest MediaDrmTest.testIsCryptoSchemeSupportedForSecurityLevels
Change-Id: I5c0d511358c394aff6885135de851395f199dac0
Merged-In: I5c0d511358c394aff6885135de851395f199dac0
2022-02-20 19:36:07 +00:00
Robert Shih
0684df3b6c Update cipher mode enumeration in AIDL WvDrmPlugin
To match the v17 change.

[ Merge of go/wvgerrit/146231 ]

Bug: 216585596
Test: atset WidevineGenericOpsTests
Change-Id: I7eb25a5db30a82cf8015e3c19af419c02a1d5002
Merged-In: I7eb25a5db30a82cf8015e3c19af419c02a1d5002
2022-02-20 16:04:11 +00:00
Robert Shih
ea1d5d6891 wv aidl: no set security level opening default session
Bug: 219538389
Test: atest WidevineDashPolicyTests#testL3ValidateKeyOutputProtection
Change-Id: I5912a93fd0b7a144694ec3b251a129d839b8b149
2022-02-20 16:02:24 +00:00
Robert Shih
c6d7d6e69b wv aidl: fix native handle memory leak
[ Merge of go/wvgerrit/145971 ]

Bug: 219754570
Test: atest GtsMediaTestCases
Change-Id: Id4705d5bc10ba6dfbe878f2d95fdd9ae9d2e9f1d
Merged-In: Id4705d5bc10ba6dfbe878f2d95fdd9ae9d2e9f1d
2022-02-20 15:59:51 +00:00
Edwin
93b5514a27 Fix gts issues.
Fix the conversion from in_args.keyId to Cdm format
which causes nullptr dereference signal 11 faults.

Test: atest
  atest-dev GtsMediaTestCases:com.google.android.media.gts.WidevineGenericOpsTests

Bug: 214410088
Change-Id: If84863e2501d4ccae7b8b38dceb707bb4bfa12fb
2022-02-14 10:42:52 -08:00
Edwin
9654d29be6 Widevine drm aidl: address API review
Interface update in change 16810770

Bug: 214410088
Test: atest VtsAidlHalDrmTargetTest
Change-Id: I19da51ef75952f5ff6c7c02e0393f574e69ee30b
2022-02-09 22:19:36 -08:00
Edwin
6112060529 Ran google3 clang-format on cdm source.
Merge from http://go/wvgerrit/144969

Test: build
  m android.hardware.drm-service.widevine -j128

Test: atest VtsAidlHalDrmTargetTest

Bug: 216720425
Change-Id: Ie1872d2a48e3b3645853e9831816afecffac747f
2022-02-03 20:33:05 -08:00
Robert Shih
f1bfd6f202 misc wv aidl bug fix to pass vts
* handle default security level
* init ScopedAStatus before sending events

Bug: 205845199
Test: atest VtsAidlHalDrmTargetTest
Change-Id: Ie72d837bb2b7caa1da2721262b76bd47d5bdab03
2022-02-01 23:26:15 -08:00
Edwin
3c3da01d58 Use aidl interface for Widevine service.
The interface is defined in
hardware/interfaces/drm/aidl(http://go/ag/15329852).

Test: build
  m android.hardware.drm-service.widevine -j128

Test: build_and_run_all_unit_tests.sh
  for hidl tests

Test: atest VtsAidlHalDrmTargetTest

Test:   atest vts_treble_vintf_vendor_test:vts_treble_vintf_vendor_test.DeviceManifest/SingleManifestTest#ManifestAidlHalsServed/0 -- --abi x86_64

Bug: 200055138
Bug: 170964303
Change-Id: I5654d90d8a4b0bae4b4a78e79b27c1cafec36be7
2022-02-01 22:20:04 -08:00
Kyle Zhang
627c8d6855 Merge "Fix files mis-synced from cdm repo to Android" 2022-02-02 06:07:45 +00:00
Kyle Zhang
fdc585a55d Fix files mis-synced from cdm repo to Android
Test: build
Bug: 161477208
Change-Id: I2d48dff987fe37a54ffdfc47a7896fba975a0e20
2022-02-01 18:08:38 +00:00
Cong Lin
efbe13ea36 Update Android L3 after cipher mode fix
This is a merge of
https://widevine-internal-review.googlesource.com/c/cdm/+/144790

Updated cipher mode to allow playback in v17;
Added check for key selection before decrypting.

Merge from Widevine repo of http://go/wvgerrit/144779
Fix allow_null for key control iv in L3 v17

Merge from Widevine repo of http://go/wvgerrit/144792
Fix api version check in L3 v17

Test: L3 unit tests
Bug: 217145027
Change-Id: I584bd57e26407cbf4d4b94eb1bc5cf80839377be
2022-02-01 10:00:40 -08:00
Yohei Yukawa
a4d835af3a Revert "Use aidl interface for Widevine service."
This reverts commit 96a8ccd4a1.

Reason for revert:
Could break DeviceManifest/SingleManifestTest#ManifestAidlHalsServed

Bug: 200055138
Bug: 170964303
Bug: 217241995
Change-Id: I9c42df15defec428c9ef8c62439c63d4a603fee6
2022-01-31 22:01:25 +00:00
Edwin
96a8ccd4a1 Use aidl interface for Widevine service.
The interface is defined in
hardware/interfaces/drm/aidl(http://go/ag/15329852).

Test: build
  m android.hardware.drm-service.widevine -j128

Test: build_and_run_all_unit_tests.sh
  for hidl tests

Test: atest VtsAidlHalDrmTargetTest

Bug: 200055138
Bug: 170964303
Change-Id: If2f2a129914436ba5cef1c46f6cb9415e12c3d1c
2022-01-28 20:29:14 -08:00
Kyle Zhang
642965c678 Merge latest oemcrypto-v17 change
No-Typo-Check: Not related to this change.

Bug: 161477208
Change-Id: I99e4780f6855b7045aa0cd5a49c13d2d0d51ed64
2022-01-27 20:07:15 -08:00