Commit Graph

22 Commits

Author SHA1 Message Date
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
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
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
Rahul Frias
48feb576e6 Enable CDM integration tests to run against staging
[ Merge of https://go/wvgerrit/15534 ]

Added command line support and configuration information.
Removed secure transfer, full path and port options from the usage
message as they are not supported.

b/23593222

Change-Id: I7d4cdb4b4db543a6302c742bfc2d2572d75957bd
2015-09-10 14:13:10 -07:00
John "Juce" Bruce
59811eed57 Support Per-Origin Provisioning
This is a merge of several Widevine-side commits that, cumulatively,
allow callers to specify an origin to be used to isolate data storage
as specified in the W3C Encrypted Media Extension specification.
Separate origins have separate certificates, and consequently cannot
share device identifiers with each other.

The changes included in this are:

Add Ability to Check for Existing Certificates
    http://go/wvgerrit/13974
Add Ability to Remove the Certificate
    http://go/wvgerrit/13975
Make CDM Origin-Aware
    http://go/wvgerrit/13977
Add Per-Origin Storage to Widevine CDM on Android
    http://go/wvgerrit/14026
Remove Automatic Origin Generation
    http://go/wvgerrit/14031

Bug: 19771858
Change-Id: I6a01c705d9b6b4887a9c7e6ff4399a125f781569
2015-04-09 19:02:31 -07:00
Kongqun Yang
bdb82e04f8 Report change in session expiration
Bug: 19771612

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13885/

Change-Id: I754f06a7ed9476554f9e1da3fe23f4563f9fc07e
2015-03-31 14:33:53 -07:00
KongQun Yang
85e838b957 Replace generic OnEvent with actual event callbacks
Also pass session_id and event_listener to PolicyEngine to make it easier
to dispatch events from PolicyEngine.

Bug: 19771437

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13816/

Change-Id: I5723cb371cb3c43c945051af3402b09069ba5859
2015-03-27 21:42:20 +00:00
Kongqun Yang
170485f771 Merge "Fix cdm_extended_duration_test failures" 2015-03-27 20:24:26 +00:00
Kongqun Yang
49f7d4cdf8 Merge "Report key request type in GenerateKeyRequest" 2015-03-27 19:43:41 +00:00
Jeff Tinker
7c28090a61 Annotate logcat with current running test
It's hard to correlate test failures with the tests that
were running when looking in the logcat.  This change adds
the current test name in the log for each test to make it
more clear.

Merge of go/wvgerrit/#/c/13847/ from the widevine cdm repo

b/19822500

Change-Id: Idd37a22f7063d9d686d3ead567954b86fb0fa70f
2015-03-26 13:47:36 -07:00
Kongqun Yang
ef00d84b05 Fix cdm_extended_duration_test failures
Remove renewal related expectations from WvCdmStreamingPstTest.

Also clean up the code in cdm_extended_duration_test.cpp.

Bug: 19534907

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13842/

Change-Id: I89f9aafd80c8867af541b29bc8a6778f53a8b7e6
2015-03-26 13:36:46 -07:00
Kongqun Yang
8ea1ab7f5e Report key request type in GenerateKeyRequest
Bug: 19771299

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13830/

Change-Id: Id9b4547febcabbb73a4be5dbb2e4c63b1c3eacd3
2015-03-26 13:35:38 -07:00
KongQun Yang
6d9e0302f2 Merge "Refactor WvCdmEventListener and some cleanups" 2015-03-23 16:44:26 +00:00
Edwin Wong
f65c88d35c Fix GetResponse() return type usage and log response data if error occurs.
The return type of GetResponse() has been changed from int to bool a while back.
Fix the return type in unit tests that were still expecting int as the return type.
Also log the response message if there is an error in the http response.

Merged from go/wvgerrit/13783.

bug: 19822500
Change-Id: Ie52df0e19744a847690b788680f59915b0b6b534
2015-03-20 14:36:12 -07:00
KongQun Yang
fddbc89136 Refactor WvCdmEventListener and some cleanups
Bug: 19771437

It is a merge of below CLs from Widevine CDM repo:

Clean up CdmSession and PolicyEngine testing injection
https://widevine-internal-review.googlesource.com/#/c/13700

Refactor WvCdmEventListener handling
https://widevine-internal-review.googlesource.com/#/c/13702

Change-Id: I356b90000c056113d394926862b859aab380d305
2015-03-20 11:25:52 -07:00
Fred Gylys-Colwell
d2ba3a3f91 Allow selective removal of Usage Table Entries by PST
This is a merge of http://go/wvgerrit/13693 in the Widevine
repository.

This adds level 3 and mock implementation and unit tests for the
OEMCrypto function OEMCrypto_ForceDeleteUsageEntry.  It also plumbs
this function up into CdmEngine, CdmSession, and CryptoSession so that
deleting all usage information for a given app id will now delete the
entries in OEMCrypto, too.

b/18194071

Change-Id: Iaea4034a507b323878657215784edfe95876386a
2015-03-18 18:09:37 -07:00
Fred Gylys-Colwell
12a986f808 Clean up some compiler warnings
This is a cherry pick of http://go/wvgerrit/13665

Added a few static casts and removed some unused parameters.

Change-Id: I4f2d1c26580a188de429defc8d1d22757f4c6917
2015-03-16 11:31:48 -07:00
John "Juce" Bruce
1bd405fc40 Merge Tweaks Originating in Merge Review Comments
This merges several small changes that were made in response to
comments that arose when LMP changes were merged into the Widevine
repository's master branch.

Change-Id: Ifec968af54dbc3288f24654ec0c6ca9b5962e1aa
2015-03-10 16:08:20 -07:00
Rahul Frias
aa7ad630d7 MediaDrm throws an exception when Secure Stops are requested
Our recommendation to OEMs is that they support a table of at least 50
usage entries in OEMCrypto. If more usage entries are stored, the PSTs get
added to the CDM but are LRU'ed out of the OEMCrypto usage table. When the
CDM queries those usage entries, OEMCrypto will return a
OEMCrypto_ERROR_INVALID_CONTEXT. Rather than return an error and have
MediaDrm throw an exception, CDM should delete this PST and return the
next usage entry, when queried.

[ Merge of https://widevine-internal-review.googlesource.com/#/c/11457/
  from Widevine cdm repo ]

b/17994711

Change-Id: I00e3f93000096fb434d94333e22958de795a4bb5
2014-11-13 12:56:26 -08:00
Fred Gylys-Colwell
20191d996c Allow Secure Stops to be queried and deleted by application ID
This CL changes the WVDrmPlugin so that an application can segregate
its secure stops from those of other applications by setting an
application ID.

This CL is a merge of the following Widevine CLs:
https://widevine-internal-review.googlesource.com/#/c/11565/
Add getSecureStop by ssid

https://widevine-internal-review.googlesource.com/#/c/11572
Add getSecureStop by SSID and releaseAllSecureStops by app id.

https://widevine-internal-review.googlesource.com/#/c/11564/
Store Usage Info by App Id (device_file stubs)

https://widevine-internal-review.googlesource.com/#/c/11563/
Add application id to StoreUsageInfo.

https://widevine-internal-review.googlesource.com/#/c/11561/
Added Application ID to PropertySet for secure stop.

bug: 18053197
bug: 18076411
Change-Id: I5444baf67ba1b960dee2dc958bced8de82ab70a3
2014-11-05 17:39:44 -08:00
Rahul Frias
9bc13a07a0 Corrections for license release on fallback to L3
When falling back to L3, release requests were failing. Information
requesting falling back to L3 is passed along when the session is opened.
Licenses however are released using the key set ID and information
requesting fallback to L3(CdmClientPropertySet) at that point is
unavailable. The release was actually attempting to release a license
at the default security level which is incorrect.

In addition, the mac keys were not being setup correctly and the release
message was signed with keys derived from the license request and not the
response.  Both these issues have been addressed and unit tests added
to track release of offline licenses and usage reporting scenarios.

[ Merge of https://widevine-internal-review.googlesource.com/#/c/11062
  from wv cdm repo ]

b/17073910

Change-Id: I5cd95a7dfe58ebae7ae27ece6c92e67755c1d665
2014-09-04 10:29:10 -07:00
Rahul Frias
4819a26bd4 Fixes for query information and usage reporting
* The Usage APIs return usage reports from either L1 or L3 (if available).
* Correction to when usage reports are saved. In addition to other events
  they are now saved when keys are loaded, usage reports are released and soon
  after first decryption and periodically (60 seconds) after that,
  if decryption takes place.
* Usage reports now get deleted on an unprovision request.
* Policy timer is now started when offline licenses are restored.
* Usage session is now released, when a usage response is received.
* Usage tests ahev been enabled.
* Added CDM extended duration (integration) tests to test usage reporting
  and querying. These need to be run manually as they take a while (currently
  half an hour).

b/15592374

[ Merge of https://widevine-internal-review.googlesource.com/#/c/10800
  from the Widevine CDM repo ]

Change-Id: Ia817e03ebbe880e08ba7b4a235ecb82b3ff35fbf
2014-08-07 10:58:40 -07:00