Commit Graph

117 Commits

Author SHA1 Message Date
Jeff Tinker
0553f411db Add ExoPlayerDemo.apk to vendor/widevine so partners can access
it and use to verify integrations.

bug: 11357407

Change-Id: Ie38cef1dfd2fe685721e7fb4f37e881326321727
2013-11-06 14:28:09 -08:00
John "Juce" Bruce
fd482527e4 L1 System Lowered to L3 Still Requires Secure Decoders
Merge of https://widevine-internal-review.googlesource.com/#/c/8263
from the Widevine repo.

Changes the behavior of requiresSecureDecoderComponent() to query the
session for whether a lowered security level has been requested
before querying the system to see what its default security level is.

As part of this, we added a new QuerySessionStatus() method to the
CDM that gets status info on a session-specific level, such as the
effective security level of a session.

Bug: 11428937
Change-Id: I5549a2fdd400cc87f567d27fcf74c473451093d6
2013-11-06 19:31:24 +00:00
Jeff Tinker
dd672f0c68 Merge "Use renewal URL in license tests" into klp-dev 2013-11-06 17:24:07 +00:00
Jeff Tinker
3046902171 Merge "Search for keys in shared sessions only when content is encrypted" into klp-dev 2013-11-06 17:22:33 +00:00
Rahul Frias
64c3cb986a Use renewal URL in license tests
After a change to the GPlay license server, it no longer accepts heartbeats
at the license server URL ( https://jmt17.google.com/video-dev/license/ ).
The CDM correctly reports https://jmt17.google.com/video-dev/heartbeat/
as the renewal URL but the current test code ignores the reported URL.
The license server then rejects the request and send back an empty
license response.

This causes WvCdmRequestLicenseTest.StreamingLicenseRenewal
and WvCdmRequestLicenseTest.StreamingLicenseRenewal to fail. Request
license tests have been modified to respect the renewal URL.

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

b/11290339

Change-Id: I1dcf8277edce99633086fb3db8ffeb7a32a5500d
2013-10-25 13:15:56 -07:00
Rahul Frias
252a07316a Search for keys in shared sessions only when content is encrypted
Also return NEED_KEY rather than KEY_ERROR if keys are not found.

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

b/11375092

Change-Id: Ibc629e8b4018f43f5f9528258563a2af79bdfb4b
2013-10-25 13:09:40 -07:00
Jeff Tinker
49e593d127 Stop policy timer before invoking session destructor
The CDM session was being destroyed before the policy timer was stopped
and before the session was removed from a list of active sessions. This
allowed race conditions, where the policy timer would try to evaluate
policy for a closed session. This led to segfaults.
b/11338324

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

Change-Id: Ib159ccfdb763a47da573f5c06c0793c2c63886c4
2013-10-25 10:50:02 -07:00
Colin Cross
6fc2ee33c3 set LOCAL_MODULE_OWNER for libwvdrmengine.so
Change-Id: I10d63ef381a612a0177ce5a3ddd24f44b6ae05a0
2013-10-24 12:40:19 -07:00
Rahul Frias
e385ff3a7f Do not close CDM session on removeKeys
A change was introduced between jb-mr2 and klp-dev that closed
the CDM session when the removeKeys mediaDrm APIs was called.
This was introduced because there is no way of unloading keys from
an OEMCrypto session.

This caused problems for Netflix, as an exception occurred when they
tried to close a session after calling removeKeys.

Reverting to jb-mr2 behaviour for now. b/11188818 has been opened to
track a longer term resolution.

b/11185042

Change-Id: I03bc736d2bc5bdabc86cfb7b75ae8bcbc03ffc7c
2013-10-11 14:42:37 -07:00
Jeff Tinker
9b1d8119e5 Merge "Allows sharing of keys between sessions" into klp-dev 2013-10-11 17:02:00 +00:00
Rahul Frias
56bd5d5d82 Allows sharing of keys between sessions
This change allows the app to specify that keys may be shared by sessions.
The app enables this by setting the session sharing properties in DRM Plugin.
Keys are shared only amoungst the specified group of sessions.

Merged from widevine CDM repo
 * https://widevine-internal-review.googlesource.com/#/c/8019/
 * https://widevine-internal-review.googlesource.com/#/c/8021/

Bug: 11013707
Change-Id: I52db41a53138b4fc563ebc6d38a623f23f7cdfb5
2013-10-10 23:23:39 -07:00
Rahul Frias
a74980b2f1 Address key selection and decryption concurrency issues
Decryption calls though multiple threads may result in race conditions
between the setting of the key and the actual call to decryption.
This results in OEMCrypto errors when the buffer type used in
decryption did not match the key selected. This is addressed by
having the the two calls be in the same critical section.

b/11009857

Change-Id: I74f1a0689ca17114f3cdd029022013b05c415acd
2013-10-02 15:44:39 -07: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
Jeff Tinker
c28be299dc Avoid multiple loads of Device RSA private key
Molly reports OEMCrypto errors when Device RSA private key is
loaded a second time in the same session. This occurs in privacy
mode when a service certificate is request and later a key request is
generated.

bug: 10815492

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

Change-Id: I98999fb0e77597109b68c379eaaa4838d3f6dde4
2013-09-19 17:23:58 -07:00
Fred Gylys-Colwell
d475d0282a Added locking to session table in oemcrypto_adapter_dynamic.
This change the merge from the android tree of:
https://widevine-internal-review.googlesource.com/7353

bug: 10447846

Change-Id: I0a2496fc6f225e0f3b23731c24087ddc6068c9cc
2013-09-04 11:06:37 -07:00
Jeff Tinker
d3a8d10868 Merge "Do Not Return an Error When AddKey Says it Needs a Key" into klp-dev 2013-09-04 17:26:33 +00: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
Rahul Frias
a233ac2084 Replace staging with production Root CA public key
A staging Root CA public key was used in earlier releases to verify
service certificates. These were in turn used to encrypt the
client identification. This met our needs for an end-to-end verification.
Now that the production Root CA and service certs are available
this change replaces staging certs with production ones.

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

b/10329328

Change-Id: Id02649201d9a8ba4d08acc4166503341a5bbdd23
2013-09-03 10:53:53 -07:00
Jeff Tinker
0ef6550593 Merge "Rename Unit Test" into klp-dev 2013-08-30 22:30:57 +00: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
Jeff Tinker
0faf26ba2d Merge "Turn off verbose logging" into klp-dev 2013-08-30 18:43:53 +00:00
Jeff Tinker
d4fa39113d Improve Widevine MediaDrm plugin tests
1. add missing checks to set the overall result when some tests fail
(to verify b/10528466)

2. Fix test result on L1 devices where we can't hash the decrypt result
due to inaccessible memory buffers.

3. Configure the codec with a surface to avoid codec errors on L1 devices

b/10528466

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

Change-Id: I5c7ef5ce802cc4ff63f62524ef2120fb671920f4
2013-08-28 17:14:46 -07:00
Fred Gylys-Colwell
144f5ced83 Turn off verbose logging
This CL turns off the verbose logging if LOG_NDEBUG is 1, or if NDEBUG
is defined.  You can set the environment variable LOG_NDEBUG to 0 to
turn on verbose debugging for the CDM library on android.

Also, as in b/9672657, some applications call SelectKey when switching
between video and audio, which is much too verbose and affects
playback.  I have removed the log statements for SelectKey.

bug: 9672657

Change-Id: I635b997118996871356f7126852b4744fb05e810
2013-08-28 16:19:08 -07:00
Jeff Tinker
b4dae0af49 Merge "Backward compatibility for licenses and certificates" into klp-dev 2013-08-22 23:09:12 +00:00
Jeff Tinker
db41502f86 Backward compatibility for licenses and certificates
Certificates and offline licenses are stored in security level
specific directories in klp. When devices transition from jb-mr2,
their persistent information has to be ported to these directories.

bug:10366036

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

Change-Id: I70b4a79dc5b69bda7fc3a4b92fdcde7ef8b41836
2013-08-22 09:37:18 -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
Jeff Tinker
2fa6b63292 Replace event notification from when openSession fails
Merge of https://widevine-internal-review.googlesource.com/#/c/7280/1
from the Widevine CDM repo.

bug: 10396953
Change-Id: I085b60e01292f37379d19d059b39ac7a7f299012
2013-08-19 18:53:57 -07:00
Rahul Frias
a2e15186e5 Add Privacy Mode and Serivce Certificate Support
This merges the following changes from the Widevine CDM repository:

da001b6  Add Privacy mode and service certificate
  This adds support to the CDM for privacy mode and service certificates.

92bf200  Add support for using Youtube Content Protection server for testing
  Enables testing with Youtube Content Protection server. Google Play license
  server is still the default. Select YTCP server by using the flag -icp
    e.g. adb shell '/system/bin/request_license_test -icp'

85dcd60  Fixes to enable privacy mode
  These includes changes to use PKCS7 padding, corrected root CA formatting
  and changes to integration test. Also refactored service certificate
  handling.

989971c  Correction to request license test
  Corrected PropertySetTest to provision when needed. Also added disabled
  privacy tests to run against YTCP staging server until GooglePlay
  integration is complete.

Bug: 10109249
Change-Id: If81d68c65d743d77a485406f48d1be41a74de0af
2013-08-15 13:29: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
0fa3e16999 Remove Stale Licenses on Reprovisioning
Merges change 267713c (Remove stale licenses on reprovisioning) from
the Widevine CDM repository.  This change removes licenses belonging
to the previous provisioning when provisioning changes.

Bug: 9761923
Change-Id: I473816dd11dd950f4fb009b5b004630bd2d2b579
2013-08-08 14:57:40 -07:00
John "Juce" Bruce
ba66224ef4 Report When Decrypt Is Attempted With No Key Loaded
This merges change 43c7fda (Do Not Obscure wvcdm::NEED_KEY) from the
Widevine repository.  After this change, decrypt calls will return
ERROR_DRM_NO_LICENSE if the CDM returns NEED_KEY.

Bug: 10157154
Change-Id: I97b3a3990abeebb620ee4925fabf5c4261d968c4
2013-08-08 14:56:49 -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
6d93e43c3a Part of fix for TEE resource leaks when app crashes
bug: 9672606

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

Change-Id: I8ed27cbd9944c3459fce251f1261f7656f99e277
2013-07-03 15:45:56 -07:00
Fred Gylys-Colwell
9fdeabe3ed Update Widevine Modular DRM Integration Guide
The function OEMCrypto_LoadKeys should accept a null pointer for the
enc_mac_keys pointer.   This indicates that the mac_keys are not being
updated. This CL just updates the documentation to clarify this behavior.

bug: 9549308
Change-Id: I1073e72f9c8d0fa712ad02e4c2d517202b3defab
2013-06-24 17:23:30 -07:00
Jeff Tinker
f2afd99431 Add Property for Provisioning ID
Adds a property that allows applications to get the provisioning-unique serial
number.

Bug: 9175567

Also fixes some missing mutexes that were causing intermittent failures in
calls to OEMCrypto due to concurrency issues.

Bug: 9175583

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

Change-Id: I1d7e3ca9f3b06da345022f5f0d64e0c17a5cedca
2013-05-30 11:55:25 -07:00
Jeff Tinker
0f2ff32f78 Merge "Fix Level 3 Field Provisioning Device ID" into jb-mr2-dev 2013-05-23 16:13:57 +00:00
Jeff Tinker
424ead3417 Fix Level 3 Field Provisioning Device ID
The field provisioning code generates a randum number to use as the
device id, and then restricts the data to alphanumeric characters.
Previously, it could have also included a 0 byte in the data.  This CL
corrects that.

bug: 9073146

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

Change-Id: Iaf3e9e733f7c66c19d4168178a8e25ee0ba7e936
2013-05-22 12:10:11 -07:00
Jeff Tinker
418f4b0e60 License property for company_name should come from device on android
The company_name was hardcoded in the CDM as "Google" for all devices.
On Android, it needs to come from the ro.product.manufacturer system
property.

bug: 9074091

This is a merge of https://widevine-internal-review.googlesource.com/#/c/5730/
from the Widevine CDM repository.

Change-Id: Ia3ae82abf350c32ba8b4d05b59e95361927dea40
2013-05-21 15:22:00 -07:00
Jeff Tinker
32d61899a2 Merge "Fix intermitent bad nonce being passed to RewrapDeviceRSAKey." into jb-mr2-dev 2013-05-21 16:57:53 +00:00
Jeff Tinker
9019e22b11 Key derivation failure on key release
Signing and encryption keys are not correctly setup in OEMCrypto, when
an offline license is restored, before generating a key release message.
This results in key release failures. Playing back the license response
causes keys to be derived and allows the key release message to be constructed.

b/9016545

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

Change-Id: Ica9f13acc7c87e3125fa706f3a56e95b77a14a3c
2013-05-17 11:23:54 -07:00
Jeff Tinker
71aa639c48 Fix intermitent bad nonce being passed to RewrapDeviceRSAKey.
Since CryptoSession::RewrapDeviceRSAKey takes a const std::string& nonce, the calling code
implicitly constructa temporary std::string from a character array with undefined termination
and sometimes bogus value when nonce.data() is passed in.

Bug: 9016828

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

Change-Id: Ia3beaa5f1a96924a8cc53a719f25af52217b8cc5
2013-05-17 11:19:45 -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
898d870126 Merge "Disable OEMCrypto tests that install a test keybox." into jb-mr2-dev 2013-05-14 05:36:29 +00:00
Jeff Tinker
e1151975d0 Merge "Resize signature buffer" into jb-mr2-dev 2013-05-14 05:17:49 +00: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
3342e33143 Resize signature buffer
There is an ambiguity in the use of the signature length in
OEMCrypto_GenerateRSASignature.  If the pointer to the vector is null,
the function should set the length parameter to be the size of the
buffer needed.

This ambiguity has been clarified in the documentation: the
length returned should be the exact length of the buffer.  It
will be corrected in a future release of Qualcomm's L1.  However,
we are putting this change in both as a stop-gap and as a
belt-and-suspenders fix.

Bug: 8878371

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

Change-Id: I7574874884ca10da68d15674c971a565d015767d
2013-05-13 14:13:00 -07:00
Jeff Tinker
0bbbcaa1cb Device unable to recover from a bad certificate
In the android media DRM api test, provisioning is indicated, when a
generate license request command is issued after a switch between L1 and
L3. This is as expected as oemcrypto is unable to decrypt
the key wrapped earlier (bad padding). Subsequent provisioning request
and storage of wrapped keys complete successfully. If the same session
is used to reissue a generate license request command, the wrapped keys
and cert used are those present in memory from the initial retrival,
rather than rereading the new ones from persistent storage.
This results in a cycle of successful provisioning attempts followed
by generation of license requests commands which return a provisioning needed
error.

A change has been added to reinitialize the session and reload the
wrapped keys.

b/8878324

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

Change-Id: Iaf47d15d104fd681706df5f64be583af24186abe
2013-05-13 13:39:56 -07:00