Commit Graph

546 Commits

Author SHA1 Message Date
John Bruce
0e1839ac4d Merge "Do Not Clean Up Licenses As Aggressively" into mnc-dev 2015-08-20 21:21:43 +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
Fred Gylys-Colwell
9a714edc6f Merge "Fix RSA Key Padding in OEMCrypto Unit Tests" into mnc-dev 2015-08-14 22:01:06 +00:00
Fred Gylys-Colwell
631d3e7a4c Relax test on forbidden signing [DO NOT MERGE]
Copy from widevine repo of http://go/wvgerrit/15390

Because some devices are failing oemcrypto unit tests related to
signing schemes that they do not support, we are relaxing the
requirement that they return the correct error code.

We are still requiring that the device does NOT sign with a forbidden
scheme.  However, it is OK if they do not return an error code from
OEMCrypto_GenerateRSASignature.   They will be required to return the
correct error code in the next release.

bug: 21668896
bug: 21708882

Change-Id: I1b8a410909b364d0086cba38eadca11aceaac5f6
2015-08-11 17:05:20 -07:00
Fred Gylys-Colwell
29e08f2166 Fix RSA Key Padding in OEMCrypto Unit Tests
Merge from widevine of http://go/wvgerrit/15371

incorrectly have leading 0x00 bytes added to all integers.  This
leading 0 should only be added to integers that had a leading byte
larger than 0x80 because those would be parsed as negative numbers.

bug: 23105200
Change-Id: I1dd01cc2b83a807bbdb78c079c6ce4e01d41f616
2015-08-11 13:52:50 -07: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
bf10061929 Merge "Verification of client identification in Secure Stop messages" into mnc-dev 2015-07-13 18:45:18 +00:00
Jeff Tinker
47014df2e8 Return specific error code when decrypting on invalid session
bug: 22235465
Change-Id: I7b4d47d86d35270291ced02112a96800ba03ed1a
2015-07-07 08:55:22 -07: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
Fred Gylys-Colwell
e280ba6c41 Merge "Add Short Key ID Test" into mnc-dev 2015-07-01 22:50:10 +00:00
Fred Gylys-Colwell
4b3c02267a Add Short Key ID Test
Merge from widevine repo of http://go/wvgerrit/14970

Even if devices cannot handle key ids with different lengths in the
same license, they should still handle keys with a shorter key id.

This is a partial fix for:
bug: 21935358

Change-Id: Ibc84f0b5d7d9bc5d24a2081f0581a2b256e51f44
2015-07-01 13:21:21 -07:00
Kyle Alexander
86adf4a25c Add secure VP9 content to GTS content list.
ExoPlayerDemo build is based on the demo-debug.apk built from:
google3/third_party/java_src/android_libs/exoplayer

Supporting cl in google3: cl/97176187

Bug: 19571315
Change-Id: I611e9e5f363ecfeb66e4813c1f6939abbf855d09
2015-07-01 10:02:49 -07: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
57eb7cb6ba Merge "Add unit tests for offline licenses without session usage" into mnc-dev 2015-06-25 06:40:21 +00:00
Fred Gylys-Colwell
666031026c Make MaxSessionsOpenCloseAPI10 More Lenient
Merge from widevine repo of http://go/wvgerrit/14870

OEMCrypto_GetMaxNumberOfSessions is not required to return a hard
limit for the number of sessions.  This CL adjusts the test to verify
we can open within 5% of the maximum number of sessions.

bug: 22029687
Change-Id: I6e72e39338cead8d547cdb194a32fb7e7dc53037
2015-06-24 17:49:06 -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
John "Juce" Bruce
256dd1a5b4 Merge "Re-Add MIPS to Android CDM Build" into mnc-dev 2015-06-20 00:33:01 +00:00
John "Juce" Bruce
da8e2beb28 Merge "Do Not Use GNU-Style Hashing on MIPS" into mnc-dev 2015-06-20 00:31:50 +00:00
John "Juce" Bruce
64d9be5615 Fix OEMCrypto Tests
(This is a merge of http://go/wvgerrit/14810)

By making this constant unsigned, all calculations in EXPECT_ALMOST
were cast to unsigned, leading to underflow problems when it was
subtracted from zero.

Change-Id: Iefc4e30604c45fec8b203375074b26fb12ec385f
2015-06-19 17:08:56 -07: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
123c469d3e Do Not Use GNU-Style Hashing on MIPS
(This is a merge of http://go/wvgerrit/14801)

The MIPS compiler does not support GNU hashing, which means this
compiler option needs to be excluded.

Bug: 19482469
Change-Id: I913f666a39eb535a33ebfbc49e5e7531115db5d4
2015-06-19 16:33:11 -07:00
Fred Gylys-Colwell
20b07afad9 Merge "Disable Flaky Key Id Length Tests" into mnc-dev 2015-06-19 22:27:26 +00:00
Fred Gylys-Colwell
592f8ad6db Disable Flaky Key Id Length Tests
Merge from widevine directory of http://go/wvgerrit/14784

These tests are not passing on multiple devices so I will disable them
until I am sure they are giving a clear signal.

bug: 21935358
Change-Id: I1e0cf01e64ea50b02d61d4b8334c0efb55e47d35
2015-06-19 13:29:52 -07:00
Rahul Frias
dcc5cc1ee1 Merge "Address compiler warning" into mnc-dev 2015-06-19 19:40:32 +00:00
John "Juce" Bruce
3efe87583d Merge "Be More Forgiving in EXPECT_ALMOST()" into mnc-dev 2015-06-19 18:20:30 +00:00
John "Juce" Bruce
b0cfa834f1 Merge "Fail Test if LoadOfflineLicense() Helper Fails" into mnc-dev 2015-06-19 18:17:55 +00:00
Rahul Frias
f08d6fae3a Address compiler warning
[ Merge of http://go/wvgerrit/14788 ]

A retired error code was not being handled when converting from
a WVStatus error code to a ERROR_DRM_VENDOR error code.

b/13976775

Change-Id: Ib4363792e4a5e9a20fc718d169b3e0348413267a
2015-06-19 11:14:21 -07:00
John "Juce" Bruce
6a773e3630 Be More Forgiving in EXPECT_ALMOST()
(This is a merge of http://go/wvgerrit/14776)

This change widens the range in EXPECT_ALMOST slightly, to allow for
slight timing errors in the tests.

Bug: 21489628
Change-Id: Ibb074c2d037566c307c0438efdda3841bc48f7ed
2015-06-18 19:00:06 -07:00
John "Juce" Bruce
57fd014f6d Fail Test if LoadOfflineLicense() Helper Fails
(This is a merge of http://go/wvgerrit/14775)

This change causes tests that call LoadOfflineLicense() to fail if
the session is still open after that call. Due to the way that gTest
handles ASSERT_*() macros, failures in LoadOfflineLicense() will leave
the session open, causing unexpected state and cascading failures
throughout the rest of the test. With this change, we will abort
sooner, reducing log noise.

Bug: 21489628
Change-Id: Ic35bc77bbc5f676f23deeefaacd1986e383538c8
2015-06-18 18:59:24 -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
John "Juce" Bruce
968993cd05 Allow Clearing of Privacy Cert
(This is a merge of http://go/wvgerrit/14782)

The ability to clear the privacy cert after setting it was
accidentally removed by adding validation, as an empty certificate is
invalid. This restores the ability to clear the certificate by not
validating if the value being set is empty.

Bug: 21923281
Change-Id: Ibb57481a398c9599163ab3512125a9d5b5fcaab4
2015-06-18 18:47:41 -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
Fred Gylys-Colwell
b879cc6c3a Merge "Fix QueryKeyControl Unit Test" into mnc-dev 2015-06-17 23:35:23 +00:00
Fred Gylys-Colwell
854a409ae6 Accept Other Error Codes in TestSignatureBoth
Merge from widevine of http://go/wvgerrit/14744

The OEMCrypto unit test TestSignatureBoth verifies that a cast
certificate cannot be used to derive session keys.  This CL relaxes
the requirement that DeriveKeysFromSessionKey returns a specific error
code instead of just failing.

bug: 21708882
Change-Id: I4163a9616122ad709bab76f488d030239029861c
2015-06-17 15:58:58 -07:00
Fred Gylys-Colwell
b6f096d08a Fix QueryKeyControl Unit Test
Merge from widevine repo of http://go/wvgerrit/14720

The QueryKeyControl test expects an error message that the output
buffer is too small.  However, it also gives a bad key id.  Some
devices were correctly returning key not found.  This corrects the key
id length so that the only error is that the buffer is too small.

bug: 21881768
Change-Id: I96f59ede42eeddc9849fbac1e52acecdb562df08
2015-06-17 15:53:12 -07:00
Fred Gylys-Colwell
e16e4c1a49 Merge "Replace MockCDM with Android Smart Pointer to MockCDM" into mnc-dev 2015-06-17 21:43:25 +00:00
Fred Gylys-Colwell
87dbf0d941 Replace MockCDM with Android Smart Pointer to MockCDM
Merge from widevine repo of http://go/wvgerrit/14742

The CDM object can no longer be created on the stack because it
inherits from RefBase.  This caused some unit tests to hang in the
MockCDM destructor.

bug: 21881298

Change-Id: Ieeb7863031609f12ad3d9188c4525aa2fa1eb736
2015-06-17 13:57:44 -07:00
Fred Gylys-Colwell
f9453190fd Improve RSA performance in Level 3 OEMCrypto
Merge from widevine repo of http://go/wvgerrit/14668

This CL modifies the multiplication routine to avoid memory cache
misses.  This shows a 10-20% speed improvment in license requests on
an x86.

Level 3 library version:
level3/arm/libwvlevel3.a  Level3 Library Jun 15 2015 14:09:24
level3/x86/libwvlevel3.a  Level3 Library Jun 15 2015 14:09:10

bug: 18252910

Change-Id: I4429324374de46d1d710d5fcac80f7ed363c696c
2015-06-17 11:28:27 -07:00
Fred Gylys-Colwell
82bf03f062 Verify OEMCrypto supports Level 1
Merge from widevine repo of http://go/wvgerrit/14708

This CL adds a test to verify that oemcrypto is a level 1 device.  It
is part of oemcrypto_test_android.cpp, so it only applies to android
devices and to the widevine buildbot which also runs the android tests.

bug: 21814204

Change-Id: Icbcdd3496fb8a656891bd7c873c60cba23c9666a
2015-06-16 17:46:52 -07:00
Fred Gylys-Colwell
8bd1a40cd2 Verify Key Rewrapping Does Not Leave Key in Clear
Merge from widevine repo of http:/go/wvgerrit/14707

This CL adds a check to oemcrypto_test to verify that when a
certificate is rewrapped, it does not show up in the clear.  We can't
really verify that it is encrypted well, but we can check this.

bug: 21871738

Change-Id: I07c87c38a1e2a099a90a5be4e3350e91e09f6722
2015-06-16 11:16:46 -07:00
Fred Gylys-Colwell
1d934be5d1 Merge "Separate and Clarify Cast Reciever Tests" into mnc-dev 2015-06-15 20:24:02 +00:00
Fred Gylys-Colwell
bf484e95de Separate and Clarify Cast Reciever Tests
Merge from widevine of http://go/wvgerrit/14667

This CL updates oemcrypto_test.cpp so that devices that are not cast
recievers do not attempt to run those tests that are only needed by
cast recievers.

bug: 21708882
bug: 18948285

Change-Id: I75f9170cee13e66667db54c5f298ed5c6cf14a48
2015-06-15 11:22:46 -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