Commit Graph

141 Commits

Author SHA1 Message Date
John W. Bruce
ce9c5f35ac Update Widevine Android Version Number to 5.1.0
(This is a merge from http://go/wvgerrit/31360)

This also updates the version number change canary.

Bug: 64209738
Test: request_license_test
Change-Id: Ibdf27256822a32988a848ef5bf79bf2e2633fd59
2017-08-17 02:42:54 -07:00
Rahul Frias
e61259e075 Support provisioning 3.0
[ Merge of http://go/wvgerrit/29004 ]

Enable support for provisioning with OEM certificates as root of
trust.

b/62972441

Test: WV unit/intgration test, cdm_feature_test and GTSMediaTestCases

Change-Id: I30576fc0bb68a873eeaaca03f6b9c89fa6a14327
2017-07-23 18:00:23 +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
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
ba346a1bea Merge "Update Widevine integration test to match android version" into oc-dev 2017-05-31 21:31:14 +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
Rahul Frias
c2969ef0f4 Merge changes I9039bc1f,I43758cd2 into oc-dev
* changes:
  Allow decryption of unencrypted data before key has been retrieved
  Correct CryptoException error returned before keys have been loaded
2017-04-19 23:40:51 +00:00
Rahul Frias
6260d4d628 Merge "Allow OfflineLicenseRenewal test to be repeatedly invoked" into oc-dev 2017-04-19 18:11:48 +00:00
Rahul Frias
0f374af4ab Allow decryption of unencrypted data before key has been retrieved
[ Merge of http://go/wvgerrit/25987 ]

Test: Added Cdm/WvCdmSessionSharingNoKeyTest to request_license_test.
      Verified by wv unit and integration tests.

b/28182987

Change-Id: I9039bc1fca83e2c1044c3af2f47f31dc4fb5c910
2017-04-19 00:47:40 -07:00
Rahul Frias
5321b96623 Correct KeySetId value when returned by AddKey
[ Merge of http://go/wvgerrit/25643 ]

The MediaDrm#provideKeyResponse API states that an empty byte array is
returned when the license type is streaming or release but a non-empty
value was being returned in some cases.

The KeySetId is now returned when the license type is offline or when
the license is streaming and has a secure stop associated with it.

Test: Verified by request_license_test integration tests. Tests have been
      modified to validate the returned Key Set Id values.

b/36093612

Change-Id: I82dba537c77ddd1d1876cbce58729f3db901ee51
2017-04-14 07:54:01 -07:00
Rahul Frias
b474ba042e Allow OfflineLicenseRenewal test to be repeatedly invoked
[ Merge of http://go/wvgerrit/25720 ]

Test: Repeatedly invoke WvCdmRequestLicenseTest.OfflineLicenseRenewal

b/28915200

Change-Id: I5be6be02d09ced1a7ba8bac2c8706f199d063db8
2017-04-11 16:40:16 -07:00
Rahul Frias
e75d3a6512 Revise usage entry metadata
[ Merge of http://go/wvgerrit/23742 ]

In OEMCrypto V13, usage table header and usage entries are stored in
persistent non-secure storage and loaded and unloaded from the TEE.
Information needs to be maintained to assist finding the associated license
or usage information. This information has been revised for usage information
to use key set id and usage info file name rather than provider session
token and app id.

The app id is stored in a hashed form (usage info file name) and was not
extractable during the upgrade process to OEMCrypto V13. Due to this
DeviceFiles UsageInfo routines have switched to use usage info file name
rather than app id as a key.

b/34327459

Test: Verified by unit/integration tests on angler
Change-Id: I95aa0435d0955c61fc45b951f5b5d44de2ba5cfc
2017-02-16 14:58:34 -08:00
John W. Bruce
c85351682f SPOID
(This is a merge of go/wvgerrit/23182)

This patch adds the framework for Stable Per-Origin Identifiers to the
CDM. Calculating SPOIDs will be done on the client-side, and they are
sent as part of the provisioning request. SPOIDs are also available to
the app as the Device Unique ID, replacing the previous method of
returning the actual Device Unique ID from the keybox / OEM certificate.

Different SPOIDs must use separate storage, just as different origins
already do. Support for this has been added to the Android adapter to the
CDM Core. However, the code in the Android glue layer that would drive
this behavior will be checked in in a separate change. As such, all
Android devices will continue using the legacy behavior even after this
patch goes in, until the glue layer code can be updated.

Bug: 27101531
Test: CE CDM Unit Tests
Test: Linux Jenkins Unit Tests
Test: Android Unit Tests (with and without SPOIDs forced on)
Test: Android GTS Tests
Change-Id: Ia0caf890381cbcb97504d08b19aeab8b29bd07ae
2017-01-25 15:45:01 -08:00
Rahul Frias
14fe03e195 Merge changes I6d7b5bfb,Ib9041d39
* changes:
  Add License::Policy::play_start_grace_period_seconds
  Update CDM to newest license protocol definitions.
2017-01-20 23:02:05 +00:00
John Bruce
e782a78e9c Merge "Update Widevine Version Number for Android O" 2017-01-20 19:18:31 +00:00
Rahul Frias
b492f7b73b Update CDM to newest license protocol definitions.
* CDM license protocol updates

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

No functional changes (yet) - all tests in widevine_ce_cdm_unittest
run successfully.

* Address android test build failures

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

Updates to the license_protocol.proto in go/wvgerrit/22789
did not include the integration tests for android.

b/34202048

Test: Reran unittests. All tests other than some oemcrypto,
request_license_test passed. Those tests failed with or without this CL.

Change-Id: Ib9041d397187859b8fcbc1b1f7d275f8c4ef6aba
2017-01-20 10:55:01 -08:00
John W. Bruce
9ef114392d Update Widevine Version Number for Android O
(This is a merge of go/wvgerrit/23080)

Updates the Widevine version number and canary for the Android O
release. Widevine is now at v5.0.0 on Android.

Bug: 34114979
Test: request-license-test
Change-Id: I19558d6b297263f816522176a5649be70b471073
2017-01-17 11:09:01 -08:00
Rahul Frias
2045316001 Add API for device provisioning server certificate
[ Merge of http://go/wvgerrit/20205/ ]

This is separate from the server certificate used for license
requests.

b/34211823

Test: Reran unittests. All tests other than some oemcrypto,
request_license_test passed. Those tests failed with or without this CL.

Change-Id: I23abdf276f8d3db9222f014175d0bb5094010a04
2017-01-13 13:18:39 -08:00
John W. Bruce
5f4397fdc4 NYC-MR2 Widevine Version Number Bump am: 1b298c6ec7
am: 8309a406b3

Change-Id: I10117c8fd120a64489b0094a231c9b3e63ba3b2c
2017-01-06 02:03:24 +00:00
John W. Bruce
1b298c6ec7 NYC-MR2 Widevine Version Number Bump
(This is a merge of go/wvgerrit/22897)

Bumps the Widevine version to 4.2.0 for NYC-MR2 and also updates the
test to expect the NYC-MR2 OS version number.

Bug: 32955300
Test: request_license_test
Change-Id: I2f186928f20e0848cbeef5fef2182045ad27140a
2017-01-05 15:50:31 -08:00
Rahul Frias
4c89e58f9b Correct subsample flags in request_license_test am: e7782c1e27
am: 541c9e632a

Change-Id: Ib97b8d7a9bfe57f68275e9193943df84afa729e5
2016-12-05 23:06:59 +00:00
Rahul Frias
541c9e632a Correct subsample flags in request_license_test
am: e7782c1e27

Change-Id: I7667fe5cd3ae42b72b5c65686bc9ae8f78fb61af
2016-12-05 23:03:12 +00:00
Rahul Frias
dab8aab4a8 Merge "Correct subsample flags in request_license_test" into nyc-mr2-dev 2016-12-05 22:58:51 +00:00
Rahul Frias
e6f668ca16 Release offline release sessions
[ Merge of http://go/wvgerrit/21960 ]

When an offline release message is generated, a session is created
internally to generate the release and handle the release response.
If the response is never provided (network, server errors),
or there is an error when the response is being processed, the
session may not be closed. This change introduces a time to live for
release sessions of 60 seconds and will be reclaimed after this period.

Test: verified by unittests on angler

b/32223945

Change-Id: I3bd4637733ddf6c343956ed9f97c68d84dc7d4e4
2016-12-04 01:51:09 -08:00
Rahul Frias
9a55ca3249 Release offline release sessions -- DO NOT MERGE
[ Merge of http://go/wvgerrit/21960 ]

When an offline release message is generated, a session is created
internally to generate the release and handle the release response.
If the response is never provided (network, server errors),
or there is an error when the response is being processed, the
session may not be closed. This change introduces a time to live for
release sessions of 60 seconds and will be reclaimed after this period.

b/32223945

Change-Id: I3bd4637733ddf6c343956ed9f97c68d84dc7d4e4
2016-12-02 14:43:53 -08:00
Rahul Frias
e7782c1e27 Correct subsample flags in request_license_test
[ Merge of  http://go/wvgerrit/21980 ]

b/32487750

Change-Id: I5a3c3a768f3d1a81af4e8d897f68cfdbeb3526da
2016-12-01 11:17:59 -08:00
Fred Gylys-Colwell
f248bbb9ee Merge "File util, generic crypto, and key query" 2016-10-25 17:40:54 +00:00
John "Juce" Bruce
2201d52b4c Update Expected Version Number in Canary
(This is a merge of go/wvgerrit/21580)

The version number for N-MR1 has been increased to 7.1.1, which
triggered our version number canary. Since this is still N-MR1, no
Widevine version number update is necessary as we already updated it for
N-MR1, but the canary needs to be updated.

Bug: 32018966
Change-Id: Ia1d673f837d9c6a5935f26beec7372b25ea3a6b9
2016-10-19 13:36:01 -07:00
Fred Gylys-Colwell
eb3f8b786a File util, generic crypto, and key query
This CL merges several CLs from the widevine repo:

http://go/wvgerrit/18012 Add support for querying allowed usage for key.
http://go/wvgerrit/17971 Add per-origin storage.
http://go/wvgerrit/18152 Add OEMCrypto's generic crypto operations to CDM.
http://go/wvgerrit/17911 QueryKeyControlInfo => QueryOemCryptoSessionId

Note: numbering in wv_cdm_types.h was added in this CL and will be
back ported to wvgerrit in a future CL.

Change-Id: Idb9e9a67e94f62f25dc16c5307f75a08b3430b64
2016-09-14 16:43:07 -07:00
John "Juce" Bruce
08a706f1b0 Widevine Version Number for NYC-MR1
am: 15ca8148a8

Change-Id: I6faba922cc7b02cf4e2a7a274cdd554bc294deb1
2016-09-02 20:15:01 +00:00
John Bruce
3fbc2106d8 Merge "Widevine Version Number for NYC-MR1" into nyc-mr1-dev 2016-09-02 20:09:55 +00:00
John "Juce" Bruce
15ca8148a8 Widevine Version Number for NYC-MR1
(This is a merge of go/wvgerrit/20402)

This updates the version number to v4.1.0 for the NYC-MR1 release. It
also updates the canary to pass on the nyc-mr1-dev branch.

Bug: 30813903
Change-Id: I05de038ff52e9f7633efff7011052b48b59d90fa
2016-08-23 15:34:39 -07:00
Rahul Frias
6a206191f0 Do not convert the protection scheme to network byte order
[ Merge of http://go/wvgerrit/19960 ]

Protections schemes are specified using a 4CC code {"cbc1", "cbcs",
"cenc", "cens"}. A host to network conversion was performed when the
PSSH was created and inserted into the license request. A reverse
conversion was performed when the code was extracted from the
license response.

These conversions are problematic if the PSSH is created externally and
passed into mediaDrm. To address this, the conversions have been removed
and allow protobuf to handle byte ordering. For backward compatibility
we allow codes in either ordering.

b/30713238

Change-Id: I25f01ecc621549fd3c13b443e4c8b89168463249
2016-08-23 12:51:12 -07:00
Jeff Tinker
2bd6131162 Update the expected android build version for NYC release
bug: 29270537
Change-Id: I2f85dd95e1a2b9eaa79299441b48716599211eea
2016-06-17 00:39:33 +00:00
Rahul Frias
c535436bab Modify QueryStatusL3 test to allow for L3 devices
[ Merge of http://go/wvgerrit/17501 ]

Widevine request_license_tests were written with the expectation that
devices would by default be enabled for security level 1 and fallback
to level 3 if needed. Some devices such as seed are L3 only and results
in failures in the QueryStatusL3 test. This CL corrects the test's
expectation.

b/26902214

Change-Id: Ie84554337cd3716d120f67e592888af0cde719c7
2016-04-13 10:30:07 -07:00
Rahul Frias
7cb83eb02e Load keys before sending OnKeyStatusChange notifications
[ merge of http://go/wvgerrit/17454 ]

When processing a license or renewal, calls to Set/UpdateLicense
update the policy information. A side effect was introduced whereby
updating the policy may cause (expiration, session key state)
notifications to be sent to the listener. Due to the ordering,
the notifications would be sent before the keys were loaded/refreshed,
which caused issues when the notifications were immediately acted upon.
This has now been corrected.

b/27842970

Change-Id: Id81a71ff48edfa9ca0baafc43267995d5a3e80a6
2016-04-07 15:58:45 -07:00
Rahul Frias
85d776c8b8 Address SessionSharingTest failures from WV request_license_test
[ Merge of http://go/wvgerrit/17204 ]

Sleep was being employed, to introduce a delay so that one license expired
but the other was still active. The duration was long enough that
occasionally the second license would also expire, causing the test to fail.
Reduce the sleep duration to correct this behaviour.

b/27673513

Change-Id: Ieef9100c98783c16fc5ab8fe345fa1dd26604f18
2016-03-21 15:29:08 -07:00
Rahul Frias
59580f40ab Add CDM integration tests for HLS
[ Merge of https://go/wvgerrit/17083 ]

b/27559429

Change-Id: I65a0a163e0e14bf711c257d7ab2c9486ec002c07
2016-03-09 01:13:47 -08:00
Rahul Frias
aefd104981 Use session with longest remaining duration when session sharing is used.
[ Merge of https://go/wvgerrit/16940 ]

An alternate scenario to renewing keys is to load the same keys in
a separate session and make use of them by using the session sharing
feature.

Session sharing involves iterating through a map of sessions and
returning the first session that contains the Key ID. In certain cases
(license about to expire) we might prefer an alternate session
be chosen.

Licenses may expire in two ways. Policy engine, driven by a 1 second
timer may detect expiry and send an asynchronous event. OEMCrypto may
also detect expiry based on information in the key control block
and return an error during decryption. It is possible that these
may differ by upto a second. This can lead to issues where decryption
fails but EVENT_KEY_EXPIRED is not generated till later.

It is possible to address this by using information from both timers
to notify the app about expiry. To implement this correctly will
add complexity and require synchronization between threads. To avoid
this an alternate solution is, if session sharing is used, to pick
the session that has a license with the longest remaining validity.

b/27041140

Change-Id: I398cc4c10ee3a2f192d4a0befe7c8a469dd5bf86
2016-02-24 10:22:18 -08:00
Rahul Frias
a444571c53 Refactor GenerateKeyRequest to reduce number of parameters
[ Merge of http://go/wvgerrit/16625 and http://go/wvgerrit/16633 ]

Reduce the number of parameters needed by GenerateKeyRequest.
Combining all output values into a single struct.

BUG: 26162546
Change-Id: Ibeb3f4df4a8e877511f8ab2e6c543001a921f285
2016-02-10 17:50:05 -08:00
Kyle Alexander
c7e92b68e6 Update canary test with latest Android version string.
This silences the canary test to match the Android version string
change from NYC to N. properties_android.cpp has already previously
been updated for N, so no need to bump the Widevine Android version
number at this time (see: go/ag/800077)

Matching Widevine cl: go/wvgerrit/16664

Bug: 26901110
Change-Id: Ib8f47f77bbb4dd2c7c302102fe43007059af2d50
2016-02-04 20:47:12 +00:00
John "Juce" Bruce
64ad54fdb0 Update Widevine Android Version Number to 4.0
(This is a merge of http://go/wvgerrit/15992)

This also updates the canary so that it will be silent on master.

Bug: 25153516
Change-Id: I11163c98230c5a521609b5556b139f4508996858
2015-10-23 15:12:11 -07:00
Rahul Frias
72e4a10a8b Merge "Additional merges from cdm master" 2015-10-07 20:42:38 +00:00
Rahul Frias
e5dfb83e03 Improve query performance
[ Merge of http://go/wvgerrit/15780 ]

Android mediaDrm allows callers to serially query status information through a
property API. CDM however retrieves all status information in a map and
filters out all but the relevent one. This leads to delays in Netflix app
startup. Rewriting the CDM interface to return only the queried value.

b/24181894

Change-Id: Ie9ed6288524e3a7e03b83aa55ef3531dd52a0dfb
2015-10-05 15:22:20 -07:00
Rahul Frias
0fe3f79cc3 Additional merges from cdm master
* Update unit test make files to use BoringSSL

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

  This CL updates the android makefiles to use the libcrypto_static.

* Do Not Run Provisioning Tests On Devices Without Keyboxes

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

  The provisioning tests outside OEMCrypto were failing on devices that
  use baked-in certificates because only OEMCrypto knows that the cert
  is baked in and the device cannot be reprovisioned. This change
  skips those two tests if the device says it does not implement
  rewrapping the cert. (i.e. it does not implement provisioning)

  Bug: 23554998

* Add new third-party libs (protobuf & gyp)

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

  The CE CDM used to expect these to be installed system-wide, which
  creates challenges for integrators who must cross-compile the CDM.

  These are now used in source form from third_party.

Change-Id: I29cca2f9415fe2fafdf948273e5a0f5d7de50285
2015-10-05 14:24:40 -07:00
Rahul Frias
85da7bdb98 Refactoring to cache service certs and initialization data
* Extend CdmLicense's stored_init_data_

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

  CdmLicense will store init data when a server cert must be
  provisioned.  After provisioning, the original init data can be used
  to generate the originally-intended license request.

  To do this before, the caller had to call CdmSession's
  GenerateKeyRequest with an empty InitializationData object.  However,
  the init data's type still had to be set, as did the license type.

  This CL allows the caller to use a truly empty InitializationData
  without a type.  To permit this, CdmLicense now stores a full
  InitializationData object, rather than just a copy of it's data field.

  With this CL, the caller also avoid storing the original license type.
  To accomplish this, CdmSession uses the already-set is_offline_ and
  is_release_ flags from the original call to reconstruct the intended
  license type.  The caller uses the new type kLicenseTypeDeferred.

  To facilitate storing whole InitializationData objects, they are now
  copyable.

  This ultimately simplifies server cert code for the new CE CDM.

* Store service certs in Properties

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

  This allows CE devices to mimic the Chrome CDM's behavior of sharing
  server certs between sessions.

  This also affects Android behavior.  Previously, provisioned service
  certificates were per-session, while explicitly-set service certs
  were per-DRM-plugin.  Now, both are per-DRM-plugin.

  A DRM plugin is associated with a mediaDrm object. Content
  providers will still be able to retrieve and use different
  certificates. The change here requires an app, that wishes to use
  different provisioned service certificates will have to use
  multiple mediaDrm objects. This is an unlikely scenario.

Change-Id: If2586932784ed046ecab72b5720ff30547e84b97
2015-09-30 10:51:46 -07:00
Rahul Frias
4e047b8b0c Make CdmProvisioningResponse const and DeviceFiles level support
* Make CdmProvisioningResponse const.

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

  The lack of const on this reference seems to be a mistake, since the
  responses is never modified.  This also allows the new CE CDM to pass
  responses directly through from the caller.

* Let Properties determine DeviceFiles level support

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

  Non-Android platforms do not have multiple security levels, and so do
  not use the security level to construct a base path.

  Instead of requiring a known "security level" to construct a file,
  accept anything that platform Properties will accept as a base path.

* Drop Properties::GetSecurityLevel().

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

  This seems to be dead code.

Change-Id: I94a970279213100730d6e6c763558dbe386f936a
2015-09-25 19:05:02 -07:00
Rahul Frias
ae5397ebcd Merge "Prevent renewal license when can_renew is set to false" 2015-09-23 07:13:02 +00:00
Fred Gylys-Colwell
bf0c87e734 Modify Code to Work with Clang/C++11
Merge from widevine repo of http://go/wvgerrit/15659

The clang compiler is more strict about C++11. This is needed for
future Android work.

In particular, iostream no longer converts to bool automtically, so
those instances were replaced with ss.fail().

Arrays or structures that appear to be variable length need to be
placed last in a structure.  In oemcrypto_test a variable size
structure was replaced with an explicit buffer size, and a check was
added to make sure the buffer is not exceeded.

bug: 20893039
Change-Id: I5e25fc618dcf68262079c15554ee4ceae1858b8b
2015-09-16 15:58:33 -07:00