Commit Graph

3287 Commits

Author SHA1 Message Date
Rahul Frias
a2eeb8abf7 Native fault in MediaDrm property call
OEMCrypto was being initialized on session creation. Calls to
get property information may occur before any sessions are
created. This resulted in calls to OEMCrypto before a call to
OEMCrypto_Initialize which caused a segfault.

OEMCrypto initialization is now verified before any other calls are made.
Unit tests have been modified to verify that this indeed works.

bug: 8660973

Change-Id: I1b14fa8ad2e88750776b28715a48d8a1d1c57089
2013-04-20 23:52:50 -07:00
Jeff Tinker
bb0c62768a Merge "Don't add offsets to ion handles" into jb-mr2-dev 2013-04-20 00:16:02 +00:00
Jeff Tinker
d29372909d Don't add offsets to ion handles
Fixes a secure buffer addressing offset error in the Widevine
CENC drm engine.

bug: 8667527

Merges the following from Widevine CDM repository:

Allow specification of offset into secure buffer
https://widevine-internal-review.googlesource.com/#/c/5100/

Update WVCryptoPlugin to Pass Output Offset as a Separate Parameter
https://widevine-internal-review.googlesource.com/#/c/5120/

Add offset to secure data buffer in OEMCrypto DecryptCTR
https://widevine-internal-review.googlesource.com/#/c/5110/

Change-Id: Ic3e4b35304c8fbae4aebe4c495285eb787e8c205
2013-04-19 16:45:51 -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
87c3f5652f Merge "Unit test script and end-to-end license/decrypt test update" into jb-mr2-dev 2013-04-19 02:19:55 +00:00
Jeff Tinker
d601914d57 Don't set BufferType to clear for non-encrypted buffers
When non-encrypted buffers are sent to OEMCrypto_DecryptCTR,
the cdm is overriding the buffer type to be non-secure.  This
is incorrect, the encrypted state is not the same as the buffer
protection level.

This change removes the special case override that should not
be there.

bug: 8621521
Change-Id: I705b1dc82b393305b9e6bdcb524d6b8126f58d3d
2013-04-18 18:23:21 -07:00
Jeff Tinker
f2c3db81d3 Unit test script and end-to-end license/decrypt test update
Does not affect any production code, only unit tests

Makes the end-to-end license/decrypt test compatible with the
fix for b/8604068 (merged).

related-to-bug: 8604068

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

Change-Id: Ic5739c9de0cd385a672311ec87b9a475e367121a
2013-04-18 17:20:57 -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
fa1f5fafe1 Merge "Add Detail Error Messages" into jb-mr2-dev 2013-04-18 23:11:25 +00:00
Jeff Tinker
0ab787b958 Add Property to Access System ID
Adds a new property to the CDM's QueryStatus called QUERY_KEY_SYSTEM_ID that
contains the System ID. (as read from OEMCrypto_GetKeyData)  Adds a new
property to the DrmPlugin (cleverly named "systemId") that allows the app to
query for this.  Also adds unit tests.

Also changes the Device ID getter in crypto_engine.cpp to return a failure
instead of an empty ID.

Bug: 8621632

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

Change-Id: I8f309af18487c499e8ce25e829059e45623ea4dc
2013-04-18 15:25:11 -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
0fc9bf9699 Merge "Add device ID to Widevine license request" into jb-mr2-dev 2013-04-18 21:02:01 +00:00
Rahul Frias
7e390361f6 Add device ID to Widevine license request
Also added other Client identification fields specified in license exchange
protocol, Appendix C

https://docs.google.com/a/google.com/document/d/1cng6cDnchbDQDymLEd5MxMc_laS3EDv6IsoW3IzpgwQ/edit#heading=h.pmkiti873xeg

They are company, model, architecture, device and product name.

bug: 8292249
Change-Id: I4d5fa93a0c85c7abb025c66d48e4aafbfe90efd8
2013-04-18 10:02:27 -07:00
Jeff Tinker
38f5308c85 Update libwvdrmengine to be consistent with MediaDrm API review update
bug: 8603279

Change-Id: I1d4dfdc52c1cdb74ead4ad373a3a03abc8886299
2013-04-17 19:45:19 -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
4f47afda9f Fix DASH movie playback decrypt error
Decryption works now with Exoplayer

bug:8604068
Change-Id: Ib24fcd4bb1fce54db9111f3c51e6ab1ff6f475a3
2013-04-13 11:30:17 -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
Jeff Tinker
2f980d7d7e Fix for b/8594163 [SelectContentKey(): No key matches key id]
...when playing clear parts of encrypted content.

Change-Id: I5fb027d22212f07b43deced2da77c98cb3800e7f
2013-04-11 14:14:55 -07:00
Jeff Tinker
352e7b0820 Add end-to-end decryption test with vectors
Added a test_mode flag to the libwvdrmengine plugin
to support verifying decryption results.

Change-Id: I9edbd6279d54fc495b5bbad8273c179106cad474
2013-04-09 13:32:46 -07:00
Jeff Tinker
826576315c Widevine CENC drm engine update: enable decryption
This import syncs to the widevine git repostiory change
commit ab3e1e43642cf36900f55169597a33f222709fdb

Change-Id: I3a6f1e2969e5fe7ed1ca12f90b0eb0a3b7899835
2013-04-09 13:24:32 -07:00
Jeff Tinker
c0f1d6750e Fix broken full_x86 and full_mips builds
Also cleans up some redundant files.

Change-Id: Id9a18bcb917ae999865f7c5564a72dba27b0ce97
2013-04-04 19:44:27 -07:00
Jeff Tinker
f3ec8c19d6 Import updates to the Widevine CENC DRM Plugin
This change incorporates the following CLs from the Widevine
cdm repository:

    Update the java request/response test app to match Drm API changes
    Don't build the mock liboemcrypto.so by default
    Do not build CDM tests by default
    Fix Build Break in DrmEngine Unit Tests
    Fix Build Break in WVDrmPlugin
    Initial version of roadmap for CDM projects.
    Implement License Query
    Implement Generic DRM in OEMCrypto Reference Implementation
    Add key_data_length field when calling OEMCrypto_LoadKeys
    Policy engine unittests
    Generalized DRM API for OEMCrypto
    Fixes proto buf libraries build.
    Add Version Number to OEMCrypto API
    Test key control block duration field in OEMCrypto
    Add fix for missing crypto offset.
    Fixed android/media*/test builds and added proto files for Cert. provisioning
    Refactor and clean up callback code in CDM.
    Add "device_id" name-value pair to LicenseRequest::ClientIdentification
    Separate unit and end-to-end tests from the top level makefie.
    Includes changes for 'fall back to l3 oemcrypto lib' in top level makefile.
    Fall Back to Level 3 if Level 1 Fails
    Fix compilation error in wvcdm_unittest.
    Fix Android build break due to Decrypt() signature change in cdm_engine.h.
    Wire up callbacks and errors in the Steel proxy.
    Fix lock assert if there is no keybox on the device.
    RSA Certificate Unit Test
    Change Generic_Verify signature to constant.

Change-Id: I2e42db9d0b4f8d4e833675ae81d0714509bbfd2c
2013-04-03 19:53:12 -07:00
Jeff Tinker
998d67fc8c Merge "MediaDrm API update" into jb-mr2-dev 2013-04-02 22:49:22 +00:00
Jeff Tinker
9a16115975 MediaDrm API update
Clarify offline usage of sessions and keys and implement
implement CryptoSession to support additional crypto use
cases.

Change-Id: I3788e7b187cd20c4224bf07f3fc6bef48ee38bd6
2013-03-30 16:30:21 -07:00
Edwin Wong
fe06ceec14 Separate unit and end-to-end tests from the top level makefie.
The top level makefile will build license_protocol_protos.a, which is
needed by libcdm.a. Unit and end-to-end tests are now build separately
under cdm/test.

Also, the tests use Google C++ Testing Framework, so please build the
gtest library from external/gtest and run "mm" once before building
the tests.
Or just run "mmma vendor/widevine/libwvdrmengine" (or mma in
vendor/widevine/libwvdrmengine") once.

Change-Id: Iec5a7a974e2f23651191b7325230d9ae3d6b83f2
2013-03-27 11:54:46 -07:00
Jeff Tinker
1a8aa0dd05 Initial import of Widevine Common Encryption DRM engine
Builds libwvmdrmengine.so, which is loaded by the new
MediaDrm APIs to support playback of Widevine/CENC
protected content.

Change-Id: I6f57dd37083dfd96c402cb9dd137c7d74edc8f1c
2013-03-22 11:14:17 -07:00
Fred Gylys-Colwell
0d5a8ccc7a Move OEMCrypto Mock files to Clear Key Library
In order to match the other implementations of CDM, we are going
to replace the android OEMCrypto mockup with the one in the cdm
repository.

This would be disruptive to the clear key library because it
relies on the current implementation of the mockup.  In order to
prevent that, I am moving the current mockup into the same directory
as the clear key library.  Then, we can put the new mockup under
the directory libwvdrmengine.

This mockup will then be deleted when the clear key library is deleted.

Change-Id: I89ee23f249dacd18241ae5ca499329e620bf5a2c
2013-01-31 09:22:22 -08:00
Fred Gylys-Colwell
fede3bffdd Add DecryptCTR to OEMCrypto Mock
This is a software only implementation of the OEMCrypto library for
testing the rest of the DRM code.  It currently implements the
OEMCrypto_DecrtyptCTR function using a clear key.

I've included the license request code so the rest of the group can
play with it, but I have only tested part of it.

This patch also has some makefiles and an integration testing.  You
should be able to generate the shared library libclearkeydrmengine.so with
cd vendor/widevine/libclearkeydrmengine; mm
You can create some unit test and integration test programs from the
directories:
vendor/widevine/libwvdrmengine/oemcrypto/test
vendor/widevine/libclearkeydrmengine/test
vendor/widevine/libclearkeydrmengine/inttest
vendor/widevine/libclearkeydrmengine/crypto/test

This change also addresses some comments about comments in OEMCryptoDASH.h
which were made in https://googleplex-android-review.googlesource.com/257323

Change-Id: Id6899b9f8d2f09e09be2ea493baa83a6b929073b
2012-12-21 12:41:42 -08:00
Fred Gylys-Colwell
d5aa1e41d3 Threading Contract and Error Messages
I added a few error codes for out-of-resource type conditions.

I added comments explain which functions may be called simultaneously.

Basically, info only functions, like getDeviceId, may be called anytime after
initialization.  Functions that have a session parameter may be called at the
same time as other functions for a different session, but not for the same session.
Functions that create or delete sessions may not be called as the same time as any
each other, or at the same time as any session functions.  The CDM is required to
honor these conventions.

If the OEM can only decrypt for one session at a time, it is the OEM's
responsibility to hold a lock.

Change-Id: If4b11afd70b5b2e67d78802ea0057fb25271ae90
2012-12-05 15:58:55 -08:00
Fred Gylys-Colwell
03d43a5d2d Merge "Separate OEMCrypto DASH from Legacy OEMCrypto" 2012-12-04 14:32:35 -08:00
Fred Gylys-Colwell
4529037bd8 Separate OEMCrypto DASH from Legacy OEMCrypto
The file OEMCrypto.h was renamed to OEMCryptoDASH.h and all
functions that are only needed for legacy support were removed.

Change-Id: I3a7a6f8cbb3ee415b4a313416a25ed78785ecdd7
2012-12-04 13:48:52 -08:00
Edwin Wong
eebba73ce1 Merge "Add ContentDecryptionModule API" 2012-12-04 12:31:39 -08:00
Fred Gylys-Colwell
d74290cc9f Update OEMCrypto.h
This change incorporates updates to the Eureka version of
OEMCrypto.h as documented here:
     https://widevine-internal-review.googlesource.com/2334

Change-Id: I52abde82cbea9b30b74e9c2292e401d5318df99d
2012-12-03 14:17:53 -08:00
Rahul Frias
9a7e424596 Add ContentDecryptionModule API
This header file documents the interface of the ContentDecryptionModule
and the CDM client.

b7615806

Change-Id: I9a036ec5539f7e5b66adb8a6a4326120624d1b30
2012-12-02 22:49:02 -08:00
Fred Gylys-Colwell
684eb227d4 Add Mock OEMCrypto Stub
I added a Mock OEMCrypto implementation with stubs only.

I corrected the "extern C" location in OEMCrypto.h. (Thanks, Jerry!)

I added some Android.mk files that allows us to compile and
run a few simple unit tests.

Unit Test 1: The library compiles. (passes)
Unit Test 2: The test program links and runs. (passes)

Change-Id: Ib4c9554553de49645b5841b0bae889728cbfc8b1
2012-11-30 12:41:10 -08:00
Fred Gylys-Colwell
27bb877763 Add OEMCrypto.h Header
I put the OEMCrypto.h file in its final resting place.

Change-Id: Ie8ccf5501c518dda0a7ee4ea494e588ea9497afd
2012-11-27 16:40:42 -08:00
Fred Gylys-Colwell
225c70eeed Create Skeleton Directory Tree for DASH
This is the skeleton directory tree for work in the DASH
implementation.

Change-Id: I38b52d133d48df6b78f3d142b1969686c60fc76b
2012-11-27 13:04:27 -08:00