Commit Graph

3561 Commits

Author SHA1 Message Date
Alex Dale
2a16d70a06 Suppress error for removing lingering offline licenses.
[ Merge of http://go/wvgerrit/97963 ]

There are situations where an offline license file will remain on the
system after it's usage entry has been deleted.  This would result in
its key set ID being reported as present by the CDM, but any
operations acting upon it will result in an error.

The app should be able to remove the license without error, so long
as the license file exists and no other OEMCrypto operations fail.

This change introduces a new error code LICENSE_USAGE_ENTRY_MISSING,
which indicates that a license's usage entry cannot be found.

A new integration test checks that the CDM can handle the calls to
removeOfflineLicense().

Bug: 137034719
Test: Android unit and integration tests
Change-Id: Ibdbe963b7f7e3ac97b446300d8e3896cdee7abc5
2020-04-29 17:48:26 -07:00
Rahul Frias
2ffb86ffca Accept a security level to be specified during provisioning am: e27bc4ba6a
Change-Id: I40d648eadb71cc4677fb9b38f8e766ee4f552c19
2020-04-30 00:27:14 +00:00
Rahul Frias
e27bc4ba6a Accept a security level to be specified during provisioning
[ Merge of http://go/wvgerrit/97267 ]

In earlier releases, provisioning would occur based on a cached
security level. If an open session call returned a NotProvisionedException
the security level would be cached for use with any future provisioning
call.

An app would have to set the security level, then call openSession,
have it fail and then request provisioning. This fits the normal flow of
most apps. Still on occasion, an app might change requested security level
after an openSession call failed. Using the cached security level
would result in unexpected behavior.

This change allows provisioning to occur at the last security level that
was set.

Bug: 129356527
Test: wv unit/integration tests, GTS tests (GtsMediaTestCases)
Merged-In: I8d9234eec2b23a9c913e77a709943b431e25e43e
Change-Id: I8d9234eec2b23a9c913e77a709943b431e25e43e
2020-04-28 11:58:59 -07:00
TreeHugger Robot
c14031eb7b Merge "Verify error code when usage entry in use" into rvc-dev am: 6bd68c9660
Change-Id: I9ee2b3a47a3a61e0596195de39f9e47a4128ec33
2020-04-28 17:42:16 +00:00
TreeHugger Robot
48a1c257fd Merge "Fix buffer size on generic decrypt tests" into rvc-dev am: 9448696b9f
Change-Id: I5d365b629a6c13c36b60d90680c012d81f360baf
2020-04-28 17:42:06 +00:00
TreeHugger Robot
6bd68c9660 Merge "Verify error code when usage entry in use" into rvc-dev 2020-04-28 17:25:22 +00:00
TreeHugger Robot
9448696b9f Merge "Fix buffer size on generic decrypt tests" into rvc-dev 2020-04-28 17:23:37 +00:00
Rahul Frias
086aa7b283 Correct OpenSessions_1_1 test failure am: 3df8bc5133
Change-Id: I4c1eb3590a956967e85cb1d63969e002a026e8a0
2020-04-24 23:11:21 +00:00
Fred Gylys-Colwell
a3a61a68c4 Verify error code when usage entry in use
Merge from Widevine repo of http://go/wvgerrit/98265

Previously, if we tried to shrink the usage table over an entry in
use, we expected an error. Now, we expect the specific error,
OEMCrypto_ERROR_ENTRY_IN_USE.

Test: unit tests on taimen
Bug: 124776024
Change-Id: I2b4b872943bf65401c0a6b5dc1237d77341b1f5b
2020-04-24 14:13:15 -07:00
Rahul Frias
3df8bc5133 Correct OpenSessions_1_1 test failure
[ Merge of http://go/wvgerrit/98025 ]

This adds mocking for WvContentDecryptionModule::QuerySessionStatus
to WvDrmPluginTest which was missing. This corrects the failure in
WVDrmPluginTest.OpensSessions_1_1 from libwvdrmdrmplugin_hidl_test

Bug: 154011452
Test: wv unit/integration tests
Change-Id: I9904595a62a71541ab534aca7d7dfbf95f3225c9
2020-04-20 15:48:20 -07:00
Rahul Frias
0b0d3500ec Merge "Correct reporting of KeyStatus usable in future" into rvc-dev am: d260c2cf2d
Change-Id: I44b9672e6d1ef99ef2ef95bdb8eb04edc811b27a
2020-04-20 19:20:22 +00:00
Rahul Frias
d260c2cf2d Merge "Correct reporting of KeyStatus usable in future" into rvc-dev 2020-04-20 19:06:18 +00:00
Rahul Frias
6404b42fb2 Correct reporting of KeyStatus usable in future
[ Merge of http://go/wvgerrit/98004 ]

This corrects mapping for KeyStatus event kKeyStatusUsableInFuture in
the legacy WVDrmPlugin. It earlier reported DrmPlugin KeyStatusType
kKeyStatusType_StatusPending and now reports kKeyStatusType_UsableInFuture.

This fixes the test failure WVDrmPluginTest.MarshalsEvents

Bug: 153509007
Bug: 116738851
Test: WV unit/integration tests
Change-Id: I4b2c74f5a0757975861ef41fa575a749ff9da391
2020-04-20 10:23:27 -07:00
Fred Gylys-Colwell
eb227bdc61 Fix buffer size on generic decrypt tests
Merge from Widevine repo of http://go/wvgerrit/98264

The generic decrypt tests changed the variable controlling buffer size
after it initialized the buffer -- so the buffer was not changed. This
CL fixes that.

Also, RefreshLargeBuffer changed the size of the license message
buffer, not the renewal message buffer.

Bug: 153590142
Test: ran unit tests on taimen
Change-Id: Ib01b411478a181ba956ac2e23c03634a2d971cc0
2020-04-18 09:07:07 -07:00
Fred Gylys-Colwell
b38e279ed6 Update OEMCrypto documents am: 15b1cd9cc9
Change-Id: I2c5f7fc814a621642a2376f98ef25eb4d10c392f
2020-04-13 18:24:57 +00:00
Fred Gylys-Colwell
15b1cd9cc9 Update OEMCrypto documents
Merge from Widevine repo of http://go/wvgerrit/97763

There were no function signature changes, so the API version number
did not change from 16.2. There were several grammar and spelling
errors. There were also the following corrections:

1. The description of OEMCrypto_LoadProvisioning now says that devices
with a keybox use keys derived from the keybox device key, and devices
using Provisioning 3.0 use keys derived from the session key. The
description was previously reversed.

2. The function OEMCrypto_SupportedPatterns is no longer
discussed. This function was never fully defined.

3. The function OEMCrypto_LoadRenewal no longer says that keys and key
control blocks should be verified. This is because the function
OEMCrypto_LoadRenewal processes a message with no key control
block. It should update timers for the entire license.

Test: doc and comment change only
Bug: 153731804
Change-Id: I11a3069fcdbf67b369e2e2bc3fea8c08842eeb7b
2020-04-10 10:12:10 -07:00
Robert Shih
1659f38dd4 WVDrmPlugin signRSA: check arguments before caller am: 2278917116
Change-Id: Iaaf830cd60c417bbc595a175d901a6088861eab0
2020-04-08 20:08:44 +00:00
Robert Shih
2278917116 WVDrmPlugin signRSA: check arguments before caller
Merge of http://go/wvgerrit/97444

Bug: 153356263
Test: VtsHalDrmV1_0Target
Test: VtsHalDrmV1_3Target
Change-Id: Ic27056d86804972859a85c0eb2a0e79a0563d040
2020-04-06 16:13:40 -07:00
John W. Bruce
379127929e Fix Entitlement Licenses am: 4444ba3b47
Change-Id: Ib438a6659f401e59cf58671dbac3f2cc865a5b0e
2020-04-03 22:54:22 +00:00
John W. Bruce
4444ba3b47 Fix Entitlement Licenses
(This is a merge of http://go/wvgerrit/97083.)

The switch from LoadKeys to LoadLicense broke entitlement licenses
entirely because the LoadLicense path in CryptoSession didn't include
any affordances for updating the KeySession, unlike the LoadKeys path.
This patch adds code to handle this.

Bug: 152814106
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: Id0c33a566e17e6be8da04e12be4b0fc87559aa8f
2020-04-03 22:33:40 +00:00
Fred Gylys-Colwell
3c71641040 Merge "Adjust time for unit tests" into rvc-dev am: bab44e0ad4
Change-Id: I021dcc56aa8619325f9c97b632562cc8e387c2a2
2020-04-03 16:54:29 +00:00
Fred Gylys-Colwell
bab44e0ad4 Merge "Adjust time for unit tests" into rvc-dev 2020-04-03 16:30:53 +00:00
Fred Gylys-Colwell
67aaa1c309 Adjust time for unit tests
Merge from Widevine repo of http://go/wvgerrit/96843

This CL modifies the system time used by the reference OEMCrypto so
that it recovers from a clock rollback. When the clock rolls back, it
now adjusts the current time and continues forward. This is needed
when running unit tests on some platforms that reset the clock at
the beginning of a test.

Bug: 152649427
Test: unit tests on buildbot. (No production code on Android)
Change-Id: I7edcdc0cd4e5938c9a54e745d3a0e008f9eb13ed
2020-04-03 16:28:38 +00:00
TreeHugger Robot
5775aff942 Merge "CryptoSession: Propagate err from GetSystemIdInternal in Open" into rvc-dev am: 4fe638a779
Change-Id: I01fda2def9771a40c1e4c5b2bfcac2b92401f574
2020-04-01 23:19:25 +00:00
TreeHugger Robot
4fe638a779 Merge "CryptoSession: Propagate err from GetSystemIdInternal in Open" into rvc-dev 2020-04-01 22:52:21 +00:00
Robert Shih
07f40d1bed CryptoSession: Propagate err from GetSystemIdInternal in Open
Merge of http://go/wvgerrit/96509

Bug: 151231204
Test: GtsMediaTestCases
Change-Id: Ib29691fcea1c9d5fcfa981caf3e5bdab00cbb0bf
2020-04-01 07:01:24 +00:00
TreeHugger Robot
f8175bda83 Merge "CryptoSession: handle 0-length buffer in DecryptSample" into rvc-dev am: e59339ed6d
Change-Id: Ib7a0a1c7f1ad11f80482efa0bf87259d5d7d5207
2020-04-01 05:32:06 +00:00
TreeHugger Robot
e59339ed6d Merge "CryptoSession: handle 0-length buffer in DecryptSample" into rvc-dev 2020-04-01 05:12:53 +00:00
Robert Shih
dc9809f7c3 CryptoSession: handle 0-length buffer in DecryptSample
In `Combine Decrypt Calls to OEMCrypto`,
OEMCrypto_ERROR_BUFFER_TOO_LARGE is used as the default error code to
signal fallback to legacy decrypt (sending subsamples separately).
The error code would not be updated if no calls to OEMCrypto were
made (e.g. 0-length buffers).

This change resets error code to OEMCrypto_SUCCESS after fall back to
legacy decrypt. Consequently, buffers that do no require OEMCrypto
calls would return OEMCrypto_SUCCESS.

Merge of http://go/wvgerrit/96743

Bug: 150188155
Test: GtsMediaTestCases
Test: DashTest#testWidevineH264AdaptiveWithRendererDisabling
Change-Id: Ib23803c51f16bc809bda5c2720e628e81f1df1dc
2020-04-01 02:47:13 +00:00
John Bruce
5f09de89ae Merge "Update OEMCrypto Version Compatibility Document" into rvc-dev am: c113df815d
Change-Id: Ifcfe2508123bca879c457082090133751bceae6a
2020-03-30 17:59:52 +00:00
John Bruce
c113df815d Merge "Update OEMCrypto Version Compatibility Document" into rvc-dev 2020-03-30 17:46:33 +00:00
Fred Gylys-Colwell
4af6f0cf42 Replace OEMCrypto_LoadDeviceRSAKey with OEMCrypto_LoadDRMPrivateKey am: 56b836bda3
Change-Id: Ia80b1cb34f01e6d85461eb2fef7f22abe219e6b4
2020-03-29 19:30:57 +00:00
Fred Gylys-Colwell
56b836bda3 Replace OEMCrypto_LoadDeviceRSAKey with OEMCrypto_LoadDRMPrivateKey
Merge from Widevine repo of http://go/wvgerrit/96783

This CL updates the reference code, unit tests, and adapter to use the
new v16 function OEMCrypto_LoadDRMPrivateKey. This is just an API
change to allow ECC support in the future. The reference code does not
yet support ECC certificates, and the CDM code assumes that all
certificates have an RSA key.

Bug: 152558018
Test: unit tests on taimen and w/v16 mod mock.
Change-Id: I0793b416513b81b3d74849f0b58dbdc91f075ac6
2020-03-29 10:43:54 -07:00
Rahul Frias
eba182293d Merge "Reject partial clear subsamples when keys are not loaded" into rvc-dev am: 3560247878
Change-Id: I8af7288266e5ad5ec82685ea7b467e8ef35a29cb
2020-03-28 18:43:07 +00:00
Rahul Frias
3560247878 Merge "Reject partial clear subsamples when keys are not loaded" into rvc-dev 2020-03-28 18:24:15 +00:00
Rahul Frias
734aea940b Reject partial clear subsamples when keys are not loaded
[ Merge of http://go/wvgerrit/96514 ]

The combined decryption call feature was introduced in android R.
In earlier releases, subsamples were passed one at a time for
decryption within the plugin. A decryption request that consists
entirely of clear data should be passed on to OEMCrypto even if
no keys are loaded.

A sample might consist of subsamples of clear and protected data.
In legacy mode, this proved to be an issue for OEMCrypto if the clear
subsamples were passed on but the protected ones were rejected (b/110251447).

For legacy mode and in the absence of keys being loaded, the subsample will
be passed to OEMCrypto only if the clear lead/frame is in a single subsample
and not broken up across multiple subsamples.

Bug: 150316417
Test: WV android unit/integration tests
Change-Id: Iff8ae8f58530cb9c5d31ce388742443ae807c16f
2020-03-27 15:07:29 -07:00
John W. Bruce
1f08e4dcf1 Update OEMCrypto Version Compatibility Document
(This is a merge of http://go/wvgerrit/96723.)

This syncs the document with the current version in Google Docs. Changes
since the last version:

* Specified that the Cobalt table only applies to First-Party Platforms
* Filled in gaps in Cobalt table
* Updated the Android R entry to reflect that some devices will stay on
  v15
* Added further details on the contents of various OEMCrypto v16
  versions
* Corrected Cobalt versions erroneously marked as Supported
* Updated copyright statement for 2020
* Reworded the header on the CE CDM section
* Corrected which CE CDM versions used OEMCrypto v8
* Put a section heading on the first table in the document to clarify
  that it is not a table of contents nor a document version history

Bug: 151455443
Test: Verified PDF visually
Change-Id: I0a15f79a58a94cda178018373852582abb6c1463
2020-03-27 13:41:59 -07:00
Fred Gylys-Colwell
6bd4b47612 Add unit test for preloaded license am: ca404aae6f
Change-Id: Ieeff31dfb52a182da5217ab26ddd168d39e44381
2020-03-27 19:05:43 +00:00
Fred Gylys-Colwell
ca404aae6f Add unit test for preloaded license
Merge from Widevine repo of http://go/wvgerrit/96508

This adds a unit test for to verify that a preloaded license may be
loaded into OEMCrypto. A preloaded license is a license that does not
have a nonce, and for which there is no license request. This is used
in CAS and ATSC.

I also updated the test version string to
OEMCrypto unit tests for API 16.2. Tests last updated 2020-03-27

Bug: 144105097
Test: ran oemcrypto unit tests on taimen and with v16 modmock.
Change-Id: I6a4926917f36a084d15defa7b908d067612c4dcf
2020-03-26 15:38:38 -07:00
Cong Lin
275b896d9c Merge "Use unique_ptr in oemcrypto ref" into rvc-dev am: a55244025b
Change-Id: I266de93e39d6754539b562da6b24ce42892b294d
2020-03-26 18:28:22 +00:00
Cong Lin
a55244025b Merge "Use unique_ptr in oemcrypto ref" into rvc-dev 2020-03-26 18:15:33 +00:00
Cong Lin
a53a6bf355 Use unique_ptr in oemcrypto ref
Merge from Widevine repo of http://go/wvgerrit/95945

The reference oemcrypto and testbed still use old style pointers, even
though we now require a more modern C++ compiler. Updated a few places
where smart pointer would be appropriate.

Bug: 141393616
Test: Ran unit tests
Change-Id: I8b1e155bce241075928e373478d6f8e1001233f9
2020-03-26 16:15:24 +00:00
Alex Dale
d650718c27 Merge "Usage table header operations no longer need an open session." into rvc-dev am: 73f301a66c
Change-Id: I2853ab3f534c8f1c3d7a5597bfc69a4685574d19
2020-03-26 03:45:43 +00:00
Alex Dale
4188d4478b Merge "New CDM error codes for usage table errors." into rvc-dev am: 8d45d93d0e
Change-Id: Iab515ba54795d43abd7eefd02d41461aabd777bb
2020-03-26 03:45:24 +00:00
Alex Dale
73f301a66c Merge "Usage table header operations no longer need an open session." into rvc-dev 2020-03-26 03:27:31 +00:00
Alex Dale
8d45d93d0e Merge "New CDM error codes for usage table errors." into rvc-dev 2020-03-26 03:26:30 +00:00
TreeHugger Robot
b82da207fd Merge "Address review comments" into rvc-dev am: d035d76ed6
Change-Id: I66931f849edf67e9d1bde00a5d948969615a16b9
2020-03-25 19:31:01 +00:00
TreeHugger Robot
d035d76ed6 Merge "Address review comments" into rvc-dev 2020-03-25 19:14:55 +00:00
Fred Gylys-Colwell
80b0005d44 Address review comments
Merge from Widevine repo of http://go/wvgerrit/96163

This CL just addresses some review comments from the big merge to
master. The header OEMCryptoCENC.h is now synced with the
document http://go/oemcrypto.

Test: unit tests
Bug: 148907684
Change-Id: Ic825126e0dd3d7e86eefab2c51b4abb5d57fb568
2020-03-25 16:16:58 +00:00
Alex Dale
193d5c384d Usage table header operations no longer need an open session.
[ Merge of http://go/wvgerrit/95405 ]

There are several OEMCrypto functions that do not require an open
session to be called.  This change updates the OEMCrypto functions
related to the Usage Table Header.

Bug: 150888316
Test: Linux unit tests and Android build
Change-Id: Ic879876dd190fb3e058bbe8e0cce37273030b105
2020-03-23 12:56:41 -07:00