Commit Graph

580 Commits

Author SHA1 Message Date
Jeff Tinker
7aa99d4a36 Squashed commit of 3 CLs related to provisioning retries
Bug: 8770327

    1. Allow provisioning retries

    Allow multiple provisioning request messages to be generated without
    requiring an equal number of HandleProvisioningResponse's. This is to
    allow for lost messages.

    2. Properly deletes cdm and crypto sessions created for cert provisioning.

    The CleanupProvisioningSession() has not been deleting the cdm and crypto sessions
    created for certificate provisioning properly. The lives of these sessions are
    short and therefore, not added to the CdmSessionMap. We need to explicitly delete
    these objects when error occurs or when we are done with provisioning.

    3. Fixes provisioning responses that contain multiple chunks.

    When we make multiple provisioning requests during testing, Apiary
    sends response that contains more than one chunk. The test app.
    needs to parse the response and concatenates the chunk data.
    Otherwise, the size for each chunk is treated as base64 encoded data,
    which will generate error when we try to deserialize the response
    message.

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

Change-Id: I5b0ed982849c12628a3949f8d51515fcf6ce5a5f
2013-05-06 23:04:34 -07:00
Jeff Tinker
d0f1784615 Sends signed provisioning request as query string instead of payload.
Bug: 8790775

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

Change-Id: I749303eee8162f37982f6dd5d83b6cf254b96847
2013-05-06 16:28:32 -07:00
Jeff Tinker
779b887bb3 Merge "Generate renewal and expiry events" into jb-mr2-dev 2013-05-06 22:11:14 +00:00
Jeff Tinker
3cfb86cea1 Generate renewal and expiry events
The android timer class was not generating timer events correctly. This caused
renewal and expiration events not to be sent. A strong pointer to the
timer thread was not held and this caused the android util timer
thread to exit after firing once. This is now addressed.

Bug: 8736545

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

Change-Id: I2d904e55d4d10eacc1a51f1c6b5c1a267c92c8d8
2013-05-02 16:42:04 -07:00
Jeff Tinker
e9ab093917 Merge "Hook up events and new exceptions in the MediaDrm API test" into jb-mr2-dev 2013-05-01 22:02:10 +00:00
Jeff Tinker
cb5541b740 Hook up events and new exceptions in the MediaDrm API test
Bug: 8725707

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

Change-Id: If142e558585e5cc7ba0cecf45693413943b2b64f
2013-04-30 17:35:29 -07:00
Jeff Tinker
4bce2959ef Allow PSSH data to be unspecified on license renewal
Currently the CDM requires the caller to specify init data both on key
generation and renewal requests. With this change the CDM relaxes
this requirement for renewals.

Bug: 8732893

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

Change-Id: Idf4ad2bdb20023da4f30bc369ed87eb811c1c4d9
2013-04-30 17:32:20 -07:00
Jeff Tinker
d291efc823 Update Integration Documentation
This CL updates to the latetest Widevine Integration document.

bug: 8698129

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

Change-Id: I3f0ce88915057285ce6de80582d75a0514b92f79
2013-04-25 17:25:12 -07:00
Jeff Tinker
665c9c1525 Verify version number of Level 1 OEMCrypto before using it
There is an OEMCrypto wrapper that loads the OEM provided library.
For debugging and initial implementation, this only verified that some
of the API existed before continuing.
With this CL, the level 1 library is not used if any of the API
functions are missing, or if the version number is not correct.  There
is no plan to make this library backwards compatible.

bug: 8621521

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

Change-Id: Ie82907925450b9fe93d0d857c1133f5382f55d21
2013-04-25 14:48:19 -07:00
Jeff Tinker
63c597d330 Update path to Widevine MediaDrm engine credentials
Use separate directories for unit test-generated
credentials vs actual credentials, so the unit test
credentials don't interfere with the real ones.

related-to-bug: 8620943

Merge of:

Update path to where CDM persistently stores data
https://widevine-internal-review.googlesource.com/#/c/5300/

Rename Keybox File
https://widevine-internal-review.googlesource.com/#/c/5240/

... from the widevine CDM repo.

Change-Id: Idefa484b3a2f71f723238f033460bf431ce4209b
2013-04-25 14:12:11 -07:00
Jeff Tinker
e8575212b6 Merge "Add Widevine Security Integration Guide to tree" into jb-mr2-dev 2013-04-25 20:59:52 +00:00
Jeff Tinker
d1e2925cf0 Add Widevine Security Integration Guide to tree
Having the integration docs in the tree helps with version
management and distribution to partners.

bug: 8698129
Change-Id: I4c1e4f5902457815eaf58e6bd5313951d2b773ca
2013-04-25 13:54:27 -07:00
Jeff Tinker
187d3e94e8 Translate Some CDM Errors as Events
The CDM may use the eventing mechanism or the error return-value mechanism to
notify callers of errors that the Java APIs expect to be passed via the
eventing mechanism.  We need to detect when an error has been synchronously
returned via the error return value of a method and fire an appropriate event.

bug: 8620943

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

Change-Id: I2055854dc960845dc775b1fceab9d0850b63fbb5
2013-04-25 06:14:37 -07:00
Jeff Tinker
15cf441d17 Fix RefreshKey Test
The test for refresh keys with a stale nonce was not performed
correctly.  It was supposed to test that RefreshKeys fails when the
nonce is stale.  However, the nonce in the test was not stale. The reference
implementation did fail, but it failed because the control bits were
in network byte order instead of host byte order.  Both of these
problems are fixed in this CL.
This CL changes test code only.  The change has already been
communicated with Qualcomm.

bug: 8621521

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

Change-Id: I0821eff914d1680481006b9b68d49e8f2c5b9cd8
2013-04-25 06:00:23 -07:00
Jeff Tinker
f702e50919 Update java MediaDrm API test to cover more of the API
bug: 8620943
Change-Id: I72b690cfcd838064a470042e0943a711cc536207
2013-04-25 05:34:39 -07:00
Jeff Tinker
b5a782bdb2 Changes JSON format for provisioning request and response to match server change.
This new format uses the SignedProvisioningMessage proto buffer definition so
the client does not have to parse the message and signature from the JSON
response separately. This change makes it more flexible to extend the fields
in the SignedProvisioningMessage.
Adds Apiary API key to the default provisioning server url.
Fixes a bug in GetCertRequestResponse() where a LOGD() can generate a
fault if there is no response data.

Bug: 8620943

Merge of https://widevine-internal-review.googlesource.com/#/c/5230/
from Widevine CDM repository

Change-Id: I4945ee2d16f88666e41edf990dd07102a9271105
2013-04-25 03:34:31 -07:00
Jeff Tinker
f2406daae1 Use /data/mediadrm for MediaDrm plugin-related storage
related-to-bug: 8702754

Merge of:

Rename Keybox File
https://widevine-internal-review.googlesource.com/#/c/5240/

Store persistent data in /data/mediadrm
https://widevine-internal-review.googlesource.com/#/c/5234/

...from Widevine CDM repository

Change-Id: I4030257942e572e6f42cc8f32872a6409d9e3892
2013-04-24 22:10:44 -07:00
Jeff Tinker
b7debfe2a1 Enable certificate based licensing
Includes fixes for provisioning and license renewal signature generation.

bug: 8620943

Merge of:
  https://widevine-internal-review.googlesource.com/#/c/5231/
  https://widevine-internal-review.googlesource.com/#/c/5200/

from the Widevine CDM repository.

Change-Id: I2928c9d59ad5337ca34b4ef7ed58272d34755d2d
2013-04-24 22:08:02 -07:00
Jeff Tinker
4b0963de96 Update MediaDrmAPI test to use boxless-pssh
bug: 8584241

Merge of https://widevine-internal-review.googlesource.com/#/c/5280/
from Widevine CDM repository

Change-Id: I3596e41a67df44e25c9b31c4c16d4c3d9b7ad92a
2013-04-24 14:29:27 -07:00
Jeff Tinker
8f7ed34c3a Wrap Init Data in PSSH Box
The Java APIs only easily expose getting the PSSH data blob, not the full PSSH
box.  So that apps do not have to do extra work, wrapping the PSSH data blob in a
PSSH box again, we do it for them in the DrmPlugin.

Includes requisite changes to the Unit tests

Bug: 8584241

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

Change-Id: Ifb5910dd52380e1b591ecdf1e4273c8d9f3294cc
2013-04-23 16:38:17 -07:00
Jeff Tinker
1aff209f91 Field provisioning for L3 OEMCrypto
bug: 8621460

Merge of https://widevine-internal-review.googlesource.com/#/c/4955/
from Widevine CDM repository.

Change-Id: I30cf4314283db51c8e706c026501784259c87c13
2013-04-23 15:37:58 -07:00
Jeff Tinker
958bbe6d05 Certificate provisioning verification
bug: 8620943

This is a merge of changes made to the Widevine CDM
repository during certificate provisioning verification.

The following changes are included:

Fixes for certificate based licensing
https://widevine-internal-review.googlesource.com/#/c/5162/

Base64 encode and decode now handles non-multiple of 24-bits input
https://widevine-internal-review.googlesource.com/#/c/4981/

Fixed issues with device provisioning response handling
https://widevine-internal-review.googlesource.com/#/c/5153/

Persistent storage to support device certificates
https://widevine-internal-review.googlesource.com/#/c/5161/

Enable loading of certificates
https://widevine-internal-review.googlesource.com/#/c/5172/

Provide license server url
https://widevine-internal-review.googlesource.com/#/c/5173/

Change-Id: I0c032c1ae0055dcc1a7a77ad4b0ea0898030dc7d
2013-04-22 20:12:03 -07:00
Jeff Tinker
3a28eeeb68 Part of Qualcomm L1 OEMCrypto integration on mako
bug: 8621521

This fixes a problem where insecure audio buffers were being
passed incorrectly as secure buffers to the trusted
environment's OEMCrypto_DecryptCTR.

This is a merge of the following changes from the widevine
git repository to android git repository:

https://widevine-internal-review.googlesource.com/#/c/5163/2
Allow selection of secure/non-secure buffers

https://widevine-internal-review.googlesource.com/#/c/5164/
Pass Secure Buffer Request to CDM

Change-Id: Iec1192a216305c6cf92c359b15b148eccc6ce6ce
2013-04-22 17:50:38 -07:00
Jeff Tinker
e4181922af Merge "Increment IV in WVCryptoPlugin" into jb-mr2-dev 2013-04-22 23:34:06 +00:00
Jeff Tinker
039822d4cb Merge "Part of Qualcomm L1 OEMCrypto integration" into jb-mr2-dev 2013-04-22 23:20:14 +00:00
Fred Gylys-Colwell
39ea1df671 Part of Qualcomm L1 OEMCrypto integration
Upgrade to version 2.1 of license protocol in OEMCrypto.

related-to-bug: 8621521

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

Change-Id: I0d85dae1981b7525ab17aec5f21cf668d078bf47
2013-04-22 16:15:03 -07:00
John "Juce" Bruce
088288cb76 Increment IV in WVCryptoPlugin
WVCryptoPlugin was not properly implementing part of its responsibilities to
AES-CTR in ISO-CENC.  Specifically, it was not incrementing the IV after each
block.

Also, I have greatly expanded the unit tests for decrypt() to catch more edge
cases.

This change fixes the two failing test vectors in the Java integration tests.

Copied from https://widevine-internal-review.googlesource.com/#/c/5123/2

Bug: 8656421
Change-Id: If935edbf01068f5b0d5254b4e657057ef57d8fcf
2013-04-22 14:25:06 -07:00
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
40abceaaed Merge "Fix DASH movie playback decrypt error" into jb-mr2-dev 2013-04-14 23:56:40 +00: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
c0dde16644 Merge "Widevine CENC drm engine update" into jb-mr2-dev 2013-04-12 22:39:03 +00: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
1a93e68a4b Merge "Fix for b/8594163 [SelectContentKey(): No key matches key id]" into jb-mr2-dev 2013-04-11 22:18:15 +00: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
Edwin Wong
cd7c58be45 Removes intermediate proto generated files and cdm library files.
Change-Id: I6e22025a3df60adc396209d69dc1332c37b8bc6b
2013-04-10 11:44:40 -07:00
Ying Wang
3711ca87ae Merge "Add liblog" into jb-mr2-dev 2013-04-10 05:11:02 +00:00