Commit Graph

2899 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
f42038d89a Update OEMCrypto documentation to 15.1
Merge from Widevine repo of http://go/wvgerrit/68184

Please add comments to the original documents at http://go/oemcrypto
or http://go/wvdelta15.

Some unit tests will need to be updated.  Those will be in a separate CL.

bug: 120795057 Full Decrypt Path Testing - change design
bug: 119688262 Full Decryption Path Test update section in go/wvdelta15
bug: 117898271 Corrections to Documentation
bug: 119881959 Remove shared license from documentation.
bug: 80540710 Document double call to OEMCrypto_DeactivateUsageEntry

Test: documentation and comment change only
Change-Id: I1ef35e15207d3dabea8329a1f05518370ec099e6
2019-01-07 09:53:07 -08:00
TreeHugger Robot
d44a8016ad Merge "Verify double call to OEMCrypto_DeactivateUsageEntry" 2019-01-03 19:37:51 +00:00
Edwin Wong
47c2b65cba Cleanup unaligned code.
Merge from: http://go/wvgerrit/69211

Cleanup unaligned code while working on b/117570686 and remove
a duplicate break statement.

Test: unit tests
  ./run_all_unit_tests.sh

Bug: 121971420
Change-Id: I0ca1dc0fe54e7fe3a87aa7c8dac7ef9da04e90b2
2018-12-24 18:31:12 -08:00
Adam Stone
7e77327d9c Merge changes I505c46fe,Id315c643
* changes:
  Add Oemcrypto build information to metrics.
  Add a field indicating online vs offline licenses.
2018-12-23 21:59:33 +00:00
Adam Stone
27e26110b4 Add Oemcrypto build information to metrics.
Import from http://go/wvgerrit/68385

Adds the build information returned from OEMCrypto_BuildInformation()
to the CDM session metrics.

Bug: 117117555
Test: Unit tests. GPlay manual. GTS Tests.
Change-Id: I505c46fec61a7c62538f843185ec0358f860da79
2018-12-21 13:09:59 -08:00
Adam Stone
0a64d25067 Add a field indicating online vs offline licenses.
Import of http://go/wvgerrit/68188

This adds an attribute to metrics indicating if the license was online
or offline.

Also, added a unit test for CdmEngineMetricsImpl.

Test: Unit tests. GPlay manual. GTS tests.
Bug: 115523917

Change-Id: Id315c643048914a2c51904451f9665987bc87eb7
2018-12-21 13:09:29 -08:00
Fred Gylys-Colwell
e5161a318e Verify double call to OEMCrypto_DeactivateUsageEntry
Merge of http://go/wvgerrit/68187

This adds a unit test to verify that OEMCrypto_DeactivateUsageEntry
may be called several times without an error or changing the entry's
state.

Bug: 80540710
Test: unit tests
Change-Id: I594594bfde75c3e38a3b9efc51a667613a5da6ed
2018-12-19 12:08:43 -08:00
Fred Gylys-Colwell
17932a63fd Change from custom Lock to std::mutex.
Rest of merge of http://go/wvgerrit/67884
Some files were deleted on original CL that were not deleted here.

Now that we can use C++11, we should use the cross-platform std::mutex
type, not the custom pthread version.

Bug: 111850982
Test: WV unit/integration tests
Change-Id: I48a1e47aa79e5e66b5869c0f766c18d561d26784
2018-12-19 12:06:21 -08:00
Srujan Gaddam
4c5c4caf66 Add detail about L3 initialization
Bug: b/70299597
Merge of http://go/wvgerrit/67304
Test: Android, CE CDM, and Linux tests

There's a few different things that can go wrong in the L3
initialization, with seeding and device key failures among others. They
should be recorded in metrics to track. Along the same lines, since
multiple errors can happen in conjunction, metrics needs to change to
add more fields for errors. This CL also adds the
hidl_metrics_adapter_unittest to the Android test scripts.

Change-Id: Ie5bcf81bbe294a1136c58410f90087a13b3d911d
2018-12-14 11:32:19 -08:00
Rahul Frias
25d29fd22b Use the std::chrono to get the time.
[ Merge of http://go/wvgerrit/67985 ]

Now that we can use C++11, we should use the cross-platform types for
clocks instead of the platform-specific versions.

Test: WV unit/integration tests.
Change-Id: I50318e3d1caf9e814f33f497f83c19c9f3c154a1
2018-12-13 12:09:04 -08:00
Rahul Frias
3c350b677f Use vec.data() instead of &vec[0].
[ Merge of http://go/wvgerrit/67984 ]

Getting the address of the first element is invalid when the size is
0.  Calling data() is valid when the size is zero so long as we
don't use the resulting pointer.  This is important when we pass the
pointer to low-level functions like memcpy.

Also, MSVC is stricter about this and doesn't allow indexing the 0-th
element when it is empty.  But GCC/Clang seem to be fine with it so
long as the object isn't used.

Test: WV unit/integration tests

Change-Id: Ic5d11da41dd3a185a63f86a6ea91e9b954fd699a
2018-12-13 12:05:56 -08:00
Rahul Frias
e22d0ab48c Only export public symbols.
[ Merge of http://go/wvgerrit/67923 ]

Before, all symbols were being exported in the dynamic library.  Now
only the public symbols are.  This no longer has the unit tests load
the dynamic library, so we lose testing the dynamic integration; but
the unit tests use a lot of internals, even the top-level CDM ones.

Bug: 69271232
Bug: 69548115
Test: WV unit/integration tests
Change-Id: I62919937277ec785aca1f8b36b28caa2f9d8f3ea
2018-12-13 11:56:02 -08:00
Rahul Frias
0e28104cff Change from custom Lock to std::mutex.
[ Merge of http://go/wvgerrit/67884 ]

Now that we can use C++11, we should use the cross-platform std::mutex
type, not the custom pthread version.

Bug: 111850982
Test: WV unit/integration tests
Change-Id: If2fde2836826c5184609e6b1f3a6511206bd4594
2018-12-13 11:55:54 -08:00
Rahul Frias
65c64292b7 Merge "Enforce OEMCrypto insufficient resources error reporting" 2018-12-12 16:47:11 +00:00
Srujan Gaddam
b10d5c2a8f Merge changes from topic "level_3_oecv15"
* changes:
  Changes to adapter + gyp to support v15
  Add full decrypt path testing functionality to Level 3
  Update pointers to substrings in Level 3
  Update level 3 reference API for v15
2018-12-11 19:54:39 +00:00
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