Commit Graph

1283 Commits

Author SHA1 Message Date
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
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
Adam Langley
96f5d1bef3 am f934d6fb: (-s ours) widevine: update to work with BoringSSL.
* commit 'f934d6fb41f5e75fb9fbd44fb74be2be1a2cd803':
  widevine: update to work with BoringSSL.
2015-04-18 18:46:08 +00:00
Adam Langley
f934d6fb41 widevine: update to work with BoringSSL.
This change:

1) Switches the Makefiles over to using LOCAL_STATIC_LIBRARIES, which I
understand is the new hotness, rather than setting a -I flag directly.

2) Switches to the non-deprecated _ex versions for EVP_EncryptFinal.

3) Uses the EVP_PKEY interface for checking PSS signatures. This is the
only supported interface in OpenSSL: the PSS padding check functions are
only exported in upstream OpenSSL because it's a library from the 90s
and they don't have a concept of "unexported". Also, by using the EVP
functions, OpenSSL/BoringSSL can do a better job of being constant-time.

Since there aren't any obvious tests for checking that the signtaure
verification still works, I tested with the code in the referenced
paste, which includes both the old and new verification functions and
checks that they both work on a sample signature. (And I also checked
that they both fail when a bit in the signature is changed.)

https://paste.googleplex.com/5747976139964416

(cherry picked from commit 4f01ef23d1)

Change-Id: Iae7409c53eeea9c3892a32c180d7181d72467dcb
2015-04-18 09:46:53 -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
Kyle Alexander
7cb708b8ad Merge "Fix compatibility for tests to execute on older OS versions" 2015-04-10 17:14:06 +00:00
Kyle Alexander
1e87ad760f Fix compatibility for tests to execute on older OS versions
Change-Id: I7b2554d097901cd5880b6cd3ddbe66c9b127dcfd
2015-04-10 09:15:23 -07:00
John "Juce" Bruce
efea2ddba4 Allow Unprovisioning of Origins
(This is a merge of http://go/wvgerrit/14051)

Adds support for passing a special provisioning response ("delete")
to the provisioning API in order to unprovision the current origin.
Note that the origin MUST be set or else this will fail.

The existing, system-only unprovisionDevice() method is unaffected.

Bug: 12247651
Change-Id: I16d296397d8e9e73c8f43e36c86838873318a398
2015-04-09 19:07:51 -07:00
John "Juce" Bruce
59811eed57 Support Per-Origin Provisioning
This is a merge of several Widevine-side commits that, cumulatively,
allow callers to specify an origin to be used to isolate data storage
as specified in the W3C Encrypted Media Extension specification.
Separate origins have separate certificates, and consequently cannot
share device identifiers with each other.

The changes included in this are:

Add Ability to Check for Existing Certificates
    http://go/wvgerrit/13974
Add Ability to Remove the Certificate
    http://go/wvgerrit/13975
Make CDM Origin-Aware
    http://go/wvgerrit/13977
Add Per-Origin Storage to Widevine CDM on Android
    http://go/wvgerrit/14026
Remove Automatic Origin Generation
    http://go/wvgerrit/14031

Bug: 19771858
Change-Id: I6a01c705d9b6b4887a9c7e6ff4399a125f781569
2015-04-09 19:02:31 -07:00
John "Juce" Bruce
786bbba499 Update Protobufs to Include Per-Origin Provisioning ID
(This is a merge of http://go/wvgerrit/13976)

Updates the certificate provisioning protobuf to include the stable_id
field.

Bug: 19771858
Change-Id: I6c1ed8c8c219a8cacc9798d189458d9861aa46d0
2015-04-09 19:00:16 -07:00
John "Juce" Bruce
b0b11bc534 Replace OS Version with Widevine Version
(This is a merge of http://go/wvgerrit/13813)

Removes the OS Version property which was only ever implemented on
Android to appease Netflix and never actually used by them. Adds,
instead, a Widevine library version property. Also adds
implementations of this function for both Android and CE Devices.

For Android, the version number is starting at 3.0.0-android, to
reflect that this is the third major revision of the Widevine CDM in
Android.

For CE Devices, the version number is not changing from its current
value (2.2.0) but is gaining a "-ce" on the end in order to
differentiate it from the Android version number.

Bug: 18376638
Change-Id: Ifb3fa0d62631b45d9e91a6a53bcab3be38763d3a
2015-04-09 18:53:49 -07:00
Fred Gylys-Colwell
3ff106f86a Merge "OEMCrypto Unit Tests" 2015-04-10 00:06:39 +00:00
Jeff Tinker
453eb29b57 Merge "Integrate OnExpirationUpdate and OnSessionKeysChange with Android" 2015-04-10 00:01:32 +00:00
Fred Gylys-Colwell
2527f77201 OEMCrypto Unit Tests
This is a merge from the Widevine repository of
http://go/wvgerrit/14024
Add Level 3 Oemcrypto Unit Tests To Run All Tests Script

This CL adds the ability to restrict the oemcrypto unit tests to only
use the fall back level 3.  This restriction is per-process, and is
only used while running the unit tests.  This allows us to automate
running the unit tests on an android device as both level 1 and level
3 without modifying files in /system/lib.  To turn on the restriction,
set the environment variable: FORCE_LEVEL3_OEMCRYPTO=yes.

New level 3 library versions are:
level3/arm/libwvlevel3.a  Level3 Library Apr  8 2015 13:09:05
level3/x86/libwvlevel3.a  Level3 Library Apr  8 2015 13:15:42

http://go/wvgerrit/14055
Remove Redundant Tests

This CL modifies the UsageTableTests in oemcrypto_test.cpp so that
they are not all parameterized by new_mac_keys_.  This parameter is
used when testing signatures.  In particular, we do not need to verify
timing twice.

Also, I modified the run_all_unit_tests.sh script so that the
environment variable GTEST_FILTER is passed down to the android
process.  This allows us to use the script to run a limited list of
tests while debugging.

http://go/wvgerrit/14054
Filter Out API Version 10 Tests

This CL updates the OEMCrypto tests so that all but one test will pass
for a device that implements the version 9 API.

Android LMP devices should pass tests with
        GTEST_FILTER="*-*MNC*:*CanLoadTestKeys*"

http://go/wvgerrit/13886
Update Documentation about Optional Features

The intergration guide has been updated to include reference to
OEMCrypto_LoadTestRSAKey.  It also now discusses optional features.

The Delta 10 document now mentions OEMCrypto_LoadTestRSAKey.
The android supplement warns that most optional features are required.

This also adds clarification about which functions should save the
usage table, in answer to:

b/16799904 OEMCrypto v9 ambiguous about saving usage table information

Change-Id: Ifb517d58952c9b332b2958ca99af64bc293b985f
2015-04-09 16:19:17 -07:00
John "Juce" Bruce
ac0e1cf07f Merge "Widevine CDM Now Goes to Eleven" 2015-04-09 21:50:03 +00:00
John "Juce" Bruce
2ebfce52ef Merge "Add Getter for App ID" 2015-04-09 21:49:50 +00:00
John "Juce" Bruce
7bfda6ec82 Merge "Use Idiomatic Generators for DeviceFiles Unit Tests" 2015-04-09 21:49:31 +00:00
John "Juce" Bruce
85b46b454b Widevine CDM Now Goes to Eleven
(This is a merge of http://go/wvgerrit/13980)

Adding origins to Android is going to push the number of arguments to
GenerateKeyRequest over the maximum allowed by gMock. This change
increases the maximum to 11 in order to continue supporting us.

Bug: 19771858
Change-Id: Id04609d70da194f1491573b1b4aa9c23a67b78ab
2015-04-09 12:28:39 -07:00
John "Juce" Bruce
c1c2615f46 Merge "Add Hard Return to run_all_unit_tests.sh" 2015-04-09 01:12:32 +00:00
John "Juce" Bruce
6e075cfca8 Add Hard Return to run_all_unit_tests.sh
(This is a merge of http://go/wvgerrit/14052)

Adds a hard return at the end of the output of run_all_unit_tests.sh
if tests failed, which was previously missing.

Change-Id: Ie888168fb965e1f116c2cd7d586b46736abc9c80
2015-04-08 18:00:55 -07:00
Fred Gylys-Colwell
4d6ec2ac4c Merge "Enable OEMCrypto Unit Tests" 2015-04-08 18:27:18 +00:00
Ying Wang
b872ae1b0c Merge "Remove setup of proto generated include/header dependency." 2015-04-08 16:22:42 +00:00
John "Juce" Bruce
7a8e33ca21 Add Getter for App ID
(This is a merge of http://go/wvgerrit/13973)

The app ID was write-only because no getter was ever written.

Change-Id: Ie5e383ee3a2dcf2843a6671becb6ff1f88e97d24
2015-04-07 16:34:33 -07:00
John "Juce" Bruce
e0727b8af6 Use Idiomatic Generators for DeviceFiles Unit Tests
(This is a merge of http://go/wvgerrit/13971)

gTest provides generators for ranges of numbers and booleans so that
we don't have to roll our own.

Change-Id: Id7d9310c5d5c1314f680200da4457c0e529ac107
2015-04-07 16:33:27 -07:00
Fred Gylys-Colwell
6d5be4fddf Enable OEMCrypto Unit Tests
This is a merge from the widevine repository of
http://go/wvgerrit/13923 Switch openssl to use the EVP interface for aes-ctr-128
http://go/wvgerrit/13979 Add Test Certificate to OEMCrypto Mock
http://go/wvgerrit/13978 Add Test Keybox to Level 3 OEMCrypto
http://go/wvgerrit/13873 Enable OEMCrypto Unit Tests

This CL adds a main program to oemcrypto_test.cpp, which filters out
tests that are not supported on the specified platform. It also adds
LoadTestKeybox to the mock. This allows oemcrypto unit tests to be run
on devices that have production keybox.  It also allows the same set
of unit tests to work on Android and on non-Android platforms.

b/18962381 Use test certificate (partial fix)
b/19867990 Separate cast receiver tests

Change-Id: If89c31530103ed85aa37d7379bd5b4dc2a927f38
2015-04-07 15:24:10 -07:00
Edwin Wong
229fb48f83 Merge "Add VerifyUsageTimes() test." 2015-04-07 20:17:35 +00:00
Ying Wang
0c850a4cb3 Remove setup of proto generated include/header dependency.
They are now set up automatically by the build system.

Bug: 20093047
Change-Id: I3ab1256952915e402adf6510c0f6fdb158feb802
2015-04-07 12:51:20 -07:00
John Bruce
71ccb7f032 Merge "widevine: update to work with BoringSSL." 2015-04-07 19:14:34 +00:00
Edwin Wong
cc189d0461 Add VerifyUsageTimes() test.
Merge from Widevine: http://go/wvgerrit/14022

This test will be called by GTS test to verify secure stops
are reporting the correct time during online playback.

bug: 18625670
Change-Id: Ieb2b9ad860d796eea3c63c4fb349f4e3c6ac8f34
2015-04-07 12:09:30 -07:00
Fred Gylys-Colwell
88d9472cfb Merge "Fix Memory Leak In OEMCrypto Level 3 Haystack" 2015-04-06 01:52:20 +00:00
Kongqun Yang
8a37cd4538 Clean up get/set property code
Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13970

Change-Id: I2b52248e71c18808f36730a438390f855309cc14
2015-04-02 15:22:17 -07:00
Kongqun Yang
7c003cdb0e Merge "Report key status change" 2015-04-02 17:18:20 +00:00
Kongqun Yang
d9b274cb4a Merge "Report change in session expiration" 2015-04-02 17:18:06 +00:00
Kongqun Yang
de35e1e228 Add Android property for numberOfOpenSessions
Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13960

Change-Id: I04c63c75987b7cd81fd60af925676c6d99368b22
2015-04-01 19:30:15 -07:00
Kongqun Yang
f7c449e93a Integrate OnExpirationUpdate and OnSessionKeysChange with Android
Also removes OnSessionExpiration which is no longer needed with
OnSessionKeysChange.

Bug: 19771612
Bug: 19771431

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

Change-Id: I0603e808e8d50ff7bb1fb1d5e44fabd8d268ee8a
2015-04-01 19:28:35 -07:00
Kongqun Yang
4621028434 Report key status change
Also modified PolicyEngine::CanDecrypt to use the new Keys_status_.

Bug: 19771431

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

Change-Id: If7fb7fa45ecf9ff4e65278cda00ad7230b57f50b
2015-04-01 19:25:39 -07:00
Adam Langley
4f01ef23d1 widevine: update to work with BoringSSL.
This change:

1) Switches the Makefiles over to using LOCAL_STATIC_LIBRARIES, which I
understand is the new hotness, rather than setting a -I flag directly.

2) Switches to the non-deprecated _ex versions for EVP_EncryptFinal.

3) Uses the EVP_PKEY interface for checking PSS signatures. This is the
only supported interface in OpenSSL: the PSS padding check functions are
only exported in upstream OpenSSL because it's a library from the 90s
and they don't have a concept of "unexported". Also, by using the EVP
functions, OpenSSL/BoringSSL can do a better job of being constant-time.

Since there aren't any obvious tests for checking that the signtaure
verification still works, I tested with the code in the referenced
paste, which includes both the old and new verification functions and
checks that they both work on a sample signature. (And I also checked
that they both fail when a bit in the signature is changed.)

https://paste.googleplex.com/5747976139964416

Change-Id: Iae7409c53eeea9c3892a32c180d7181d72467dcb
2015-04-01 15:46:54 -07:00
John "Juce" Bruce
74afe9dd4e Remove Unused Member from CDM Session
This is a merge of http://go/wvgerrit/13929 from the Widevine repo.

Change-Id: Ic0dea9a0a263fe68bea5ca6c87f5d8e8356ed77c
2015-04-01 13:28:39 -07:00