Commit Graph

2056 Commits

Author SHA1 Message Date
Jeff Tinker
9f5438c812 Disable AmiAdapter info logging
AmiAdapter logging is too noisy, change
it to verbose.

Change-Id: Ib01df9e2fd8d0df34ec2883f5b773a7ff532896c
2017-02-01 15:57:42 -08:00
Fred Gylys-Colwell
eeaaf311e1 Correct comments and nits from other reviews
Merge from Widevine repo of http://go/wvgerrit/23436

This change is just comment changes: minor rewording and grammar
fixes.

Change-Id: I4cb2ef77715623fdb2567f5b504ffaceb937a480
2017-01-30 15:26:43 -08:00
Fred Gylys-Colwell
e4231fea3b More OEMCrypto Usage Table Unit Tests
Merge from widevine repo of http://go/wvgerrit/23421

This CL adds some more unit tests for big usage tables, and corrects a
problem found in the reference code.

Change-Id: Iae9a4406d79a13362223c2b4da7365b845d92382
2017-01-30 15:26:43 -08:00
Fred Gylys-Colwell
49a61f6270 Merge "OEMCrypto Backwards Compatible Usage Table" 2017-01-30 23:24:52 +00:00
Fred Gylys-Colwell
a118988ecf Merge changes I4e4a6a01,I4e360ea5,I6e08e76f
* changes:
  Refactor OEMCrypto Engine
  Add Shared License bit to key control block
  Reference Code for Big Usage Tables
2017-01-30 23:24:39 +00:00
Fred Gylys-Colwell
8cd21139f3 Remove malloc from haystack initialization *DO NOT MERGE* am: 66f07b3985
am: fd8d9315dd  -s ours

Change-Id: I11d1db472965becaf9d7277ad0e5ee3b0ba45ed7
2017-01-30 20:15:38 +00:00
Fred Gylys-Colwell
fd8d9315dd Remove malloc from haystack initialization *DO NOT MERGE*
am: 66f07b3985

Change-Id: Ib65652ce603e9aa6a4dbd27fb863f00064cd8f25
2017-01-30 20:14:09 +00:00
Fred Gylys-Colwell
9e153438db OEMCrypto Backwards Compatible Usage Table
Merge from widevine of http://go/wvgerrit/23283

This CL adds the backwards compatiblity functions to the new usage
tables in the oemcrypto mock reference code.

b/31458046
b/32554171

Change-Id: I04901d95aceb8910406f7c514c26c29c2c575322
2017-01-30 19:27:14 +00:00
Fred Gylys-Colwell
afb006f960 Merge "Add Unit Tests for Big RSA Keys" 2017-01-30 19:11:10 +00:00
Aaron Vaage
e8a138b11c Merge "Resolving Compiler Warnings" 2017-01-30 17:51:45 +00:00
Aaron Vaage
be448ed24a Collect Errors and Warnings In OEMCrypto Initialize
As a large number of provisioning errors can come from failures
initializing OEMCrypto we need to collect these  messages.
Errors and warnings were only printed to the log. This
change takes those messages and puts them into the oemcrypto
intialization mode metric.

"Mode" was chosen as most messages were about how oemcrypto
was initialized (e.g. into L3 because no L1 library was found).

Test: Ran all GTS Media Tests

Bug: 34782934
Change-Id: I1fcdd74c99011d53bdffe9609d2f4c46c222e2f6
2017-01-29 14:36:07 -08:00
Aaron Vaage
3a5fdd71a0 Resolving Compiler Warnings
There were warnings about unused parameters and unnecessary "const"
that were hiding other warnings. This change resolves those
warnings and resolves some constructor list ordering warnings
that were hidden among the other warnings.

Bug: 34784667
Change-Id: Ied78b00d3565abd66f90dbd1f4cce635dae7b957
2017-01-29 09:29:36 -08:00
Aaron Vaage
edb9f00df7 Widevine Metrics System
This change is the complete Widevine metrics system. It will
measure and record runtime information about what is happening
in the CDM - such as errors and throughput.

Bug: 33745339
Bug: 26027857
Change-Id: Ic9a82074f1e2b72c72d751b235f8ae361232787d
2017-01-27 16:59:17 -08:00
Fred Gylys-Colwell
d06fa606c7 Refactor OEMCrypto Engine
Merge from widevine repo of http://go/wvgerrit/23280

This CL moves some of the oemcrypto mock classes into their own
files.  There are no real code changes.

Change-Id: I4e4a6a01d8e75051bc0eb2a5d58361c438c7f41b
2017-01-27 15:21:08 -08:00
Fred Gylys-Colwell
650a0fdead Add Shared License bit to key control block
Merge from widevine of http://go/wvgerrit/23184

This adds the shared license bit to the key control block for the
reference code and the unit tests.

b/31458046

Change-Id: I4e360ea5dd2e6cee145663d4ab4f384b65cac427
2017-01-27 15:20:03 -08:00
Rahul Frias
ee5aff7706 Correct setting of service certificate.
[ Merge of http://go/wvgerrit/23380 ]

The service certificate was setup correctly if specified in mediadrm
properties. If instead the service certificate was later fetched from
the license service, it would not be marked as valid. This led to an
infinite loop of service certificate fetches and processing. This
prevented the license from being fetched and playback failures.

b/34638410

Test: Verified by new service certificate unittests + Hulu playback
using fugu.

Change-Id: I2a4f8754614fccdad3c80d3e13fba0b44d177d61
2017-01-27 02:44:38 -08:00
Fred Gylys-Colwell
3d977d999c Reference Code for Big Usage Tables
Merge from widevine of http://go/wvgerrit/23283

This CL adds some big usage table functionality to the oemcrypto
mock and unit tests.

Still missing are: backwards compatibility, defragging the table,
haystack code, and lots of new unit tests.

The haystack now reports it doesn't support usage tables, so that
the unit tests will pass.  This will be fixed in a future CL.

b/31458046
b/32554171
b/34173776
b/34174907

Change-Id: I6e08e76f7612ffb77e413151e00f830339298c62
2017-01-27 00:11:52 +00:00
Rahul Frias
ace09c710f Merge "Changes to CryptoSession to support big usage tables" 2017-01-26 18:40:22 +00:00
Fred Gylys-Colwell
1c5b4175aa Add Unit Tests for Big RSA Keys
Merge from widevine of http://go/wvgerrit/22958/

This adds unit tests for OEMCrypto to check 3072 bit RSA keys.  It
also adds indicates that the mock supports them.

b/32776334

Change-Id: I68a3ff56969a860602e6c230558478dc3577c8f5
2017-01-25 18:21:01 -08:00
John Bruce
961e7b4795 Merge "SPOID" 2017-01-26 01:00:15 +00:00
Rahul Frias
d29886f184 Changes to CryptoSession to support big usage tables
[ Merge of http://go/wvgerrit/23167 ]

This allows CryptoSession to support the new functionality added to
OEMCrypto to support big usage tables. No changes in behavior yet.
Code that calls these methods will be in a subsequent CL.

b/34327459

* Minor changes to cdm/Android.mk and cdm/test/unit-test.mk to remove
  profiler changes that were missed in previous releases.

Test: All unittests other than some oemcrypto, request_license_test
passed. Those tests failed with or without this CL.

Change-Id: I9becd97c5a8ddf74d30fabd1251e796b534c010f
2017-01-26 00:51:51 +00:00
Fred Gylys-Colwell
a24acfa928 Clang Format some OEMCrypto Files
Merge from Widevine repo of http://go/wvgerrit/23240

This CL runs clang format on some OEMCrypto test and mock files,
so it is easier to see what really changed in the next CL.

Change-Id: I0abf98fc8d312d5b94ad51c3ef2caae820b931de
2017-01-25 16:30:09 -08:00
Fred Gylys-Colwell
15e1f7dca2 Log Bad Keybox Token
Merge from widevine repo of http://go/wvgerrit/22664

This logs an error message when oemcrypto returns an error for
GetKeyData, and it updates the level3 to return a different error code
depending on which error was returned.

We have seen some provisioning errors in the field caused by GetToken
failing, but with no more information.   This should close that barn
door a little tighter.

Change-Id: Ie70980bbc3ac1353b76b668f12addf76c5e53cb8
2017-01-25 16:30:09 -08:00
Fred Gylys-Colwell
407c06a8da Add New Parameters to CreateUsageTableHeader
Merge from Widevine repo of http://go/wvgerrit/23166

This changes OEMCrypto_CreateUsageTableHeader so that the new header
is passed back in a buffer to the cdm layer.

I hacked out the haystack call and just stubbed out the mock call.
This should still build and run with previous liblevel3.a builds.

I also removed from the header some function names that are no longer
part of OEMCrypto v13.

bug:31458046

Change-Id: Ie490c482fe2457076f9026369f4b4b9491a4eb81
2017-01-25 16:28:26 -08:00
Fred Gylys-Colwell
de6d208380 Merge "Unit Test Updates for v13" 2017-01-26 00:21:50 +00:00
Fred Gylys-Colwell
47d6f99a1e Merge "OEMCrypto v13 Documentation" 2017-01-26 00:21:05 +00:00
Fred Gylys-Colwell
d75f0045e7 OEMCrypto v13 Documentation
Merge from Widevine repo of http://go/wvgerrit/22788
Merge from Widevine repo of http://go/wvgerrit/22887

This CL updates the documents for OEMCrypto v13, and adds the version
number to the file name.  There are no code changes.

b/34080119 Source and destination buffers may point to same buffer
b/32776334 Support 3072 bit RSA keys
b/33815454 Add Flag to disable Analog Outputs
b/28955873 Add support for Google hosted SRM
b/32554171 Usage table entry eviction and sharing by apps
b/31458046 Android Requires OEMCrypto v13

Change-Id: Id99f3c41e70451d0c73209797e9fa14e7b15cc1d
2017-01-26 00:18:13 +00:00
John W. Bruce
c85351682f SPOID
(This is a merge of go/wvgerrit/23182)

This patch adds the framework for Stable Per-Origin Identifiers to the
CDM. Calculating SPOIDs will be done on the client-side, and they are
sent as part of the provisioning request. SPOIDs are also available to
the app as the Device Unique ID, replacing the previous method of
returning the actual Device Unique ID from the keybox / OEM certificate.

Different SPOIDs must use separate storage, just as different origins
already do. Support for this has been added to the Android adapter to the
CDM Core. However, the code in the Android glue layer that would drive
this behavior will be checked in in a separate change. As such, all
Android devices will continue using the legacy behavior even after this
patch goes in, until the glue layer code can be updated.

Bug: 27101531
Test: CE CDM Unit Tests
Test: Linux Jenkins Unit Tests
Test: Android Unit Tests (with and without SPOIDs forced on)
Test: Android GTS Tests
Change-Id: Ia0caf890381cbcb97504d08b19aeab8b29bd07ae
2017-01-25 15:45:01 -08:00
John W. Bruce
5249221e3a Report 3072-bit Certificate Capability
(This is a merge of go/wvgerrit/23154)

This patch updates the ClientCapabilities protobuf to match the latest
on the server side and adds plumbing to the provisioning request
process so that devices can report whether they like big certs.

Their capacity to lie remains untested.

Bug: 34076937
Test: license_unittest
Change-Id: I3bcc9f1741146953d8bc0ff3d7d2305e7ac2c118
2017-01-24 16:54:43 -08:00
Rahul Frias
f854794c50 Merge "Infrastructure changes to support big usage tables" 2017-01-24 22:19:04 +00:00
Rahul Frias
4069e72102 Infrastructure changes to support big usage tables
[ Merge of http://go/wvgerrit/23161 ]

The usage table redesign will require storing usage table headers
and usage entries in non-secure persistent store. This information
will be signed by the TEE to prevent against modification. New
Storage and retrieval methods have been added for usage table headers,
while usage entries will be stored alongside (offline) licenses and
(secure stops/)usage info.

b/34327459

Test: All unittests, including newly introduced ones other than some
oemcrypto, request_license_test passed. Those tests failed with or without
this CL.

Change-Id: I9b8d6210e33774b0803f8af1711b2d593d467aec
2017-01-23 23:14:26 -08:00
Fred Gylys-Colwell
2afe783ce0 Unit Test Updates for v13
Merge from widevine of http://go/wvgerrit/23042

This updates unit tests to account for key control block changes for
OEMCrypto v13.  There are two new bits, restricting SRM version and
restricting analog output.  The verification string is also updated.

Part of this is to include some simple unit tests for the SRM
functions.

b/33815454
b/28955520

Change-Id: I7cc2ce508688fded2b67fc2a4379c7a8d59d8d22
2017-01-23 20:34:13 -08:00
Rahul Frias
0c4b8572cd Report disable analog output error
[ Merge of http://go/wvgerrit/23061 ]

b/34131127

Test: All unittests other than some oemcrypto, request_license_test
passed. Those tests failed with or without this CL.

Change-Id: I27a3cde8e5c86dc8f9b26f9d4e7793f86c016743
2017-01-23 20:03:10 -08:00
Rahul Frias
6a98f56412 Add support for SRM
[ Merge of http://go/wvgerrit/22980 ]

System Renewability Messages (SRM) contains a list of Key Selection
Vectors, which are HDCP Identifiers that have been revoked.
During HDCP negotiations a transmitter may authenticate a receiver
and verify that its unique identier is not present in the SRM.

This CL enables reporting of the current SRM version and whether SRM
updates are supported. It also loads SRM updates in the license
and specifies SRM version requirements when keys are loaded.

Test: All unittests other than some oemcrypto, request_license_test
passed. Those tests failed with or without this CL.

b/28955520

Change-Id: Id840078ea2deb01d9619c1cd8d367b50452f76cc
2017-01-23 17:01:07 -08:00
Fred Gylys-Colwell
65a2c240de Merge changes Ib41046d0,Ie138f034,If8d8e32e,I0318c532,I498e633a, ...
* changes:
  Remove missing tests from build_all_test script
  Replace PST Report with buffer
  Add InactiveUnused to Usage Report status
  OEMCrypto v13 Header and Stubs
  Log HTTP errors in unit tests
  Rename oemcrypto's CryptoEngine configuration functions.
  Move keybox and root certificate handling into new class.
  Test OEMCrypto with backwards compatible verification
2017-01-23 19:54:18 +00:00
Fred Gylys-Colwell
3147ad3265 Remove missing tests from build_all_test script
Merge from Widevine repo of http://go/wvgerrit/23180

The previous CL removed entry_writer_test and
circular_buffer_test. This CL updates the android build and run alll
unit test scripts.

Change-Id: Ib41046d0f224899f4d1d2742f07c030f7ce6b084
2017-01-23 19:54:07 +00:00
Fred Gylys-Colwell
7152957e42 Replace PST Report with buffer
Merge from Widevine repo of http://go/wvgerrit/23044

On some platforms, the compiler will not pack structures.  This CL
replaces the OECrypto_PST_Report packed structure with a simple buffer
of uint8_t.  This changes the signature of OEMCrypto_ReportUsage as
part of OEMCrypto v13.

There is also a new wrapper class that test code, the mock, and debug
code can use to access data in the report.

The old packed structure definition is moved to the level 3, where we
use a compiler that packs sructs when asked nicely.

arm/libwvlevel3.a  Level3 Library 4445 Jan 20 2017 11:29:15
x86/libwvlevel3.a  Level3 Library 4464 Jan 20 2017 11:10:49
mips/libwvlevel3.a  Level3 Library 4465 Jan 20 2017 10:56:08

b/32180083

Change-Id: Ie138f034cb12780a2f8636888cebf022c52169e5
2017-01-23 19:53:45 +00:00
Fred Gylys-Colwell
a494eeafdc Add InactiveUnused to Usage Report status
Merge from Widevine repo of http://go/wvgerrit/22963

This change kInactive to kInactiveUsed and adds kInactiveUnused to the
possible values for the status field in the Usage Report.  This CL
updates the header, the unit tests, and haystack and reference code.

b/32714323

Change-Id: If8d8e32ea1e3dc18da34e5fae35f578b027de9c7
2017-01-23 19:53:24 +00:00
Fred Gylys-Colwell
b2a3921b37 OEMCrypto v13 Header and Stubs
Merge from Widevine repo of http://go/wvgerrit/22899

This is most of the header changes for OEMCrypto v13.  This updates
just enough of the code that existing unit tests build and pass.

The documentation will be reviewed in http://go/wvgerrit/22887.  When
that CL has been approved, comments in the code will be updated to
match.

Real code will be broken into several other CLs.

bug:31458046

arm/libwvlevel3.a  Level3 Library 4445 Jan 17 2017 20:01:26
x86/libwvlevel3.a  Level3 Library 4464 Jan 17 2017 19:00:37
mips/libwvlevel3.a  Level3 Library 4465 Jan 17 2017 19:24:35

Change-Id: I0318c53235c0b33afb623cba933365e09dec4e61
2017-01-23 03:28:28 +00:00
Rahul Frias
a8e3bf9c28 Merge "Support Keybox, DRM Cert, and OEM Cert for Client ID" 2017-01-23 00:45:39 +00:00
Fred Gylys-Colwell
d7b27e49a0 Log HTTP errors in unit tests
Merge from Widevine repo of http://go/wvgerrit/23028

This logs the full response when the status code causes a gtest to
fail.  I hope we can figure out why the buildbot has flakey tests.

Change-Id: I498e633ad65fde4473e01ea227ffe75755fb4fd9
2017-01-20 18:41:17 -08:00
John Bruce
ebd72379c2 Merge "Reduce Duplication in CryptoPlugin" 2017-01-21 01:29:15 +00:00
Fred Gylys-Colwell
5748860679 Rename oemcrypto's CryptoEngine configuration functions.
Merge from Widevine repo of http://go/wvgerrit/22797

CryptoEngine has a number of functions that return constants that
control the configuration of mock OEMCrypto.  Give all the functions
a common prefix (config_) so their intent is more clear.

Change-Id: Idf9d3e9e8941fa0e793b0eb17a3f89bf634d9ed5
2017-01-20 17:02:12 -08:00
Fred Gylys-Colwell
3164194908 Move keybox and root certificate handling into new class.
Merge from Widevine repo of http://go/wvgerrit/22804

Create a class, AuthenticationRoot, to encapsulate the objects and
logic for managing either keyboxes or certificates as the device's
root of trust.

Currently the class provides the existing keybox-related functions
needed by oemcrypto's CryptoEngine. It will be extended to provide
both keybox and certificate related functions, and the logic to
determine whether keybox or certificate based authentication should
be performed.

Change-Id: I792d1bfc8e9a81bbfd2baec20e3b3d182f0392f7
2017-01-20 16:57:32 -08:00
Rahul Frias
2812c3d2ac Support Keybox, DRM Cert, and OEM Cert for Client ID
[ Merge of http://go/wvgerrit/22900 ]

Add GetClientToken(), GetProvisioningToken(), GetPreProvisionTokenType()
to CryptoSession.  They return the correct token bytes and token type
for preparing the ClientIdentification message for provisioning and
license server transactions.

Also refactor service certificate handling.

OEM certs are introduced in Provisioning 3.0

b/30811184

* Address build breaks

[ Merge of http://go/wvgerrit/23162 ]

This addresses issues introduced by http://go/wvgerrit/22900

b/30811184

* When http://go/wvgerrit/18012 was merged (ag/1446934) some changes
were not merged for mapErrors-inl.h. These changes are included in this CL.

* When ag/1678104 was reverse merged to http//go/wvgerrit/21981/ a variable
was renamed and some comments were added to add clarity in cdm_engine.cpp.
These changes are included in this CL.

Test: All unittests other than some oemcrypto, request_license_test
passed. Those tests failed with or without this CL.

Change-Id: Ie0215509f2f985f2a610f5a4c865db47edec8662
2017-01-20 16:42:21 -08:00
Fred Gylys-Colwell
a0c1f218c5 Test OEMCrypto with backwards compatible verification
Merge from Widevine repo of http://go/wvgerrit/22571

This adds unit tests to verify that OEMCrypto accepts all key control
block verification strings kctl, kc09, kc10, ....   This is needed now
that the unit tests use the current API for all other unit tests.

b/33253872

Change-Id: Ie6b556fc91cd6cb6e07141bd50da3dbfa1681fec
2017-01-20 16:40:23 -08:00
Rahul Frias
7c01f954da Merge "Use "individualization-request" to provision devices." 2017-01-20 23:02:34 +00:00
Rahul Frias
14fe03e195 Merge changes I6d7b5bfb,Ib9041d39
* changes:
  Add License::Policy::play_start_grace_period_seconds
  Update CDM to newest license protocol definitions.
2017-01-20 23:02:05 +00:00
Rahul Frias
826c91ba26 Add License::Policy::play_start_grace_period_seconds
[ Merge of http://go/wvgerrit/22565 ]

When using the grace period, the CDM will need to override the values
given to use by the TEE (through OEMCrypto).  Normally the first (and
last) decrypt times are stored securely by the TEE.  To avoid extra
complexity in OEMCrypto, we will simply ignore the values given to us
by the TEE when using this feature.

However, the TEE will still enforce the (hard) license duration.  So
only the rental/playback durations will be affected by malicious
editing of files.

b/34211676

Test: Reran unittests including newly added tests. All tests other than
some oemcrypto, request_license_test passed. Those tests failed with
or without this CL.

Change-Id: I6d7b5bfb669fd8603b474b68c2f7175b0c30901d
2017-01-20 11:26:57 -08:00
John Bruce
e782a78e9c Merge "Update Widevine Version Number for Android O" 2017-01-20 19:18:31 +00:00