Commit Graph

3554 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
30ea7ee843 Update OEMCrypto documentation to v16.3 am: aa5fc5afd0
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11707216

Change-Id: Ie462379eedd98d16a3ac33d9184147baf7a47988
2020-06-04 21:34:08 +00:00
Fred Gylys-Colwell
aa5fc5afd0 Update OEMCrypto documentation to v16.3
Merge from Widevine repo of http://go/wvgerrit/101243

Changed the version number to 16.3 and the date to June 1st.  The
delta document has a short description of CL's added since
April 6th.

Test: documentation changes only
Bug: 157030231
Change-Id: I93c2b09d6a24efc71ed77110b115cafbd6fde1c6
2020-06-03 06:14:35 -07:00
Fred Gylys-Colwell
d599c74011 Update OEMCrypto unit tests to require ODK 16.3 am: 45681615b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11677949

Change-Id: Ic8c45cc7fce842f67777ab0a003a541fbae7f9fb
2020-06-02 21:49:26 +00:00
Fred Gylys-Colwell
51992ab155 Do not verify decrypt hash when no key selected am: 36968de671
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11677948

Change-Id: I7f9acec222c2840720be3b36423b502582c2ee25
2020-06-02 21:49:24 +00:00
Fred Gylys-Colwell
ed900f242b Unit test for loading nonce-free offline license am: a615671f48
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11677947

Change-Id: Ia129aba764568a853b6b89a7f35f902ef2068942
2020-06-02 21:49:22 +00:00
Fred Gylys-Colwell
7a4313483c Check for null pointers in oemcrypto adapter am: 42eb79a3ff
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11677946

Change-Id: I01d29869ce9f1ce6c252066cbb8f9b4f5286a5ef
2020-06-02 21:49:21 +00:00
Fred Gylys-Colwell
62802d8e10 Update ODK Library to 16.3 am: 166b3e8403
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11699230

Change-Id: I4d951b808e21128d8dbe4e0fafe4fd24b4753124
2020-06-02 21:49:19 +00:00
Fred Gylys-Colwell
5bb396fb72 ODK: forward compatibility and nonce-free offline license support am: 8dc1d7a11d
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11688972

Change-Id: I61a70e52e875c017a706f1337d75405f19748dfa
2020-06-02 21:49:17 +00:00
Fred Gylys-Colwell
45681615b8 Update OEMCrypto unit tests to require ODK 16.3
Merge from Widevine repo of http://go/wvgerrit/101144

This CL updates the version string of the oemcrypto unit tests.

Test: unit tests on taimen and with reference oemcrypto v16.
Bug: 156789529
Change-Id: I504a32f0c3781870052b58d30312c58e090b145c
2020-06-02 09:36:38 -07:00
Fred Gylys-Colwell
36968de671 Do not verify decrypt hash when no key selected
Merge from Widevine repo of http://go/wvgerrit/101143

This CL removes the check for a decrypt hash error when CopyBuffer is
used instead of DecryptCenc because a key was not selected.

We also remove the attempt to check the decrypt hash when there are
multiple buffers, because that is not well defined behavior.

Bug: 155185867
Bug: 155192141
Test: ran unit tests on taimen and on v16  reference oemcrypto
Change-Id: I640e904e256f0913ca606bb5db891430b23f44a3
2020-06-02 08:30:34 -07:00
Fred Gylys-Colwell
a615671f48 Unit test for loading nonce-free offline license
Merge from Widevine repo of http://go/wvgerrit/100964

The previous nonce-free test used the same session to generate the
request as to load the license. However, it is a realistic use case to
have a new session used for loading the license.

The use case relates to a pre-loaded, shared license.

Test: Ran unit tests on taimen and on v16 ref implementation
Bug: 156853321
Change-Id: Ibc07744a16edcd3952d88d73660a75d0c3e8eeb8
2020-06-02 08:30:34 -07:00
Fred Gylys-Colwell
42eb79a3ff Check for null pointers in oemcrypto adapter
Merge from Widevine repo of http://go/wvgerrit/100963

Test: unit tests on taimen
Bug: 156967805
Change-Id: Ic8ba7461ffcaa371a5239dca84e8a3007b0df517
2020-06-02 08:30:34 -07:00
Fred Gylys-Colwell
166b3e8403 Update ODK Library to 16.3
Merge from Widevine repo of http://go/wvgerrit/101130

https://cr/314253512
ODK Library: roll version number to 16.3

https://cr/314253425
ODK Library: Accept release request as renewal request

To support forward compatibility, the v16 server should parse a
release request as a renewal request.

https://cr/314213725
ODK: Accept larger message sizes

The ODK should accept a message size that is larger than the
current
API requires. This allows for future API versions to append
fields to
a message that current the current license SDK will
ignore.

https://cr/313962712
ODK: accept messages with future API version numbers

This CL updates the ODK parse functions to accept future versions
of
the message. This will allow a v16 server to talk to a v17
device.

https://cr/313814938
ODK Version String

Add an automatically generated version string to odk_structs.h

Bug: 157030231
Bug: 157512150
Bug: 157822248
Bug: 157512322
Test: unit tests on taimen
Change-Id: I346f73c41bc984fe17856d3b61cd08cf92b39919
2020-06-02 08:30:34 -07:00
Fred Gylys-Colwell
8dc1d7a11d ODK: forward compatibility and nonce-free offline license support
Merge of http://go/wvgerrit/101183

This is a combination of multiple commits from google3:
* http://cl/313814938
  ODK Version String
* http://cl/313962712
  ODK: accept messages with future API version numbers
* http://cl/312219187
  Ignore hash if initial load of license, and the nonce not required
  (squashed into http://cl/313962712)

Test: OEMCryptoLicenseTest.LoadKeyWithNoRequest
Bug: 157822248
Bug: 156853321
Change-Id: I735d355241876bddb0c52440b0049efb72a4b26f
2020-06-01 19:13:32 +00:00
Cong Lin
4f895ec8ec Merge "Fix implicit type conversion issue in ODK" into rvc-dev am: c34e2af181
Change-Id: Idcdbf54471e640b79a9af2a924b139d1c5def0f5
2020-05-30 03:13:36 +00:00
Cong Lin
c34e2af181 Merge "Fix implicit type conversion issue in ODK" into rvc-dev 2020-05-30 02:56:31 +00:00
John Bruce
b349680d3f Merge "OEMCrypto Unit Test Fix: Do Not Derive Keys Immediately" into rvc-dev am: 729723b3d2
Change-Id: I72df59375a2c05e47978abc37418ebc69f308bdc
2020-05-29 23:40:52 +00:00
John Bruce
729723b3d2 Merge "OEMCrypto Unit Test Fix: Do Not Derive Keys Immediately" into rvc-dev 2020-05-29 23:26:50 +00:00
Cong Lin
69e7e21882 Fix implicit type conversion issue in ODK
Merging CL
https://widevine-internal-review.googlesource.com/c/cdm/+/100924 Fix implicit type conversion issue in ODK

1. Implicit cast is reported as error when compiling ODK with Level3
2. Override odk_add_overflow_xxx function with the built in functions can cause
redefinition issue when compiling Level3; Let's use odk customized overflow functions.

Bug: b/157510403
Test: ODK unittests and CDM unittests passed.
Change-Id: Ieef8ccfb41d08007ec72f4a061f92968e55539cb
2020-05-29 10:07:08 -07:00
Alex Dale
9329bf331c Rolled expected version number for R. am: dd70d63b76
Change-Id: Id8ddfa7e676b57eb0ab8261d166dd0cf8901a458
2020-05-27 21:24:39 +00:00
Alex Dale
dd70d63b76 Rolled expected version number for R.
[ Merge of http://go/wvgerrit/100403 ]

VersionNumberTest.VersionNumberChangeCanary was expecting a version
string of "R".  However, Android rvc branch is now far enough into
development to use a numbered version: version "11".

Bug: 156853733
Test: Android license request test
Change-Id: I63d33f742c849b672b2d2402ab8423fdf2450f6f
2020-05-27 17:27:46 +00:00
TreeHugger Robot
5bedd9c4ad Merge "The Entitlement key map was not being cleaned up." into rvc-dev am: bd8e573e0c
Change-Id: I992d0c2d9da83a6d192a019b1fca2c1b774bad92
2020-05-27 04:00:54 +00:00
TreeHugger Robot
208a088e8e Merge "Start playback timer in integration tests" into rvc-dev am: 7534d9795b
Change-Id: I9e2aadbdbfa628e5987df9ea780c85f8a64e7b86
2020-05-27 04:00:22 +00:00
TreeHugger Robot
bd8e573e0c Merge "The Entitlement key map was not being cleaned up." into rvc-dev 2020-05-27 03:43:48 +00:00
TreeHugger Robot
7534d9795b Merge "Start playback timer in integration tests" into rvc-dev 2020-05-27 03:43:30 +00:00
John W. Bruce
b8e13cec2d OEMCrypto Unit Test Fix: Do Not Derive Keys Immediately
(This is a merge of http://go/wvgerrit/100053.)

The OEMCrypto Unit Tests were previously deriving keys from the session
key as part of loading the test RSA key. This creates an invalid
function call order, since the OEMCrypto session will likely next be
used for actions that need to be done *before* deriving these keys. With
ODKiTEE, which is more strict about this order, all OEMCrypto tests were
failing.

Bug: 156655072
Test: OEMCrypto Unit Tests
Change-Id: Ibfede587da30cfff4a44a5e0687e4199b1430372
2020-05-27 01:19:48 +00:00
Fred Gylys-Colwell
7cd14be01d Update TimeRollbackPrevention unit test am: 75575418d0
Change-Id: I3c6e54676e35581d0dfa255e230b7b4094f783bb
2020-05-21 22:29:14 +00:00
Fred Gylys-Colwell
75575418d0 Update TimeRollbackPrevention unit test
Merge from Widevine repo of http://go/wvgerrit/100110

The unit test TimeRollbackPrevention was broken for several
reasons. This CL reduces the test to its most basic functionality and
updates it to be compatible with a v16 oemcrypto.

This CL also adjusts the fake clock used by the buildbot to fake
sleeping backwards, so that the TimeRollbackPrevention test can also
be run on the buildbot.

Bug: 155773482
Bug: 79422351
Test: unit tests on buildbot, and on flame w/v16 modmock
Change-Id: I3027018b17b738281989e63ae6b0729757217d05
2020-05-20 13:47:28 -07:00
Fred Gylys-Colwell
e9dfca1219 The Entitlement key map was not being cleaned up.
Merge from Widevine repo of http://go/wvgerrit/100385

The map now contains unique_ptr instead of raw pointers
to ensure the memory is released.

Bug: 156780432 OEMCrypto Fuzzing: Fix OEMCrypto Memory Leak.
Test: oemcrypto reference code only
Change-Id: I78054f9207399f052d6e4bfdfa96824f6e050bac
2020-05-19 10:58:05 -07:00
Fred Gylys-Colwell
f6229788b0 Start playback timer in integration tests
Merge from Widevine repo of http://go/wvgerrit/100328

Several integration tests in WvCdmRequestLicenseRollbackTest had been
testing the duration of a license. However, the license they request
sets the playback duration and not the rental duration. That means the
timer we are checking does not start until the first playback. To fix
the tests, we simply add a decrypt operation right after the license
is received.

Test: integration tests w/v16 mod mock.
Bug: 156854660
Change-Id: Ie4f017c82db8aaf084ad050de3fcb7f51987c97e
2020-05-18 20:57:41 +00:00
Fred Gylys-Colwell
98ca694dcd License release does not use core message am: 760bf71908
Change-Id: Ief5646322d0311f44d9b1040bda5200fdfe76cee
2020-05-14 21:45:15 +00:00
Fred Gylys-Colwell
760bf71908 License release does not use core message
Merge from Widevine repo of http://go/wvgerrit/99843

When processing a license release, the license is not loaded, so
OEMCrypto does not know nonce version information for the core
message. It assumes that all license releases are v15, so it is not an
error for a license release to not have a core message.

This CL also adds some extra logging to tests so that we can track
content id and the pssh. This CL also updates some of the test content
policies when running the local license server. The local license
server is only used for debugging problems.

Bug: 152648172 Integration test WvCdmEngineTest.LicenseRenewal failing
Bug: 156259697 License release does not need core message
Test: Unit tests with v16 mod mock
Change-Id: I04c896adadfb17877ce1115345d2419e0d2489f0
2020-05-13 21:22:43 +00:00
Alex Dale
4c97abd57a Update AddEntry() for usage table changes. am: 66e3d69300
Change-Id: I83808cf7ebd0ed0f616766564864943fd152f7c3
2020-05-01 01:22:33 +00:00
Alex Dale
51f5315a62 Added a few edge case unittests for InvalidateEntry(). am: 1e5e221909
Change-Id: I3afd210c896fd0ffa794f1565bf7baee53e4b77e
2020-05-01 01:22:30 +00:00
Alex Dale
44cc2500b3 Reworked DeleteEntry() into InvalidateEntry(). am: da48461ba2
Change-Id: Ic6a6d107a138f9a2ad9b2a935751249587bf540e
2020-05-01 01:22:29 +00:00
Alex Dale
66e3d69300 Update AddEntry() for usage table changes.
[ Merge of http://go/wvgerrit/96071 ]

Changes to how the usage table method InvalidateEntry() behaves
required additional changes to CDM code that uses this method.

This involved some refactoring to AddEntry(), moving the LRU
related code to its own function.

A few unittests had to be changed / removed as the moving
multiple entries changes expectations of several existing tests.

Several additional helper methods have been created to improve
readability.  These include getters for information about the
usage table, a method for releasing stale entries, and a method of
recording LRU metrics.

Bug: 150890014
Bug: 150887808
Bug: 154269671
Test: Linux unit tests and Android unit tests
Change-Id: I11a98f9a2dea9b2ae57b37d7d4483a37be721763
2020-04-30 18:00:25 -07:00
Alex Dale
1e5e221909 Added a few edge case unittests for InvalidateEntry().
[ Merge of http://go/wvgerrit/95365 ]

The changes made to how DeleteEntry (now InvalidateEntry) works
introduced a few additional edge cases which were not covered from the
previous set of unit tests.

Bug: 150887808
Bug: 149100568
Test: Linux unit tests and Android unit tests
Change-Id: I263b72fb708c6546294af23ae5ddbd2e82da34df
2020-04-30 18:00:25 -07:00
Alex Dale
da48461ba2 Reworked DeleteEntry() into InvalidateEntry().
[ Merge of http://go/wvgerrit/95406 ]

There was an issue with DeleteEntry() where it would result in an
invalid table state if shrinking the usage table when the number of
sessions is at its max.

This required changing how the usage table invalidates entries.  Now,
after invalidating an entry (marking an entry as kStorageTypeUnknown)
the table is defragmented if specified to.

Defragmentation involves:
1)  Move valid entries near the end of the table to the position of
    invalid entries near the front of the table.
2)  Shrinking the table to cut off trailing invalid entries.

This change updates the existing tests to pass, but still needs new
tests for some of the edge cases.

Bug: 150887808
Bug: 149100568
Test: Linux unit tests and Android unit tests
Change-Id: I70c7b296e5e4b367746fcdaabbf0f12dcfb39230
2020-04-30 18:00:25 -07:00
Alex Dale
d7f5a74ea3 Merge "Suppress error for removing lingering offline licenses." into rvc-dev am: 792e17a8c4
Change-Id: Ia522d7b007a4088ff7f1812115196a06408ea186
2020-05-01 00:09:49 +00:00
Alex Dale
792e17a8c4 Merge "Suppress error for removing lingering offline licenses." into rvc-dev 2020-04-30 23:53:44 +00:00
Rahul Frias
da19e563f5 Merge "Do not log nonces" into rvc-dev am: d627fdfdd4
Change-Id: I1a767568408f306b5ff8b2070f362556ba331ef6
2020-04-30 20:55:12 +00:00
Rahul Frias
d627fdfdd4 Merge "Do not log nonces" into rvc-dev 2020-04-30 20:40:42 +00:00
Rahul Frias
6ea6723462 Do not log nonces
[ Merge of http://go/wvgerrit/99063 ]

Bug: 155329753
Test: wv unit/integration tests
Change-Id: I642b19f817ce69cb0838512cb8922a2e9c51cef2
2020-04-30 00:34:44 -07:00
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
8429ab587a Accept a security level to be specified during provisioning am: e27bc4ba6a
Change-Id: I20b0adbb6c27507b7d63a6cd0084b4230d5ed6e0
2020-04-30 00:27:03 +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
6fd344812d Merge "Verify error code when usage entry in use" into rvc-dev am: 6bd68c9660
Change-Id: I59fa7ba554c560f0c8e68f69747a4eb98f297e51
2020-04-28 17:42:14 +00:00
TreeHugger Robot
ed4daa7583 Merge "Fix buffer size on generic decrypt tests" into rvc-dev am: 9448696b9f
Change-Id: I6d367165623fd96fa21fee3e274b9c9b99b0aba3
2020-04-28 17:42:03 +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