Commit Graph

1480 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
da4029d83d Add README for Android
Merge from Widevine repo of http://go/wvgerrit/66883

The main reason this README is needed is that we want to tell partners
which branches they should be using.

test: docs only
bug: 31963611
Change-Id: Ifce968cdffc69e547c58cd8a4615b2f949bcab62
2018-11-22 00:33:30 +00:00
Rahul Frias
f0e855a8d4 Merge "Always use configured client authentication" 2018-11-17 23:18:20 +00:00
Rahul Frias
dd55fefe87 Add support for HDCP 2.3
[ Merge of http://go/wvgerrit/66283 ]

Bug: 78773763
Test: WV unit/integration tests

Change-Id: I5050295a7aa6d829a66adce5d5de86b725a82738
2018-11-16 23:46:27 -08:00
Rahul Frias
d8cc5481e3 Update license_protocol and client_identification protos
[ Merge of http://go/wvgerrit/65442 ]

This also requires the removal of sub session related code as references
were removed from the proto.

Bug: 119077124
Test: WV unit/integration tests
Change-Id: Ida1a591afc267ec97344e5bba00bbf401887a202
2018-11-16 23:44:43 -08:00
Fred Gylys-Colwell
87b3c3cbe7 Align table in comments
Merge from Widevine repo of http://go/wvgerrit/66667

This CL uses the magic of https://www.emacswiki.org/emacs/TableMode
to fix the table in OEMCryptoCENC.h

Test: comment only
Bug: 111939411
Change-Id: Iddc884bb8d9f1d9470bae9c5f6ebbec7524a7111
2018-11-16 17:14:02 -08:00
Fred Gylys-Colwell
f18ac47d71 Update oemcrypto adapter for v15 -> v14
Merge from master branch of Widevine repo of http://go/wvgerrit/66081
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/65962

This CL changes function names in the v14 level 3 libraries to work with
the dynamic adapter.  I also excluded several OEMCrypto unit tests from
running with a v14 oemcrypto because they require error code changes
introduced in v15.

Bug: 117888897 Fix backwards compatibility
Bug: 119313532 Integration test failing

Test: unit tests on taimen.  Play Movies, ExoPlayer, Netflix play on taimen.
Some unit tests do not pass because Taimen uses a v13 oemcrypto. Most pass.

Change-Id: Ib8eb8a89591fdba3055064c4bdf90523b01309a8
2018-11-16 17:14:02 -08:00
Fred Gylys-Colwell
246621c5ce Full decrypt path testing
Merge from master branch of Widevine repo of http://go/wvgerrit/66080
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64002

This CL updates OEMCrypto reference code and unit tests to support full decrypt
path testing.

Test: unit tests
Test: tested as part of http://go/ag/5501993
Bug: 34078913
Change-Id: Ia67374599d6619698a336f41513068ad04294e7f
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
4ffacfdcc7 OEMCrypto_GetRandom should only be called after init
Merge from master branch of Widevine repo of http://go/wvgerrit/66079
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/65662

This CL forces OEMCrypto_Initialize to be called before OEMCrypto_GetRandom is
called in the reference code.

Bug: 34847139
Test: tested as part of http://go/ag/5501993
Change-Id: Ibb94e2fdc11cdb43c2c7bd2a3379f87b0155479a
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
4fa255ea51 Add Sandbox ID support
Merge from master branch of Widevine repo of http://go/wvgerrit/66078
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64022

This CL updates OEMCrypto ref code, unit tests, and core code for
setting the sandbox id before initializing OEMCrypto.

Test: unit tests only
Test: tested as part of http://go/ag/5501993
Bug: 115834255
Change-Id: Id9831680fe4db1c69413815931cae4bc80df0c01
2018-11-16 17:14:00 -08:00
Srujan Gaddam
0ee5214b92 Add rollback-prevention time methods to ref
Merge from master branch of Widevine repo of http://go/wvgerrit/66077
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64562

Bug: b/78357351

b/62058202 addressed issues with the Level 3 OEMCrypto in guarding
against rollback. This change does something similar for the ref, so
that OEMCrypto vendors have rollback-prevention code they can refer to.

Test: linux/ce cdm unit tests
Test: tested as part of http://go/ag/5501993

Change-Id: I76128c5def2615ecbdbe94e3af1fec4a025be8c1
2018-11-16 17:14:00 -08:00
Srujan Gaddam
b7e4b56934 Update OEMCrypto calls to use substrings (addendum)
Merge from master branch of Widevine repo of http://go/wvgerrit/66076
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64743

http://go/wvgerrit/64083 had some refactorings that weren't completely
accurate or slightly changed the meaning of some tests. This CL is an
addendum to that CL to fix those refactorings.

Test: tested as part of http://go/ag/5501993
Bug: 115874964

Change-Id: I37766a4c34de737eb9ca94ef781805435ee30dfd
2018-11-16 17:14:00 -08:00
Srujan Gaddam
4d5e0f961b Add tests for null kc/kc iv
Merge from master branch of Widevine repo of http://go/wvgerrit/66075
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64702

Bug: 118172995

Tests OEMCrypto_LoadKeys when given a KeyObject with NULL KeyControl or
KeyControl iv.
Test: tested as part of http://go/ag/5501993

Change-Id: I1a5d26b1e2ff395fbd5ef7769af1165222c1877e
2018-11-16 17:14:00 -08:00
Srujan Gaddam
926a780397 Resize mac_key string to 2 * MAC_KEY_SIZE
Merge from master branch of Widevine repo of http://go/wvgerrit/66074
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/65102

Currently, the string only contains the mac_key_server, which isn't an
issue currently because we just get the offset into the message for the
enc_mac_keys pointer when calling LoadKeys, and rely on OEMCrypto to
read the 64 bytes. However, v15 will need the length of the enc_mac_keys
to reflect the true size.

Test: tested as part of http://go/ag/5501993
Bug: 115874964

Change-Id: Id76e91feb176755467c0433e6b0e87d2bb221033
2018-11-16 17:14:00 -08:00
Srujan Gaddam
e6439255ba Update OEMCrypto calls to use substrings
Merge from master branch of Widevine repo of http://go/wvgerrit/66073
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64083

As part of the update to v15, LoadKeys, RefreshKeys, and
LoadEntitledContentKeys should all use offsets and lengths into the
message rather than a pointer for its parameters. The CDM, tests,
adapters, and OEMCrypto implementations are changed to reflect this.

Test: tested as part of http://go/ag/5501993
Bug: 115874964

Change-Id: I981fa322dec7c565066fd163ca5775dbff71fccf
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
4550979f22 OEMCrypto Resource Rating
Merge from master branch of Widevine repo of http://go/wvgerrit/66072
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63764

This adds the function OEMCrypto_ResourceRatingTier to the oemcrypto referenece
code, dynamic adapter, and unit tests.

Bug: 117110800
Test: tested as part of http://go/ag/5501993

Change-Id: Idf47af405f0c69601108b75c788a97b30abdb39d
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
52b274a3a4 Add HDCP 2.3 to logs
Merge from master branch of Widevine repo of http://go/wvgerrit/66071
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63842

OEMCrypto tests log the HDCP value.  This CL updates those logs to include logs
for HDCP 2.3.

Test: unit tests
Test: tested as part of http://go/ag/5501993
Bug: 78773763
Change-Id: I7a3003e081c3c848b5d595ac241a0b546dacb747
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
43a47a60c0 Add session parameter to OEMCrypto_CopyBuffer
Merge from master branch of Widevine repo of http://go/wvgerrit/66070
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63662

To make the threading model more clear, CopyBuffer is now a session function.
This means we need to pass in which session the current thread locks.

Test: unit tests.
Test: tested as part of http://go/ag/5501993
Bug: 113680369
Change-Id: I2fdd2cfcaab99f3793950b3845941463675f5e4c
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
5b20bb54ff Documentation for OEMCrypto v15
Merge from master branch of Widevine repo of http://go/wvgerrit/66069
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/62420

This is the full API -- not just the delta.

Bug: 111939411
Test: docs only
Test: tested as part of http://go/ag/5501993

Change-Id: Id839bf10666e271c882fc437f9ebbd3941d23784
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
5b76ad3648 Documentation for OEMCrypto v15 Delta
Merge from master branch of Widevine repo of http://go/wvgerrit/66068
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/62066

Bug: 111939411
Test: docs only
Test: tested as part of http://go/ag/5501993

Change-Id: Ic682b603cd6d90b10df433b76c071c303b4e35cc
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
29805b367c Generate OEMCrypto header from doc
Merge from master branch of Widevine repo of http://go/wvgerrit/66067
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63002

The OEMCryptoCENC.h comments are now generated from the doc.  This corrects
several years of drift caused by small changes to the doc that were not copied
to the header.

Test: tested as part of http://go/ag/5501993
Bug: 111939411
Change-Id: I56ab9c6cf280bc72b39f6ddafc26cf21f6074c98
2018-11-16 17:13:50 -08:00
Fred Gylys-Colwell
ef067572bc Remove error OEMCrypto_KEY_NOT_LOADED
Merge from master branch of Widevine repo of http://go/wvgerrit/66066
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63628

The error code OEMCrypto_KEY_NOT_LOADED is redundant with
OEMCrypto_ERROR_NO_CONTENT_KEY and OEMCrypto_KEY_NOT_ENTITLED.  The
function LoadEntitledContentKey should return KEY_NOT_ENTITLED if it
does not find the corresponding entitlement key in its key table.  All
other functions that do not find a key id in the key table should
return OEMCrypto_ERROR_NO_CONTENT_KEY.  This includes QueryKeyControl,
SelectKey, and RefreshKeys.

Test: unit tests
Test: tested as part of http://go/ag/5501993
Bug: 115574797
Change-Id: Ida2111f32e331b99f3f0c77fa404a42654d0870c
2018-11-16 17:09:32 -08:00
Fred Gylys-Colwell
f3e9d84484 Add build info API to OEMCrypto
Merge from master branch of Widevine repo of http://go/wvgerrit/66065
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63080

This is for the reference code, the unit tests, and the oemcrypto adapter.

Bug: 116414218
Test: unit tests
Test: tested as part of http://go/ag/5501993

Change-Id: I05a631f6cfcf1584a748b3a0c9ae48633893589f
2018-11-16 15:38:45 -08:00
Fred Gylys-Colwell
f2edb8f2dd Update API version to 15
Merge from master branch of Widevine repo of http://go/wvgerrit/66064
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63063

This is in the reference code for OEMCrypto, and in the unit tetss.

Bug: 111939411
Test: unit tests
Test: tested as part of http://go/ag/5501993

Change-Id: I2cc2e7028f62d1c375eb632452eef94566fa9ae3
2018-11-16 15:38:45 -08:00
Fred Gylys-Colwell
dbd437d7da Reorder OEMCrypto header
Merge from master branch of Widevine repo of http://go/wvgerrit/66063
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/62960

This CL reorders the functions in the OEMCrypto header to be the same as the
order in the API document.

Test: unit tests
Test: tested as part of http://go/ag/5501993
Bug: 111939411

Change-Id: Ic233b11141bf10f4a34b7d9c9c9288afed67aa14
2018-11-16 15:38:45 -08:00
Fred Gylys-Colwell
091a75d863 OEMCrypto v15 header
Merge from master branch of Widevine repo of http://go/wvgerrit/66062
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/62880

This CL updates the OEMCrypto v15 header to add new functions and change the
signatures of functions that need changing.

Note: It does not update all of the comments in the functions. This will be
done in a future CL.

Bug: 111939411
Test: unit tests
Test: tested as part of http://go/ag/5501993

Change-Id: Ie08a8fd4b749f61cbac08fd67ac32dcd404848fc
2018-11-16 15:38:45 -08:00
Fred Gylys-Colwell
05fc8b5e97 Temporarily use old test keybox
Merge from Widevine repo of http://go/wvgerrit/65922

This CL puts the old 4121 test keybox back into the unit and android
integration tests so that we can run tests on a device with OEMCrypto v13.

This change should not be released, and should not be included in CE CDM.  It
should be removed once we have more test devices with v14 or v15.

Bug: 119313532
Bug: 119316243
Test: unit tests
Test: tested as part of http://go/ag/5501993

Change-Id: If6a459e11176e07c66fbe6fc45c63d87595a20dc
2018-11-16 15:38:45 -08:00
Fred Gylys-Colwell
458de2569d Remove old test cert and rest of 4121
Merge from Widevine repo of http://go/wvgerrit/62782

There were still some old test keyboxes in the unit tests for older devices and
in the mod mock.  These are removed.  Also, the cert with system id 7346 has
been removed.

The new test keybox has system ID 7912.
The new test cert has system id 7913.

bug: 76435251
Test: unit tests (unit tests do not pass on v13 oemcrypto)
Test: tested as part of http://go/ag/5501993

Change-Id: I6007b6650162d9dc9d01384faaafc87acdf8ebd7
2018-11-16 15:38:45 -08:00
Fred Gylys-Colwell
c3772ebd0c Ensure provisioned in unit tests
Merge from Widevine repo of http://go/wvgerrit/61262

This CL helps the CE CDM unit tests provision by providing a helper code to
determine if OEMCrypto is L1 or L3.

Test: unit tests
Test: tested as part of http://go/ag/5501993
Bug: 37286053
Change-Id: Ibe358e0eb628b4051f2db3406eaa6fcfc07f07ff
2018-11-16 15:38:45 -08:00
John Bruce
218aa76560 Merge changes I37d6d7aa,I9e8624dd,I96c2015a,I0b755962
* changes:
  Replace scoped_ptr With std::unique_ptr
  Replace shared_ptr With std::shared_ptr
  Replace UniquePtr with std::unique_ptr
  override, Don't OVERRIDE
2018-11-16 18:08:02 +00:00
Srujan Gaddam
49906026b7 Merge "Setup test ROT + log empty root key in ref" 2018-11-14 21:01:47 +00:00
John W. Bruce
b182a7445e Replace scoped_ptr With std::unique_ptr
(This is a merge of http://go/wvgerrit/65782)

We have had our own scoped_ptr implementation that is used throughout
the codebase. Now that we support C++11, we can replace these with
std::unique_ptr.

Doing this replacement exposed a few places where the two were not
interchangeable. OEMCrypto Ref was doing some unsafe things with passing
scoped_ptrs to functions and has been updated to use move semantics. And
a few constructors were explicitly constructing a scoped_ptr with NULL,
which is ambiguous with std::unique_ptr. These have been replaced with
default constructor calls.

Bug: 111851141
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I37d6d7aad4906709381c74f0c5439f826d2be768
2018-11-14 10:50:34 -08:00
John W. Bruce
fb4d53bae6 Replace shared_ptr With std::shared_ptr
(This is a merge of http://go/wvgerrit/65783)

Straightforward patch to replace our shared_ptr implementation with
std::shared_ptr, which works identically for all our use cases.

Bug: 111851141
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I9e8624dd3cab70a45941a45eb553c1ea0c077d2f
2018-11-14 10:50:34 -08:00
John W. Bruce
39cfe6037f Replace UniquePtr with std::unique_ptr
(This is a merge of http://go/wvgerrit/65264)

Now that we have C++11, we can remove Android's hand-rolled UniquePtr in
favor of std::unique_ptr.

Bug: 111851141
Test: Android Unit Tests
Change-Id: I96c2015aa2422da66a4bcbefb927dacc5f6e782f
2018-11-14 10:50:34 -08:00
John W. Bruce
d902366ac8 override, Don't OVERRIDE
(This is a merge of http://go/wvgerrit/65263)

Now that C++11 is mandatory, we can drop the OVERRIDE macro which was
inconsistently used in the codebase in favor of using the override
keyword directly.

Bug: 111851141
Test: CE CDM Unit Tests
Test: Android Build
Change-Id: I0b7559624b84feb19740afd63463dadd243412b0
2018-11-14 10:50:34 -08:00
Rahul Frias
3c42b91471 Merge "Update WV build and android version number change canary" 2018-11-13 18:12:07 +00:00
Rahul Frias
9b7e2013d4 Update WV build and android version number change canary
[ Merge of http://go/wvgerrit/66145 ]

Bug: 119431010
Test: WV unit/integration tests
Change-Id: Ib869ee0df03dda6124ebcdb6ed8e502915ba9896
2018-11-12 23:54:16 -08:00
Rahul Frias
49f518a911 Always use configured client authentication
[ Merge of http://go/wvgerrit/66002 ]

Client authentication was needed when licenses were requested from
the Play movies license service. For UAT/staging client authentication
is set to the empty string.

The play movies license service has not been used recently for testing.
Also, client authentication has not been supported as one of the
command line arguments. This was even before the command line parameters
were consolidated in TestBase.

Since it is not possible to specify client authentication on the
command line, the configured(default) value is always used.
This CL will remove code in the test to check if it has
been specified on the command line. It can be added back later,
if we decide to support client authentication as an option.

b/119221644
Test: WV unit/integration tests

Change-Id: I4a7fab5ec27b4897c9a73bd3ff34615d8ae11c28
2018-11-11 13:01:07 -08:00
TreeHugger Robot
e89c9b969c Merge "Parameterize "forbid analog" in mod mock" 2018-11-10 16:05:37 +00:00
Rahul Frias
9fc06b07a3 Merge "Fix invalid iterator in CloseCdm" 2018-11-07 17:16:38 +00:00
Rahul Frias
39fd24b8d8 Merge "Avoid double release of crypto_lock_" 2018-11-07 17:14:56 +00:00
Srujan Gaddam
5c2f991973 Setup test ROT + log empty root key in ref
Bug: b/117897682
Test: unit tests

Merge of http://go/wvgerrit/65223

Gtest setup does not call the base class' setup if it's defined in the
derived class. As a result, the WvCdmEngineTests were not installing the
test root of trusts in the OEMCrypto, which leads to segfaults when
using a key derived from the root of trust when a real root of trust
doesn't exist. The test class' setup is changed to use its base class'
methods, and logging is added to handle empty derived keys.

Change-Id: Ia574c4ade48206d771d6079fb3b67ccd7653428c
2018-11-01 16:02:37 -07:00
Rahul Frias
19c582aac7 Avoid double release of crypto_lock_
[ Merge of http://go/wvgerrit/65162 ]

Bug: 118645525
Test: WV unit/integration tests
Change-Id: Ia8c8e156cf5a5a795d2a502dcb021936b99d0367
2018-10-31 18:41:28 -07:00
Rahul Frias
d374b17b7c Fix invalid iterator in CloseCdm
[ Merge of http://go/ag/5334065 and http://go/wvgerrit/65122 ]

Sessions were not being correctly released when CloseCdm() was called.
Broadcom noticed this issue and proposed the fix.

Bug: 117876077
Test: WV unit/integration tests, GtsMediaTestCases and playback tests
Change-Id: I8800744f2396f0955c76d5f3e187a69fe04330f6
2018-10-31 16:19:33 -07:00
Rahul Frias
058b80f906 Partner (Amazon) reported a memory leak
[ Merge of http://go/wvgerrit/64682 ]

Looks like we do not delete control_block_

Bug: 117126556
Test: WV unit/integration tests
Change-Id: If0b4db163276bbf016bb81ed7e8ef56fa66ea30e
2018-10-31 10:22:14 -07:00
Colin Cross
c0144ac97f Add SetValue for unsigned long for uint64_t
am: b0f80eb4a7

Change-Id: Ia95df0946a40f0383c32f94006576220205e613d
2018-10-30 14:11:46 -07:00
Colin Cross
b0f80eb4a7 Add SetValue for unsigned long for uint64_t
google::protobuf::uint64 is changing from unsigned long long to
uint64_t, which is sometimes unsigned long long and sometimes
unsigned long.  Add a SetValue specialization for unsigned long.
Mark both the unsigned long and unsigned long long specializations
as sometimes unused, they will be unused if uint64_t is the other.

Bug: 117607748
Test: m checkbuild
Change-Id: I8bec0be6cd7e13354cf96a7e510fe2b920aec561
2018-10-27 23:35:51 -07:00
Rahul Frias
d44294b663 Address VTS test failures
[ Merge of http://go/wvgerrit/64402 ]

Changes to support PSSHs for single content and entitlement licenses in the
same PSSH tightened up validation of PSSHs. Some of the test PSSH had
incorrect length fields which led to VTS test failures.

b/117265150
b/117616791
b/117616861
Test: VtsHalDrmV1_0Target

Change-Id: I86354817eb9060a7bcea774583c4d4155a400fff
2018-10-22 12:09:06 -07:00
Rahul Frias
e2a1682b99 Suppress implicit-fallthrough warnings.
[ Merge of http://go/wvgerrit/63782 ]

Add FALLTHROUGH_INTENDED for clang compiler.

Bug: 117675755
Test: build with global -Wimplicit-fallthrough.
Change-Id: I603042152ae8fb7e6518ca24e404df1d63097337
2018-10-15 19:04:26 -07:00
John Bruce
de66ef118d Merge "Allow Reloading Partially-Released Licenses" 2018-10-12 03:10:31 +00:00
Srujan Gaddam
1cc16a83c8 Merge "Move AES tables to clear buffers for decryption" 2018-10-11 18:35:08 +00:00