Commit Graph

248 Commits

Author SHA1 Message Date
Robert Shih
2278917116 WVDrmPlugin signRSA: check arguments before caller
Merge of http://go/wvgerrit/97444

Bug: 153356263
Test: VtsHalDrmV1_0Target
Test: VtsHalDrmV1_3Target
Change-Id: Ic27056d86804972859a85c0eb2a0e79a0563d040
2020-04-06 16:13:40 -07:00
Fred Gylys-Colwell
56b836bda3 Replace OEMCrypto_LoadDeviceRSAKey with OEMCrypto_LoadDRMPrivateKey
Merge from Widevine repo of http://go/wvgerrit/96783

This CL updates the reference code, unit tests, and adapter to use the
new v16 function OEMCrypto_LoadDRMPrivateKey. This is just an API
change to allow ECC support in the future. The reference code does not
yet support ECC certificates, and the CDM code assumes that all
certificates have an RSA key.

Bug: 152558018
Test: unit tests on taimen and w/v16 mod mock.
Change-Id: I0793b416513b81b3d74849f0b58dbdc91f075ac6
2020-03-29 10:43:54 -07:00
Robert Shih
18fec07897 hidl WVDrmPlugin: check for listener transport errors
Transport errors usually happen when hidl client crashes in DRM event
handler.

Merged from http://go/wvgerrit/95963

Bug: 150204874
Test: artificial crashes in client DRM event listener
Change-Id: I8037374550357d003e302f2a25fbb2305ae5a5e7
2020-03-18 00:56:55 -07:00
Edwin Wong
a66d2b392e Clear sessionId regardless of what closeSession returns
After succeeding openSessionCommon(), when the call to
getSecurityLevel() fails, the code calls closeSession()
and only clears the sessionId if closeSession() fails.
We should always clear sessionId in this case.

Also, make it clearer that the status returned by
getSecurityLevel() does not overwrite the value from
openSessionCommon().

Merged from http://go/wvgerrit/95845

Test: unit test
adb shell LD_LIBRARY_PATH="/vendor/lib64" /data/nativetest/libwvdrmdrmplugin_hidl_test

Bug: 151364587
Change-Id: I3a9106ffa44c654d3e072a0b0597398d410fc84f
2020-03-13 11:40:20 -07:00
Edwin Wong
bdb69f73e8 openSession_1_1 should return error for wrong security level
Currently, if requestedLevel is not the same as the
current security level, openSession_1_1 still returns
Status::OK, we should return an error status.

Merged from http://go/wvgerrit/95507

Test: unit test
  adb shell LD_LIBRARY_PATH="/vendor/lib64" /data/nativetest/libwvdrmdrmplugin_hidl_test

Bug: 150407669

Change-Id: I5673ac7bbe7a234ddd07bb9c145135486fb9e583
2020-03-11 17:39:44 -07:00
Automerger Merge Worker
23c1be8cee hidl WVDrmPlugin openSession: set securityLevel correctly am: 9a530b7f1e
Change-Id: I7dbc26be06ae0fdfa0013dd65a57c169b21f4bdc
2020-03-04 19:33:38 +00:00
Robert Shih
9a530b7f1e hidl WVDrmPlugin openSession: set securityLevel correctly
Merge of http://go/wvgerrit/94827

Bug: 149035295
Bug: 150103154
Bug: 150407639
Test: VtsHalDrmV1_2TargetTest
Change-Id: I3687b2305eb413112f7fbd0d5127d2168cdf376d
2020-03-04 18:44:44 +00:00
Alex Dale
9c60d1e1ae Adding app package name to license request.
[ Merge of http://go/wvgerrit/94323 ]

Content providers wish to know the application package name that is
requesting a license from the content server.  The app package name that
is provided to the CDM during initialization is provided to the client
identification message as a key-value pair during license request
generation.  App packages names are keyed under 'application_name'.

This feature was tested manually by scraping the content of the license
request for YouTube TV.

Bug: 148689078
Test: manual
Change-Id: I6b65f2ab9845dbea37aaaab76ecea25c228bde5b
2020-02-20 13:23:16 -08:00
Robert Shih
be7b89e155 wv hidl: only mediashell/mediadrmserver can call signRSA
Merge of go/wvgerrit/93524

Bug: 134787536
Bug: 148895349
Test: VtsHalDrmV1_3TargetTest
Change-Id: I48fb63d044271243fa1d290443d437f0697994d3
2020-02-19 13:38:23 -08:00
Fred Gylys-Colwell
7665614b2e OEMCrypto v16.1
Merge of http://go/wvgerrit/93404

This CL updates the Widevine CDM to support OEMCrypto v16.1

Test: Tested in 16.2 CL
Bug: 141247171
Change-Id: I69bd993500f6fb63bf6010c8b0250dc7acc3d71b
2020-02-03 14:45:32 -08:00
Marco Nelissen
13a2504840 Link with actual headers instead of symlinks
Bug: 143245419
Test: build
Change-Id: I5981593697229c1f3314a4a8a4d0c447d7cbe808
2020-01-07 15:26:14 -08:00
Marco Nelissen
8af30972b2 Link with actual headers instead of symlinks
Bug: 143245419
Test: build
Change-Id: Iff096c2d3568f2db4260a1d2a86d2746ea4824ed
2020-01-07 13:21:05 -08:00
Robert Shih
8fce3e316b wv hidl: upgrade Drm/Crypto factories to v1.3
Bug: 139134043
Test: MediaDrmTest
Change-Id: I94d1cc8a323c144805d74d5568944dd48ae80e60
2019-12-16 01:19:49 -08:00
Rahul Frias
b8a6035298 Address compilation warnings
[ Merge of http://go/wvgerrit/90350 ]

Bug: 145244554
Test: wv android unit/integration tests
Change-Id: I5cd8a132836ce097a7b539fffdcef574f64cbdcf
2019-12-02 17:44:56 -08:00
Steven Moreland
6f556199db Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: Ie7052b17c1d468f63250755f3ffa5099760c9602
2019-10-02 12:53:59 -07:00
Edwin Wong
0c7dfda7e1 Link dynamic libcrypto.so to resolve FIPS cert breakage.
Switch Widevine service to link dynamic libcrypto.so.

Merge from http://go/wvgerrit/86323

Test: Play Movies & TV, Netflix, ExoPlayer, GTS
bug: 141082724
Change-Id: I16a7de4dab69bf3b4b550bb2ee202f4600682837
2019-09-16 14:38:00 -07:00
Rahul Frias
6c9c4697f0 Merge "Return key request type none after key rotation" into qt-dev am: 999a466275 am: 4690da2bcb
am: 4c9a3a6f02

Change-Id: Iddcac699401f64d920fcb8ff73053410019ec028
2019-05-31 09:55:31 -07:00
Rahul Frias
4c9a3a6f02 Merge "Return key request type none after key rotation" into qt-dev am: 999a466275
am: 4690da2bcb

Change-Id: I45387edbb83f05dcadec53e4514cb97c68eae6c7
2019-05-31 09:33:36 -07:00
Rahul Frias
3c9175fec5 Return key request type none after key rotation
[ Merge of http://go/wvgerrit/80084 ]

Corrected the key type being returned after entitled keys from
init data are loaded. Made test changes to validate.

Bug: 133903028
Test: WV unit/integration tests
Change-Id: Icb44587f5c3aba3b0facae6d83dc9344d6b60833
2019-05-29 19:03:43 -07:00
Haibo Huang
c70771dd20 Using ::testing::DoAll
[ Merge of ag/7620084 ]

Without this statement, compilation failed with new googletest.

Test: build
Bug: 129498355
Change-Id: I5e3f5310617e00821f70079fc700bc3f87c3d0ab
(cherry picked from commit 5764d3f801)
2019-05-22 17:27:03 +00:00
Haibo Huang
5764d3f801 Using ::testing::DoAll
Without this statement, compilation failed with new googletest.

Test: build
Bug: 129498355
Change-Id: I5e3f5310617e00821f70079fc700bc3f87c3d0ab
2019-05-20 11:19:06 -07:00
Robert Shih
fe8924f814 Add CdmKeyStatus kKeyStatusUsableInFuture am: 69c8f488ca am: 6a329e6c9a
am: e6ba3ec747

Change-Id: Iee17c92d9a3f3fd390e05bb0324ba04861236210
2019-05-16 20:07:33 -07:00
Robert Shih
69c8f488ca Add CdmKeyStatus kKeyStatusUsableInFuture
Bug: 116738851
Test: unit tests
Change-Id: I49728788e57905806b72e891f3654fbf0c8b1bc0
2019-05-15 15:16:05 -07:00
Jeff Tinker
fabf6f5311 Merge "hidl plugin: add sendKeysChange_1_2" into qt-dev am: 83068b97c8
am: 3caf992795

Change-Id: Ie49ca006a87f6071618c407b52a7d52992f0060c
2019-05-08 11:20:47 -07:00
Robert Shih
a1d9094721 hidl plugin: add sendKeysChange_1_2
Bug: 116738851
Test: vts
Change-Id: Ifdf537ff2f4922741eba5abdd37dd2dd5e37e161
2019-05-06 20:23:06 -07:00
John W. Bruce
5ea429ee2b Don't Use StringStream When It's Overkill
(This is a merge of http://go/wvgerrit/76063)

Now that we have C++11, many places that do string formatting or parsing
can be replaced with std::to_string() or one of the std::sto*() family
of functions. This patch updates places that do simple stringifying or
parsing to use these functions. Some parts of the code are left
untouched because they were using StringStream to do more complex
actions, such as constructing more complex output or checking the status
of the parsing.

Bug: 120599938
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I482dc234ecd7c6014fa9b6874387ff51e04b772f
2019-04-17 17:46:31 -07:00
Robert Shih
d54634baa4 hidl: return BAD_VALUE from RemoveOfflineLicense when keyset is not found
Bug: 127828539
Test: VtsHalDrmV1_2TargetTest
Change-Id: Ia567be076a9460546c59c2a38231e18bb0549ce3
2019-03-18 15:24:22 -07:00
Adam Stone
c891824a7a Adds a VersionInfo message to SignedMessage
[ Merge from http://go/wvgerrit/72724 ]

This adds a message that contains SDK and service version information
useful for debugging problems that occur because of different services.

BUG: 80536436

Test: Unit tests and manual GPlay testing.
Change-Id: I095f893b907ea7c2cd149155fb2cd4c7181e7bb2
2019-02-25 17:09:46 -08:00
Adam Stone
741645a4be Add UsageTableHeader metrics
[ Merge from http://go/wvgerrit/72183 ]

Adds basic metrics for the usage table header.

Bug: http://b/112919252
Test: Unit tests. Manual GPlay
Change-Id: I14d406766d8b2aba3b6e4f1a02c75eedc674b011
2019-02-25 17:09:31 -08:00
Rahul Frias
088c5afa02 Move WV unit/integration tests to /data/nativetest
[ Merge of http://go/wvgerrit/73044 ]

The tests currently get copied to /data/bin. Changes in location
of system libraries causes test failures when tests are unable to
find dependent dynamic libraries.

Bug: 123879070
Test: WV unit/integration tests
Change-Id: I86edbe33b4753238fcf8b84243ac6e6c058ea145
2019-02-21 09:53:06 -08:00
Edwin Wong
54104c7a22 Implement MediaDrm offline license support in Widevine hidl service.
Merged from http://go/wvgerrit/69723.

The new APIs are getOfflineLicenseIds, getOfflineLicenseState and
removeOfflineLicense. These methods are currently stubbed out in
Widevine hidl service. This CL completes the implementation.

Test: unit tests - libwvdrmdrmplugin_hidl_test

Test: GTS
  --test com.google.android.media.gts.MediaDrmTest#testWidevineApi29

bug: 117570686
Change-Id: I96ffb75f453e36e931effefd3664b5faa8d69d30
2019-01-29 13:41:08 -08:00
Jeff Tinker
81e77bda58 Merge "Add support for HDCP 2.3" 2019-01-19 05:48:02 +00:00
Jeff Tinker
7c0cd2582b Add support for HDCP 2.3
bug:120040804
Change-Id: I51e0d173edc36d518e12b821ccb3a7b1e7e8d217
2019-01-15 10:12:55 -08:00
Rahul Frias
ef00d6ffa5 Update property retrival method
[ Merge of http://go/wvgerrit/70203 ]

The earlier property_get() method had a limitation on property length.
Properties of some new devices exceed that length. An error message
is returned rather than a truncated string. Replace its use with
android::base::GetProperty() which does not have a length limitation.

Bug: 115358798
Test: WV unit/integration tests
Change-Id: I46ce9a7e77bcd031225d0082f83c57d484fe5405
2019-01-15 00:24:52 -08:00
Jeff Tinker
a00b50095c Add additional error conditions to MediaDrm
Merge of http://go/wvgerrit/70163

New codes are being added to handle resource
contention, lost session state, frame size too
large and insufficient security level for
decryption. Also cleans up inconsistent use of
tamper detected error where invalid state error
should have been used.

bug:111504510
bug:111505796
test: cts and gts media tests, widevine integration tests

Change-Id: I96ee441717d32ccbcabaa85c8f6a0013055ce16e
2019-01-10 15:17:48 -08:00
Rahul Frias
da18d8ea6b Merge "Add decrypt hash support" 2019-01-08 16:37:04 +00:00
Edwin Wong
f7659c72dd Fix getSecureStop returns zero opaque data intermittently.
Merge from http://go/wvgerrit/69603

In getSecureStop, the life of cdmStop will expire when
leaving the if (isCmdResponseTypeSuccess()) scope.
Since setToExternal() which is called by toHidlVec()
only performs a pointer assignment, the content of cdmStop
is lost and secureStop.opaqueData will have all zeros.

Test: netflix streaming and offline playback

Test: Play Movies & TV

Test: GTS test
  -m GtsMediaTestCases --test com.google.android.media.gts.MediaDrmTest#testWidevineApi28

Test: GTS test
  -m GtsMediaTestCases

bug: 120624463
Change-Id: I8da473d5fd06d091980eade4b7216856ef097e04
2019-01-07 22:31:21 +00:00
Rahul Frias
589a3cf27e Add decrypt hash support
[ Merge of http://go/wvgerrit/68083 ]

Add ability to query decrypt hash support, set a hash computed over a frame
and retrieve the last error at a later point.

Bug: 34080802
Test: WV unit/integration tests. New tests added to cdm_engine_test,
      libwvdrmdrmplugin_hidl_test and request_license_test.

Change-Id: I7548c8798c873a6af3e1cfc0df57c117e1e474a6
2019-01-07 10:14:25 -08:00
Adam Stone
27e26110b4 Add Oemcrypto build information to metrics.
Import from http://go/wvgerrit/68385

Adds the build information returned from OEMCrypto_BuildInformation()
to the CDM session metrics.

Bug: 117117555
Test: Unit tests. GPlay manual. GTS Tests.
Change-Id: I505c46fec61a7c62538f843185ec0358f860da79
2018-12-21 13:09:59 -08:00
Adam Stone
0a64d25067 Add a field indicating online vs offline licenses.
Import of http://go/wvgerrit/68188

This adds an attribute to metrics indicating if the license was online
or offline.

Also, added a unit test for CdmEngineMetricsImpl.

Test: Unit tests. GPlay manual. GTS tests.
Bug: 115523917

Change-Id: Id315c643048914a2c51904451f9665987bc87eb7
2018-12-21 13:09:29 -08:00
Srujan Gaddam
4c5c4caf66 Add detail about L3 initialization
Bug: b/70299597
Merge of http://go/wvgerrit/67304
Test: Android, CE CDM, and Linux tests

There's a few different things that can go wrong in the L3
initialization, with seeding and device key failures among others. They
should be recorded in metrics to track. Along the same lines, since
multiple errors can happen in conjunction, metrics needs to change to
add more fields for errors. This CL also adds the
hidl_metrics_adapter_unittest to the Android test scripts.

Change-Id: Ie5bcf81bbe294a1136c58410f90087a13b3d911d
2018-12-14 11:32:19 -08:00
Rahul Frias
afd11c0da5 Add support for Resource Rating Tiers
[ Merge of http://go/wvgerrit/67324 ]

This introduces the ability to query resource rating tier information
through the plugin and CDM. Resource rating tiers are also
sent in the client identification portion of the license request.

Bug: 117112392
Test: WV unit/integration tests
Change-Id: I68ac6dfc4362f61150af822bd526e346b5cc4bf7
2018-12-11 01:43:58 -08:00
Rahul Frias
5f96a20d99 Allow querying of OEMCrypto build information
[ Merge of http://go/wvgerrit/67503 ]

Bug: 117118184
Test: WV unit/integration tests
Change-Id: I8db90c1617e068a4711eb41a5852d15b5e228f2f
2018-12-10 21:48:13 -08:00
Edwin Wong
20adb9438d Update Widevine HIDL service to 1.2.
Widevine HIDL service added new v1.2 media APIs,
update the service to support new APIs.

Merged from http://go/wvgerrit/67083

Test: Netflix and Play Movies & TV (streaming and offline playback)

Test: GTS WidevineH264PlaybackTests test
  e.g. ANDROID_BUILD_TOP= ./android-gts/toolsefed run gts -m GtsMediaTestCases
  --test com.google.android.media.gts.WidevineH264PlaybackTests#testL1With480P30

Test: Widevine unit tests

bug: 117570686
Change-Id: I3a2091e7c62a0d2697ef97f983fd898aedfb4519
2018-11-30 16:02:07 -08:00
Colin Cross
c0144ac97f Add SetValue for unsigned long for uint64_t
am: b0f80eb4a7

Change-Id: Ia95df0946a40f0383c32f94006576220205e613d
2018-10-30 14:11:46 -07:00
Colin Cross
b0f80eb4a7 Add SetValue for unsigned long for uint64_t
google::protobuf::uint64 is changing from unsigned long long to
uint64_t, which is sometimes unsigned long long and sometimes
unsigned long.  Add a SetValue specialization for unsigned long.
Mark both the unsigned long and unsigned long long specializations
as sometimes unused, they will be unused if uint64_t is the other.

Bug: 117607748
Test: m checkbuild
Change-Id: I8bec0be6cd7e13354cf96a7e510fe2b920aec561
2018-10-27 23:35:51 -07:00
Rahul Frias
e2a1682b99 Suppress implicit-fallthrough warnings.
[ Merge of http://go/wvgerrit/63782 ]

Add FALLTHROUGH_INTENDED for clang compiler.

Bug: 117675755
Test: build with global -Wimplicit-fallthrough.
Change-Id: I603042152ae8fb7e6518ca24e404df1d63097337
2018-10-15 19:04:26 -07:00
Fred Gylys-Colwell
947531a6a9 Refactor oemcrypto mock into stand alone reference code
Merge from Widevine repo of http://go/wvgerrit/46204
Refactor utility code - split the mock, step 1

Merge from Widevine repo of http://go/wvgerrit/46205
Move some OEMCrypto types to common header - split the mock, step 2

Merge from Widevine repo of http://go/wvgerrit/46206
Split mock into two -- step 3

Merge from Widevine repo of http://go/wvgerrit/47460
Split the mock into two -- step 3.5

The CL moves several files used by oemcrypto and cdm into a common
subdirectory, so that it may more easily be shared with partners.

The CORE_DISALLOW_COPY_AND_ASSIGN macro was moved to its own header in
the util/include directory.

This CL removes some references to the mock from other code, and puts
some constants and types, such as the definition of the keybox, into a
header in oemcrypto.

Test: tested as part of http://go/ag/4674759
bug: 76393338
Change-Id: I75b4bde7062ed8ee572c97ebc2f4da018f4be0c9
2018-09-02 11:45:16 -07:00
Adam Stone
a6ad2933fb Merge "Fix API support for Widevine vendor metrics" into pi-dev 2018-05-10 17:00:24 +00:00
Adam Stone
e7edb5d2e2 Fix API support for Widevine vendor metrics
This fixes Widevine's getMetrics call so that it will return vendor
metrics through the Drm plugin 1.1 interface.

Bug: 73724453
Test: New and existing unit tests. Updated and existing GTS. Google Play manual.

Change-Id: Ie35128dc80bd6eabf9e1f3b9c1800256af77bc51
2018-05-09 15:31:34 -07:00