Commit Graph

102 Commits

Author SHA1 Message Date
Rahul Frias
3d599197be Correct CryptoException error returned before keys have been loaded
[ Merge of http://go/wvgerrit/25983 ]

Earlier versions of android returned CryptoException with
error code ERROR_NO_KEY, when a decrypt call was received before keys were
loaded. Changes to O resulted in ERROR_SESSION_NOT_OPENED being returned
instead. This CL reverts the behaviour.

Also a change to correct CDM error code numbering in comments.

Test: Verified by unit and integration tests

b/37219830

Change-Id: I43758cd29cf9d1945f878ac352a5f26538b48cdb
2017-04-19 00:40:48 -07:00
Rahul Frias
80798ae11c Merge "Revert "Detect when unable to meet policy requirements"" into oc-dev 2017-04-18 20:37:22 +00:00
Rahul Frias
e733943729 Revert "Detect when unable to meet policy requirements"
This reverts commit 1223330ccc.

b/37460568

Change-Id: I936c06f679126ac50fb2d4753b4270b4ba42def5
2017-04-18 20:03:56 +00:00
Rahul Frias
551f4cb474 Merge "Detect when unable to meet policy requirements" into oc-dev 2017-04-15 06:50:05 +00:00
Jeff Tinker
f5240b69e4 Translate CDM session not opened errors
The drm hidl hal specifies that operations on sessions that
are not opened return ERROR_DRM_SESSION_NOT_OPENED.  This
change adds that translation, previously they were mapped
to unknown error.

Test: drm vts test

bug:34178477
Change-Id: I3777dd90eea7061f3fa5413a5732d7d58b85b49b
2017-04-14 00:28:47 -07:00
Rahul Frias
1223330ccc Detect when unable to meet policy requirements
[ Merge of http://go/wvgerrit/25781 ]

The security level (software/hardware, decryption/decode)
in the policy that specified how the key was to be used was
not being respected for L3. Playback would either continue or
a vendor specific error would be thrown.

If the device cannot use the key as permitted by the policy
CryptoException#ERROR_INSUFFICIENT_OUTPUT_PROTECTION will be thrown.

Test: Verified by WV unit+integration tests.
      Verified by WidevineDashPolicyTests
      Verified by WidevineDashPolicyTests#testL3SoftwareSecureDecoderRequired,
      testL3HardwareSecureCryptoRequired, testL3HardwareSecureDecodeRequired,
      testL3SecureVideoPathRequired.

b/31913737
b/31913439

Change-Id: Ibfc7f3dd6fc7264e8cf9b0d33f6f8d619eed6c00
2017-04-13 16:50:10 -07:00
Rahul Frias
ce62e1d7e7 Correct error returned when license is for the future
[ Merge of http://go/wvgerrit/25721 ]

Return CryptoException with errorCode ERROR_NO_KEY when an attempt is made
to make use of a license whose start time is in the future.

Test: Verified by WidevineDashPolicyTests#testL1LicenseStart2030

b/31914841

Change-Id: I2a157c227550a2391b6536365f34f1dfec3dea0c
2017-04-12 13:20:44 -07:00
Jeff Tinker
76f43abcbe Add checks for invalid parameters
Part of VTS test suite validation

related-to-bug: 32815560

Test: drm hal vts test
Change-Id: I52be29cd46f535482a761f98acf6ff28870c061c
2017-03-30 16:15:01 -07:00
Fred Gylys-Colwell
14c3a3865a Give Nonce Error Explicit Name
Merge from widevine repo of http://go/wvgerrit/24421

A nonce generation error for a certificate provisioning request had a
generic name Error2.  However, this is an actionable error by the
application: the application should wait 1 second and try again.
Therefore it deserves a more descriptive name.

bug: 35926133
bug: 35879493

Change-Id: I6c87a5a762cb970c9530a55c993d7acbed773a00
2017-03-03 21:25:20 +00:00
Rahul Frias
db5c3dfb6d Enable usage header table and entries
[ Merge of http://go/wvgerrit/24022 ]

b/34327459

Test: Verified by unit, integration tests on angler

Change-Id: Idb17dc472dddbdad217c35bdaa3fb20ae8152371
2017-02-17 09:54:33 +00:00
Rahul Frias
0db3a137e9 Introduce UsageTableHeader class
[ Merge of http://go/wvgerrit/23820 ]

The UsageTableHeader class is a singleton that CDM sessions will share.
A separate object will be created for each security level. The class
synchronizes access to usage table header and associated data-structures
and controls when they are read in or written out to non-secure persistent
storage. Upgrades from a fixed size usage table (supported by previous
versions of the OEMCrypto API v9-12) are handled by this class.

b/34327459

Test: Verified by unit/integration tests on angler

Change-Id: Ifc5996985e76bc260c01e55bc12aab1248389a80
2017-02-17 04:14:09 +00:00
Rahul Frias
db6df99db1 Add usage support query method
[ Merge of http://go/wvgerrit/23522 ]

A helper method has been added to CryptoSession to determine whether the
TEE supports usage tables, usage table headers+entries or does not
provide any support for persistent licenses.

In addition
* CryptoSession now supports deletion of multiple
  usage entries rather than a single one.
* Typedefs have been added for usage table headers and entries

b/34327459

Test: Verified by unit/integration tests on angler.

Change-Id: I634d3b7b81ce94d1deccd2a7aaf26b9efde414a8
2017-02-07 13:50:22 -08:00
Rahul Frias
6d617e2be4 Implement Cdm::listStoredLicenses()
[ Merge of http://go/wvgerrit/23600 ]

This adds a new entry to IStorage:: -

  bool list(std::vector<std::string> file_names)

It returns the name of each file in the (origin-specific) file system.

b/34628115

Uses the current file system (origin-specific) bound to the CDM. Returns
the list of stored licenses (key_set_ids) in vector output parameter.

Test: verified by unittests on angler.

Change-Id: I988556b27c2a4b75f52b59bcd78cfeaddd649acd
2017-02-07 13:28:05 -08:00
Rahul Frias
d29886f184 Changes to CryptoSession to support big usage tables
[ Merge of http://go/wvgerrit/23167 ]

This allows CryptoSession to support the new functionality added to
OEMCrypto to support big usage tables. No changes in behavior yet.
Code that calls these methods will be in a subsequent CL.

b/34327459

* Minor changes to cdm/Android.mk and cdm/test/unit-test.mk to remove
  profiler changes that were missed in previous releases.

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

Change-Id: I9becd97c5a8ddf74d30fabd1251e796b534c010f
2017-01-26 00:51:51 +00:00
Rahul Frias
0c4b8572cd Report disable analog output error
[ Merge of http://go/wvgerrit/23061 ]

b/34131127

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

Change-Id: I27a3cde8e5c86dc8f9b26f9d4e7793f86c016743
2017-01-23 20:03:10 -08:00
Rahul Frias
2812c3d2ac Support Keybox, DRM Cert, and OEM Cert for Client ID
[ Merge of http://go/wvgerrit/22900 ]

Add GetClientToken(), GetProvisioningToken(), GetPreProvisionTokenType()
to CryptoSession.  They return the correct token bytes and token type
for preparing the ClientIdentification message for provisioning and
license server transactions.

Also refactor service certificate handling.

OEM certs are introduced in Provisioning 3.0

b/30811184

* Address build breaks

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

This addresses issues introduced by http://go/wvgerrit/22900

b/30811184

* When http://go/wvgerrit/18012 was merged (ag/1446934) some changes
were not merged for mapErrors-inl.h. These changes are included in this CL.

* When ag/1678104 was reverse merged to http//go/wvgerrit/21981/ a variable
was renamed and some comments were added to add clarity in cdm_engine.cpp.
These changes are included in this CL.

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

Change-Id: Ie0215509f2f985f2a610f5a4c865db47edec8662
2017-01-20 16:42:21 -08: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
Rahul Frias
b76eccf32d Return ERROR_INSUFFICIENT_OUTPUT_PROTECTION when appropriate
[ Merge from http://go/wvgerrit/17429 ]

This is to correct for when HDCP validation failure at the OEMCrypto level
ends up returning a CryptoException through MediaCrypto with error code
Unknown Error (-2998).

b/27849488

Change-Id: Ib3a9b1c3a17b9323f3d079a678cf88dedeec3b4b
2016-04-05 16:44:31 -07:00
Jeff Tinker
65ed606872 Fix some vendor-specific error reporting
Some decryption errors were being reported as
vendor-unique diagnostic codes that were not generally
actionable by an app.  Recently a new
MediaCodec.CryptoException code was added so these types
of failures can be reported as ERROR_UNSUPPORTED_OPERATION,
in which case the app can use an alternate DRM
configuration in a way that does not require
vendor-specific handling. This change remaps this class
of decrypt errors to the new error code.

Merge of http://go/wvgerrit/17110

bug: 25929554
Change-Id: Iff44c2f04f9ee28d065fb17d59bca4032c5d55ca
2016-03-18 14:16:16 -07: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
Rahul Frias
ae99bb6d11 Verify cipher block mode during decryption
[ Merge from http://go/wvgerrit/16498 ]

The CDM now supports AES CTR and CBC block cipher modes. The license
specifies the mode to be used in the key container. The mode is
also specified in mediaCrypto when calling decrypt. This adds
verification for the cipher block mode.

Change-Id: I2587fc1e4b6d77161f2f8653f8516024c73dd8ac
2016-01-19 16:23:40 -08:00
Rahul Frias
84a14f2561 Generate key set ID on initialization and interface clean up
This is a merge of squashed CLs.

* Cdm Session and Engine interface clean up

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

Key Set Ids have been removed from the CdmSession interface
(GenerateKeyRequest, Addkey) as they can be queried by an accessor.

The CdmEngine interface now allows one to specify or retrieve a session ID,
since both were not being used in a single call. Key set IDs are no longer
returned though GenerateKeyRequest as they was not being used.

* Generate key set ID when session is initialized

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

Key set IDs are currently generated at different times in the
CdmSession lifecycle. Android generates key set IDs when the license
is received, while the CE CDM generates (or overrides them)
when the session is constructed.

The key set IDs are now generated when the session is initialized.
Key set generation cannot occur earlier as it has a dependency on
security level and in turn on crypto session initialization which
occurs when the session is initialized.

Depenencies on Session ID has caused other activities, construction of
PolicyEngine, CdmLicense, setting property CDM client sets to be
deferred from CdmSession constructor to Init().

Android will still retrieve the key set IDs after the offline license is
processed. For streaming requests, the key set will be
unreserved and discarded when the session is terminated.

Change-Id: Ib802d1c043742d62efa9a2c901fcd113e836c33d
2016-01-15 17:09:09 -08:00
Rahul Frias
d2dc2e3670 Store key set ID with usage info
[ Merge of http://go/wvgerrit/16241 and http://go/wvgerrit/16364 ]

This will allow a usage session to be loaded later by key set ID.
This is needed for EME-style secure stop in the new CE CDM API.

b/25816911

Change-Id: I916340047492fbc0556d0e90bd2eac0f3eafe597
2016-01-15 12:59:40 -08:00
Fred Gylys-Colwell
e4513f4a59 Merge CE Device Changes
This is a merge of the following changes made for CE devices in the
widevine share repo:

http://go/wvgerrit/16211 Only load offline session if needed in GKR
http://go/wvgerrit/16245 Unreserve IDs in reservation test
http://go/wvgerrit/16242 Re-enable WebM tests
http://go/wvgerrit/16240 Un-reserve reserved license IDs
http://go/wvgerrit/16190 Add temporary session type
http://go/wvgerrit/16189 Enforce license type and can_persist for storage

Change-Id: I592416f66c0d1286844266c01cc9b4906c7b6b05
2015-12-07 14:12:46 -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
Rahul Frias
cdf309b9f4 Reject session clobbering and namespace fixes
* Reject session clobbering.

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

  This fixes a bug in I17de92b3e682c9c731f755e69466bdae7f560393 in which
  sessions can be clobbered by a forced session ID.  This bug manifested
  in subtle test failures which involved repeatedly creating sessions.
  This was traced to OEMCrypto not being terminated, then upward to a
  leaked CryptoSession and CdmSession, and then finally to clobbered
  session IDs.

  To avoid the bug in future, first, reject duplicate session IDs.
  Second, change the OpenSession API to make forced IDs explicit.

* Fix unit test namespaces.

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

  This fixes some odd errors that occur when linking multiple test
  suites into one executable.  When two object files both contain
  a definition of wvcdm::MockCryptoSession, for example, one will win
  silently and cause the other's tests to misbehave and/or crash.

  The solution is to put all mocks into an anonymous namespace, since
  each wvcdm::(anonymous)::MockCryptoSession is separate.

  In order to avoid lots of repetitions of wvcdm:: in the anonymous
  namespaces, all anonymous namespaces in unit tests now live inside
  or the wvcdm namespace.  This has been done even for tests which
  are not currently using mocks.

* Move timer and timer_unittest to Android.

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

  These are not used anywhere else.

Change-Id: I234f31e9b5c79061205728783596ebaff65e0aff
2015-09-28 15:54:22 -07:00
Rahul Frias
395f68456b Prevent renewal license when can_renew is set to false
[ Merge of https://go/wvgerrit/15670 ]

b/18459002

Change-Id: Idad43a621750ff01aee61e8d972957f364a698cf
2015-09-16 15:30:38 -07:00
Jeff Tinker
1319c43361 Part of fix for libmedia OOB write anywhere
Prevent usage of client provided address on
non-secure devices spoofed as being secure.

b/23223325

merge of go/wvgerrit/15420 from widevine repo

Change-Id: I1d4f3a652b3d5e78fca508f92005cfa8df5ec6db
2015-08-17 17:56:27 -07:00
Jeff Tinker
47014df2e8 Return specific error code when decrypting on invalid session
bug: 22235465
Change-Id: I7b4d47d86d35270291ced02112a96800ba03ed1a
2015-07-07 08:55:22 -07:00
Rahul Frias
f08d6fae3a Address compiler warning
[ Merge of http://go/wvgerrit/14788 ]

A retired error code was not being handled when converting from
a WVStatus error code to a ERROR_DRM_VENDOR error code.

b/13976775

Change-Id: Ib4363792e4a5e9a20fc718d169b3e0348413267a
2015-06-19 11:14:21 -07:00
Rahul Frias
99a2346e3a Return more descriptive error codes on license generation failure
[ Merge from http://go/wvgerrit/14745 ]

License generation errors previously would result in code -2916 being returned
though the mediaDrm API. More descriptive error codes are now being returned
from -2850 to -2836

b/13976775

Change-Id: I613ad650ab0a072ce9d8029e2af52b72dc617236
2015-06-17 17:32:11 -07:00
Rahul Frias
b33298a742 Fix for concurrent provisioning attempts
[ Merge from http://go/wvgerrit/14670 ]

Concurrent provisioning attempts are declared successful if any one of them
succeeds. Earlier only the successful ones were declared as such.

b/21727698

Change-Id: I67dedca44790a4ae236e14f90a8fc91775273905
2015-06-12 14:37:41 -07:00
John "Juce" Bruce
a8328dd2f9 Delete Singleton on Library Unload
(This is a merge of http://go/wvgerrit/14531)

As an optimization, the Media Server now unloads our library when not
in use. This has exposed a bug by which we were never deleting the CDM
singleton. Fix is to make WvContentDecryptionModule an Android smart
pointer ref base and then make sure all the plugins store a strong
pointer to it. The singleton is a weak pointer, so when the last
plugin is cleaned up, the CDM will be as well. And on the off chance
that the library isn't immediately unloaded, the singleton code will
generate a new CDM next time one is needed.

Bug: 21153732
Change-Id: Ifaf02fa9afe0a70a8b53e8b92ee0a3d1359ca001
2015-06-09 14:58:01 -07:00
Rahul Frias
d2e91faf8e Respect Client Properties when reporting CDM Status
[ Merge from go/wvgerrit/14286 ]

CDM now reports status information associated with the specified security level.
Earlier information would be reported from the default security level.

b/18709693

Change-Id: I7a01e8ea9773b56951c207437ce85e567fd32b09
2015-05-07 16:35:51 -07:00
Rahul Frias
20fc54e384 Add client information to release and renewal messages
[ Merge of go/wvgerrit/14240 ]

Client information is reported in release and renewal messages based on
flag in the license. License proto has been updated to match server updates.

There are two caveats
* Client IDs will be reported unencrypted when usage reports are requested.
* Release requests that enable privacy mode (encrypted client IDs) but do not
  specify a service certificate are not supported.

b/19247020

Change-Id: I95e709922122370f310936fbad3d312262128e49
2015-05-04 18:24:00 -07:00
Edwin Wong
2eb013691c Add more CdmResponseType to help with debugging in the field.
The errors in the range ERROR_DRM_VENDOR_MIN to ERROR_DRM_VENDOR_MAX are
reflected in the message that is reported to the app, which is
MediaDrmStateException.getDiagnosticInfo().

Many errors map to kErrorCDMGeneric, especially KEY_ERROR is used as a
generic error in CDM. This fix defines more specific error codes in the
CDM for places where KEY_ERROR is returned.

Merge from http://go/wvgerrit/14071

bug: 19244061
Change-Id: I688bf32828f997000fea041dd29567dde18ac677
2015-04-15 11:44:06 -07:00
John "Juce" Bruce
0540770280 Remove Backwards-Compatibility for Classic MediaCodec Mode
(This is a merge of http://go/wvgerrit/14082)

Previously, the CryptoFactory had special behavior to defer creation
to Widevine Classic if no session ID was provided. This functionality
has been deprecated, as MediaCodec Mode is no longer supported.

This is necessary as part of supporting the new API for session ID
changes because the expectation is that it is now legal to initialize
a modular CryptoPlugin without a session ID.

Bug: 19570317
Change-Id: Iad0cd01b6a8d2e66c94c5f53a8a60f5787bc02f8
2015-04-10 16:00:22 -07:00
John "Juce" Bruce
efea2ddba4 Allow Unprovisioning of Origins
(This is a merge of http://go/wvgerrit/14051)

Adds support for passing a special provisioning response ("delete")
to the provisioning API in order to unprovision the current origin.
Note that the origin MUST be set or else this will fail.

The existing, system-only unprovisionDevice() method is unaffected.

Bug: 12247651
Change-Id: I16d296397d8e9e73c8f43e36c86838873318a398
2015-04-09 19:07:51 -07:00
Dan Albert
723d67c88f Remove Widevine CDM Dependency on STLPort
* Replace an stlport static assert with a C++11 static_assert.
 * Move some libraries that were being built with the NDK but
   statically included into platform code off the NDK.
 * Rebuild the obfuscated binaries to use the new STL.
 * Remove MIPS support temporarily due to an inability to generate
   obfuscated binaries for it. (To be fixed in b/19482469.)

Bug: 15193147
Change-Id: Icc166583b0c6af68550baf17ab8c33076a1179d3
2015-02-25 15:53:36 -08:00
John "Juce" Bruce
7eea20df86 Add Support for Audio MIME Types
The EME spec technically requires CDMs to treat audio/mp4 and
video/mp4 equivalently, as well as audio/webm and video/webm. We had
only been accepting video/mp4 and video/webm up until now.

This change also centralizes handling of init data types in the shared
CDM code instead of having it spread across multiple places in the
codebase.

(This is a merge of https://widevine-internal-review.googlesource.com/9532/
from the Widevine CDM repo.)

Bug: 13564917
Change-Id: Ib8bdfb2b003ffb00e8f0559561335abb3c5778b0
2014-04-02 15:39:12 -07:00
Jeff Tinker
3db90f54c1 Support CAST V2 authentication
bug: 12702350

Squashed commit of these CLs from the widevine cdm repo:

Cast V2 cdm support
https://widevine-internal-review.googlesource.com/#/c/9190/

Add CASTv2 Support to DrmPlugin
https://widevine-internal-review.googlesource.com/#/c/9228/

Test for CastV2 authentication APIs
https://widevine-internal-review.googlesource.com/9550

Change-Id: I6d66bc1bbd653db5542c68687b30b441dd20617f
2014-04-01 14:26:27 -07:00
Jeff Tinker
f51c0d27e1 Support New isContentTypeSupported API
Adds support and tests for the new isContentTypeSupported API to the
Widevine DrmEngine.

Bug: 10244066

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

Change-Id: I4f606de7897a49da745ff76faceeb358f8ac9073
2013-08-22 09:33:58 -07:00
Rahul Frias
f6c2a60485 Allow Apps to Voluntarily Downgrade to L3 Crypto
This merges the following changes from the Widevine CDM repository:

564f4cc  Add CdmClientPropertySet to CDM
  Adds an interface to the CDM that allows it to query its client for
  certain properties.  In this case, this includes the ability to
  specify what security level is desired, as well as support for
  service ceritifcate privacy mode.

9cfbd3e  Force Level 3 fallback
  Adds support for voluntarily invoking L3 crypto to the OEMCrypto
  wrapper.

95d12c1  Add pointer to CdmClientPropertySet class to OpenSession.
  Adds support for storing the property set on a session-by-session
  basis and choosing the appropriate crypto level.

17de442  Add Settable Properties for Clank to Android
  Adds support for setting the aforementioned properties to the
  DrmEngine

bbe704d  Fixes to force fallback to level three security
  Corrections to invoke provisioning, OEMCrypto API with configured
  security level rather than the default. Unit tests were also revised.

Note that some parts of this are also support for the ability to use
a service certificate-based privacy mode. The remaining code for
supporting this mode is still forthcoming.

Bug: 10109249
Change-Id: I2755e4dea1de3e8a56cff237360298f7b7f1bddc
2013-08-15 11:31:45 -07:00
John "Juce" Bruce
e3ed6194fe Report Insufficient Resources for Crypto
This merges the following changes from the Widevine CDM repository:

bef58bc  Add new error codes
  Adds new error codes to OEMCryptoCENC.h and rearranges it to more
  closely match the documentation.

5fcfbca  Handle OEMCrypto_ERROR_INSUFFICIENT_RESOURCES on Decrypt
  Changes the CDM to support the new errors from the previous change.

d59c09d  Report Insufficient Crypto Resources
  Changes the DrmEngine to support the new errors from the previous
  change.

1085a21  Respond to Too Many Keys or Sessions Errors
  Allows errors around having too many keys or sessions to result in
  a unique error in the CDM.

Bug: 9695816
Change-Id: I826bc655109fa57e4f75de7158d7f392053666b1
2013-08-08 14:55:11 -07:00
Jeff Tinker
0190f99fb3 Migration from jb-mr2 to master for Widevine CDM
Android development of the widevine CDM has been done
on the jb-mr2 branch of the cdm code base.  This CL
contains a merge of that jb-mr2 work to CDM master, and
also reflects the evolution of the common Modular DRM
code base since jb-mr2 branched.

Change-Id: I1d7e1a12d092c00044a4298261146cb97808d4ef
2013-07-29 17:29:07 -07:00
Jeff Tinker
36aeacde48 Optimize Status Queries in WVCryptoPlugin By Deleting Them
Removes the status query from WVCryptoPlugin's decrypt method.  It was not
providing any additional security since it was not cryptographically secure,
and querying status is an expensive operation on some devices.  It should not
be done on a frequent basis, such as in every decrypt call.

Bug: 8667365

Merge of https://widevine-internal-review.googlesource.com/#/c/5121/
from widevine CDM repository to android repository.

Change-Id: Id9a877c5655cb8dbee7e97f983d43ec2ab6acc6e
2013-04-19 16:38:42 -07:00
Jeff Tinker
cd304b1c46 Use Standard Errors in DrmPlugin
Now that MediaErrors.h has errors for some of the conditions we were using
custom error codes for previously, we should switch to using the standard
error codes in order to get better error reporting to the app.

Bug: 8621516

This is a merge of https://widevine-internal-review.googlesource.com/#/c/5040/
from widevine cdm repo to android repo.

Change-Id: I111a8825fa8fd8186a0d535cf19a7b08d9f35aee
2013-04-18 16:28:02 -07:00
Jeff Tinker
c1474b9912 Add Detail Error Messages
Reworks the error message reporting that was just added to WVCryptoPlugin so
that it reports detailed error messages to the app (because the error codes
cannot be relied upon to reach the app intact) and so that it always reports
custom errors so that the detailed error message is passed to the app.

Bug: 8621516

Merge of https://widevine-internal-review.googlesource.com/#/c/5031/ from
widevine git to android git.

Change-Id: Id7a517fb6e4e772ffea4c779a8ee52b357345a08
2013-04-18 14:21:37 -07:00
Jeff Tinker
ded298688c Improve Error Reporting
Adds more meaningful error reporting where possible to the DrmEngine.  Adds
translation of CDM and OEMCrypto errors to Android errors.

Bug: 8621516
Change-Id: Ibab8a8711c3929ed72870ec7e138cd42358d9fb3
2013-04-17 19:02:54 -07:00
Jeff Tinker
e6b1fedc4c Widevine CENC drm engine update
bug: 8601053

This import syncs to the widevine git repository change
commit 6a99ad1b59ad39495f62954b3065ddc22b78da49

It includes the following changes from the widevine git
repository, which complete the jb-mr2 features

    Fix Unit Test Makefile
    Adds support for device certificate provisioning.
    Support application parameters
    Certificate based licensing
    Proto for client files
    Implement Property Query API
    Add Device Query For Unique ID
    Implement Generic Crypto in DrmEngine
    Do not validate Key IDs on clear playback
    Allow OEMCrypto_DecryptCTR with clear content and no key
    Add a case to the MediaDrm API test to repro b/8594163
    Implement requiresSecureDecoderComponent
    Implement Eventing API
    Add end-to-end decryption test with vectors
    Refactoring of properties class
    Refactor OEMCrypto unittest.
    Fix for b/8567853: License renewal doesn't renew license.
    Add KEY_ERROR callback to WvContentDecryptionModule() ctor.
    Merged certificate_provisioning.proto and
      client_identification.proto to license_protocol.proto.
    Fix nonce check failure after a malformed key in OEC Mock.
    asynchronize decryption
    Allow querying of control information
    make debugging AddKey & Decrypt statuses easier
    Revert "Revert "Send KEY_ERROR event to app on license
      expiration or failure""
    Revert "Send KEY_ERROR event to app on license expiration
      or failure"
    Send KEY_ERROR event to app on license expiration or failure
    remove extra session id copy
    use KeyError constants directly
    replace variable-length arrays with std::vector and fixed-sized array
    pass session ids as const references
    refactor key extraction and update keys on renewal
    Updates to enable renewals and signaling license expiration.
    fix error constant in OEMCrypto_DecryptCTR

Change-Id: I5f7236c7bdff1d5ece6115fd2893f8a1e1e07c50
2013-04-12 14:21:37 -07:00