Commit Graph

2207 Commits

Author SHA1 Message Date
Tom Cherry
6b2787121c remove extraneous using namespace android and deprecate utils/Log.h
This namespace is not used by this file and its declaration is removed
in a separate CL from utils/Log.h, which is the only place it is
defined, so we must remove this extraneous line.

Also, since that separate CL is deprecating utils/Log.h in favor of
log/log.h, we make the switch to the new header.

Test: Build

Change-Id: Iac4bc8faffbd2d68dc4ccccaf569db0c5a13a7bc
2017-07-12 17:13:01 -07:00
John W. Bruce
32b6cb55e7 Pass CdmIdentifier to UsageInfo Methods
am: 43b8522b70

Change-Id: Idff718d6a370fd927f4cc9019a482698313175a0
2017-06-19 23:34:21 +00:00
John W. Bruce
43b8522b70 Pass CdmIdentifier to UsageInfo Methods
The methods on WvContentDecryptionModule related to UsageInfo (Secure
Stops) do not work if kDefaultCdmIdentifier has not been provisioned.
This can occur if an app provisions and uses an origin without any app
on that device ever provisioning the default origin. More concerningly,
this will happen 100% of the time on SPOID-using devices, as there is no
way to provision the default identifier on these devices.

The fix is to pass the current identifier to these methods so that they
do not have to use kDefaultCdmIdentifier.

Test: build_and_run_all_unit_tests.sh
Test: WV GTS Tests
Bug: 62431478
Change-Id: I92a8b4acb69c964abe8129bccf2ff48a66c4a9e0
2017-06-16 17:59:24 -07:00
Rahul Frias
1073526555 Merge "Usage license handling corrections" into oc-dev
am: c3cdb531d4

Change-Id: Ib7a6b14cd009abf2247bad28939c06938c07db0a
2017-06-13 22:45:53 +00:00
Rahul Frias
c3cdb531d4 Merge "Usage license handling corrections" into oc-dev 2017-06-13 22:40:54 +00:00
Kyle Alexander
fc7e636bdf Merge "Update unit tests to build into /data/bin" into oc-dev
am: b683d2be57

Change-Id: I1a88eb1d4f9a8d1df6fc66f6277c5afc5ead9c07
2017-06-13 22:18:14 +00:00
TreeHugger Robot
b683d2be57 Merge "Update unit tests to build into /data/bin" into oc-dev 2017-06-13 22:10:13 +00:00
Kyle Alexander
038580c6c9 Update unit tests to build into /data/bin
Tradefed needs these tests to be in the /DATA directory.

Test: cd vendor/widevine && ./build_and_run_all_unit_tests
      All tests should build and pass.
      make tests
      unzip android-tests.zip and verify all tests located in DATA/bin

Bug: 62055647
Change-Id: I35925e29558561c4726bb2249499bfee4e54cf45
2017-06-12 23:48:15 -07:00
Rahul Frias
db05f1e01c Usage license handling corrections
[ Merge of http://go/wvgerrit/28460 ]

Validate that offline licenses that do not contain a provider session
token are not handled by the TEE.

b/38490468

Test: WV Unit/integration tests, GtsMediaTestCases,
      WvCdmRequestLicenseTest.ReleaseRetryL3OfflineKeySessionUsageDisabledTest

Change-Id: Idaf62f2a882ae933c1a3e108d791943034780a46
2017-06-12 20:03:57 -07:00
Rahul Frias
61f0de0e7d Recreate usage tables on error
am: 4228e2327e

Change-Id: I249dc9ee4c01dc24eb68a2ee876b800449ac7e3c
2017-06-09 23:47:01 +00:00
Rahul Frias
4228e2327e Recreate usage tables on error
[ Merge of http://go/wvgerrit/28265 ]

A vendor specific error (10008) in response to OEMCrypto_LoadKeys
indicates that usage table corruption has occurred and that
the only way to recover is to regenerate usage tables.
Recreating usage tables will result in loss of offline licenses
and usage information. To make the app aware that this information
will be lost, a provisioning exception is generated when this error
is detected. The app can then choose to reprovision and in turn
delete and recreate usage tables.

A new OEMCrypto error has been added whose use has been reserved.
Rather than correct OEMCrypto behaviour to use the new error code,
we choose to handle this within the CDM. The fix can then be ported
to prior android releases. Also this error will not be generated
with OEMCrypto V13+.

b/33817629

Test: WV Unit, integration and GTS tests.
Change-Id: I936fc234d101b6a92d86f5735d035d19ddcf19e3
2017-06-08 23:46:04 -07:00
Rahul Frias
4c8af4872d Correct offline license handling
am: 1857da2c8c

Change-Id: Ieebed7532da0e2de79e9cfafa20c40d1aed10b0f
2017-06-08 09:51:51 +00:00
Rahul Frias
1857da2c8c Correct offline license handling
[ Merge of http://go/wvgerrit/28261 ]

Licenses (offline, secure stops) that contain provider session tokens
are handled securely using usage tables. A recent fix did not correctly
handle offline licenses that do not contain a provider session token and
are not handled by the TEE.

b/62340248
Test: WV Unit/integration tests, GtsMediaTestCases

Change-Id: Ia1331fea9deff44dd1d93219b37f5bea4b8ee168
2017-06-07 17:23:27 -07:00
Rahul Frias
658dbe1dc7 Merge "Update Widevine integration test to match android version" into oc-dev
am: ba346a1bea

Change-Id: I8aa8d2711a7e0ddd3a44a964daff9d7db3f3a7a7
2017-05-31 21:37:46 +00:00
Rahul Frias
ba346a1bea Merge "Update Widevine integration test to match android version" into oc-dev 2017-05-31 21:31:14 +00:00
Rahul Frias
97a77d4c2c Merge "Corrections for big usage table support in L3" into oc-dev
am: 9edaf2ab39

Change-Id: I4651713271f53d0aca77d8ecaaae57f3ab855471
2017-05-31 21:31:03 +00:00
Rahul Frias
9edaf2ab39 Merge "Corrections for big usage table support in L3" into oc-dev 2017-05-31 21:12:21 +00:00
Fred Gylys-Colwell
efeb2e0593 Merge "Update Docs for OEMCrypto v13.2" into oc-dev
am: d64169c1da

Change-Id: I78a00db44fba4f7eec9c7292a8aa3bd9d79f3cef
2017-05-31 19:28:42 +00:00
Fred Gylys-Colwell
7316aba6fc Merge "Build level 3 with latest updates" into oc-dev
am: 31a2af7c17

Change-Id: I731cace0d95a3d624f1787ae9e93697100e5c0d4
2017-05-31 19:28:32 +00:00
TreeHugger Robot
d64169c1da Merge "Update Docs for OEMCrypto v13.2" into oc-dev 2017-05-31 19:26:10 +00:00
TreeHugger Robot
31a2af7c17 Merge "Build level 3 with latest updates" into oc-dev 2017-05-31 19:18:33 +00:00
Fred Gylys-Colwell
af34b31112 Use mac keys from usage entry if keys are not loaded
am: 8138df1c86

Change-Id: I00c781d2074be6ec7358ad208a6dc91b0bfdb7a8
2017-05-31 17:37:13 +00:00
Rahul Frias
5da8da58f6 Corrections for big usage table support in L3
[ Merge of http://go/wvgerrit/26421 ]

* Corrects usage_table_header lifetime management. Earlier the
  UsageTableHeader class was a singleton tied to the CdmEngine lifetime.
  With SPOIDs there might be multiple concurrent CdmEngine objects.
  The UsageTableHeader class is now associated with OEMCrypto
  lifetime. There are two UsageTableHeader objects one for each L1 and L3.
  These get allocated/deallocated on OEMCrypto Initialization/Termination
  respectively.
* UsageTableHeader requires OEMCrypto, file read/writes and
  metric gathering to perform its required functionality. Because of the
  lifetime changes, CryptoSession, DeviceFiles and MetricsGroup objects
  need to passed to the methods rather than at Creation time.
* Miscellaneous fixes, when moving or deleteing entries.
* Adds usage_table_header_unittests.
* Addresses failures with request_license_test with secure stop in L3.

b/36858906
b/36855557
b/36048120
b/38341136
b/37100505
b/35946047

Test: Verified by unit and integration tests. Added new
      usage_table_header_unittests

Change-Id: I20e396ab2c0afbd14372dd93b969e5b0f1ccd291
2017-05-31 00:37:58 -07:00
Rahul Frias
b1fe0834a5 Update Widevine integration test to match android version
[ Merge of https://go/wvgerrit/27860 ]

The android version was updated from "O" to "8.0.0"

b/62201928

Test: Ran wv unit and integration tests.

Change-Id: I57525af2ab3bdfa0e77ad8f0efbff26cf8ff5c32
2017-05-30 23:43:43 -07:00
Fred Gylys-Colwell
f0ef2a32e8 Build level 3 with latest updates
Merge from Widevine repo of:
http://go/wvgerrit/27504
http://go/wvgerrit/27461

arm64/libwvlevel3.a            Level3 Library 7283 May 21 2017 09:56:42
arm/libwvlevel3.a              Level3 Library 4445 May 19 2017 17:17:20
x86_64/libwvlevel3.a           Level3 Library 7284 May 22 2017 11:21:02
x86/libwvlevel3.a              Level3 Library 4464 May 19 2017 16:59:48

b/38203566
b/37521546

Change-Id: Ia881e7bc2ef8e56e67e3b8775d9dd6a94a834d95
2017-05-31 01:29:15 +00:00
Fred Gylys-Colwell
32348b987c Update Docs for OEMCrypto v13.2
Merge from Widevine repo of http://go/wvgerrit/27462

This updates the documentation for OEMCrypto:
1) Clarification on values for the key control block verification
field.  Unit tests for this change are already in the code.

2) Clarification on how Offline License Release messages are signed.

And for the Android supplement:
3) liboemcrypto.so may be installed in several places.

b/38422219
Testing: docs only change.  no testing needed.

Change-Id: Iab3f5b585a41c80c5d7aa5f00aabce2de2df3a79
2017-05-24 11:44:16 -07:00
Fred Gylys-Colwell
8138df1c86 Use mac keys from usage entry if keys are not loaded
Merge from Widevine repo of http://go/wvgerrit/27461

In order to sign a license release message, the mac keys from the
usage entry should be used whenever keys have not been loaded.

This CL updates the reference code, the unit tests, and the level 3
oemcrypto.

b/38203566
Test: unit tests passing on bullhead.

Change-Id: Ic71fee4b4b7b45801548ab80fbbbf8f4ccab3e6e
2017-05-19 15:56:11 -07:00
Jeff Tinker
d4d3732aac Merge "Revert "Fix widevine drm hal resource leaks"" into oc-dev
am: 45c98e47f2

Change-Id: I5230438c6389769b67719590d2483727e8dc3941
2017-05-17 23:59:15 +00:00
TreeHugger Robot
45c98e47f2 Merge "Revert "Fix widevine drm hal resource leaks"" into oc-dev 2017-05-17 23:47:19 +00:00
Jeff Tinker
d2080a8b9f Revert "Fix widevine drm hal resource leaks"
This reverts commit 006506278a.

It needs to be reverted to fix b/38343960 on marlin.

This change is not needed since the root cause of the
resource leak was addressed in ag/2226738. 

Change-Id: I93b64d39103d574b7dcde6b1477839a50b64aefd
2017-05-16 22:20:20 +00:00
Jeff Tinker
d5934a8af4 Merge "Fix widevine drm hal resource leaks" into oc-dev
am: 27deb32b79

Change-Id: I38c2af0efde3c95c8399e0cb5118c8880864f2df
2017-05-15 20:09:19 +00:00
TreeHugger Robot
27deb32b79 Merge "Fix widevine drm hal resource leaks" into oc-dev 2017-05-15 19:53:54 +00:00
Fred Gylys-Colwell
0947339468 Merge "Avoid calling DeleteUsageEntry for OEMCrypto v13" into oc-dev
am: 0a02017009

Change-Id: I93b6587c97d8325cc1b2ccbb88e585e5f4053d11
2017-05-13 05:44:05 +00:00
Fred Gylys-Colwell
0a02017009 Merge "Avoid calling DeleteUsageEntry for OEMCrypto v13" into oc-dev 2017-05-13 05:39:10 +00:00
Edwin Wong
fd71455558 Merge "Fix GTS testL3PlayHDCPV* tests." into oc-dev
am: dcf78b1062

Change-Id: I0a8ad43b626e7ed1e99833dd3d32c8f4bc479f81
2017-05-13 04:19:29 +00:00
Edwin Wong
dcf78b1062 Merge "Fix GTS testL3PlayHDCPV* tests." into oc-dev 2017-05-13 04:15:55 +00:00
Fred Gylys-Colwell
7d5b88a06a Avoid calling DeleteUsageEntry for OEMCrypto v13
Merge from Widevine repo of http://go/wvgerrit/27182

This function is not defined for v13, and should not be called by the
adapter.

b/38203780
Test: Ran unit tests specified in bug, on sailfish.

Change-Id: I38b1cc8493dd22da724f415f28d94f47d6d9c942
2017-05-12 17:26:24 -07:00
Edwin Wong
d751e81790 Fix GTS testL3PlayHDCPV* tests.
These tests verify whether a L3 device respects the HDCP policy set in the
license request. L3 device should only play the clear lead, and stop at
encrypted content. MeidaDrm should throw an ERROR_INSUFFICIENT_OUTPUT_PROTECTION
exception. This is because L3 device always returns current HDCP connection
status as HDCP_NONE.

This CL modifies the policy engine CanDecryptContent method to return
CdmResponseType instead of a boolean, so the app can generate the correct
error response if HDCP constriants are not met.

Test: GTS tests
  ANDROID_BUILD_TOP= ./android-gts/tooadefed run gts -m GtsMediaTestCases --test
  com.google.android.media.gts.WidevineDashPolicyTests#testL3PlayHDCPV*Required

Test: unit tests
  adb shell /data/app/policy_engine_unittest
  adb shell /data/app/policy_engine_constraints_unittest

Test: Play Movies

bug: 34258607
Change-Id: I11fc9da1e077e18e38f34159daae9d8ebcd948b6
2017-05-12 16:55:26 -07:00
Rahul Frias
54876569de Fix deadlock when pending key release sessions are deallocated
am: 02fe2ef693

Change-Id: Ic6ac79dbb24ffd3fd137c4149167618f74f398b6
2017-05-12 22:27:21 +00:00
Rahul Frias
02fe2ef693 Fix deadlock when pending key release sessions are deallocated
[ Merge from http://go/wvgerrit/27261/ ]

Sessions created to release keys are periodically cleaned up if the
key release operation does not complete within a specific
amount of time. If other sessions are open, they will be released
through the timer thread. This would result in deadlock as a mutex
was taken twice.

Test: Verified by cdm_extended_duration_test
(AutomatedOfflineSessionReleaseOnOpenSession and
AutomatedOfflineSessionReleaseOnTimerEvent tests)

b/37546078

Change-Id: I7d45f939bdce77e5db461a401364da4f42c1c034
2017-05-11 20:12:33 -07:00
Jeff Tinker
006506278a Fix widevine drm hal resource leaks
A strong pointer cycle was preventing the drm plugin
from being released.  This change converts the listener
to a weak pointer to break the cycle.

bug:36408047
test: manual testing to verify leaks are fixed
Change-Id: I2e2af392c2b263b7b0943d61dcaee5e94089ce27
2017-05-09 14:31:07 -07:00
Fred Gylys-Colwell
e76930cf14 Remove TODO logs from dynamic adapter
am: ee283ec61c

Change-Id: I9c1fbea53e5fb94738ba4159772d891628a85986
2017-05-06 01:31:16 +00:00
Fred Gylys-Colwell
ee283ec61c Remove TODO logs from dynamic adapter
Merge from Widevine repo of http://go/wvgerrit/26943

b/37987506

Test: built and run unit tests on sailfish -- no new failures.  Ran
Netflix on sailfish.

Change-Id: I96f8bb7a5c060fefd116b165406ce6bfad29f59d
2017-05-05 17:00:08 -07:00
Fred Gylys-Colwell
8a66118d7a Remove unused variables from mips build
am: 35fc4edc11

Change-Id: I25e9f2deb3b729c7bd303fd08dc91aea66922f75
2017-05-05 17:03:56 +00:00
Fred Gylys-Colwell
35fc4edc11 Remove unused variables from mips build
Merge from Widevine repo of http://go/wvgerrit/26940

b/38014227
b/38016711
Test: built sdk_phone_mips

Change-Id: Ibcdbf49f96e976f51c38db25a944268a86a1671e
2017-05-05 07:55:36 -07:00
Fred Gylys-Colwell
9dec53c46c Refresh Current Key in Level 3
am: 38b5e8c71c

Change-Id: I2c133746b2775649df5dbc140b55ee5992f68036
2017-05-05 01:48:10 +00:00
Colin Cross
475bf406ed Add moved drm include path to widevine
am: 712fd74d85  -s ours

Change-Id: I487afb1fc397ea23e656ad1f529e9891127f97d3
2017-05-04 22:23:08 +00:00
Colin Cross
712fd74d85 Add moved drm include path to widevine
Test: m -j libdrmwvmcommon
Change-Id: I7783470aeba248aa381021007e27dcea1fd33e81
2017-05-04 14:56:35 -07:00
Fred Gylys-Colwell
38b5e8c71c Refresh Current Key in Level 3
Merge from Widevine repo of http://go/wvgerrit/26780
and http://go/wvgerrit/26740

Previously, in oemcrypto level 3, a session's current key's duration
was not updated until the next call to SelectKey.  This caused
problems with license that only used one key.  This CL fixes that.

arm64/libwvlevel3.a            Level3 Library 7283 May  2 2017 13:16:21
arm/libwvlevel3.a              Level3 Library 4445 May  2 2017 11:49:34
x86_64/libwvlevel3.a           Level3 Library 7284 May  2 2017 12:09:21
x86/libwvlevel3.a              Level3 Library 4464 May  2 2017 11:53:46

Test: unit tests run on emulator.
b/37481239
b/37523523

Change-Id: Ife90a3358b6620c8fb81324ec2331d3775a38191
2017-05-03 11:53:49 -07:00
Steven Moreland
680f23d350 Remove redundant dependencies
android.hidl.base@1.0 and android.hidlmanager@1.0 are built into libhidltransport.

Test: links
Bug: 33276472
Change-Id: Id9053e4484275e3404f31a72d2037884ff6bef5b
(cherry picked from commit 80ec937545)
2017-05-02 21:52:59 +00:00