Commit Graph

292 Commits

Author SHA1 Message Date
Rahul Frias
178cadfce1 am 25a6185c: Address releaseAllSecureStops crash
* commit '25a6185c8434c62af73d2c6c91bda5fc50d20ca7':
  Address releaseAllSecureStops crash
2015-08-25 19:05:30 +00:00
Rahul Frias
25a6185c84 Address releaseAllSecureStops crash
[ Merge of http://go/wvgerrit/15474 ]

Changes to releaseAllSecureStops made use of a session that was
initialized only if getSecureStops had been previously called. If it was not,
accessing the session resulted in a segfault. This was uncovered by a change
in how the Netflix app invoked mediaDrm.

b/23498809

Change-Id: Ib426ae1830c3a42c5e0849f1b6e8bbfe0d2c74ff
2015-08-25 10:40:12 -07:00
John Bruce
67b5d9216d am 0e1839ac: Merge "Do Not Clean Up Licenses As Aggressively" into mnc-dev
* commit '0e1839ac4d4b540f46db83684b436d400fe4a292':
  Do Not Clean Up Licenses As Aggressively
2015-08-20 22:13:15 +00:00
John Bruce
0e1839ac4d Merge "Do Not Clean Up Licenses As Aggressively" into mnc-dev 2015-08-20 21:21:43 +00:00
Jeff Tinker
d38fc184a7 am 1319c433: Part of fix for libmedia OOB write anywhere
* commit '1319c43361cc8fdd3e2ce61db4185e38f128e76b':
  Part of fix for libmedia OOB write anywhere
2015-08-19 23:13:05 +00:00
John "Juce" Bruce
1d4339d0df Do Not Clean Up Licenses As Aggressively
(This is a merge of http://go/wvgerrit/15430)

Previously, after provisioning, any existing offline licenses would be
deleted, as they were inevitably tied to the certificate that was just
replaced. However, due to the way per-origin provisioning works on
Android, this is no longer a safe assumption. Licenses from different
origins are all stored together, so this behavior would delete all
offline licenses across all origins every time any origin is
provisioned. And it is not possible to delete only the licenses for
specific origins without changing how licenses are stored. It is too
late to change how licenses are stored in Android M, so we need to
stop proactively cleaning up licenses in this edge case for now. Once
b/23354606 is resolved, we can reinstate this clean-up and properly
only clean up the licenses associated with the origin that was just
provisioned.

Bug: 23324167
Change-Id: Ic21db8c21bdb4243266cd49020ed52287eb21d9a
2015-08-19 21:21:44 +00:00
Jeff Tinker
1319c43361 Part of fix for libmedia OOB write anywhere
Prevent usage of client provided address on
non-secure devices spoofed as being secure.

b/23223325

merge of go/wvgerrit/15420 from widevine repo

Change-Id: I1d4f3a652b3d5e78fca508f92005cfa8df5ec6db
2015-08-17 17:56:27 -07:00
Rahul Frias
ae28e74144 am 496bfc87: Correct android release version number in tests
* commit '496bfc87b31fc31d4a04542cb1877d7be28ec911':
  Correct android release version number in tests
2015-08-05 07:11:32 +00:00
Rahul Frias
496bfc87b3 Correct android release version number in tests
[ Merge of http://go/wv/15293 ]

b/22916797

Change-Id: I120bae5e656c6d766f8ab7a21d578f17ff22d37a
2015-08-04 14:59:08 -07:00
Rahul Frias
93f5f1cda8 am bf100619: Merge "Verification of client identification in Secure Stop messages" into mnc-dev
* commit 'bf10061929aebb2ddf088b4daad42458ac8eefa4':
  Verification of client identification in Secure Stop messages
2015-07-14 16:30:22 +00:00
Rahul Frias
12ccd847cf Verification of client identification in Secure Stop messages
[ Merge of http://go/wvgerrit/14993 ]

b/22047007

Change-Id: I8f3de72f0746fad4a2382a826cb301408398a4c4
2015-07-06 15:23:24 -07:00
Rahul Frias
49022130db am 460d24b1: Merge "Return Client Identification information in Secure Stop" into mnc-dev
* commit '460d24b135bc601f712b432ba915bd2009fe230a':
  Return Client Identification information in Secure Stop
2015-06-29 23:26:02 +00:00
Rahul Frias
5bda807161 am 6e2cc1a3: Avoid multiple deletions of a usage entry
* commit '6e2cc1a3ed53d2fed2ad87edbcda4fac37313fb0':
  Avoid multiple deletions of a usage entry
2015-06-29 23:26:01 +00:00
Rahul Frias
460d24b135 Merge "Return Client Identification information in Secure Stop" into mnc-dev 2015-06-29 22:59:47 +00:00
Rahul Frias
6e2cc1a3ed Avoid multiple deletions of a usage entry
[ Merge of http://go/wvgerrit/14900 ]

When releasing a license, usage entries were being released twice with
both OEMCrypto_DeleteUsageEntry and OEMCrypto_ForceDeleteUsageEntry being
called. The second call would always fail because the usage information had
already been released. The CdmSession::DeleteLicense methods will now only
handles deletion of license metadata and leave deletion of usage entries to
the CdmLicense class.
b/22097805

Change-Id: Ic55764d5357043d136e7d88583f709a4ceea3e64
2015-06-29 14:47:24 -07:00
Rahul Frias
d220d41425 Return Client Identification information in Secure Stop
[ Merge of http://go/wvgerrit/14920 ]

The renew_with_client_id field was not being correctly set when licenses
were being restored for usage reporting.

b/22047007

Change-Id: Ib769431b1e49bb498f53d8153a970b6c0a2776d2
2015-06-29 14:06:17 -07:00
Rahul Frias
d58ac8094f am 57eb7cb6: Merge "Add unit tests for offline licenses without session usage" into mnc-dev
* commit '57eb7cb6ba415634aa90fbb2d7b63561f1b6416d':
  Add unit tests for offline licenses without session usage
2015-06-25 15:12:30 +00:00
Tim Kilbourn
c74222f523 Rename the internal copy of gmock.
The external/gmock project does not include the patches needed for
widevine, so renaming the internal copy allows both to coexist in the
build system.

(cherry-pick of 5b830f19b6 with conflict.)

Change-Id: I77c956db30921afffe31d11e1cd2d99541925f35
2015-06-23 16:00:47 -07:00
Rahul Frias
f5f2e826f2 Add unit tests for offline licenses without session usage
[ Merge of http://go/wvgerrit/14824 ]

OEMCrypto v9 added support for secure usage reporting with the help of
a session usage table. This was enabled through the replay control bits
in the key control block. It was expected that streaming licenses
would enable the nonce required bit, while offline licenses would
enable session usage table entry flag. There are certain cases
where content providers would prefer not to enable the flag for offline
licenses and this test verifies that this scenario works.

b/17514500

Change-Id: Icd1bea8cec2fd52be2be249424891ce1755d5f25
2015-06-22 15:38:33 -07:00
Rahul Frias
9aca14e4fe Merge "Allow interspersed provisioning attempts to succeed." into mnc-dev 2015-06-20 01:06:01 +00:00
Rahul Frias
a1895e7e2e Allow interspersed provisioning attempts to succeed.
merge of http://go/wvgerrit/14807 from the widevine repo.

The mediaDrm API only allows for a single provisioning attempt at a time.
If concurrent provisioning attempts occur, resources are released from
all but the last request, in order to allow at least that one to be successful.

Any provisioning responses received before one from the last request will
be rejected. A side-effect was that all provisioning resources would
then be released. This caused a provisioning response from the last attempt
to be rejected as well. This CL corrects this behavior and releases resources
only if a provisioning attempt is successful.

The side-effect is that, if the response to the last request is not received
or failure occurs while processing, a crypto session may be held until the
next provisioning attempt.

In other cases of concurrency, provisioning responses to requests other than
the last which are received after the last response will be declared successful.

b/21879484

Change-Id: I3a840ceda1a16ee6adb40c2dbca6c4adf3da12c3
2015-06-19 23:40:05 +00:00
John "Juce" Bruce
8443abc555 Re-Add MIPS to Android CDM Build
(This is a merge of http://go/wvgerrit/14795)

This change restores the ability to build the Widevine CDM for Android
for MIPS devices. It restores the precompiled binaries for MIPS and
re-adds MIPS to all makefiles.

This change includes a new build of the obfuscated binaries for
MIPS32r1 that were built using a MIPS device on the emulator.

level3/mips/libwvlevel3.a  Level3 Library Jun 19 2015 12:32:49

Bug: 19482469
Change-Id: Ifa1c299a5751f3772c42289d8333a2b8cec51f69
2015-06-19 16:34:08 -07:00
John "Juce" Bruce
89682556ad Fix CanSetServiceCertificate Test
(This is a merge of http://go/wvgerrit/14783)

When validation was added to the service certificate property, it
broke the associated test, which sends random data. It also did not
do any testing of the new validation itself.

This fix makes the validation method on WvContentDecryptionModule
non-static so that it can be mocked and handled appropriately in the
test.

Bug: 21923281
Change-Id: Id5d2315709fce35f9347b3545f594371810349f0
2015-06-18 18:54:19 -07:00
Rahul Frias
99a2346e3a Return more descriptive error codes on license generation failure
[ Merge from http://go/wvgerrit/14745 ]

License generation errors previously would result in code -2916 being returned
though the mediaDrm API. More descriptive error codes are now being returned
from -2850 to -2836

b/13976775

Change-Id: I613ad650ab0a072ce9d8029e2af52b72dc617236
2015-06-17 17:32:11 -07:00
Rahul Frias
1b88e370cf Merge "Fix for concurrent provisioning attempts" into mnc-dev 2015-06-15 17:29:40 +00:00
Rahul Frias
b33298a742 Fix for concurrent provisioning attempts
[ Merge from http://go/wvgerrit/14670 ]

Concurrent provisioning attempts are declared successful if any one of them
succeeds. Earlier only the successful ones were declared as such.

b/21727698

Change-Id: I67dedca44790a4ae236e14f90a8fc91775273905
2015-06-12 14:37:41 -07:00
John "Juce" Bruce
6dbc3749b0 Merge "Validate Service Certificates Before Accepting Them" into mnc-dev 2015-06-12 19:49:46 +00:00
John "Juce" Bruce
c400a37d19 Validate Service Certificates Before Accepting Them
(This is a merge of http://go/wvgerrit/14630)

To create a better flow when an application sets a service certificate
manually, we will now validate the certificate when it is given to us,
and if it is invalid, we will not allow the property to be set.

Bug: 21307186
Change-Id: If980ad075604223fc962a859fae93e98d86a7f4f
2015-06-12 11:46:32 -07:00
Jeff Tinker
e1ba3ee601 Fix session count properties
bug: 21787354

merge of http://go/wvgerrit/14663 from the widevine repo

Change-Id: Ia8618c9daba2526234c5c5c84590e74d6feebf95
2015-06-11 14:57:18 -07:00
John "Juce" Bruce
a8328dd2f9 Delete Singleton on Library Unload
(This is a merge of http://go/wvgerrit/14531)

As an optimization, the Media Server now unloads our library when not
in use. This has exposed a bug by which we were never deleting the CDM
singleton. Fix is to make WvContentDecryptionModule an Android smart
pointer ref base and then make sure all the plugins store a strong
pointer to it. The singleton is a weak pointer, so when the last
plugin is cleaned up, the CDM will be as well. And on the off chance
that the library isn't immediately unloaded, the singleton code will
generate a new CDM next time one is needed.

Bug: 21153732
Change-Id: Ifaf02fa9afe0a70a8b53e8b92ee0a3d1359ca001
2015-06-09 14:58:01 -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
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
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
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
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
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
c4d9c1036e Merge "Update unit test make files to use BoringSSL" 2015-04-22 17:35:25 +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
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
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