Commit Graph

693 Commits

Author SHA1 Message Date
Jeff Tinker
a54ae37ceb Merge "Correct mapping for too many open sessions" into mnc-dev 2015-06-08 16:52:25 +00:00
Fred Gylys-Colwell
30abdd58a0 Merge "Add Tests With Different Sized Key IDs" into mnc-dev 2015-06-05 17:40:12 +00:00
Jeff Tinker
2478c36b51 Correct mapping for too many open sessions
The drm resource manager expects openSession to fail
with ERROR_DRM_RESOURCE_BUSY, but in some cases the
WV DRM plugin is returning a vendor-specific code
kErrorTooManySessions instead.  This change updates
the error code mapping to match what the resource
manager expects.

Merge of http://go/wvgerrit/14564 from widevine repo

bug: 21640598
Change-Id: I0b296ff5eeef8a6b94cfe0fd450b15f15cf03eab
2015-06-05 00:03:00 +00:00
Fred Gylys-Colwell
177c59033e Add Tests With Different Sized Key IDs
Merge from widevine repo of http://go/wvgerrit/14550

This CL adds several tests with different sized key ids to
oemcrypto_test.

bug: 21643096
Change-Id: I62a89c557f3f746f09ee5a2fe5bdd3ca821448e4
2015-06-04 15:57:56 -07:00
Fred Gylys-Colwell
92958a0e6a Protect OEMCrypto Mock and Level 3 From Null Pointers
Merge from widevine repo of http://go/wvgerrit/14502

If any OEMCrypto session call is made after Terminate is called, then
there was a null pointer access.  This is protected by the oemcrypto
adapter, but could still be a problem in unit tests which by-pass the
adapter.

bug: 21642892

Level 3 versions:
level3/arm/libwvlevel3.a  Level3 Library May 29 2015 14:03:11
level3/x86/libwvlevel3.a  Level3 Library May 29 2015 14:03:12

Change-Id: I84fd098c2faea71a79bc21658485593e22a8e994
2015-06-04 15:54:08 -07:00
John "Juce" Bruce
4fce36e91f Use ToVector Everywhere
(This is a merge of http://go/wvgerrit/14390)

Expands usage of the ToVector() helper that kqyang@ wrote across the
entire DRM Plugin.

Bug: 20037441
Change-Id: I55112245af6fdf21ea3d3db87b1564af2f54929d
2015-06-01 16:47:13 -07:00
Jeff Tinker
71a1779776 Merge "Fix possible infinite loop in test code" into mnc-dev 2015-05-29 23:15:51 +00:00
Fred Gylys-Colwell
9dfa85ae2a Replace some arrays with vectors and initialize
Merge from widevine side of http://go/wvgerrit/14462

This cleans up some tests in oemcrypto_test.cpp so that they use
vectors instead of arrays.  The two reasons this is needed are that
arrays are more likely to use up stack space, and that arrays on the
stack are not initialized.

The lack of initialization caused some negative tests to fail because
buffers that were reused from unencrypted data still contained values
that the test expected not to be there.

Change-Id: Ic1705b6bc581084a9fe3cd573adf34d8219a1a45
2015-05-29 13:53:08 -07:00
Fred Gylys-Colwell
994a7fc4c1 Update OEMCrypto Offset Tests
Merge from widevine repo of http://go/wvgerrit/14321

It is expected that OEMCrypto will only be given subsamples with a
block offset when there are multiple subsamples, so that the entire
sample may be decrypted after all calls are made.  This CL modifies
the existing tests so that the result of DecryptCTR is only checked
after all subsamples have been decrypted.

Also, the QueryKeyControl test has been modified so that failure does
not require a specific error code.

bug: 20757848
bug: 21063276
Change-Id: Ie2b12b287b0c9c661cd14111b2ae9eab004cd8b8
2015-05-29 13:50:20 -07:00
Rahul Frias
93d326129a Enable tests that cover renewals/releases with client IDs
[ Merge of http://go/wvgerrit/14480 ]

Server upgrades have been completed and allow these tests to run successfully
against UAT. They were earlier tested against staging.

b/21479112

Change-Id: Ifc5e5780fa5305c6ddfd662ada204db599cb5c6e
2015-05-28 00:33:00 -07:00
Jeff Tinker
92bf971ea8 Fix possible infinite loop in test code
Also handle ResourceBusyException

merge of http://go/wvgerrit/14470 from widevine repo

bug: 21172957
Change-Id: I6815786eb7a678725cf2632f1009c7f566ba7499
2015-05-27 16:52:28 -07:00
Rahul Frias
997ea4f447 Accept signed service certificates
[ Merge of http://go/wvgerrit/14410 ]

When specifying a service certificate though mediaDrm, the CDM earlier expected
serialized service certificates rather than signed ones.

b/21334970

Change-Id: I39af2aa25e8dc2a651cbdce84eb32f266b5b3382
2015-05-26 10:34:18 -07:00
Kongqun Yang
3cdc43caeb Use 0 to represent unexpired license in OnExpirationUpdate
Also fix a missing change for
"playback duration should override license duration".

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/14435/

Bug: 21393975
Change-Id: Ibfcf3ae4c13db8944ea285bcc79b6312ea621e1b
2015-05-22 15:47:42 -07:00
Rahul Frias
5f227dd85d Avoid throwing exceptions when sessions are closed
[ Merge of http://go/wvgerrit/14404 ]

Closing a non-existant (already closed) session results in an exception
being thrown though mediaDrm. The mediaDrm plugin will now ignore
errors when called though MediaDrm.closeSession.

b/21122725

Change-Id: Ib1c48ade4bdb131195ee56ce2af32bf0cd2166da
2015-05-22 11:17:25 -07:00
Fred Gylys-Colwell
3a7ef26375 Merge "Update padding scheme in mock" into mnc-dev 2015-05-22 01:14:54 +00:00
Kongqun Yang
ce68b8ee88 Fix expiry time overflow if it is unlimited
Bug: 21324836

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/14392

Change-Id: I2a8da14c98f8ae0fece3667b6f6b8517577f8a98
2015-05-20 18:31:06 -07:00
Fred Gylys-Colwell
6639965d30 Update padding scheme in mock
Merge from widevine repo of http://go/wvgerrit/14370

In order to run on android, we need the mock to compile with
BoringSSL, which uses a different function call for
RSA_padding_add_PKCS1_PSS.

Change-Id: I9cad4e7d5c1d4a3117fe7c0fc1e27590809a7ac3
2015-05-19 21:05:29 -07:00
Kyle Alexander
b513c016ed Merge "Updating expected Android version to M" into mnc-dev 2015-05-15 18:24:15 +00:00
Rahul Frias
6e7339f40f Merge "Playback duration should override license duration" into mnc-dev 2015-05-15 17:40:07 +00:00
Kyle Alexander
fdefa86e6e Updating expected Android version to M
Change-Id: Ie8f066658377e58af8c132125c815ef847c2938b
2015-05-15 09:08:00 -07:00
Fred Gylys-Colwell
7fffdcdbd9 Print values in host byte order
Merge from widevine of http://go/wvgerrit/14361

In oemcrypto_test, we look at some control duration and control
bits. These are stored in network byte order.  However, it is easier
to read error messages if they are converted to host byte order before
printing them.

Change-Id: I116b5f43957351b0e40e05331c282c248128903c
2015-05-14 15:54:38 -07:00
Rahul Frias
d4900bc9a2 Playback duration should override license duration
[ Merge of go/wvgerrit/14360 ]

If within playback window, do not expire license on expiry of rental or
license duration. In this case playback duration will extend the license.

b/17791094

Change-Id: I26d255aa8f0287bd583ebdeec991c613d49d8f22
2015-05-14 15:51: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
Chih-Hung Hsieh
1c6b675f0c Use gcc to build unit tests until vendor code is fixed.
BUG: 20893039
Change-Id: I649dae16bbc748defc8eb92c879140fe950fe936
2015-05-06 16:44:47 -07:00
Rahul Frias
7bfef98571 Merge "Add client information to release and renewal messages" into mnc-dev 2015-05-06 17:42:44 +00:00
Jeff Tinker
63d587fda7 Merge "Clarify decrypt error detail messages" into mnc-dev 2015-05-06 17:22:18 +00:00
Jeff Tinker
aae58981ea Clarify decrypt error detail messages
Merge of http://go/wvgerrit/14290 from widevine cdm repo.

Change-Id: I4c33a1202ca45064c65c7c1a4e36fed999f7bd82
related-to-bug: 20857014
2015-05-05 22:22:45 +00: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
Fred Gylys-Colwell
6573adc343 Merge "Use PRNG to Encrypt Needles in Haystack" into mnc-dev 2015-05-02 00:39:14 +00:00
Fred Gylys-Colwell
48e84580e9 Close Unused Sessions in NonceFlood Unit Test
Merge from widevine of http://go/wvgerrit/14263

The unit test PreventNonceFlood3 opens 8 sessions and floods the nonce
table.  It then opens one more session after a pause to verify that it
can still request nonces.  However, there is no requirement that we
can open more than 8 sessions.  This CL reuses one of the already open
sessions to verify that we can continue generating nonces.

Change-Id: If35f146477bd21e381ec5375dde7ec7fdbe8f366
2015-05-01 15:55:34 -07:00
Fred Gylys-Colwell
dfb1c39275 Use PRNG to Encrypt Needles in Haystack
This is a merge from the widevine repo of http://go/wvgerrit/14262

This CL replaces AES with a psuedorandom number generator to encrypt
the needles in the oemcyrpto level 3 haystack.  This speeds up the
overhead significantly, and reduces decrypt times by as much as 75%
for small buffers (1-3 kb).  This makes the obfuscation slightly less
secure but is worth the overall performance boost.

Level 3 library versions:
level3/arm/libwvlevel3.a  Level3 Library May  1 2015 15:45:12
level3/x86/libwvlevel3.a  Level3 Library May  1 2015 15:45:55

b/19582757 L3 Widevine extremely choppy on Nexus 6 (480p)

Change-Id: I3077c04047a7f2da6f64869d7a9af5ddcc62671f
2015-05-01 15:50:26 -07:00
John "Juce" Bruce
f18021f99a Merge "Remove Unnecessary Locking from Android" into mnc-dev 2015-05-01 21:12:19 +00:00
Fred Gylys-Colwell
9585237b33 Merge "Add keybox definition to docs" into mnc-dev 2015-04-30 20:47:52 +00:00
Fred Gylys-Colwell
20bd476104 Add keybox definition to docs
Merge from widevine repo of http://wvgerrit/14219

This updates the integration guide to include a definition of the
keybox.  Previously, there was a broken link in the description of
IsKeyboxValid.

This CL also updates the android supplement to describe how to request
a keybox.  I just copied the information from the legacy integration
guide.

Change-Id: I486a3ccad9889a732a9c1374c40b793deb249459
2015-04-30 12:13:52 -07:00
John "Juce" Bruce
8c81d38a73 Remove Unnecessary Locking from Android
(This is a merge of http://go/wvgerrit/14242)

To try to fix b/17761616, I added a lock to the DRM Plugin. However,
the API guarantees that any single DrmPlugin will never be called into
from multiple threads at the same time, rendering this unnecessary.
Previously, b/18194977 meant that this was not always true, but now
that that bug is fixed, this lock is not needed and can be removed.

Bug: 18194977
Change-Id: I25ee5fa44f35706f863b036997453441eac29c95
2015-04-29 16:09:21 -07:00
Fred Gylys-Colwell
2229e51c18 Set default GTEST_FILTER in android script
Merge from widevine repo of http://go/wvgerrit/14218

If GTEST_FILTER was not set, it defaults to "" which matches no
tests.  This CL changes it to "*" if it was "".

Also, quotes are added around the environment variable and command so
that it multiple variables can be set.

Change-Id: Icad9a1fbca2d1b436f6e37a2a080a70a384f0a1d
2015-04-27 12:51:54 -07:00
John "Juce" Bruce
509471b058 Fix Case on InitDataResemblesPSSH()
(This is a merge of http://go/wvgerrit/14156)

This was Google-cased, not Android-cased like the rest of the file
it's in.

Change-Id: I79ecf490212428de9a668d49d6feca678379f3ae
2015-04-24 15:17:03 -07:00
Fred Gylys-Colwell
c4d9c1036e Merge "Update unit test make files to use BoringSSL" 2015-04-22 17:35:25 +00:00
Fred Gylys-Colwell
d6da9518ec Merge "Annotate logcat with current running test (oemcrypto)" 2015-04-22 17:34:53 +00:00
Fred Gylys-Colwell
f75fddcdf1 Update unit test make files to use BoringSSL
Merge from widevine of go://wvgerrit/14173

This CL updates the android makefiles to use the libcrypto_static.

Change-Id: I74567ff880ebdce366766a9ab44c92cc9540b8db
2015-04-22 07:47:51 -07:00
Fred Gylys-Colwell
39a86c688a Simplify Nonce Flood Test
Merge from widevine of http://go/wvgerrit/14134

This CL adjusts the nonce flood test so that the timing is more
explicit.  Also, if the test fails, the error message should tell us
exactly how many nonces were generated and the duration of the test.
Thus we'll be able to tell if the test almost passed.

b/19081206

Change-Id: I2c59755466b017910b86f6b02f2883a771d0ccb7
2015-04-20 11:38:59 -07:00
Fred Gylys-Colwell
a745387c20 Annotate logcat with current running test (oemcrypto)
Merge from widevine repo of http://go/wvgerrit/14125

This copies code from http://go/wvgerrit/13847 to the oemcrypto unit
tests.  It puts the test name in the log file.

I also commented out some unused function parameters to avoid compiler
warnings.

Change-Id: I3ba259de2f408ec60e90db7f0ea1524d5aa8f8a4
2015-04-17 12:51:20 -07:00
Rahul Frias
dfe9a55a15 Merge "Fix offline key restoration failures" 2015-04-16 00:38:42 +00: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
Rahul Frias
a48331a747 Fix offline key restoration failures
[Merge of https://widevine-internal-review.googlesource.com/#/c/14110/ from
 widevine cdm repo]

Backward compatibility handling was causing L3 usage and clock information
to be moved. This caused nonce and other failures when attempting to restore
offline keys.

b/20025990

Change-Id: I6e0fa1030bcce1a5bdd811a9064989d3b6ce2f04
2015-04-15 11:01:39 -07:00
John "Juce" Bruce
c5f576585b Allow Setting of Session ID
Implements the optional setMediaDrmSession() method. To enble this,
support was added to the core to report if a session ID is valid.

As a consequence of this, in the tests for the CryptoPlugin,
construction of the plugin must be deferred until all gMock
expectations are set, as construction now calls into the CDM core.

This is a merge of two changes from the Widevine CDM repo:
http://go/wvgerrit/14083
  Allow Setting of Session ID
http://go/wvgerrit/14085
  Check If Session ID Is Valid When Changing CryptoPlugin IDs

Bug: 19570317
Change-Id: I7dbd777ce6efebd71fdb5e602663a0e35a48a9c4
2015-04-10 16:00:33 -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
86fdcc744d Merge "Allow Unprovisioning of Origins" 2015-04-10 18:28:34 +00:00
John "Juce" Bruce
bf5515faa1 Merge "Support Per-Origin Provisioning" 2015-04-10 18:20:55 +00:00
John "Juce" Bruce
13afc71658 Merge "Update Protobufs to Include Per-Origin Provisioning ID" 2015-04-10 18:18:58 +00:00