Commit Graph

2934 Commits

Author SHA1 Message Date
Rahul Frias
afd11c0da5 Add support for Resource Rating Tiers
[ Merge of http://go/wvgerrit/67324 ]

This introduces the ability to query resource rating tier information
through the plugin and CDM. Resource rating tiers are also
sent in the client identification portion of the license request.

Bug: 117112392
Test: WV unit/integration tests
Change-Id: I68ac6dfc4362f61150af822bd526e346b5cc4bf7
2018-12-11 01:43:58 -08:00
Rahul Frias
e01b559bb7 Update ClientIdentification in proto
[ Merge of http://go/wvgerrit/67323 ]

This allows the client to report resource rating tier in
ClientIdentification.

Bug: 117112392
Test: WV unit/integration test
Change-Id: I5bcbd5217c376cb52be2548ee63e0b0232b411d3
2018-12-11 01:40:11 -08:00
Rahul Frias
5f96a20d99 Allow querying of OEMCrypto build information
[ Merge of http://go/wvgerrit/67503 ]

Bug: 117118184
Test: WV unit/integration tests
Change-Id: I8db90c1617e068a4711eb41a5852d15b5e228f2f
2018-12-10 21:48:13 -08:00
Rahul Frias
f98fbbb187 Enforce OEMCrypto insufficient resources error reporting
[ Merge of http://go/wvgerrit/63682 and http://go/wvgerrit/4977904 ]

Enforce OEMCrypto insufficient resources error reporting in CDM tests.
In addition, when CreateNew/LoadUsageEntry fails with OEMCrypto
insufficient resources error, delete a random usage entry
and retry. The current behavior evicts low index entries
from the usage table, which was a crude attempt to emulate a LRU.
This was deficient as, on occasion, it will result in the deletion
of a recently added usage entry.

Bug: 111260263
Bug: 113828866
Bug: 120433165

Test: Widevine OEMCrypto tests, integration tests. GtsMediaTestCases.
      Play movies and Netflix playback tests.
      GtsMediaTestCases MediaDrmTest#testUsageTableCapacity

Change-Id: I63340f76d1e2af3c6834b98ad816e11eea18fc7f
2018-12-10 00:09:56 -08:00
Rahul Frias
caa8c99752 Push generic_crypto_unittest to the device
[ Merge of http://go/wvgerrit/68066 ]

This got dropped as a side-effect of b/120519038 and causes only
some of the WV unit tests to be executed. Oops.

b/120519038
Test: WV unit/integration tests

Change-Id: If256af0f7e620006642a98a1bbecb5a55da7090c
2018-12-09 02:34:18 -08:00
Rahul Frias
0513205d7f Merge "Allow tests to take serial number as a parameter" 2018-12-07 16:32:07 +00:00
John Bruce
dbef7f34ac Merge changes Ic23e2e48,I5d25844b
* changes:
  Google-style override & virtual
  Remove Sub-Licenses and Sub-Sessions
2018-12-07 00:35:51 +00:00
Srujan Gaddam
732c077f79 Changes to adapter + gyp to support v15
Bug: b/117558570
Test: Android, CE CDM, and Linux tests
Merge of http://go/wvgerrit/67566

This CL adds changes to support the Level 3 upgrade to v15 with both the
dynamic and static adapters. It also rearranges the wvcrc.cpp files so
that the tests have their own copy and Level 3 can just use the one in
ref/src.

Change-Id: Ieee2859601881aa1800622454e6ce0345eb94aa7
2018-12-06 23:04:12 +00:00
Srujan Gaddam
64ae554237 Add full decrypt path testing functionality to Level 3
Bug: b/117558570
Merge of http://go/wvgerrit/67565

This CL adds the methods and functionalities needed to compute and
verify hashes as part of decrypt as part of v15.

Change-Id: Ic0626b204571b5f748a6c913ab378fa353ab45d0
2018-12-06 23:03:54 +00:00
Srujan Gaddam
f018070236 Update pointers to substrings in Level 3
Bug: b/117558570
Merge of http://go/wvgerrit/67564

This CL updates LoadKeys, LoadEntitlementKeys, and RefreshKeys to use
OEMCrypto_Substrings of the provided message.

Change-Id: I47f7ef958adfb0a78c54db2e27b5c0a636ddad49
2018-12-06 23:03:42 +00:00
Srujan Gaddam
a0de811f85 Update level 3 reference API for v15
Bug: b/117558570
Merge of http://go/wvgerrit/67563

This CL adds certificate validation, a resource rating, sandbox
functions, build info, modifications to CopyBuffer, and an API
version update.

Change-Id: Id84a33f3553220a659ff628ceb99ab0dbb0ae7b4
2018-12-06 23:03:04 +00:00
John Bruce
f900486d1b Merge "Add Missing Includes Netflix Pointed Out" 2018-12-06 20:59:40 +00:00
John W. Bruce
92cf993cf5 Add Missing Includes Netflix Pointed Out
(This is a merge of http://go/wvgerrit/66810)

Netflix discovered that several files were only compiling because of
transitive includes via the Metrics code. This patch adds the missing
headers they noted.

Bug: 118676365
Test: CE CDM Build
Change-Id: Ifbc4e5d4276d1c3fb9bbd677230cd431e34e5c76
2018-12-06 09:31:42 -08:00
John W. Bruce
b771d93514 Google-style override & virtual
(This is a merge of http://go/wvgerrit/66625)

Google C++ Style dictates that methods which override base class or
interface methods should be declared "override" but not "virtual". Since
our codebase has not had access to "override" until now, many of our
classes do not follow this rule. I've updated as many places as I could
find to follow Google C++ Style, which should hopefully help us catch
errors better in the future.

Bug: 111851141
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: Ic23e2e482e967256da306791532b5fec7b81b2f2
2018-12-06 09:01:18 -08:00
John W. Bruce
5629a646d8 Remove Sub-Licenses and Sub-Sessions
(This is a merge of http://go/wvgerrit/66643)

The sub-license feature has been removed from the server and packager.
So that we do not have to continue maintaining the code that supports
this feature that never shipped, I am removing it from the CDM as well.

Bug: 113165466
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I5d25844b161e74aa19adf19a29c56e4881aa7304
2018-12-06 09:00:51 -08:00
Rahul Frias
7653f2dc15 Allow tests to take serial number as a parameter
[ Merge of http://go/wvgerrit/67583 ]

The new command formats are
$ build_and_run_all_unit_tests.sh [-j <num>] [-s <device_number>]
$ run_all_unit_tests.sh [-s <device_number>]

Bug: 120519038
Test: WV unit/integration tests with a single device and with two devices
      connected (with and without specifying a target serial number)

Change-Id: I518038c3fc178a7eb658fcd4cf82dd13dfa7131f
2018-12-04 23:33:51 -08:00
Edwin Wong
d81904ec78 Move MediaDrmApiTest to its own folder.
Merged from http://go/wvgerrit/67523

This is in preparation for adding the Full Decryption Path Test
android application so it will reside under
vendor/widevine/libwvdrmengine/test/java.

Test: build and run MediaDrmAPITest.apk from the new directory

bug: 113594822
Change-Id: If4adb51ba7bb24a5e28e04956909c2d5a1af3c53
2018-12-04 15:21:09 -08:00
Edwin Wong
cb8631776a Merge "Update Widevine HIDL service to 1.2." 2018-12-03 20:20:30 +00:00
Srujan Gaddam
fb54367674 Merge "Refactor file_store to use smart pointers" 2018-12-03 17:58:34 +00:00
Elliott Hughes
a27b30d65c [automerger skipped] DO NOT MERGE Keep pi-dev-plus-aosp widevine building.
am: 8d460254da  -s ours

Change-Id: Ic975d7f84219fa0e0d7359ba6901511762a91b49
2018-11-30 17:25:07 -08:00
Elliott Hughes
8d460254da DO NOT MERGE Keep pi-dev-plus-aosp widevine building.
This time it's unit tests...

Bug: http://b/111067277
Test: builds
Change-Id: I43a07a5f39b46f2b0e93faf25bb9c172ff1ae2e1
2018-11-30 16:53:50 -08:00
Srujan Gaddam
896ce2b5aa Refactor file_store to use smart pointers
Bug: b/119276649
Merge from: http://go/wvgerrit/66367
Test: Android, CE CDM, Linux unit tests

The FileSystem interface as it exists expects an Open for a file and
then a Close when finished. However, the Close doesn't delete the file
itself and depending on the platform, the underlying impl_ as well,
leading to a memory leak. To fix this leak as well as harden against
future memory issues, this change refactors the interface to shift away
from raw pointers and towards smart pointers.

Change-Id: I7a7132ea95cd3775796a540f510b698f4f27dd24
2018-11-30 16:25:58 -08:00
Elliott Hughes
f6739e7412 [automerger skipped] DO NOT MERGE Keep pi-dev-plus-aosp widevine building.
am: c0a8e51725  -s ours

Change-Id: I8337e8f28b9d1fa4ddf6be7b1506730718921f3b
2018-11-30 16:14:39 -08:00
Edwin Wong
20adb9438d Update Widevine HIDL service to 1.2.
Widevine HIDL service added new v1.2 media APIs,
update the service to support new APIs.

Merged from http://go/wvgerrit/67083

Test: Netflix and Play Movies & TV (streaming and offline playback)

Test: GTS WidevineH264PlaybackTests test
  e.g. ANDROID_BUILD_TOP= ./android-gts/toolsefed run gts -m GtsMediaTestCases
  --test com.google.android.media.gts.WidevineH264PlaybackTests#testL1With480P30

Test: Widevine unit tests

bug: 117570686
Change-Id: I3a2091e7c62a0d2697ef97f983fd898aedfb4519
2018-11-30 16:02:07 -08:00
Elliott Hughes
c0a8e51725 DO NOT MERGE Keep pi-dev-plus-aosp widevine building.
Bug: http://b/111067277
Test: builds
Change-Id: If3905c8132c23f2d763792c76da7716a6161eef7
2018-11-30 16:01:24 -08:00
Rahul Frias
5d360abd4b [automerger skipped] Enforce OEMCrypto insufficient resources error reporting *** DO NOT MERGE *** am: ac596b4f6c
am: 8b97612fb7  -s ours

Change-Id: Id8eccad8c4d2fe27a5ad36bf7d4104973946e960
2018-11-27 15:37:52 -08:00
Rahul Frias
8b97612fb7 Enforce OEMCrypto insufficient resources error reporting *** DO NOT MERGE ***
am: ac596b4f6c

Change-Id: I6fbb254ad788f4c9a5de6a2c2c22958a9ca23a7b
2018-11-27 15:28:32 -08:00
Fred Gylys-Colwell
e59b976625 Update comments and unit tests for InstallKeyboxOrCert
Merge from Widevine repo of http://go/wvgerrit/66865

This CL updates the comments for the code that uses
InstallKeyboxOrCert to install a keybox or oem cert at runtime.  There
is also a new unit test for the device id.  There are not many unit
tests because we don't want to accidentally overwrite the production
keybox or cert on a device when running tests.

bug: 111725154
test: unit tests
Change-Id: Ide9b3d4732f3f96a723a128907babe7e59c02ffc
2018-11-26 14:08:17 -08:00
Rahul Frias
7beac0352e Merge "Address NTS TCs AUDIO-026-* failures" 2018-11-26 18:28:43 +00:00
TreeHugger Robot
f76387d1fc Merge "Fix for off by one error and correct comments" 2018-11-26 06:11:21 +00:00
TreeHugger Robot
579edcb52c Merge "Add README for Android" 2018-11-26 05:51:22 +00:00
Fred Gylys-Colwell
9326cf9a41 Merge "Unit test for pointer alignment" 2018-11-22 00:34:31 +00:00
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
14978a0832 Address NTS TCs AUDIO-026-* failures
[ Merge of http://go/wvgerrit/66083 and http://go/ag/5445191 ]

Fix proposed by amlogic. Release usage session early in the CdmEngine
destructor to avoid SIGBUS.

Bug: 118646062
Test: WV unit/integration tests.

Change-Id: I8b419c57814dc32e9873173ab6c24d209bdcc3a0
2018-11-21 13:43:15 -08:00
Rahul Frias
ac596b4f6c Enforce OEMCrypto insufficient resources error reporting *** DO NOT MERGE ***
[ Merge of http://go/wvgerrit/59720 ]

Enforce OEMCrypto insufficient resources error reporting in CDM tests.
In addition, when CreateNew/LoadUsageEntry fails with OEMCrypto
insufficient resources error, delete a random usage entry
and retry. The current behavior evicts low index entries
from the usage table, which was a crude attempt to emulate a LRU.
This was deficient as, on occasion, it will result in the deletion
of a recently added usage entry.

Bug: 111260263
Bug: 113828866

Test: WV unit/integration tests, GtsMediaTestCases.
      Netflix and Play movies playback tests.

Change-Id: I63340f76d1e2af3c6834b98ad816e11eea18fc7f
2018-11-21 18:16:11 +00:00
Fred Gylys-Colwell
0f57ebb5b4 Unit test for pointer alignment
Merge from Widevine repo of http://go/wvgerrit/66708

This adds a unit test to verify that LoadKeys still works if the message is not
word alligned.

Test: unit tests on desktop and taimen (x86 and arm)
Bug: 68783727
Change-Id: Ib081a2c21af710b294772513c2c777ef1ac0daf0
2018-11-20 14:51:28 -08:00
Fred Gylys-Colwell
3a3307242d Fix for off by one error and correct comments
Merge from Widevine repo of http://go/wvgerrit/66711

This addresses review comments for the OEMCrypto v15 CLs, as documented in
b/119685652.

Test: unit tests
Bug: 119685652
Change-Id: I0e7ce13dd80335eb1a12240df5c1df2c34ba4298
2018-11-18 14:00:28 -08: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