Commit Graph

3658 Commits

Author SHA1 Message Date
Rong Xu
31aa16fbab Fix gcc-4_9 warning
Fix a warning in gcc-4.9:
In file included from
vendor/widevine/libwvdrmengine/cdm/core/src/max_res_engine.cpp:3:0:
vendor/widevine/libwvdrmengine/cdm/core/include/max_res_engine.h:56:9:
error: 'class wvcdm::MaxResEngine::KeyStatus' is private
   class KeyStatus {
         ^
vendor/widevine/libwvdrmengine/cdm/core/src/max_res_engine.cpp:10:53:
error: within this context
 typedef std::map<wvcdm::KeyId,
wvcdm::MaxResEngine::KeyStatus*>::const_iterator

(cherry picked from commit 944d085a79)

Change-Id: I4984bd52c52c36e59c4d09db5e4f4d581e577b07
2014-12-09 11:20:24 +01:00
Fred Gylys-Colwell
f47b8c813a am d2ca9d44: Merge "Level 3 OEMCrypto library for mips" into lmp-mr1-dev
* commit 'd2ca9d448e135ea48e5c8c6eb0e8b87c193c07cd':
  Level 3 OEMCrypto library for mips
2014-12-08 19:13:58 +00:00
Fred Gylys-Colwell
5ea1279eef am 1811a8ac: Level 3 OEMCrypto library for x86
* commit '1811a8ac12873c2c1d2a1ac215d04829868da1a8':
  Level 3 OEMCrypto library for x86
2014-12-08 19:13:58 +00:00
Fred Gylys-Colwell
d2ca9d448e Merge "Level 3 OEMCrypto library for mips" into lmp-mr1-dev 2014-12-05 02:57:26 +00:00
Fred Gylys-Colwell
cb9360fb65 Level 3 OEMCrypto library for mips
This CL is a merge of the widevine change
https://widevine-internal-review.googlesource.com/#/c/11881

The function rand() was not available on the mips build used to
generate the level 3 oemcrypto fallback library.  This function has
been replaced by the openssl RAND_bytes(), so that compilation may
complete.

New version of library:
libwvdrmengine/level3/mips/libwvlevel3.a  NONOB Level3 Library Dec  3 2014 17:11:00

bug: 17288466
Change-Id: Ibe2ae3add4f5830ddc1cce501d76aeb4be5ce926
2014-12-03 17:39:50 -08:00
Fred Gylys-Colwell
1811a8ac12 Level 3 OEMCrypto library for x86
This is a merge of the Widevine change:
https://widevine-internal-review.googlesource.com/#/c/11871

The level 3 oemcrypto fall back now compiles cleanly on a Fugu, and
passes all unit tests.

New version of library:
libwvdrmengine/level3/x86/libwvlevel3.a  Level3 Library Dec  3 2014 13:06:03

bug: 17289103

Change-Id: I677888536dd2ca12e27b5985737e080b69d81477
2014-12-03 13:28:57 -08:00
Dan Albert
670993262f Fix build.
This project is still using stlport (without telling the build system
about it), which was causing (broken) stlport headers to override
libc++ headers, leading to a broken copy of std::enable_if, which in
turn caused <atomic> to fail to compile. Since this project has
prebuilts that will need to be updated before this project can
actually move away from stlport, tell the build system that it is
still using stlport for now.

Bug: 18433002
Change-Id: I38b356428977ed2184eb28a07bd5e7424a4ace8d
(cherry picked from commit de4bc34719)
2014-11-26 03:05:50 +00:00
Rahul Frias
3a586ab27b Report HDCP status of no HDCP device attached
OEMCrypto may report an HDCP status of "No HDCP device attached/using
local display with secure path". This is not propagated upto
the server as an appropriate HDCP value did not exist in the
license protocol. This has now been added. Netflix has requested that
this be reported.

[ Merge of https://widevine-internal-review.googlesource.com/#/c/11806/
  from Widevine cdm repo ]

b/18377309

Change-Id: I3db88c7ab5e79a3c12dbc8a398c4770e14e5ee5c
2014-11-22 01:46:13 -08:00
Fred Gylys-Colwell
5acf3cdc3d Save and load usage table in level 3 OEMCrypto
This is a merge of the widevine change:
https://widevine-internal-review.googlesource.com/#/c/11781

The OEMCrypto did not save the usage table correctly after a key was
loaded and not used.

Also, oemcrypto uses the keybox to verify and sign the usage table.
On library initialization, the usage table was being loaded before the
keybox, so the signature was not verified correctly.

Both these problems have been corrected.

Current Library Version:
arm:  Level3 Library Nov 19 2014 16:53:43

bug: 17328418 Can't play pinned content
Change-Id: Ia753e2f47b36433931fbe8dba78939581e647222
2014-11-19 17:02:33 -08:00
Rahul Frias
aa7ad630d7 MediaDrm throws an exception when Secure Stops are requested
Our recommendation to OEMs is that they support a table of at least 50
usage entries in OEMCrypto. If more usage entries are stored, the PSTs get
added to the CDM but are LRU'ed out of the OEMCrypto usage table. When the
CDM queries those usage entries, OEMCrypto will return a
OEMCrypto_ERROR_INVALID_CONTEXT. Rather than return an error and have
MediaDrm throw an exception, CDM should delete this PST and return the
next usage entry, when queried.

[ Merge of https://widevine-internal-review.googlesource.com/#/c/11457/
  from Widevine cdm repo ]

b/17994711

Change-Id: I00e3f93000096fb434d94333e22958de795a4bb5
2014-11-13 12:56:26 -08:00
Fred Gylys-Colwell
3b1a3e47d8 Merge "Adjust CDM engine and request license unit tests" into lmp-mr1-dev 2014-11-13 01:12:22 +00:00
Fred Gylys-Colwell
9ff5125867 Adjust CDM engine and request license unit tests
Merge of the widevine change:
https://widevine-internal-review.googlesource.com/#/c/11632

Several unit tests in cdm_engine_test.cpp and request_license_test.cpp
were failing regularly. These were caused by either:
1) The device was not provisioned.
  This has been fixed by adding a certificate provisioning step in the
  test setup for the cdm engine tests and changing the existing
  provision steop in the request license tests to provision for both
  security levels.
2) The device was hitting a flaky server.
  This has been fixed by switching from the GooglePlayServer to the
  Widevine server.
3) A null pointer introduced when testing secure stops with an app
  id.  This has been fixed by directly injecting the app id in the unit
  tests.
4) Flaky network connections.  The unit tests were requesting data
  from the server and were timing out after 3 seconds.  I changed that
  to 12 seconds.
5) The tests were searching for an end-of-line marker to find the GLS
  header in the license response message.  The end-of-line marker was
  present in a valid DRM message for almost 1% of the test cases.  This
  code  has been replaced by searching for the string "GLS/1" at the
  begining of the HTML body.

I also added test_printers.cpp that defines functions used by GTest to
print error codes by name instead of numeric value.

This CL changes unit tests only. It does not change any production
code.

bug: 18316036

Change-Id: I3398580059a03114e782ac7ac59e6b0944012df4
2014-11-12 13:57:03 -08:00
John "Juce" Bruce
abbef3d002 Merge "Fix Typos in License.cpp" into lmp-mr1-dev 2014-11-07 21:33:24 +00:00
John "Juce" Bruce
4d695de2b0 Fix Typos in License.cpp
(This is a merge of http://go/wvgerrit/11626 in the Widevine CDM
repo.)

Change-Id: Iad48e76a77c285c0e0738b22436dc60cb3704740
2014-11-07 13:21:40 -08:00
John "Juce" Bruce
039b984a75 Merge "Add OS Version to Properties" into lmp-mr1-dev 2014-11-07 20:04:55 +00:00
John "Juce" Bruce
31f87bc19e Add OS Version to Properties
(This is a merge of http://go/wvgerrit/11613 from the Widevine CDM
repo.)

Adds a property for the OS version, implements it on Android, and
adds it to the license request property bag so that Netflix may
use it to discern the supported capabilities of the CDM.

Bug: 18230738
Change-Id: If5174a108093855314f3e0102b83691e20bb247b
2014-11-07 11:47:51 -08:00
Fred Gylys-Colwell
def3c4d5b8 Merge "Adjust PreventNonceFlood tests" into lmp-mr1-dev 2014-11-07 19:27:22 +00:00
Fred Gylys-Colwell
2ca704e5c0 Adjust PreventNonceFlood tests
The OEMCrypto library should prevent too many nonces from occuring in
a row. Previously, we tested that GenerateNonce generated an error if
there were too many nonce requests.

This CL makes it possible for OEMCrypto to delay the return from
GenerateNonce if there are too many requests.  This is an equally
valid solution to the nonce flood attack.

This is a unit test change only.  No production code is affected.

This is a merge from the widevine repository of:
https://widevine-internal-review.googlesource.com/#/c/11604/

bug: 17630253
Change-Id: Ie97f712d70230cd8e7ea7089da0aa18039673bb4
2014-11-06 22:12:51 -08:00
Edwin Wong
59da418883 Remove corrupted license file from storage.
(This is a port of http://go/wvgerrit/11614 from the
 Widevine repo.)

CDM does not recover if a license file has invalid size
or the hash is incorrect. Remove the corrupted license
file in such cases.

bug: 18002606

Change-Id: I46dec853ce6b2e7c7430297d50df5d30488cde3b
2014-11-06 17:07:48 -08:00
Jeff Tinker
960718a673 Merge "Wire Up Max-Res Plumbing" into lmp-mr1-dev 2014-11-06 02:36:01 +00:00
Jeff Tinker
418887a5e7 Merge "Add Max-Res Decode Engine to CDM Core" into lmp-mr1-dev 2014-11-06 02:35:56 +00:00
Fred Gylys-Colwell
20191d996c Allow Secure Stops to be queried and deleted by application ID
This CL changes the WVDrmPlugin so that an application can segregate
its secure stops from those of other applications by setting an
application ID.

This CL is a merge of the following Widevine CLs:
https://widevine-internal-review.googlesource.com/#/c/11565/
Add getSecureStop by ssid

https://widevine-internal-review.googlesource.com/#/c/11572
Add getSecureStop by SSID and releaseAllSecureStops by app id.

https://widevine-internal-review.googlesource.com/#/c/11564/
Store Usage Info by App Id (device_file stubs)

https://widevine-internal-review.googlesource.com/#/c/11563/
Add application id to StoreUsageInfo.

https://widevine-internal-review.googlesource.com/#/c/11561/
Added Application ID to PropertySet for secure stop.

bug: 18053197
bug: 18076411
Change-Id: I5444baf67ba1b960dee2dc958bced8de82ab70a3
2014-11-05 17:39:44 -08:00
John "Juce" Bruce
e4252f3861 Wire Up Max-Res Plumbing
(This is a port of http://go/wvgerrit/11556 from the Widevine CDM
repo.)

This wires up the new method on the crypto interface with the core
code that handles the max-res decode.

Bug: 16034599
Change-Id: Id2ea5635bf732eabf1fd33712ff8bab6cf1a1745
2014-11-04 11:55:27 -08:00
John "Juce" Bruce
12821d5968 Add Max-Res Decode Engine to CDM Core
(This is a port of http://go/wvgerrit/11555 from the Widevine CDM
repo.)

Bug: 16034599
Change-Id: Ie69afac7d89e27623adbc84d2baebccf1d1ba6e6
2014-11-04 11:55:23 -08:00
John "Juce" Bruce
3da4f9d7d5 Protect Session ID List With a Lock
(This is a merge of
https://widevine-internal-review.googlesource.com/#/c/11405
from the Widevine CDM Repo.)

AUPT is revealing a crash when destructing WVDrmPlugin due to
multi-threaded contention over the session map. As a fix, we are now
protecting access to the map via a mutex.

Bug: 17761616
Change-Id: Iddeca657effd3c7f3ff35ce334d7979291667cef
2014-10-13 13:40:44 -07:00
Fred Gylys-Colwell
95658e73b2 Flush instruction cache for arm in haystack code
This is a merge of the widevine CL:
https://widevine-internal-review.googlesource.com/11254

On arm64, some devices are having random issues that probaby relate to
a stale instruction cache.  This code change flushes the cache for
pages that are going to be made executable.

b/17400000

Current Library Version:
  arm64:  Level3 Library Sep 25 2014 17:10:03

Change-Id: I3904e96e922654c055a478079aa52c29cbde8b9f
2014-09-30 14:43:22 -07:00
Jeff Tinker
16abc110bb Eliminate delay in MediaDrm.closeSession for widevine CDM
merge of https://widevine-internal-review.googlesource.com/11255
from the widevine cdm repo.

bug: 17657356
Change-Id: Ia228395c412c8d00ef0230f86f4b56469a1e6c69
2014-09-25 18:35:24 -07:00
Lajos Molnar
63aa037b03 Dequeue new input buffer once old on is queued
Bug: 17630446
Change-Id: I9ce19849f85eba4c419e0dab8ea03a0675526366
2014-09-24 14:07:11 -07:00
Edwin Wong
138160ddea Update license request url to new signed Widevine UAT proxy.
Bug: 16631113
Change-Id: I442f9c9decd03213912c8c2befcbeccc2a332c53
2014-09-13 01:32:29 +00:00
Jeff Tinker
887dcfef6b Revert workaround for WVv9 netflix license issue on fugu and molly
related-to-bug: 17212907

Change-Id: I9a6eed207f8fbdbd621b9ecde2cb99112f02e9fa
2014-09-08 19:32:04 +00:00
Fred Gylys-Colwell
457998d677 Correctly handle missing entry in DeactivateUsageEntry
This is a copy of
https://widevine-internal-review.googlesource.com/#/c/11110/

The level 3 oemcrypto library version of DeactivateUsageEntry now
returns OEMCrypto_ERROR_INVALID_CONTEXT if there is no entry in the
usage table.

Current Library Version:
arm:  Level3 Library Sep  3 2014 18:13:47

b/17373630

Change-Id: Iaeb65b4ad4b2b9f3c6733a2c9c8d96e2be263d09
2014-09-05 14:21:07 -07:00
Fred Gylys-Colwell
72b47e5789 Clarify Documentation
This is a copy of
https://widevine-internal-review.googlesource.com/#/c/11115/

This CL just updates the integration guide.  In particular, the
following clarifiaction is made about usage tables:

The sentence:
  When the session using this key is closed, the entry in the table will
    be marked as inactive.
is replaced by
      After the session using this key is closed, the application will
      request that the entry in the table will be marked as inactive.

This should make it clear that OEMCrypto should not automaically
deactivate usage entries.  This behaviour is already verified by unit
tests.

bug: 17405160

Change-Id: If836c7c76205e6759c1c194a6f31232c52c4f179
2014-09-05 17:44:42 +00:00
Rahul Frias
9bc13a07a0 Corrections for license release on fallback to L3
When falling back to L3, release requests were failing. Information
requesting falling back to L3 is passed along when the session is opened.
Licenses however are released using the key set ID and information
requesting fallback to L3(CdmClientPropertySet) at that point is
unavailable. The release was actually attempting to release a license
at the default security level which is incorrect.

In addition, the mac keys were not being setup correctly and the release
message was signed with keys derived from the license request and not the
response.  Both these issues have been addressed and unit tests added
to track release of offline licenses and usage reporting scenarios.

[ Merge of https://widevine-internal-review.googlesource.com/#/c/11062
  from wv cdm repo ]

b/17073910

Change-Id: I5cd95a7dfe58ebae7ae27ece6c92e67755c1d665
2014-09-04 10:29:10 -07:00
Fred Gylys-Colwell
eb4b7cdc47 Merge "Catch null pst in OEMCrypto" into lmp-dev 2014-09-03 23:03:03 +00:00
Fred Gylys-Colwell
e51f8ba7a1 Catch null pst in OEMCrypto
This is a copy of
https://widevine-internal-review.googlesource.com/#/c/11030

It is an error for the key control block to have a nonzero replay
control flag and a null pst.  This CL adds unit tests to
oemcrypto_test to verify that oemcrypto checkes this.  A unit test is
also added for verifying that an offline license has a valid nonce the
first time it is loaded.

It also updates the reference implementation (mock) to check that the
pst is not empty when the replay control flag is nonzero.

It also updates the level 3 implementation to check that the pst is
not empty when the replay control flag is nonzero.

This change is compiled into the arm library, but because of
compilation errors, is not included in x86 or mips.

    Current Library Version:
    arm:  Level3 Library Aug 27 2014 18:42:40

bug: 16525204 OEMCrypto unit test for reloading offline license
bug: 16844305 Mock OEMCrypto does not catch null pst
Change-Id: Icdb090e80fc92522c187b26f30e5ba082f26363b
2014-09-03 11:46:10 -07:00
Rahul Frias
d2ad6d7f13 Address CDM request license unit test failures
UAT issues fixed PSTs for each piece of content. This requires the usage
table to be cleared (or usage records released) between tests. If not
PST collisions occur and OEMCrypto fails with
OEMCrypto_ERROR_INVALID_CONTEXT (0x29).

b/17318063

[ Merge of https://widevine-internal-review.googlesource.com/#/c/11061/
  from wv cdm repo ]

Change-Id: I7758e5444637583a171edafcd4fb18315bfa8395
2014-08-29 11:14:29 -07:00
Jeff Tinker
14460bd66e Workaround WVv9 netflix license issue on fugu
Change-Id: Ib4335d1dd0fea88b23c1b7ce675ae3863b86bc42
related-to-bug: 16994418
2014-08-28 15:28:42 -07:00
Jeff Tinker
b445a1fef2 Workaround for casting and playback failures
Change-Id: I45add76d7941d4942368d10e5893ff8f89a8bf82
related-to-bug: 16994418
2014-08-20 16:06:41 -07:00
Jeff Tinker
773ddd3864 Fix MediaDrmAPITest install command in test script
Change-Id: Ibf062788e26e75838875460718c665ea56a773aa
related-to-bug: 17080975
2014-08-20 11:21:56 -07:00
Jeff Tinker
fbe0994902 Fix widevine unit test builds on 64-bit devices
bug: 17080975
Change-Id: Ic54d484e18fe0416855264ca073474f3d597e1a3
2014-08-16 12:11:05 -07:00
Fred Gylys-Colwell
157afc627a Merge "Integers encoded with PKCS#8 binary DER should have sign bit" into lmp-dev 2014-08-12 23:14:33 +00:00
Fred Gylys-Colwell
909887923d OEMCrypto_DeleteUsageTable now returns OEMCrypto_SUCCESS
Copy of widevine change:
https://widevine-internal-review.googlesource.com/#/c/10911/

OEMCrypto_DeleteUsageTable used to return an error on every call
because UsageTable::Clear always returned false.  Since there is no
error checking that Clear can do, its return type has been changed to
void, and DeleteUsageTable now returns OEMCrypto_SUCCESS for all
calls.

bug: 16799906
Change-Id: Iaa2f572e4b0feb554877579596a7f43a64d20954
2014-08-12 14:14:46 -07:00
Fred Gylys-Colwell
24c2ca2f9b Integers encoded with PKCS#8 binary DER should have sign bit
Copy of widevine change:
https://widevine-internal-review.googlesource.com/#/c/10910/

This CL adds a leading 0 to integers in the RSA test key in
oemcrypt_test.cpp.  Before this CL, versions of OEMCrypto that
correctly interpret the encoding were treating some large
integers as negative.

bug: 16876126
Change-Id: I1990fdb09509c15566d12d4cfcd055e9d200e08a
2014-08-12 14:12:23 -07:00
Rahul Frias
4819a26bd4 Fixes for query information and usage reporting
* The Usage APIs return usage reports from either L1 or L3 (if available).
* Correction to when usage reports are saved. In addition to other events
  they are now saved when keys are loaded, usage reports are released and soon
  after first decryption and periodically (60 seconds) after that,
  if decryption takes place.
* Usage reports now get deleted on an unprovision request.
* Policy timer is now started when offline licenses are restored.
* Usage session is now released, when a usage response is received.
* Usage tests ahev been enabled.
* Added CDM extended duration (integration) tests to test usage reporting
  and querying. These need to be run manually as they take a while (currently
  half an hour).

b/15592374

[ Merge of https://widevine-internal-review.googlesource.com/#/c/10800
  from the Widevine CDM repo ]

Change-Id: Ia817e03ebbe880e08ba7b4a235ecb82b3ff35fbf
2014-08-07 10:58:40 -07:00
John "Juce" Bruce
b608e17e08 Add Properties to Query HDCP Status and Usage Reporting Support
This is a merge of http://go/wvgerrit/10846/ from the Widevine repository.

Change-Id: I682069073d9ec58c03781de25d9c6fa5ec5864ff
2014-08-05 18:29:25 -07:00
Jeff Tinker
3099da6170 Merge "Support Device Unprovisioning" into lmp-dev 2014-08-01 13:51:29 +00:00
John "Juce" Bruce
4db7780cb5 Support Device Unprovisioning
Merge of https://widevine-internal-review.googlesource.com/#/c/10845/
from the widevine cdm repo.

Bug: 12247651
Change-Id: Ice6ec95865640fa2f736c7a9f09956395d648337
2014-08-04 13:07:20 -07:00
Rahul Frias
9f52cd3724 Allow offline release retries
A bug prevented regenerating license release requests. This has
been corrected. A crash due to a formatting error has been addressed.
Clean up of logging and additional logging for open session failures
have been included.

b/16197822

Merge of https://widevine-internal-review.googlesource.com/#/c/10806
from the widevine cdm repo.

Change-Id: I854ead388f311d00b1cd700dfa1b2f58322c2dd4
2014-07-29 02:06:09 -07:00
Rahul Frias
e894774942 Correct CancelKeyRequest behavior
[ Merge of https://widevine-internal-review.googlesource.com/#/c/10659/
  from the widevine cdm repo. ]

CdmEngine::CancelKeyRequest would earlier release keys by closing and
reopening a crypto session. Behavior has been changed to just close
the session.

b/15984869

Change-Id: I92a1f82fd4a97b5510596d4bc69bf07406cee606
2014-07-21 14:36:50 -07:00
Fred Gylys-Colwell
a19a965fb7 Close session after provisioning
Merge of CDM change:
https://widevine-internal-review.googlesource.com/#/c/10691/

This prevents the provisioning session from being created unless the
device needs provisioning.  And then, after provisioning, it closes
the session it had previously opened.

b/15782159 CertificateProvisioning object keeps unused CryptoSession

Change-Id: Ic52ed864fa47c7ba50b7ca4d9fea1e74930228e9
2014-07-18 13:54:42 -07:00