Commit Graph

2484 Commits

Author SHA1 Message Date
Rahul Frias
11068accd2 Merges to android Pi release (part 3)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Add CDM status return for decrypt blocked by HDCP.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/28062 ]

  New status code is kKeyUsageBlockedByPolicy. It is returned by the decrypt()
  call instead of kDecryptError or kNoKey.

  Also shuffled the CDM status returns to define the EME-aligned codes
  first, and added comments to highlight the differences in handling.

  BUG: 37540672

* Change division and mod ops to relocatables

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/28600 ]

  This is similar to I2dad1028acf295288cd10817a2bcff2513c053c9.
  We should be using the relocatable functions instead of the
  native division and mod operations.

* Cleanup Encrypted ClientID in provisioning request

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/28083 ]

  b/36897239

  Staging server does not support it (or the client is not constructing
  it properly).  Leave it disabled pending investigation.

* Certificate Provisioning fixes.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/28066 ]

  Partial fix for BUG: 37482676
  Partial fix for BUG: 37481392

  Update service certificates, get rid of DEV/QA root certificate.
  Provisioning request and response are base64 (web-safe) encoded.
  Response is optionally JSON-wrapped.

  Change ConfigTestEnv; clearer comments and a closer match to reality.

BUG: 71650075
Test: Not currently passing. Will be addressed in a subsequent
      commit in the chain.

Change-Id: I79d3c4bf1124e5e0d3e4d40baead65a8266ea874
2018-01-16 19:25:31 -08:00
Rahul Frias
387147dffe Merges to android Pi release (part 2)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Update service certificate.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/28065 ]

  The updated service certificate fixes a number of failing tests.
  There are still some that fail, apparently due to mismatches
  with key set IDs and usage tables.

  Also updated QA server URL to point to QA proxy (although neither
  can be used by this client).

  Also fixed segfault in CdmTest.ListUsageRecords.

* Add CDM APIs for Handling Service Certificates.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/28064 ]

  The responsibility for managing Service Certificates has been moved
  out of the CDM. Instead, provide CDM and CdmEngine methods to generate
  a service certificate request message, and handle a service certificate
  response. The API client can use these calls if it needs to get the
  service certificate from the License Server.

  These functions assume the request and response are base64 (web-safe)
  encoded (see b/37481392). Not all servers are operating this way yet.
  Any adaptations for non-compliant servers is handled outside the CDM.
  See test WvCdmEnginePreProvTest::ServiceCertificateRequestResponse in
  cdm_engine_test.cpp for an example of this.

  These changes also eliminate the stored init_data and deferred
  license type which were used to perform a service certificate request
  during a license request.

* Fix and rename ClosesSessionWithoutReturningError test.

  Author: Edwin Wong <edwinwong@google.com>

  [ Merge of http://go/wvgerrit/27880 ]

  ClosesSessionWithoutReturningError should not check for
  Status::OK since it is expecting an error code back.
  The test is renamed to ClosesSessionWithError.

  Test: libwvdrmdrmplugin_hidl_test

  BUG: 62205215

* Get rid of default service certificate.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27981 ]

  Instead, we need at least two service certs - one for the QA/Test
  servers, and one for UAT (and prod?)

  There are still some issues around the signature verififcation
  of the service cert, and in license_unittest.cpp, the use
  of the default service cert has been commented out.  I don't know
  why this test needs a service cert.  If it really does, then the
  same mechanism that is used elsewhere for selecting a specific
  server type will be needed here.

BUG: 71650075
Test: Not currently passing. Will be addressed in a subsequent
      commit in the chain.

Change-Id: Ieab815fb202c809ad5714cd0364c4bdfa068f77d
2018-01-16 19:22:48 -08:00
Rahul Frias
0419b55222 Merges to android Pi release (part: 1)
Below are a set of CLs being merged from the wv cdm repo to the android repo.

* Fix handling of OEM Cert public key.

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/27921 ]

  This is a potential fix for b/36656190. Set aside public
  key on first call to get the public key, and use it afterwards.
  This gets rid of extra calls to OEMCrypto_GetOEMPublicCertificate(),
  which has side-effect of staging the OEM private key.

  This also fixes a problem where the public cert string was
  not being trimmed to match the size returned by
  OEMCrypto_GetOEMPublicCertificate().

* Complete provisioning request/response for Provisioning 3.0

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27780 ]

  Fix bug on provisioning request path where GenerateDerivedKeys()
  was being called when preparing to generate the signature.

  Add message signature verification, and call correct OEMCrypto
  routine to rewrap the private key (OEMCrypto_RewrapDeviceRSAKey30).

* Implement Cdm::deleteAllUsageRecords()

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27780 ]

  Delete all usage records for current origin.  Removes usage
  records from file system and retains the PSTs.  The deletes
  any usage entries matching those PSTs held by OEMCrypto.

  BUG: 35319024

* Remove stringencoders library from third_party.

  Author: Jacob Trimble <modmaker@google.com>

  [ Merge of http://go/wvgerrit/27585 ]

  We have a fork of the stringencoders library that we use for base64
  encoding.  This reimplements base64 encoding to remove the extra
  dependency and to reduce the amount of code.

* Add Cdm::deleteUsageRecord() based on key_set_id.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27605 ]

  Delete specified usage record from file system usage info and
  from OEMCrypto.

  BUG: 35319024

* Modifiable OEMCrypto

  Author: Fred Gylys-Colwell <fredgc@google.com>

  [ Merge of http://go/wvgerrit/24729 ]

  This CL adds a new variant of the OEMCrypto mock code that adjusts its
  behavior based on a configuration file.  This is intended for
  testing.

  For example, a tester can set current_hdcp to 2 in the options.txt
  file, push it to the device, and verify that a license is granted for
  HDCP 2.0.  Then the tester can edit the value of current_hdcp to 1 and
  push the file to the device.  Playback should stop because the license
  is no longer valid.

  This variant uses a real level 1 liboemcrypto.so to push data to a
  secure buffer.  That means we can test playback for a license that
  requires secure buffers on an Android device with real secure buffers.

  BUG: 35141278
  BUG: 37353534

BUG: 71650075
Test: Not currently passing. Will be addressed in a subsequent
      commit in the chain.

Change-Id: I58443c510919e992bb455192e70373490a00e2b6
2018-01-16 19:21:54 -08:00
Rahul Frias
e34f83cdce Consolidate update usage table calls
[ Merge of http://go/wvgerrit/24147 ]

In OEMCrypto version 13, usage information is updated by calls to
OEMCrypto_UpdateUsageEntry. In previous versions calls were made to
OEMCrypto_UpdateUsageTable instead. Both need to be supported as the
OEMCrypto version may vary by device.

This consolidates calls to OEMCrypto_UpdateUsageTable so that they
can be disabled if OEMCrypto version >= 13. No functional changes other
than disabling by OEMCrypto version were introduced in this section.

Helper routines have been added to device files as well.

Bug: 34327459

Test: WV unit/integration tests
Change-Id: I223b0a947c21b8b7ba3c8f345b0206747eb50984
2018-01-16 19:20:10 -08:00
Rahul Frias
17ccdcf351 Implement Cdm::listStoredLicenses() code review changes
[ Merge of http://go/wvgerrit/23822 ]

This merges back to master, code review related changes when
"Implement Cdm::listStoredLicenses()" was merged from master
(http://go/wvgerrit/23189) to oc-dev (http://go/wvgerrit/23600)

Bug: 34628115
Test: WV unit/integration tests
Change-Id: Idf3acb0ff668d1cc3fe2e6fd400daa183bdb340b
2018-01-16 19:19:26 -08:00
Rahul Frias
a483c18c59 Provisioning 3.0: Changes to Provisioning and Service Certs.
[ Merge of http://go/wvgerrit/23360 ]

Service Certificates are used in two places, provisioning and
licensing. The service certificate code depended on a session_id
to get and set the service certificate properties, but the session_id
was not available in the provisioning path.

This patch pulls out the property lookup by session_id dependency,
and passes the CdmImpl's property_set into the provisioning code, so
the service certificate can be read and written there.

Bug: 62972441

Test: WV unit/integration tests. This introduces three test failures
  * WvCdmRequestLicenseTest.PrivacyModeWithServiceCertificateTest
  * Cdm/WvCdmStreamingLicenseRenewalTest.WithClientId/4
  * Cdm/WvCdmOfflineLicenseReleaseTest.WithClientId/3

Change-Id: I6e9d4e23a9e7e81a63a994db8ec0b443893449a6
2018-01-16 19:18:52 -08:00
Rahul Frias
22fdf6ae06 Add new CDM API call: Cdm::removeUsageTable()
[ Merge of http://go/wvgerrit/23168 ]

Bug: 33380441

Test: WV unit/integration tests
Change-Id: Id63c31cdb367704b0bbb77ea9ea597cc86259eeb
2018-01-16 19:09:40 -08:00
Edwin Wong
59fcc20138 Move persistent data to /data/vendor.
Widevine persistent data is stored in /data/mediadrm, HALs
are not allowed to access files in /data. Move persistent
data to /data/vendor/mediadrm/widevine for older devices,
and persistent data will not be saved under /data/vendor.

Test: Play Movies & Tv, Netflix

bug: 36601695
Change-Id: I31fdd43b7db327bf6d8343dc95e9883ae6bce70d
2018-01-15 13:50:06 -08:00
Fred Gylys-Colwell
58fe9fd1fe Change watchdog timer to 2 minutes am: 913c890c5f
am: b71c6e7c6c

Change-Id: I5ace4c6e5cf1e9aaefed90da42293ee3df9fd1f8
2017-10-06 20:47:08 +00:00
Fred Gylys-Colwell
b71c6e7c6c Change watchdog timer to 2 minutes
am: 913c890c5f

Change-Id: I8bd956f47489c53433a43bbe3a135bcda155a698
2017-10-06 20:40:33 +00:00
Fred Gylys-Colwell
913c890c5f Change watchdog timer to 2 minutes
Merge from Widevine repo of http://go/wvgerrit/35480

This relaxes the watchdog timer around the level 3 oemcrypto
initialization to 120 seconds.  There are also a couple of new log
messages at the end of initialization and at termination.

Library for arm updated:
level3/arm/libwvlevel3.a       Level3 Library 4445 Oct  4 2017 17:06:25

bug: 65379279

Test: unit tests on n5.  View netflix on Nexus 5.  GTS tests on N5.
Change-Id: Id474d6728da557051801d2ca92987496672b896a
2017-10-06 00:15:44 +00:00
Rahul Frias
70319e3345 Avoid re-initializing CDM properties am: c103250eb6
am: 3cff49b968

Change-Id: I851e264525a281bb6332f040cc9ad1a510e45913
2017-10-04 16:54:29 +00:00
Rahul Frias
3cff49b968 Avoid re-initializing CDM properties
am: c103250eb6

Change-Id: Ie19f0183e70ff17a8f58f7b6a1f58fd3625b13d6
2017-10-04 16:51:13 +00:00
Rahul Frias
c103250eb6 Avoid re-initializing CDM properties
[ Merge of http://go/wvgerrit/35405 ]

Devices that launch with android O as their first release have
SPOIDs (Stable Per-Origin IDentifier) enabled. This results
in multiple CdmEngine instances, one for each CDM identifier
(that differ by app package name possibly origin).

Each time a CDMEngine object is created, the CDM properties are
reinitialized. This causes certain property information stored on
a session basis (privacy mode, service certificate, session sharing)
to be lost. Since Query calls are not app specific, they can often
result in CdmEngine object creation, causing existing sessions to
lose associated property information. This can be avoided by
initializing CDM proerpties only once.

Bug: 65732345

Test: WV unit/integration tests
Test: GTS tests
Test: Playback using Google Play, Netflix and YT Live

Change-Id: Ic121f322ed6e45e2033964e6439c026de2401b4c
2017-10-03 16:23:23 -07:00
Rahul Frias
3b439fe935 Corrections to license duration reporting am: be9aba6d3a
am: cb24c8af0e

Change-Id: I9b73c51730066bb0f8b11a91dfdd58e7f1506904
2017-09-25 19:03:09 +00:00
Rahul Frias
cb24c8af0e Corrections to license duration reporting
am: be9aba6d3a

Change-Id: I32a5497f752fc16951f68f10f5965785487131da
2017-09-25 19:01:19 +00:00
Rahul Frias
be9aba6d3a Corrections to license duration reporting
[ Merge of http://go/wvgerrit/34900 ]

Querying information about licenses with uncommon duration values
did not, under all conditions, return expected values. This corrects
for licenses where
* playback and license durations were set to unlimited
* rental and license durations were set to unlimited

Bug: 65669869

Test: 9 new policy_engine_unittests
Test: WV unit/integration tests
Test: GTSMediaTestCases
Test: Playback using netflix and play movies
Change-Id: I6e48f82f1f194fb7e04491d33054dfe74d9465eb
2017-09-22 13:27:10 -07:00
Rahul Frias
4c5925470e Fixes for usage table upgrades am: 20eeb1e546
am: a42a52f89c

Change-Id: Ie8faa50328f959750e85d640a30b5b7af6685297
2017-09-21 04:38:33 +00:00
Rahul Frias
a42a52f89c Fixes for usage table upgrades
am: 20eeb1e546

Change-Id: Ifb5755b3f84e9b4b87e3d0cdaf618daff0bac141
2017-09-20 18:36:08 +00:00
Rahul Frias
20eeb1e546 Fixes for usage table upgrades
[ Merge of http://go/wvgerrit/34060 ]

License were not being upgraded successfully from usage
tables to usage table headers and entries (big usage tables).

Bug: 65730713

Test: WV unit/integration tests
Test: GTSMediaDrmTests
Test: Playback using netflix and play movies
Test: Manual upgrade from N (L3)
Change-Id: I7ef127204104fa36dd1ee385bc80ed6a81172b4b
2017-09-19 14:27:03 -07:00
Fred Gylys-Colwell
31437aae1e Merge "Add watch dog timer to OEMCrypto L3" into oc-mr1-dev am: ec9e1343ee
am: dc403e611b

Change-Id: I29b13f556e107e166b5d1bf1c7adb9f38ad6a2f8
2017-09-15 10:03:40 +00:00
Fred Gylys-Colwell
dc403e611b Merge "Add watch dog timer to OEMCrypto L3" into oc-mr1-dev
am: ec9e1343ee

Change-Id: Id4f005663c19ac490c4e5374d7f9612d1dcbef8a
2017-09-15 06:11:52 +00:00
TreeHugger Robot
ec9e1343ee Merge "Add watch dog timer to OEMCrypto L3" into oc-mr1-dev 2017-09-15 06:05:21 +00:00
Fred Gylys-Colwell
7ca2b21363 Add watch dog timer to OEMCrypto L3
Merge from Widevine repo of http://go/wvgerrit/33540

This code adds a watchdog timer to the level 3 initialization.  If
initialization does not finish within 5 seconds, the process will
abort, printing a small amount of debugging information.

arm/libwvlevel3.a Level3 Library 4445 Sep 11 2017 14:05:15

Test: unit tests on bullhead. Video on Play Movies.  
Kyle ran the GTS tests on loop overnight.

bug: 65379279

Change-Id: I0e0e4b158dbce193abbd8ee2cf6b366060c768b8
2017-09-14 18:16:21 +00:00
Rahul Frias
75f268ffbb Clock consistency checks am: 1f32bef75b
am: d6b0ff208e

Change-Id: Ie9751ec03281cf98c0c87c29fc4a755d2b6fe80c
2017-09-14 04:23:00 +00:00
Rahul Frias
d6b0ff208e Clock consistency checks
am: 1f32bef75b

Change-Id: Iafacc464d0acd3310b1d12807b43b8bd06007983
2017-09-14 04:21:39 +00:00
TreeHugger Robot
2026b4b4d1 Merge "Add 'vendor.' prefix to a vendor HAL service name" 2017-09-12 06:34:55 +00:00
Rahul Frias
1f32bef75b Clock consistency checks
[ Merge from http://go/wvgerrit/33440 ]

Introduce checks to guard against clock tampering.

Bug: 62037413

Test: WV unit, integration tests on angler
Test: Manual clock rollback test
Test: Playback testing (Netflix, Play movies) on sailfish
Test: GTS test on angler
Change-Id: I47938109adb5c0f5e9aefc58eb5dac156b9f16ef
2017-09-11 11:56:32 -07:00
Rahul Frias
8d454b2846 Merge "Correct when usage entry information is updated" into oc-mr1-dev am: 8309922a89
am: 8c10719658

Change-Id: I3b5e1af6e310e6fa1aa96e09dc35c64cd49502a4
2017-09-10 05:00:31 +00:00
Rahul Frias
8c10719658 Merge "Correct when usage entry information is updated" into oc-mr1-dev
am: 8309922a89

Change-Id: Id8c65a1897ecf3206c5c1a7b6f06cd0d44a38a4f
2017-09-10 04:58:31 +00:00
Rahul Frias
8309922a89 Merge "Correct when usage entry information is updated" into oc-mr1-dev 2017-09-10 04:55:59 +00:00
Rahul Frias
a40aeec7bf Correct when usage entry information is updated
[ Merge of http://go/wvgerrit/33340 ]

Update usage entry information only when usage entries are
supported.

Bug: 65483034

Test: wv unit/integration tests on angler
Test: GTS tests
Test: playback using play movies and netflix

Change-Id: If5a33900a30ce88f97ef46a800817cd4c71d195e
2017-09-08 11:24:15 -07:00
Adam Stone
df12ff1574 Merge "Fix support for app package name." into oc-mr1-dev am: f2e7f23f00
am: 9e74df736d

Change-Id: I91627c65de063e536d9cac88bd18a75f51b97d59
2017-09-07 19:32:00 +00:00
Adam Stone
9e74df736d Merge "Fix support for app package name." into oc-mr1-dev
am: f2e7f23f00

Change-Id: I0dc122e0bfe920132b8232cf9250b3f9c87784b8
2017-09-07 19:30:03 +00:00
TreeHugger Robot
f2e7f23f00 Merge "Fix support for app package name." into oc-mr1-dev 2017-09-07 19:25:10 +00:00
Rahul Frias
b080f8a718 Merge "Corrections when releasing usage information" into oc-mr1-dev am: d355e505c7
am: 637a4d10ad

Change-Id: I4e940aee5361db310d617ab1fcbb17cbb9569a62
2017-09-07 18:11:08 +00:00
Rahul Frias
eadab892aa Merge "Remove ExpiryOnReleaseOfflineKeyTest" into oc-mr1-dev am: 4c69cf6245
am: 5f92786d31

Change-Id: Ic61622799037e2a69d4ba967ed6864bf9ecc76a2
2017-09-07 18:10:51 +00:00
Rahul Frias
637a4d10ad Merge "Corrections when releasing usage information" into oc-mr1-dev
am: d355e505c7

Change-Id: Ieb64e92d52b856910dcbfe013c886b8a04788158
2017-09-07 18:00:27 +00:00
Rahul Frias
5f92786d31 Merge "Remove ExpiryOnReleaseOfflineKeyTest" into oc-mr1-dev
am: 4c69cf6245

Change-Id: Ia1ff1150cb9764f36cfaa8671052c81787aec387
2017-09-07 18:00:09 +00:00
Adam Stone
1b9c6ea789 Fix support for app package name.
The app package name was not being reported to the media stats. This
change adds the package name as part of the report to media stats.

This is one of two parts to this change. The other part is in
frameworks/av.

Bug: 64584568

Test: Unit tests, GTS tests, tried with Google Play Movies.
Change-Id: I1ca09db3a59d9a0950f424d977f8774dffd09c2b
2017-09-06 22:25:13 -07:00
Rahul Frias
d355e505c7 Merge "Corrections when releasing usage information" into oc-mr1-dev 2017-09-07 01:18:59 +00:00
Rahul Frias
4c69cf6245 Merge "Remove ExpiryOnReleaseOfflineKeyTest" into oc-mr1-dev 2017-09-07 00:42:51 +00:00
Rahul Frias
cb8bb251e4 Remove ExpiryOnReleaseOfflineKeyTest
The test verifies that a downloaded license receives an expiry event
in a session if it is released from another session. With
the introduction of the big usage table feature loading a
license/usage entry into multiple sessions is not permitted and
so this test is no longer needed.

Some OEMCrypto implementations might require OEMCrypto_UpdateUsageEntry
to be called between calls to OEMCrypto_LoadKeys and
OEMCrypto_ReportUsage. This CL adds the call to
OEMCrypto_UpdateUsageEntry.

Test: WV unit/integration test
Test: Playback using play movies and netflix
Test: GTS tests

Bug: 64988654
Change-Id: Ic737c3200ea1858736a168be835507378eaf7b3e
2017-09-06 12:06:05 -07:00
Rahul Frias
120c28cd9a Corrections when releasing usage information
[ Merge of http://go/wvgerrit/32940 ]

Releasing usage entries may cause other entries to be moved or
information updated. Instead of retrieving all entries once and trying
to release them, refetch them after each release.

Test: WV Unit/Integration tests
Test: GTS tests (failures seen, but no additional failures due to this CL)
Test: Playback testing using play movies and netflix.

Bug: 65372189
Change-Id: I700e60834c7f711c9146dfd720f9cac014981311
2017-09-06 10:22:43 -07:00
Fred Gylys-Colwell
41c6128724 Merge "Call pthread_join to clean up watchdog thread" into oc-mr1-dev am: 6e680854ed
am: 9ca2306402

Change-Id: I340076ad83dd4dce691e67fafbd70643c14ffba1
2017-09-06 01:29:59 +00:00
Adam Stone
25ac9ebad4 Merge "Fixes reporting of dynamic adapter metrics." into oc-mr1-dev am: b3654fb2ab
am: 572105deb0

Change-Id: I17df9eec9b61c0c7040a0ac68a9401443e913506
2017-09-06 01:29:45 +00:00
Fred Gylys-Colwell
9ca2306402 Merge "Call pthread_join to clean up watchdog thread" into oc-mr1-dev
am: 6e680854ed

Change-Id: Iddd04877630e2c9c96e573073c24dd9d99fecf12
2017-09-06 00:33:57 +00:00
TreeHugger Robot
6e680854ed Merge "Call pthread_join to clean up watchdog thread" into oc-mr1-dev 2017-09-06 00:23:03 +00:00
Adam Stone
572105deb0 Merge "Fixes reporting of dynamic adapter metrics." into oc-mr1-dev
am: b3654fb2ab

Change-Id: If53013cd3b38e1a7c60f1d5fdc464b7b30a33912
2017-09-05 23:52:31 +00:00
Adam Stone
b3654fb2ab Merge "Fixes reporting of dynamic adapter metrics." into oc-mr1-dev 2017-09-05 23:46:58 +00:00