Commit Graph

847 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
b5e8b87fed Merge Changes from CDM repository
This CL merges the following changes from the Widevine repository:

Avoid CdmSession reinitialization
https://widevine-internal-review.googlesource.com/#/c/10530/

Fix timer-related unit tests.
https://widevine-internal-review.googlesource.com/#/c/10510/

Correct return statement
bug: 15590802
https://widevine-internal-review.googlesource.com/#/c/10553/

Usage reporting fixes
bug/15388863
https://widevine-internal-review.googlesource.com/#/c/10460/

Make public methods virtual
https://widevine-internal-review.googlesource.com/#/c/10500/

Fix the SetTimer contract in the CDM.
https://widevine-internal-review.googlesource.com/#/c/10493/

Move inline CDM methods, add OVERRIDE.
https://widevine-internal-review.googlesource.com/#/c/10475/

Simplify storage APIs related cleanup.
https://widevine-internal-review.googlesource.com/#/c/10473/

Duration values are not correctly reported when queried
b/15592374
https://widevine-internal-review.googlesource.com/#/c/10437/

Propagate IsKeyValid() through ContentDecryptionModule.
https://widevine-internal-review.googlesource.com/#/c/10483/

Minor clean up in config_test_env.
https://widevine-internal-review.googlesource.com/#/c/10440/

General clean up.
https://widevine-internal-review.googlesource.com/#/c/10441/

Refactor HttpSocket and simplify UrlRequest interface.
https://widevine-internal-review.googlesource.com/#/c/10410/

Install good keybox at end of unit tests
b/15385981
https://widevine-internal-review.googlesource.com/#/c/10374/

Privacy crypto fixes
b/15475012
https://widevine-internal-review.googlesource.com/#/c/10383/

Incorporate header files to resolve build issued based on customers feedback.
https://widevine-internal-review.googlesource.com/#/c/10420/

Support unprovisioning
b/12247651
https://widevine-internal-review.googlesource.com/#/c/10356/

Correct usage of Host::Allocate and Cdm::Decrypt.
https://widevine-internal-review.googlesource.com/#/c/10378/

Fix logging bug, arguments in wrong order.
https://widevine-internal-review.googlesource.com/#/c/10380/

Rename types that look like constants.
https://widevine-internal-review.googlesource.com/#/c/10379/

Fix offline test failures
b/13909635
https://widevine-internal-review.googlesource.com/#/c/10348/

Add -DUNIT_TEST to the unit test makefile for Android
https://widevine-internal-review.googlesource.com/#/c/10375/

Refactor privacy-crypto and add dummy version.
https://widevine-internal-review.googlesource.com/#/c/10353/

Remove References to Apiary
https://widevine-internal-review.googlesource.com/#/c/9924/

Delete oldest entry in usage table when full
bug: 15184824
https://widevine-internal-review.googlesource.com/#/c/10295/

Port DeviceFiles to iOS.
https://widevine-internal-review.googlesource.com/#/c/10355/

Make testing functions in DeviceFiles private.
https://widevine-internal-review.googlesource.com/#/c/10354/

Add RSA encryption to haystack
https://widevine-internal-review.googlesource.com/#/c/10280/

Add string and vector includes to CDM header.
https://widevine-internal-review.googlesource.com/#/c/10352/

First version of oemcrypto logging
https://widevine-internal-review.googlesource.com/#/c/10252/

Update Names of Secure Stop Methods
bug: 11987015
https://widevine-internal-review.googlesource.com/#/c/10152/

Adjust timing on the Usage Table unit test
https://widevine-internal-review.googlesource.com/#/c/10307/

Fix all compiler warnings in CDM source release.
https://widevine-internal-review.googlesource.com/#/c/10293/

Fix memset bug: args in wrong order
https://widevine-internal-review.googlesource.com/#/c/10292/

Partial revert of 'Remove refs to test prov server, Level3 support...'
https://widevine-internal-review.googlesource.com/#/c/10281/

Pack structure OEMCrypto_PST_Report
https://widevine-internal-review.googlesource.com/#/c/10243/

Remove refs to test prov server, Level3 support; remove dead code
https://widevine-internal-review.googlesource.com/#/c/10220/

Partial revert of 'Document data strings; clean up license server parameters.'
https://widevine-internal-review.googlesource.com/#/c/10188/

Document data strings; clean up license server parameters.
https://widevine-internal-review.googlesource.com/#/c/10120/

Fix broken build after partner branch merge.
https://widevine-internal-review.googlesource.com/#/c/10181/

TODO Cleanup - core/src, core/include
https://widevine-internal-review.googlesource.com/#/c/9965/

TODO Cleanup - cdm, chromium, core/test.
https://widevine-internal-review.googlesource.com/#/c/9419/

Remove unneeded properties.
https://widevine-internal-review.googlesource.com/#/c/10162/

Change-Id: If2bb9d743a562a3875bebb91933c0aaadea286b2
2014-06-27 18:59:56 +00:00
Fred Gylys-Colwell
6f3e866882 Pack structure OEMCrypto_PST_Report
Because the OEMCrypto_PST_Report is sent as a signed block to the
server, it needs to be a fixed, platform independent, size.  This CL
adds the packed attribute to the structure, which reduces its size
from 56 bytes to 48 bytes.

Copy of widevine change:
https://widevine-internal-review.googlesource.com/#/c/10321/

Library Versions:
libwvdrmengine/level3/x86/libwvlevel3.a  Level3 Library May 30 2014 15:40:50
libwvdrmengine/level3/arm/libwvlevel3.a  Level3 Library May 30 2014 15:39:04

bug: 15184821
Change-Id: I54db2c3bbc4e20ee0c19c33d6fd56f86f432e110
2014-05-30 15:47:16 -07:00
Fred Gylys-Colwell
d68e1f8307 Usage Table for Level 3 OEMCrypto
This is a copy of the widevine CL.
https://widevine-internal-review.googlesource.com/#/c/10174/

This CL adds the OEMCrypto v9 functionality to the level 3 haystack
version of OEMCrypto.  Mostly, this is to support usage tables.

The code is feature complete, but the timing tests are a little flakey
-- I'm not sure if the problem is in the code or if the test has too
tight a tolerance.

Also, the storage of the generation number needs to be made more
secure.

Change-Id: I73fecf8934b6a46785f1f8b6f40b40ffe39b88de
2014-05-18 19:44:28 -07:00
Jeff Tinker
93bf77ed6d Merge "Pack structure OEMCrypto_PST_Report" 2014-05-19 02:26:09 +00:00
Fred Gylys-Colwell
6bac5bc50d Clean comments, namespace, and variable names
This CL removes TODOs and email addresses from comments, unifies some
namespaces and cleans a few variable names.  It is a copy of multiple
CLs on the widevine side.

Change-Id: I1bb649096476a5001a56d746427399de6a88ff69
2014-05-16 15:53:12 -07:00
Fred Gylys-Colwell
4b83f96adf Pack structure OEMCrypto_PST_Report
This change is copied from the widevine CL:
https://widevine-internal-review.googlesource.com/#/c/10163/

Because the OEMCrypto_PST_Report is sent as a signed block to the
server, it needs to be a fixed, platform independent, size.  This CL
adds the packed attribute to the structure, which reduces its size
from 56 bytes to 47 bytes.

Change-Id: I2bae058b7eb0ac54ba9fad355f3d85ddc2cd4a58
2014-05-16 13:16:51 -07:00
Fred Gylys-Colwell
7f9bff5ef5 Correct message size in call to OEMCrypto_RewrapDeviceRSAKey
This is a copy of https://widevine-internal-review.googlesource.com/#/c/10040/

The message size was wrong on several OEMCrypto_RewrapDeviceRSAKey
unit tests.  The function was supposed to fail in these tests.
However, a vendor found that they were failing with a different error
code because the buffer size was incorrect.  Now the function should
fail with the correct error code, and the test should pass for the
vendor.

Change-Id: Iea27b489f9bc386241d9add4f99ccb50560dfef6
2014-05-06 17:54:18 -07:00
Fred Gylys-Colwell
1cd8195d88 OEMCrypto Usage Tables
This CL adds usage tables to the OEMCrypto reference implementation
(mock) and unit tests.

There is also a new parameter called oem_crypto_require_usage_tables
that determines if the usage tables are required or not.  This is set
to true for Android and false for all other platforms.

This CL is most of OEMCrypto version 9 updates.

This CL is a copy of
https://widevine-internal-review.googlesource.com/#/c/9720
https://widevine-internal-review.googlesource.com/#/c/9874
https://widevine-internal-review.googlesource.com/#/c/9873

Change-Id: I78c4f7651306f9f79ba2260c3e04fb1eca7e20e3
2014-04-24 11:40:30 -07:00
Fred Gylys-Colwell
e95eebf326 Refactor OEMCrypto mock and its unit tests
This is a copy of the Widevine CL:
https://widevine-internal-review.googlesource.com/#/c/9708/

This CL refactors some of code in oemcrypto/mock and oemcrypto/test in
preparation for adding usage table code.

Change-Id: I7e58c8ecd6d92b3e177cb915733212fcad645485
2014-04-10 17:34:51 -07:00
Fred Gylys-Colwell
026a04701e Test Key Control Block with HDCP Version
This is a copy of the Widevine CL:
https://widevine-internal-review.googlesource.com/#/c/9480/

This change is part of OEMCrypto API version 9.

This CL adds verification that a key control block which requires a
specific version of HDCP can be loaded.  Also, if secure data path is
not set, it verifies that data is still decrypted.

This CL also adds test that verify DecryptCTR fails when the current
HDCP version is below that in the key control block.  The expected
error is OEMCrypto_ERROR_INSUFFICIENT_HDCP.  This error code is newly
introduced in this CL.

This is one attempt to clarify HDCP, as specified in b/13626021, and
is a slight modification from previous behavior for the mock and the
level 3 haystacked code.

This CL also tests the two valid verification codes "kctl"
and "kc09".

bug: 13626021
Change-Id: If380709d2306a3489470b29fb148a45b609b089d
2014-04-10 16:22:25 -07:00
Fred Gylys-Colwell
7a4ae90b5b Unit Test for OEMCrypto_ERROR_KEY_EXPIRED
This is a copy from the Widevine CDM repository:
https://widevine-internal-review.googlesource.com/#/c/9177/4

This CL modifies some unit tests to make sure that OEMCrypto returns
the correct error code when the key has expired.  This behaviour is
required for OEMCrypto version 9.

It also updates the code for the reference implementation and the
Level 3 implementation.

This is half of b/9205119
The other half is for the CDM layer to respond to this error code.

bug: 9205119
Change-Id: I60f934886f4ecdd1ee04825dea289fda1c0a4303
2014-03-26 18:14:38 +00:00
Fred Gylys-Colwell
e9c07e1f9b Allow Version 8 OEMCrypto to be linked with CDM
This is a copy of the Widevine CDM change:
https://widevine-internal-review.googlesource.com/#/c/9337/

This CL provides some shim code that allows the Eureka
version 8 oemcrypto library to be linked and run with CDM.

As part of this change, obfuscated names in OEMCryptoCENC.h have been
changed.

Change-Id: I18a1f91f0dfde0006591f800f8f8a034f32d9004
2014-03-24 19:51:39 +00:00
Jeff Tinker
c149538125 Merge "Prevent Nonce Flood" 2014-03-21 19:01:24 +00:00
Jeff Tinker
d898c9e8ca Merge "Add alternate RSA signing" 2014-03-21 19:01:10 +00:00
Fred Gylys-Colwell
fec3e87167 Prevent Nonce Flood
From the Widevine CDM repository:
https://widevine-internal-review.googlesource.com/#/c/9182/

This CL adds a test to verify that at most 20 nonces may be created in
one second.  This should prevent the replay attack that an
appplication could do by generating large quantities of nonces until
it finds a repeat.

I've also updated the Level 3 and reference implementations.

This feature is required for OEMCrypto version 9.

Change-Id: Ia86323133810fcbbd79d7bb27bd5a004d7c87314
2014-03-21 18:31:52 +00:00
Fred Gylys-Colwell
80e9ea9cb0 Add alternate RSA signing
From the Widevine CDM repository:
https://widevine-internal-review.googlesource.com/#/c/9183/

This adds unit tests for RSA signing with  PKCS1 block type 1. It also
adds a reference implementation.  This is part of OEMCrypto v9.

Change-Id: I2a40dbff65f6e09d75f16ae048499512f60c168d
2014-03-21 18:30:29 +00:00
Fred Gylys-Colwell
ba6b5c293a Allow OEMCrypto v8 or v9
From Widevine CL:
https://widevine-internal-review.googlesource.com/#/c/9184/

This is some shim code that will load either an OEMCrypto
version 8 or version 9 library.  This should allow us
to test and run stable devices until all OEM's have
updated to version 9.

Android Level 3 library versions are:
level3/mips/libwvlevel3.a  Level3 Library Feb 27 2014 18:18:34
level3/x86/libwvlevel3.a  Level3 Library Feb 27 2014 18:22:14
level3/arm/libwvlevel3.a  Level3 Library Feb 27 2014 12:31:29

Change-Id: I82911e3b4d9056cf3c3ab2b47194fe81ac2776d9
2014-03-21 18:29:06 +00:00
Fred Gylys-Colwell
dd75655102 Changes from Widevine CDM repo
Squashed commit of these CLs from the widevine cdm repo:

Update YT CP server URI to point to the UAT server
https://widevine-internal-review.googlesource.com/#/c/9327/

OEMCrypto Version 9 API
https://widevine-internal-review.googlesource.com/#/c/9142/

Correct Device ID length in OEMCrypto reference version
https://widevine-internal-review.googlesource.com/#/c/8723/

Modify tests to prevent intermittent failures
https://widevine-internal-review.googlesource.com/#/c/8982/

Generate a unique license request ID
https://widevine-internal-review.googlesource.com/#/c/8721/

Re-enable android timer mechanisms
https://widevine-internal-review.googlesource.com/#/c/8833/

Do not close CDM session on removeKeys
https://widevine-internal-review.googlesource.com/#/c/8703/

And numerous changes required by Eureka, Steel, and CTE versions of
Widevine CDM, as highlighted here:
https://widevine-internal-review.googlesource.com/#/c/8596/
https://widevine-internal-review.googlesource.com/#/c/8955/
https://widevine-internal-review.googlesource.com/#/c/8922/
https://widevine-internal-review.googlesource.com/#/c/8890/
https://widevine-internal-review.googlesource.com/#/c/8871/
https://widevine-internal-review.googlesource.com/#/c/8706/
https://widevine-internal-review.googlesource.com/#/c/8425/

Change-Id: Iafd33905227e74eb2132c240b929d2282ab68042
2014-03-17 20:29:51 +00:00
Jeff Tinker
b2af1e6303 OEMCrypto Version 9 API (KLP Modular Version)
This CL changes the header file and documentation for OEMCrypto
version 9.

It is a cherry pick of Change-Id: I1a43a686ef5d345132affc672bc1c6acf7b3f661

I modified the reference implementation and the calling functions just
enough that existing unit tests still pass.  Acutal implementation of this
API will be in future CLs.

Comments on the documentation can be made in the Google Doc here:
    https://docs.google.com/a/google.com/document/d/1pHSJ2IKL0axmQz2gmDZ7olxPWb_ZcULaJrYwDZAeS7k/edit?usp=sharing

Merge of https://widevine-internal-review.googlesource.com/#/c/9170/
from the widevine cdm repo.

Change-Id: I0197b1dfadedd6cc85710c7408e739cedeb45dce
2014-03-10 11:08:41 -07:00
Fred Gylys-Colwell
becb1bf0be Haystack and Obfuscated OEMCrypto Level 3
This CL contains working versions of the haystack tools and the
OEMCrypto Level 3 library for android ARM, MIPS and x86.

The version number of the level 3 library is:
android/level3/arm/libwvlevel3.a  Level3 Library Nov  4 2013 18:39:06
android/level3/mips/libwvlevel3.a Level3 Library Nov  4 2013 18:42:29
android/level3/x86/libwvlevel3.a  Level3 Library Nov  4 2013 18:41:07

bug: 9374954 MediaDrm haystack based L3 code hardening implementation.
Change-Id: Ifef13900a11e83e4257723d3c6fc7107550882a8
2013-11-05 10:32:11 -08:00
Fred Gylys-Colwell
67c794bac3 Add unit test for empty mac key
Merge of change https://widevine-internal-review.googlesource.com/7950.

In the OEMCrypto library, it is valid to call LoadKeys with an empty
mac key.  The library should not update the mac and enc keys and
should not throw an error.

Since we have seen this behavior in several implementations, a unit
test should be added that verifies the correct behavior.

bug: 11032674
Change-Id: I011ba39c8abc47547226a722143e92dac3f63dc5
2013-10-01 19:02:16 -07:00
John "Juce" Bruce
259927efc5 Do Not Return an Error When AddKey Says it Needs a Key
Swallows the error NEED_KEY if it comes back from AddKey(), as this
is expected behavior. (It means privacy mode is on and the key that
was just added was the privacy certificate, ergo the real decryption
key is still absent.) Note that this carefully does not squelch the
notification that comes from NEED_KEY, which is still necessary in
order for the app to make a second key request.

Also streamlines a test case that I noticed was overcomplicated for
what it did while poaching code from it for new test cases.

Also removes a .gyp file that was erroneously being copied to the
Android tree.  Android does not use GYP.

Bug: 10495563
Change-Id: Ife3ff0270a0d09dac1b0eb0d84bddffd811e1eef
2013-09-03 16:29:08 -07:00
Fred Gylys-Colwell
0ab663d8a5 Rename Unit Test
In order to run all disabled OEMCrypto unit tests with one gtest
filter, one of them needs to be renamed so it matches the others.

These tests are disabled by default because they install a test
keybox, which would be dangerous on a production device.

Merged from CDM change
https://widevine-internal-review.googlesource.com/7440

bug: 10508973
Change-Id: I9508b133c6500ec28ce8890a4af89f016344b842
2013-08-30 12:51:11 -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
John "Juce" Bruce
b0d85ac1af Add Call to Install Keybox to Widevine CDM
This merges the following changes from the Widevine CDM repository:

1a72a7e  Combine utility code into single library on Android
  Combines several previously-separate files into a static library,
  libcdm_utils, so that it can easily be used by both CDM and
  OEMCrypto.

8c4d04d  Install Keybox
  If the keybox has not been installed, install it from
  /factory/wv.keys.

Bug: 9972451
Change-Id: I8688ecd0adcf321e0c7d0faf55dd10f3910c12ec
2013-08-08 14:52:31 -07:00
Jeff Tinker
f4560f109f Squashed commit of the following CDM changes:
* Add additional parameters to CDM decryption API
  https://widevine-internal-review.googlesource.com/#/c/6500/

* Pass Length and Flags Parameters to Decrypt()
  https://widevine-internal-review.googlesource.com/#/c/6740/

* Remove core files from oemcrypto/mock
  https://widevine-internal-review.googlesource.com/#/c/6853/

Change-Id: I1c73f5454da20da99130b161543fb990e16e7130
2013-07-29 17:41:22 -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
1b295f4c81 Support Offline Licenses
Bug: 8621588

Merge of the following CLs from the Widevine CDM repository:

https://widevine-internal-review.googlesource.com/#/c/5602/
https://widevine-internal-review.googlesource.com/#/c/5431/
https://widevine-internal-review.googlesource.com/#/c/5660/

Change-Id: If37940e2535e1a1eca95e4394d8cf9bf689e9c3a
2013-05-15 21:18:20 -07:00
Jeff Tinker
5d7ac644c5 Disable OEMCrypto tests that install a test keybox.
Because we do not want to accidentally install a test keybox on a
production device, most of the oemcrypto unit tests are being disabled
by default.

If you wish to run these tests, you can override this choice, by
running:
adb shell /system/bin/oemcrypto_test --gtest_also_run_disabled_tests

This change prompts for and requires positive confirmation before
running the disabled tests on a device that has a non-test keybox
already installed.

Bug: 8907626

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

Change-Id: Ib8e3605129ebf0861b4af15d04676f7a06cc5b78
2013-05-13 14:56:01 -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
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
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
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
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
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
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
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
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
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
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