Commit Graph

6099 Commits

Author SHA1 Message Date
Alex Dale
564c68135c Correctly record license service version in metrics. am: 8aabf20134 am: c645c398c5
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16416872

Change-Id: I875b44c863f4f73e6e0d0f043e127b9a6381f81e
2022-01-07 03:56:07 +00:00
Fred Gylys-Colwell
bf776ef27d Fix System ID problem for devices with no keybox am: f6d682b182
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16408945

Change-Id: I26c5d75affe116c56665de4a038e008ba34bd0d7
2022-01-07 03:48:24 +00:00
Alex Dale
c645c398c5 Correctly record license service version in metrics. am: 8aabf20134
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16416872

Change-Id: Ic3fe7f7bc7f425f6e1a3071b098f0c602e6ac927
2022-01-07 03:48:18 +00:00
Fred Gylys-Colwell
df0cfa2daa Fallback to L3 if provisioning lost
Merge from Widevine repo of http://go/wvgerrit/142349

If a provisioning request is sent, but no response is loaded, we
should fall back to L3. This covers the case where the OTA request is
malformed and the provisioning server ignores it.

This might happen if the device has a bad KM key.

Test: manual testing
Bug: 210823889
Bug: 210807585
Change-Id: I951241539ace97b668868d5abf8a9811d874fb28
2021-12-23 20:19:27 +00:00
Fred Gylys-Colwell
31faf51933 Fall back to L3 if L1 has test keybox
Merge from Widevine repo of http://go/wvgerrit/142150 (part 2)

For an EVT device, without a keybox or with a test keybox, we want it
to fall back to L3. However, when running the unit or integration
tests it should continue running tests with test keybox. This will
allow us to test L1 oemcrypto on an EVT device, while still using an
EVT device for dogfooding video content at the L3 level.

Bug: 210807585
Bug: 210823889
Change-Id: I30c35134239db35bb39f11f75220063181987763
2021-12-23 20:19:26 +00:00
Fred Gylys-Colwell
df04f3f0f8 Add MediaDrm property to allow test keybox
Merge from Widevine repo of http://go/wvgerrit/142150 (part 1)

For an EVT device, without a keybox or with a test keybox, we want it
to fall back to L3. However, when running the unit or integration
tests it should continue running tests with test keybox. This will
allow us to test L1 oemcrypto on an EVT device, while still using an
EVT device for dogfooding video content at the L3 level.

This CL modifes the HIDL and non-HIDL plugin, so it was hand merged to
downstream branches.

Bug: 210807585
Merged-In: I85b96f127abe30f8f061b242f7580fa8f6c01776
Change-Id: I85b96f127abe30f8f061b242f7580fa8f6c01776
2021-12-23 20:18:44 +00:00
Rahul Frias
84abb87fd8 Protect against race conditions when adding a license
[ Merge of http://go/wvgerrit/142249 and http://go/ag/16307264 ]

This adds concurrency protection to a session when policy
timers are reset to from v15 to v16. The v15 policy timer may still be
in use by the decryption thread.

Bug: 204282907
Bug: 207304220
Test: Unit/Integration tests, GtsMediaTestCases
Change-Id: I4967b3927e47733fb23a1a12b6094d1cd2072918
2021-12-21 16:27:36 -08:00
Rahul Frias
a4756e2a7f Protect against race conditions when removing keys
[ Merge of http://go/wvgerrit/142229 and http://go/ag/16147655 ]

This adds concurrency protection to a session when keys or a
license is removed from a session.

Bug: 195625322
Test: GtsMediaTestCases, unit/integration tests, YT EME conformance test
Change-Id: I38601a58dc593ce053cb5457b9d42d2c35f3f041
2021-12-21 16:25:52 -08:00
Fred Gylys-Colwell
04e1d8efbc Add MediaDrm property to allow test keybox
Merge from Widevine repo of http://go/wvgerrit/142150 (part 1)

For an EVT device, without a keybox or with a test keybox, we want it
to fall back to L3. However, when running the unit or integration
tests it should continue running tests with test keybox. This will
allow us to test L1 oemcrypto on an EVT device, while still using an
EVT device for dogfooding video content at the L3 level.

The original CL modified the HIDL and non-HIDL plugin, so this is the
hand cherry-pick.

Bug: 210807585
Change-Id: I85b96f127abe30f8f061b242f7580fa8f6c01776
2021-12-19 20:04:02 +00:00
Fred Gylys-Colwell
75b87c7f59 Test session should continue with no keybox
Merge from Widevine repo of http://go/wvgerrit/142149

This CL updates the TestCryptoSession so that it will recover from
initializing without a keybox. This allows unit and integration tests
to be run using a test keybox on a device that does not have any
keybox.

Bug: 210807585
Bug: 161925952
Change-Id: I8639bd733a50ae5af3a7c786347b5a06a9d783ce
2021-12-19 17:58:58 +00:00
Fred Gylys-Colwell
2f57079f6a Skip OTA test if not supported
Merge from Widevine repo of http://go/wvgerrit/142050

This is test only code.

Bug: 210690170
Change-Id: Ic982cc1ed801325146918bd6153e7f34faf31196
2021-12-19 17:58:26 +00:00
Fred Gylys-Colwell
3c7528de62 Handle nonce flood in OTA test
Merge from Widevine repo of http://go/wvgerrit/142049

This CL is test only code. A nonce flood was causing the OTA test to
be a little flaky when run on the automatic testing platform Luci.

Bug: 205889158
Change-Id: I4f3e5d8469b899e565c430bd46994e098c5d94e6
2021-12-19 17:56:57 +00:00
Alex Dale
2d1372fbec Open session when checking for OTA keybox support.
[ Merge of http://go/wvgerrit/142089 ]
[ Cherry-pick of http://ag/16496425 ]

Qualcomm's implementation of GenerateOTARequest requires an open
session before attempting to generate an OTA keybox request.  When
checking for OTA keybox support, the dynamic layer was not opening
a session, getting a different error than expected.  Coincidentally,
this would trick the dynamic layer to thinking it was supported, but
hides useful error information.

Bug: 210823889
Test: Android manual testing
Change-Id: I60662d2d9d411c0f999b619d6088aabdba55e2c3
2021-12-17 04:31:31 +00:00
Alex Dale
1b35b915b5 Return failure if ignore keybox debug count is non-zero.
[ Merge of http://go/wvgerrit/141949 ]
[ Cherry-pick of http://ag/16496424 ]

If the debug count for ignoring an L1 keybox is still non-zero after
successfully processing an OTA keybox request, the dynamic layer MUST
return a failure to the CDM to keep the CDM and dynamic layer in
agreement that the L1 keybox should continue be treated as invalid.

This will trigger a fallback; but the fallback can be canceled via
the debugging app.

Bug: 210823889
Test: Android manual testing
Change-Id: I75f50ba605d17872c0e8abffc1eee13ff539f01c
2021-12-17 04:30:43 +00:00
Fred Gylys-Colwell
f6d682b182 Fix System ID problem for devices with no keybox
Merge from Widevine repo of http://go/wvgerrit/139372
Revert workaround for falling back to L3
(Partially merged previously)

Merge from Widevine repo of http://go/wvgerrit/139498
Guard against double initialize
(Partially merged previously)

Merge from Widevine repo of http://go/wvgerrit/139343
Use a placeholder ID for devices missing a system ID

Merge from Widevine repo of http://go/wvgerrit/140934
Check security-level during OpenSession.

Merge from Widevine repo of https://go/wvgerrit/141469
Make OTAKeyboxSupported handle the short buffer return
code

Bug: 187646550
Bug: 206670307
Bug: 206570220
Bug: 205896558
Bug: 205041153
Test: Manual test on flame
Change-Id: I71f5faf6b611337b82d8b6179251f6b0224780e6
2021-12-14 19:36:41 -08:00
Alex Dale
8aabf20134 Correctly record license service version in metrics.
[ Cherry-pick of http://ag/15245767 ]
[ Merge of http://go/wvgerrit/128624 ]

The CDM session was incorrectly recording the "license SDK version" as
the "license service version" in the session metrics.  This
discrepancy reduces the quality of devices' metrics and limits
debugging capabilities for the Widevine metric monitoring services.

Bug: 193177333
Test: Linux unit tests
Change-Id: Ic58cf7bc4fde777bb590c05777b76f5ff5c2f1ea
(cherry picked from commit 78278c3eb4)
2021-12-08 02:23:43 +00:00
Jeff Tinker
d808ae18b6 Merge "OEMCrypto Testing: Don't return key data if no keybox" into sc-v2-dev am: ecb4d64e41 am: 6a005a95b9
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16300800

Change-Id: I48765d04825722e493e5f175941c6ebbb57e6a0c
2021-12-03 09:45:21 +00:00
Jeff Tinker
6a005a95b9 Merge "OEMCrypto Testing: Don't return key data if no keybox" into sc-v2-dev am: ecb4d64e41
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16300800

Change-Id: I1284acd93a68a49185c9fbffe91b0b7bd7cf35c1
2021-12-03 09:25:03 +00:00
Jeff Tinker
ecb4d64e41 Merge "OEMCrypto Testing: Don't return key data if no keybox" into sc-v2-dev 2021-12-03 07:12:19 +00:00
John "Juce" Bruce
8fd728e992 Consistent result variable in CdmSession::RestoreOfflineSession
(This is a merge of http://go/wvgerrit/139632.)

While fixing a compiler error about shadowed variables in CdmSession, I
noticed that this function had two result variables with different names
as well. This patch consolidates down to one result variable.

Bug: 207684988
Test: x86-64
Change-Id: Iaf6d742ef3409d85a1c364b486909d2497093112
2021-12-01 14:30:37 -08:00
John "Juce" Bruce
c43b9fc3de Use nullptr in more places
(This is a merge of http://go/wvgerrit/139630.)

This patch fixes a few places that were using NULL or 0 instead of
nullptr.

Bug: 207702482
Test: x86-64 build
Change-Id: I10e19febebd093fe4445208a082216002d9a4482
2021-12-01 11:58:05 -08:00
John "Juce" Bruce
bfd299a4be Add missing override keywords
(This is a merge of http://go/wvgerrit/139629.)

This patch fixes several places where the override keyword was missing.
These were found when future patches that enable stricter checking of
the override keyword were enabled. There are two basic categories of
missing override:

* Destructors found to be overriding a virtual destructor without using
  the override keyword.
* Test methods overriding methods on test-only or mock objects.

Some of these were previously marked as virtual, following our pre-C++11
style guidelines, but this is not necessary now that we have override.

Bug: 207684988
Test: x86-64 build
Change-Id: I09aa499bd3ea80d925e2fc422290d61eb005a769
2021-12-01 11:55:32 -08:00
John "Juce" Bruce
8574a4b98c Update handling of move-only types in DeviceFiles unit test
(This is a merge of http://go/wvgerrit/139569.)

The unit test for DeviceFiles previously had to work around googlemock's
lack of support for move-only types. Now that we have upgraded to
googletest 1.10, we can use move-only types directly via the ByMove()
utility, removing the need for this workaround.

Bug: 207693599
Test: x86-64
Change-Id: Ib4dcc5ec367ef413465a3e8a8f45f9187976ed5e
2021-12-01 11:42:19 -08:00
TreeHugger Robot
f7a950ea51 Merge "Add "Model Year" to list of CDM identification properties" 2021-11-24 01:06:39 +00:00
Fred Gylys-Colwell
b47aa150ea Guard against double initialize am: 03f8d1b6f7 am: 6864a04975
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16306734

Change-Id: I82dacd938afd609f48eeb786b8ad78098b6dbe36
2021-11-20 07:04:16 +00:00
Fred Gylys-Colwell
6864a04975 Guard against double initialize am: 03f8d1b6f7
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16306734

Change-Id: Ie2628bdebded7e58474b54abebb58b3b4e7ff54e
2021-11-20 06:55:38 +00:00
Fred Gylys-Colwell
03f8d1b6f7 Guard against double initialize
Merge from Widevine repo of http://go/wvgerrit/139498

If L1 OEMCrypto fails to initialize, we won't try again.

Bug: 206670307
Change-Id: I89084476ae01d9c98291392c2ce703ebc6326322
2021-11-20 05:37:34 +00:00
Fred Gylys-Colwell
a6cdd16900 Fall back to Level 3 if Keybox not found am: 0e55743d3a am: 057c925d3c
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16300799

Change-Id: I8b5eb5fd6d2b9d2ef32ee4d80f961963e03adede
2021-11-19 01:49:50 +00:00
Fred Gylys-Colwell
057c925d3c Fall back to Level 3 if Keybox not found am: 0e55743d3a
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16300799

Change-Id: I22d4bb59754bc4c7b61b704a1c2181e1685b818a
2021-11-19 01:38:12 +00:00
Fred Gylys-Colwell
7c3e06f46d OEMCrypto Testing: Don't return key data if no keybox
Merge from Widevine repo of http://go/wvgerrit/139336

When pretending we have no keybox, we should also have no system id or
device id. This should reproduce our problem with the test app.

Bug: 206570220
Test: reproduced problem using TestOPK app
Change-Id: I893336ce8e1fd2272f5b511676e1da28654639a7
2021-11-18 23:08:30 +00:00
Fred Gylys-Colwell
0e55743d3a Fall back to Level 3 if Keybox not found
Merge from Widevine repo of http://go/wvgerrit/139333

This is a workaround for devices that don't have a
keybox installed.

Bug: 206570220
Bug: 205896558
Bug: 205041153
Test: verified device falls back to L3 using TestOKP app
Change-Id: Id929b48ddaa7114a81765095aac536705f69e68c
2021-11-18 22:53:51 +00:00
John W. Bruce
7992650ff6 Add "Model Year" to list of CDM identification properties
(This is a merge of http://go/wvgerrit/138969.)

Provisioning 4.0 on CE CDM requires not only the make & model but the
model year in order to relate a device back to its system ID. This patch
adds model year to the list of properties that partners must provide as
client identification.

As no equivalent field exists for Android, this property is not
provided on Android platforms.

Bug: 206453352
Test: x86-64
Change-Id: I0764d67fec54fa9a0c65074e68f3ee02de1e7820
2021-11-17 16:53:34 -08:00
Rahul Frias
9067a53892 Merge "Update Version number" 2021-11-17 10:36:38 +00:00
Alex Dale
4d219ef217 Merge "Added new error code OEMCrypto_ERROR_INVALID_KEY." 2021-11-17 05:11:42 +00:00
Rahul Frias
1592da96f3 Update Version number
[ Merge of http://go/wvgerrit/138149 ]

Update the android version number test to "12L"

Bug: 205491167
Test: wv unit/integration tests
Change-Id: If11e7c6f3a89263ab78d274aa8d776991d3942e9
2021-11-12 16:33:59 -08:00
TreeHugger Robot
9e72c70966 Merge "Restore by_exception_only comments." 2021-11-12 23:45:13 +00:00
Bob Badour
9bcf92dc35 Restore by_exception_only comments.
Required per https://opensource.google/docs/thirdparty/licenses/#ByExceptionOnly

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m nothing

Change-Id: I45be3e01c44bd053f4c60e8a84945e7d16e88481
2021-11-12 14:44:47 -08:00
TreeHugger Robot
5cf3a1c2c0 Merge "Fix -Wshorten-64-to-32 errors in test code" 2021-11-12 20:28:16 +00:00
TreeHugger Robot
5d41a77815 Merge "Fix -Wshorten-64-to-32 errors in Haystack" 2021-11-12 20:27:47 +00:00
Bob Badour
2d26368b73 Merge "[LSC] Add LOCAL_LICENSE_KINDS to vendor/widevine" 2021-11-12 14:32:51 +00:00
TreeHugger Robot
0cf4748512 Merge "Added numeric value guards to ValueMetric." 2021-11-12 05:42:43 +00:00
TreeHugger Robot
92e57b8ca7 Merge "Updated metric Distribution and Timer utils." 2021-11-12 05:41:42 +00:00
Rahul Frias
693874b9a1 Update Version number am: 0aa9b47b03 am: d44e6b2ff3
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16221418

Change-Id: I5af4bd2baf8af8a0702f8a13c6750f1d87120cf3
2021-11-12 05:03:29 +00:00
Rahul Frias
d44e6b2ff3 Update Version number am: 0aa9b47b03
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16221418

Change-Id: Ia23642271cbe27a4fd86ec4bb64d313e8acb270a
2021-11-12 04:47:17 +00:00
Bob Badour
42d6898539 [LSC] Add LOCAL_LICENSE_KINDS to vendor/widevine
Added legacy_by_exception_only to:
  libwvdrmengine/mediacrypto/Android.bp
  libwvdrmengine/mediadrm/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: I5897dd189cdafc5af86210236fa8468bfb27fd6e
2021-11-12 04:29:24 +00:00
Alex Dale
59f0f7cd36 Added new error code OEMCrypto_ERROR_INVALID_KEY.
[ Merge of http://go/wvgerrit/138606 ]

The new error code OEMCrypto_ERROR_INVALID_KEY is to replace the now
deprecated error code OEMCrypto_ERROR_INVALID_RSA_KEY.  This error code
serves the same purpose of OEMCrypto_ERROR_INVALID_RSA_KEY, but may be
appied to RSA, ECC and Twisted-Edward ECC keys.  In general, this error
code is to indicate that a key is poorly formatted / unparsable, used in
an operation without allow permissions, or used in an operation that it
cannot be association (RSA signing with an ECC key).

Going forward, new OEMCrypto implementation should use
OEMCrypto_ERROR_INVALID_KEY in place of OEMCrypto_ERROR_INVALID_RSA_KEY.
The CDM will continue to support both error codes.

Bug: 201581141
Test: Testbed unit tests
Change-Id: I2cf1af33a9a1d8716eec4cc63bba52d2f4af4c1b
2021-11-11 20:25:31 -08:00
TreeHugger Robot
71e9c3cef3 Merge "Removing Non-HIDL Widevine DRM Plugin for Android" 2021-11-11 22:56:30 +00:00
TreeHugger Robot
0b02296014 Removing Non-HIDL Widevine DRM Plugin for Android
[ Merge of http://go/wvgerrit/138089 ]

Non-hidl code is no longer needed in the widevine android plugin. By
doing work this cleanup will save the team from having to keep
maintaining code that isn't needed anymore.
Clean up steps taken as follows:
    1. Remove non-hidl code but keep commonly used code
    2. Remove legacy test code
    3. Remove legacy test build and test entry

Bug: 69573078
Bug: 172285246
Test: unit tests, GtsMediaTestCases, CtsMediaDrmTestCases
Change-Id: I75938d69413c631ef6be82da3d885ba173efc581
2021-11-11 02:06:15 +00:00
John W. Bruce
c45559177a Fix -Wshorten-64-to-32 errors in test code
(This is a merge of http://go/wvgerrit/134316.)

This patch fixes code that would trigger -Wshorten-64-to-32 by
implicitly narrowing a variable from 64 to 32 bits. Most of the time, it
does this by making the implicit conversion explicit. Occasionally,
where it makes sense, it does this by expanding the code to operate on a
64-bit value.

This patch removes LicenseKeysTest::NumContentKeys(), which no one was
using, as all the tests access content_key_count_ directly.

Bug: 194971260
Test: x86-64
Change-Id: Iae7685c10b9db989253b349cab693728b438798d
2021-11-10 16:16:47 -08:00
John W. Bruce
0c7db1a836 Fix -Wshorten-64-to-32 errors in Haystack
(This is a merge of http://go/wvgerrit/134424.)

This patch fixes code that would trigger -Wshorten-64-to-32 by
implicitly narrowing a variable from 64 to 32 bits. The membarrier
functions have their return type expanded so they can report the full
return value of the syscall.

Bug: 194971260
Test: x86-64
Change-Id: I5d948162b1f3f1540288df9494cabda39ecf8905
2021-11-10 16:10:54 -08:00