Commit Graph

2919 Commits

Author SHA1 Message Date
Rahul Frias
ef00d6ffa5 Update property retrival method
[ Merge of http://go/wvgerrit/70203 ]

The earlier property_get() method had a limitation on property length.
Properties of some new devices exceed that length. An error message
is returned rather than a truncated string. Replace its use with
android::base::GetProperty() which does not have a length limitation.

Bug: 115358798
Test: WV unit/integration tests
Change-Id: I46ce9a7e77bcd031225d0082f83c57d484fe5405
2019-01-15 00:24:52 -08:00
Jeff Tinker
a4e66ac673 Merge "Add additional error conditions to MediaDrm" 2019-01-15 01:22:14 +00:00
Rahul Frias
5d6c12ff5d Add additional logging to Cdm Engine
[ Merge of http://go/wvgerrit/69965 ]

Bug: 120786527
Test: WV unit/integration tests
Change-Id: I8fea89b25435c3a3b632155fe6a2b07349b63a19
2019-01-11 14:01:49 -08:00
Jeff Tinker
a00b50095c Add additional error conditions to MediaDrm
Merge of http://go/wvgerrit/70163

New codes are being added to handle resource
contention, lost session state, frame size too
large and insufficient security level for
decryption. Also cleans up inconsistent use of
tamper detected error where invalid state error
should have been used.

bug:111504510
bug:111505796
test: cts and gts media tests, widevine integration tests

Change-Id: I96ee441717d32ccbcabaa85c8f6a0013055ce16e
2019-01-10 15:17:48 -08:00
Rahul Frias
40bd0d5209 Merge "Allow queries without opening a session" 2019-01-10 18:42:32 +00:00
Srujan Gaddam
2720633450 Merge "Remove shared license code from OEMCrypto" 2019-01-10 18:07:16 +00:00
Rahul Frias
22e991343b Allow queries without opening a session
[ Merge of http://go/wvgerrit/69724 ]

Some queries no longer require a session to be opened before they
can be answered - security level, current HDCP level, max HDCP level,
usage support, number of open sessions, max sessions,
OEMCrypto API version, current SRM version, SRM update support,
resource rating tier and OEMCrypto build information.

b/117104043
Test: WV unit/integration tests

Change-Id: I92f8249e5599860da8cbf42d3b16f25515a46c55
2019-01-10 09:01:46 -08:00
Srujan Gaddam
80166b37e2 Remove shared license code from OEMCrypto
Bug: b/119881112
Merge of http://go/wvgerrit/68983
Test: Android + Linux tests for ref and L3

This CL removes tests from OEMCrypto that test shared license
functionality and code in the ref and L3 that handle shared licenses.

Change-Id: Ia11510d8db3fa6e471a4ebbdb371fd76b0812984
2019-01-09 13:50:33 -08:00
John Bruce
38c45a66a3 Revert "Re-enable Binary Provisioning Test"
(The matching reversion in the Widevine Repository is
http://go/wvgerrit/69923)

This reverts commit c207ef8ea6.

Reason for revert: Widevine Buildbot failures

Change-Id: Ied9e36f9eaa94bb7e9cd13b8dff7a2cbdca07a07
2019-01-09 18:55:06 +00:00
John W. Bruce
c207ef8ea6 Re-enable Binary Provisioning Test
(This is a merge of http://go/wvgerrit/69843)

It turns out the reason the binary provisioning unit test was failing is
because the test base class was setting the property to turn on binary
provisioning before calling Init(), however all current Init()
implementations overwrite the value of that field. As such, the tests
weren't actually using binary provisioning. With that fixed, everything
passes; the binary provisioning flow doesn't appear to actually be
broken.

Bug: 112046733
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I7413f7fb2227e596fb610d6ddc5b95cda2f406b8
2019-01-08 18:08:26 -08:00
TreeHugger Robot
f4b4937217 Merge "Remove spurious log message" 2019-01-09 01:56:50 +00:00
Srujan Gaddam
2870210598 Merge changes I09cec674,Iee28fa90,I1ef35e15
* changes:
  Modify Level 3 full decrypt path testing for 15.1
  Remove OEMCrypto_InitializeDecryptHash
  Update OEMCrypto documentation to 15.1
2019-01-08 17:32:14 +00:00
Rahul Frias
da18d8ea6b Merge "Add decrypt hash support" 2019-01-08 16:37:04 +00:00
Edwin Wong
e2cf30bec7 Merge "Fix getSecureStop returns zero opaque data intermittently." 2019-01-07 22:39:19 +00:00
Edwin Wong
f7659c72dd Fix getSecureStop returns zero opaque data intermittently.
Merge from http://go/wvgerrit/69603

In getSecureStop, the life of cdmStop will expire when
leaving the if (isCmdResponseTypeSuccess()) scope.
Since setToExternal() which is called by toHidlVec()
only performs a pointer assignment, the content of cdmStop
is lost and secureStop.opaqueData will have all zeros.

Test: netflix streaming and offline playback

Test: Play Movies & TV

Test: GTS test
  -m GtsMediaTestCases --test com.google.android.media.gts.MediaDrmTest#testWidevineApi28

Test: GTS test
  -m GtsMediaTestCases

bug: 120624463
Change-Id: I8da473d5fd06d091980eade4b7216856ef097e04
2019-01-07 22:31:21 +00:00
Rahul Frias
589a3cf27e Add decrypt hash support
[ Merge of http://go/wvgerrit/68083 ]

Add ability to query decrypt hash support, set a hash computed over a frame
and retrieve the last error at a later point.

Bug: 34080802
Test: WV unit/integration tests. New tests added to cdm_engine_test,
      libwvdrmdrmplugin_hidl_test and request_license_test.

Change-Id: I7548c8798c873a6af3e1cfc0df57c117e1e474a6
2019-01-07 10:14:25 -08:00
Srujan Gaddam
ff307a7c0e Modify Level 3 full decrypt path testing for 15.1
Merge of http://go/wvgerrit/68986
Bug: b/120797208
Test: Android + Linux unit tests

OEMCrypto v15.1 introduced changes to full decrypt path testing.
This CL reflects those changes for the Level 3 code, including
removing InitializeDecryptHash and changes to error reporting.

Change-Id: I09cec6743524d326cb1a6c3ba4dd1764dbefff5f
2019-01-07 09:53:08 -08:00
Fred Gylys-Colwell
9c95e4caae Remove OEMCrypto_InitializeDecryptHash
Merge from Widevine repo of http://go/wvgerrit/68464

The Full Decrypt Path Testing design has changed to remove
OEMCrypto_InitializeDecryptHash.  This CL updates the unit tests and
reference code.

Bug: 120795057
Test: unit tests

Change-Id: Iee28fa9034dc21cee81c5b894c192e260375eeee
2019-01-07 09:53:07 -08:00
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
John W. Bruce
9e82eccc2e Add Missing \n to OEC Log
(This is a merge of http://go/wvgerrit/69165)

This printf() in the OEMCrypto Unit Tests was causing two log messages
to run together in the log.

Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I5a981e201de347fc8fbdc50a94c7227f944f9e8c
2019-01-04 16:30:14 -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
Jeff Tinker
769c1d3cdf Remove spurious log message
It is not an error for mapMemory to return nullptr,
remove the log message.

merged from http://go/wvgerrit/68605

bug:120148333
Change-Id: If58a4335ec3b8bd8d84993bb3959e5ccafb708e1
2018-12-13 23:06:06 +00: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