Commit Graph

2148 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
fdc024c9c0 Adjust nonce for v15 servers am: 7f347cd59f am: 940a771969 am: 08fe6b1690
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12173751

Change-Id: I4d55319169d3e2709568ff51336cce0ad6b04345
2020-07-21 08:53:50 +00:00
Fred Gylys-Colwell
08fe6b1690 Adjust nonce for v15 servers am: 7f347cd59f am: 940a771969
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12173751

Change-Id: I67ed1d76737d81d039b603d85b18977845f20007
2020-07-21 08:41:22 +00:00
Fred Gylys-Colwell
9cf2a475e2 Adjust nonce for v15 servers am: 7f347cd59f
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12173751

Change-Id: If52b4180e02638e93028d0dda38b79e6d0dbd1d0
2020-07-21 08:28:08 +00:00
Fred Gylys-Colwell
b90f88072f Start rental clock when nonce-free offline license loaded
Merge from Widevine repo of http://go/wvgerrit/103107

When an offline license is reloaded, if it does not have a usage entry
to indicate when the rental clock was started, the start time defaults
to 0 in the ODK library (in OEMCrypto). This CL changes the code to
start the rental clock in this case. It does this by signing a dummy
message, which triggers the ODK library to start the rental clock.

Bug: 161585265
Bug: 161023174
Test: GTS tests. http://go/forrest-run/L55100000642199761
Change-Id: I4cf555b2fb43009ffb62e7b2c1a37265c3f70bfe
2020-07-20 23:11:48 +00:00
Fred Gylys-Colwell
7f347cd59f Adjust nonce for v15 servers
Merge from Widevine repo of http://go/wvgerrit/102783

When OEMCrypto is v16, but the license server is v15, we should not
create a new nonce for a license renewal. However, the request does
need a nonce or the license server will not generate a valid key
control block. So we should use the nonce that came from the original
license.

Bug: 160676790
Test: tested playback using netflix
Test: GTS tests. http://go/forrest-run/L55100000642199761
Change-Id: Ie1644b5abe0662387edf01f6110d82f70a64df6c
2020-07-20 23:11:41 +00:00
Edwin Wong
6fe341c845 Merge "Add arguments to Widevine lshal debug hook." 2020-07-20 22:24:53 +00:00
Edwin Wong
5b8d21164d Add arguments to Widevine lshal debug hook.
Add options to dump Widevine Cdm properties,
Widevine Cdm metrics, or both.

The valid arguments are Cdm Metrics (m|M) or Cdm Properties (p|P).
If no arguments are provided, both Cdm properties and
Cdm metrics will be displayed.

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

Bug: 154027349
Change-Id: I95c10dd7d4274226936295c73be4eb1612c2ef6a
2020-07-20 13:51:38 -07:00
Rahul Frias
297a289a31 Merge "Correct ordering of test expectations" 2020-07-16 22:45:29 +00:00
Alex Dale
7ce8950c0f Usage table LRU only retrieves a single entry.
[ Merge of http://go/wvgerrit/102167 ]

After changes made to how the usage table is defragged by the CDM,
it was determined that there is no use in selecting more than a single
entry from the usage table to evict.  The only failure that can occur
when evicting an entry is if the last entry is in use, in that case,
evicting other entries will still result in a failure.

This change cleans up the LRU algorithm and test cases to reflect
the new functionality.

Bug: 155230578
Test: Linux unit tests
Change-Id: I817c039670d9f72c0e4f6c3fdac45c98ed5b6b21
2020-07-14 18:37:11 -07:00
Rahul Frias
347917e505 Correct ordering of test expectations
[ Merge of http://go/wvgerrit/102804 ]

This addresses post-merge review comments.

Bug: 150393659
Test: WV unit/integration tests
Change-Id: I221ed1c82b20bd0c2b0b824a2d52a2dd918fa459
2020-07-14 02:24:41 -07:00
Alex Dale
1d136b4f94 Merge "Re-enabling parallel license tests for L1 and ModMock." 2020-07-10 00:17:53 +00:00
Alex Dale
cf6cf5f4e8 Re-enabling parallel license tests for L1 and ModMock.
[ Merge of http://go/wvgerrit/102108 ]

Several tests that make parallel license requests were disabled due
to a flaky server failure unrelated to CDM code.  Most of these tests
are now re-enabled to ensure the multi-threaded license requests is
functional on V16.

These tests remains disabled for L3 due to continued flakiness.

Added a lock around the initialization of the SSL library to prevent
issues with license requests getting garbled.

Bug: 137619348
Test: Linux and Android unit tests
Change-Id: Idffaa6039b2bde12613bb5033af32d1af6704c76
2020-07-08 16:44:00 -07:00
John Bruce
5a27d24742 Merge "Memory Leak in CertificateProvisioningTest" 2020-07-08 19:56:04 +00:00
John W. Bruce
5f232c5436 Memory Leak in CertificateProvisioningTest
(This is a merge of http://go/wvgerrit/102084.)

No one was claiming ownership of the metrics object in
CertificateProvisioningTest, resulting in a leak. This patch makes the
test hold onto ownership.

Bug: 159486086
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I84710782b7a60d6bd3a7eda981de4f0af877fc39
2020-07-07 15:07:16 -07:00
Robert Shih
2ac3a6b623 GetDecryptHashSupport: recognize OEMCrypto_ERROR_NOT_IMPLEMENTED am: da09f4abca am: 0db8b90cdb am: 2009155f7e am: deb11efb5f
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12036417

Change-Id: I6df47d941ecea3ad046c90f19bd355767d0e15ab
2020-07-07 00:34:36 +00:00
Robert Shih
2009155f7e GetDecryptHashSupport: recognize OEMCrypto_ERROR_NOT_IMPLEMENTED am: da09f4abca am: 0db8b90cdb
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12036417

Change-Id: I10bc5ae45c8f20f0a9b2349c6fa01b8aae0664ae
2020-07-06 23:57:44 +00:00
Robert Shih
da09f4abca GetDecryptHashSupport: recognize OEMCrypto_ERROR_NOT_IMPLEMENTED
[ Merge of http://go/wvgerrit/102383 ]

Bug: 153297118
Bug: 160182693
Test: MediaDrmTest#testDecryptHashError
Change-Id: I107668cdd1ab0acda717f184496e569a4f9a8653
2020-06-29 22:19:26 +00:00
John Bruce
38a8b631be Merge "Rework Device File Matchers to Avoid Buffer Overflow" 2020-06-25 21:58:58 +00:00
Alex Dale
88fba96dfb Merge "Test CDM sessions prevent multiple usage entries." into rvc-dev am: c628c5aca2 am: 3adda0dfe1 am: 52901002a1 am: 33c3fd9085
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11925460

Change-Id: I224f1e42089548e2e78318df4c67e650253fde6d
2020-06-25 20:27:27 +00:00
Alex Dale
52901002a1 Merge "Test CDM sessions prevent multiple usage entries." into rvc-dev am: c628c5aca2 am: 3adda0dfe1
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11925460

Change-Id: I2c3237138f100970ab62dddb377122a980a211f1
2020-06-25 19:50:03 +00:00
Alex Dale
c628c5aca2 Merge "Test CDM sessions prevent multiple usage entries." into rvc-dev 2020-06-25 19:25:18 +00:00
John W. Bruce
804c0d470c Rework Device File Matchers to Avoid Buffer Overflow
(This is a merge of http://go/wvgerrit/102104)

The device file unit tests use some custom matchers that were written
back when we didn't have C++11. Because gMock requires std::tuple to
pass a pointer AND a length to a matcher, these matchers had to estimate
the length of the file. This technically meant they were causing a
benign buffer overrun sometimes.

Since we have C++11 now, we can fix this by using a matcher over a
std::pair of the pointer and length. I also took the opportunity to
refactor the matchers a little. The old matchers had many very specific
overloads and also collided with the names of some standard gMock
matchers. Now there are just two more-general matchers with unique
names.

Test: CE CDM Unit Tests
Test: Android Unit Tests
Bug: 159463905
Change-Id: I758b140226bfe2bae6962ee5c64fd6af186b5819
2020-06-24 14:27:09 -07:00
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
Alex Dale
0aaf1df125 Test CDM sessions prevent multiple usage entries.
[ Merge of http://go/wvgerrit/102068 ]

CDM sessions should not be able to load multiple usage entries.
OEMCrypto already prevents multiple entries from being loaded by the
same OEMCrypto session; however, restoring a key typically creates a
new OEMCrypto session, which should not be allowed twice within the
same CDM session.

This test verifies that CDM returns an error if restore key is called
multiple times within the same session.

Bug: 136143733
Test: Android integration test
Change-Id: I594c91250217fd958837328162f909bc931d373f
2020-06-19 20:40:54 -07: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