Commit Graph

2075 Commits

Author SHA1 Message Date
Alex Dale
6a247ab924 INSUFFICIENT_RESOURCE errors are mapped consistently.
[ Merge of http://go/wvgerrit/102109 ]

The CDM was using unique CDM error codes for the various cases
where OEMCrypto would return INSUFFICIENT_RESOURCE.  However, these
error codes were being incorrectly mapped at the Android level,
resulting in incorrect errors in the MediaDRM layer.

At no point does the CDM handle different INSUFFICIENT_RESOURCE_x
within the same case, as such the use of unique codes are limited.
This CL removes the unique codes, and unifies them under the same
CDM error code.

This CL also extends SelectKey to handle error codes returned by
LoadEntitledContentKeys.

Bug: 154682842
Test: Unit tests
Change-Id: I319fabf6cac60b0dc19ea891609689daeeaeb435
2020-06-22 16:27:25 -07:00
Rahul Frias
992d54d912 Merge "Handle SPOID calculation for L3" into rvc-dev am: 25d1646138 am: dffadd204c am: 61f64a00c6 am: 1b6f50a467
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11736137

Change-Id: Iba9cfe403e14249910d5ba19a3ec4c238d7c09cd
2020-06-22 18:46:13 +00:00
Rahul Frias
dffadd204c Merge "Handle SPOID calculation for L3" into rvc-dev am: 25d1646138
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11736137

Change-Id: Ia4c431617789fbbb5f973f076b29408df2b2a2bc
2020-06-22 18:14:28 +00:00
Rahul Frias
25d1646138 Merge "Handle SPOID calculation for L3" into rvc-dev 2020-06-22 18:04:18 +00:00
Rahul Frias
7e689a1828 Handle SPOID calculation for L3
[ Merge of http://go/wvgerrit/101443 ]

The WVDrmPlugin has a single CdmIdentifier. The CdmIdentifier contains
a SPOID that is calculated from the device ID (keybox or OEM cert),
an application reverse domain name and possibly an origin.

The CdmIdentifier is set and SPOID calculated on certain calls into
WVDrmPlugin. Once it is set, it will not be recalculated. We prevent
certain operations such as modifying the origin once the CdmIdentifier
has been set as this will require recalculating the SPOID.
Recalculating the SPOID may affect open sessions or calls in progress.

In a similar way, modifying the security level, will affect the
Device ID value and in turn the SPOID. The security level cannot be modified
if any sessions are open. This does leave open the possibility that the
SPOID may be calculated at one security level, sessions are then closed,
and the security level is then changed without an error being flagged.

The provisioning certificate file name is based on the SPOID. When
the SPOID does not match the security level, either the provisioning
information may not be found even though that security level has
been provisionined or the provisioning information may be stored
in an incorrect location if provisioning occurs.

The correct solution is to prevent modifications to the security level
once the CdmIdentifier is set. This is a behavior change and might
impact apps. We will reevaluate this for the next release.

For now, we will work around this. When the CdmIdentifier is set for L3,
we will calculate SPOIDs with both L1 and L3 device IDs and check if
provisioning previously occurred with SPOIDs calculated for that level.
If so, use that level, otherwise use L3.

Bug: 147703382
Test: Android unit/integration tests, GtsMediaDrmTests
Change-Id: Ia64adfc5848e431ee3876af03eebdb4b6eb83116
2020-06-17 00:50:14 -07:00
Edwin Wong
1c96f07452 Merge "Add v16 Widevine Integration Guide Android Supplement" into rvc-dev am: 6b8d0e034d am: 656db1857b am: 2efe1ab43a am: 6e3c8f51b6
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11838915

Change-Id: I16e2c71ba2abe6882d5140a79859a1e84329e198
2020-06-17 01:40:42 +00:00
Edwin Wong
2efe1ab43a Merge "Add v16 Widevine Integration Guide Android Supplement" into rvc-dev am: 6b8d0e034d am: 656db1857b
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11838915

Change-Id: Ia81efaffabcb99ab931a8538aa39d88fbf3f5835
2020-06-17 01:14:13 +00:00
Edwin Wong
f596c0929e Merge "Add v16 Widevine Integration Guide Android Supplement" into rvc-dev am: 6b8d0e034d
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11838915

Change-Id: I9969623efb2098fecdd9cfd5d38e3477a37dabed
2020-06-17 01:00:02 +00:00
Edwin Wong
6b8d0e034d Merge "Add v16 Widevine Integration Guide Android Supplement" into rvc-dev 2020-06-17 00:47:04 +00:00
Edwin Wong
72dc93ed1d Add v16 Widevine Integration Guide Android Supplement
The doc is based on
WidevineSecurityIntegrationGuideforCENCAndroidSupplement_v15.pdf.
The "Build Files" and "Reference Implementation" sections are
updated for v16.

merged from http://go/wvgerrit/101747

Please see revision history in:
https://docs.google.com/document/d/19pSOpV5_6AtyK82p1b5DajlYZnVOfyL63p5h72yWW5k/edit?usp=sharing

Test: revision history

bug: 147596889
Change-Id: If3e9fc6bb268d1d3be62b56e2e43752d8df3fc03
2020-06-16 15:19:34 -07:00
Edwin Wong
7d0c14a15e Merge "Add lshal debug hook." 2020-06-16 17:01:30 +00:00
Rahul Frias
7589364dc6 Merge changes I295f66f9,I142f286c into rvc-dev am: 05fbb3dd87 am: 0db9b974c2 am: 1c6633d408 am: 7b0fe07c8a
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11620164

Change-Id: If47d215914fbb11d2d33cd01b635d4fe16112957
2020-06-16 09:22:07 +00:00
Rahul Frias
1c6633d408 Merge changes I295f66f9,I142f286c into rvc-dev am: 05fbb3dd87 am: 0db9b974c2
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11620164

Change-Id: I31070cfbc0f7f8742fea3dc5e25c1328df68de22
2020-06-16 09:03:23 +00:00
Rahul Frias
4868f95704 Merge changes I295f66f9,I142f286c into rvc-dev am: 05fbb3dd87
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11620164

Change-Id: I3e94398b1ae4670f33a3c128e653e38d2baaa525
2020-06-16 08:54:41 +00:00
Rahul Frias
05fbb3dd87 Merge changes I295f66f9,I142f286c into rvc-dev
* changes:
  Add ATSC support - part 2
  Add ATSC support - part 1
2020-06-16 08:46:02 +00:00
Fred Gylys-Colwell
63190628a6 Remove Android.mk for OEMCrypto ref code am: 119932ea69 am: d0259e0942 am: 8ff9d2255d am: 6926815f29
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11870737

Change-Id: I41d1223029e7ca0360f253c811f3a60c210b69b0
2020-06-16 02:46:01 +00:00
Fred Gylys-Colwell
d0259e0942 Remove Android.mk for OEMCrypto ref code am: 119932ea69
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11870737

Change-Id: I3eba5d14aa17dc70888964154b11e70ff7e6bdbc
2020-06-16 02:12:30 +00:00
Fred Gylys-Colwell
119932ea69 Remove Android.mk for OEMCrypto ref code
Merge from Widevine repo of http://go/wvgerrit/101905

The reference OEMCrypto should not be built as part of Android.

Test: Builds
Bug: 146361995
Change-Id: Ic25e6e567fcac519636f64dabc0d59b3df78990e
2020-06-15 17:40:28 -07:00
Dan Willemsen
1d881bf5ad Replace libcrypto_static with libcrypto am: 761d1723ff am: abf67e2910 am: 927ef46152
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11815604

Change-Id: Ia4d772b9ee248979e8efebf9bea01da41400330c
2020-06-15 20:16:46 +00:00
Edwin Wong
53e8348860 Add lshal debug hook.
[Merge of http://go/wvgerrit/101804]

Dump build info and Widevine DRM service properties.

Test: adb shell lshal debug [drm service]
  adb shell lshal debug android.hardware.drm@1.3::IDrmFactory/widevine

Bug: 154027349
Change-Id: Ide918d7bab7a59c1564ccec57cbfef1fff9e5f0b
2020-06-15 12:09:24 -07:00
Rahul Frias
8da1145012 Add ATSC support - part 2
[ Merge of http://go/wvgerrit/100905 and http://go/ag/10708438 ]

Add support for ATSC certificate and licenses handling. ATSC
files are distinguished from the apps DRM certificate and licenses
by file naming conventions.

Bug: 139730600
Test: WV unit/integration test, GtsMediaTestCases
Change-Id: I295f66f92fe01d7716978deac9dc360d74addedd
2020-06-12 03:48:58 -07:00
Dan Willemsen
761d1723ff Replace libcrypto_static with libcrypto
libcrypto_static has restricted visibility, which is now being
implemented in Make, so we either need to allow it for all vendor
modules, or use the shared library instead.

Bug: 158599308
Test: treehugger
Test: mmma vendor/widevine/libwvdrmengine
Change-Id: I88ddce7ad221c66a20f4e05409ae77421e4196ad
2020-06-10 00:10:06 +00:00
Rahul Frias
bbe9f6afc4 Add ATSC support - part 1
[ Merge of http://go/wvgerrit/100864 and http://go/ag/10704773 ]

ATSC 3.0 allows for licenses to be downloaded OTA and are tied to
a DRM certificate that may be shared across apps. The provisioning
process for ATSC may happen at the factory or during an OS update.

This contrasts from the regular OTT model, which requires that
provisioning and license download have an uplink as well as a
downlink connection.

This adds support for the ATSC mode property. ATSC mode can only be
set (or unset) before sessions are opened. Once the CDM identifier is
set/sealed, requests to modify the ATSC mode will be rejected.

If one needs to open sessions with both ATSC mode and regular (non-ATSC)
mode, separate MediaDrm objects will need to be created. The default
mode is to not use ATSC.

Enable ATSC mode by calling
  mediaDrm.setPropertyString("atscMode", "enable")

Disable ATSC mode by calling
  mediaDrm.setPropertyString("atscMode", "disable")

Provisioning and unprovisioning requests for ATSC will be rejected as
certificates will be retrieved by the ATSC service.

Bug: 139730600
Test: WV unit/integration test, GtsMediaTestCases
Change-Id: I142f286c711fe007ff42125c3c8cdc6450b6ea36
2020-06-08 14:56:48 -07:00
John Bruce
b5a4b58ca4 Merge "Add <algorithm> to device_files.cpp" 2020-06-05 20:50:44 +00:00
Fred Gylys-Colwell
f60a2d8e22 Update OEMCrypto documentation to v16.3 am: aa5fc5afd0 am: 30ea7ee843 am: 615bf191a5 am: cc446c0075
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11707216

Change-Id: I80833b2d971bdbe82af3ba709651d98ac8e29e5b
2020-06-04 22:29:48 +00:00
John W. Bruce
e47233ecf6 Add <algorithm> to device_files.cpp
(This is a merge of http://go/wvgerrit/101423 to Android.)

This header was missing. On the STL used inside Google, it gets included
transitively, but this is not guaranteed and broke in a partner's STL.

Bug: 154185251
Test: Android Build
Test: CE CDM Build and Unit Tests
Change-Id: If8df7e288073e69250f98d67f732804a955bbaa3
2020-06-03 16:21:57 -07: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
00caf5f7c2 Update OEMCrypto unit tests to require ODK 16.3 am: 45681615b8 am: d599c74011 am: a12d082a11 am: b4f072558e
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11677949

Change-Id: Ic11c9c038de342c3c6cdc044d8046cd69ea0ee9c
2020-06-02 22:26:55 +00:00
Fred Gylys-Colwell
9e4bdda1a5 Do not verify decrypt hash when no key selected am: 36968de671 am: 51992ab155 am: 23f9a69a7f am: d4f0d69923
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11677948

Change-Id: I9ace6783f1bcdde706c83d6768826b0187378a97
2020-06-02 22:26:54 +00:00
Fred Gylys-Colwell
1106e2e913 Unit test for loading nonce-free offline license am: a615671f48 am: ed900f242b am: 32b318e7c4 am: 38d465b042
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11677947

Change-Id: I63c865fd7574289061ffe929f2ed03a30c56eac0
2020-06-02 22:26:53 +00:00
Fred Gylys-Colwell
2c8ead459e Check for null pointers in oemcrypto adapter am: 42eb79a3ff am: 7a4313483c am: 2643b76731 am: fcf75fec0d
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11677946

Change-Id: I7140851ef02ea0ee3f07ba2825b7330f661a1265
2020-06-02 22:26:50 +00:00
Fred Gylys-Colwell
7cb5714fdd Update ODK Library to 16.3 am: 166b3e8403 am: 62802d8e10 am: 4b9e91eefd am: 084bfcf938
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11699230

Change-Id: Ia726a9e052814f3ab7740daf0267df9cb94c6d20
2020-06-02 22:26:46 +00:00
Fred Gylys-Colwell
0360cf948f ODK: forward compatibility and nonce-free offline license support am: 8dc1d7a11d am: 5bb396fb72 am: c2920550ed am: 0000eef77d
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11688972

Change-Id: Ia701b9c7696d33a47f8d2a342cec3f5d79ca20db
2020-06-02 22:26:44 +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
c3be1c3098 Merge "Fix implicit type conversion issue in ODK" into rvc-dev am: c34e2af181 am: f5e7afe51d am: 5f76c56c05 am: d622cde29c
Change-Id: I1cd80a70c9b094e245a904e310406f1cbf523fb2
2020-05-30 03:56:07 +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
265ba61b5c Merge "OEMCrypto Unit Test Fix: Do Not Derive Keys Immediately" into rvc-dev am: 729723b3d2 am: b349680d3f am: 00792ac231 am: 1c7dab441a
Change-Id: I1bada2a5657eb38a8271d2da2199b145a8966d6c
2020-05-30 00:32:39 +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
94314def43 Rolled expected version number for R. am: dd70d63b76 am: 9329bf331c am: 7eb1c2b619 am: 32f70b0464
Change-Id: I4f6d3d744869708d538b5d0881044ab0d605e0a8
2020-05-27 22:11:40 +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
579cbdee6a Merge "The Entitlement key map was not being cleaned up." into rvc-dev am: bd8e573e0c am: 5bedd9c4ad am: 2308e673b2 am: 743f9971b8
Change-Id: I982fd0461d3efbcb24de944ab220d93596153b49
2020-05-27 05:00:46 +00:00
TreeHugger Robot
a34288e1fe Merge "Start playback timer in integration tests" into rvc-dev am: 7534d9795b am: 208a088e8e am: 3889252bfc am: 2379c7664a
Change-Id: I47ac491d8c5097d7372bcab1ca6667a48a8f01d8
2020-05-27 04:58:58 +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