Commit Graph

1670 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
ca1bd5cefc Update OEMCrypto v11 Delta Document
Merge of http://go/wvgerrit/17040

The delta document specified the wrong error code if
Minimum_Security_Patch_Level is not valid.  The correct error is
OEMCrypto_ERROR_UNKNOWN_FAILURE.

b/27524999

Change-Id: I0c5d9b6d40b384ae3550348569d78c60093a65d4
2016-03-07 12:04:25 -08:00
Rahul Frias
c60d238783 DO NOT MERGE Only pass whole clear frames to OEMCrypto_CopyBuffer am: 58bad94991 am: 1eeb1ee359 am: a060a58acb
am: a8330e5706  -s ours

* commit 'a8330e5706d3c83fbfb43b6a6be751981f2cfc67':
  DO NOT MERGE Only pass whole clear frames to OEMCrypto_CopyBuffer
2016-03-04 18:26:35 +00:00
Rahul Frias
a8330e5706 DO NOT MERGE Only pass whole clear frames to OEMCrypto_CopyBuffer am: 58bad94991 am: 1eeb1ee359
am: a060a58acb

* commit 'a060a58acbbbae0b37a8ff067e90f8f30d17f818':
  DO NOT MERGE Only pass whole clear frames to OEMCrypto_CopyBuffer
2016-03-04 18:24:34 +00:00
Rahul Frias
a060a58acb DO NOT MERGE Only pass whole clear frames to OEMCrypto_CopyBuffer am: 58bad94991
am: 1eeb1ee359

* commit '1eeb1ee3590095a6cc39b774e33ac6dd26b18f9c':
  DO NOT MERGE Only pass whole clear frames to OEMCrypto_CopyBuffer
2016-03-04 18:22:33 +00:00
Rahul Frias
1eeb1ee359 DO NOT MERGE Only pass whole clear frames to OEMCrypto_CopyBuffer
am: 58bad94991

* commit '58bad949913fc9311e9318d5d7a5f8f06a592367':
  DO NOT MERGE Only pass whole clear frames to OEMCrypto_CopyBuffer
2016-03-04 18:20:31 +00:00
Rahul Frias
58bad94991 DO NOT MERGE Only pass whole clear frames to OEMCrypto_CopyBuffer
[ Merge from http://go/wvgerrit/16499 ]

Passing clear subsamples to OEMCrypto_CopyBuffer and encrypted subsamples
to OEMCrypto_DecryptCTR was causing performance issues as a lack of crypto
session information made it hard to associate clear and encrypted
subsamples with each other.

[ Based on a patch from Kelly Ren/Qualcomm ]

b/26538744

Change-Id: I4644f197b2ec481f6aa89d3fce29b22ebb7b0c06
(cherry picked from commit e3724815c6)
2016-03-04 00:28:13 +00:00
Rahul Frias
8df3e060b1 Merge "Use session with longest remaining duration when session sharing is used." into nyc-dev 2016-02-25 22:29:50 +00:00
Rahul Frias
aefd104981 Use session with longest remaining duration when session sharing is used.
[ Merge of https://go/wvgerrit/16940 ]

An alternate scenario to renewing keys is to load the same keys in
a separate session and make use of them by using the session sharing
feature.

Session sharing involves iterating through a map of sessions and
returning the first session that contains the Key ID. In certain cases
(license about to expire) we might prefer an alternate session
be chosen.

Licenses may expire in two ways. Policy engine, driven by a 1 second
timer may detect expiry and send an asynchronous event. OEMCrypto may
also detect expiry based on information in the key control block
and return an error during decryption. It is possible that these
may differ by upto a second. This can lead to issues where decryption
fails but EVENT_KEY_EXPIRED is not generated till later.

It is possible to address this by using information from both timers
to notify the app about expiry. To implement this correctly will
add complexity and require synchronization between threads. To avoid
this an alternate solution is, if session sharing is used, to pick
the session that has a license with the longest remaining validity.

b/27041140

Change-Id: I398cc4c10ee3a2f192d4a0befe7c8a469dd5bf86
2016-02-24 10:22:18 -08:00
Edwin Wong
81588d4b1a Update Widevine classic integration guide.
Update "Deliverables: section 7.5 to include instructions for N.
Update version to 2.4.

bug:27301749
Change-Id: I84ddaee65325f1efe9da8d9963075b864cf236a2
2016-02-23 18:11:01 -08:00
Edwin Wong
8f6f46aee9 Update Widevine classic integration guide. am: 9790ffb8a8 am: 311d3f75c0 am: fa5eea4b39
am: 42ffb9159b

* commit '42ffb9159bc071426f73c4cecf2c206be654acd5':
  Update Widevine classic integration guide.
2016-02-23 01:50:45 +00:00
Edwin Wong
42ffb9159b Update Widevine classic integration guide. am: 9790ffb8a8 am: 311d3f75c0
am: fa5eea4b39

* commit 'fa5eea4b3924aacea611b528656442c2769af0e5':
  Update Widevine classic integration guide.
2016-02-23 01:44:14 +00:00
Edwin Wong
fa5eea4b39 Update Widevine classic integration guide. am: 9790ffb8a8
am: 311d3f75c0

* commit '311d3f75c0019bd46dc92aff94322ff6d84ce26b':
  Update Widevine classic integration guide.
2016-02-23 01:37:34 +00:00
Edwin Wong
311d3f75c0 Update Widevine classic integration guide.
am: 9790ffb8a8

* commit '9790ffb8a8fe18d2d58076a3ed0ed1d825406eaf':
  Update Widevine classic integration guide.
2016-02-23 01:30:46 +00:00
Edwin Wong
9790ffb8a8 Update Widevine classic integration guide.
Update "Deliverables: section 7.5 to include instructions for M.
Update version to 2.3.

bug:27199720
Change-Id: I55b6177f3e3e97763c6c1721836ad19ff457351f
2016-02-22 15:22:11 -08:00
Aaron Vaage
3de6b6284d Removing old profiler files
When merging the change from Widevine's repo over to NYC,
some deletes were missed. This change removed the unused
classes profiler_session and stats.

The make file still had a reference to Stats, which was
likely due to a merge conflict.

Change-Id: Ic39baafab4bfd84e2b462f6749761c8a228244c7
2016-02-22 21:17:38 +00:00
Kyle Alexander
e69a4fc6dd Merge "Disable DroidGuard during unit tests" into nyc-dev 2016-02-13 06:16:56 +00:00
Kyle Alexander
b756eb5db2 Disable DroidGuard during unit tests
This aligns our test script with the functionality found in our TF
test configuration for preventing concurrency issues with DroidGuard.

Matching Widevine cl: go/wvgerrit/16791

Change-Id: Icc891de0a5f3795d8582b21e1bcf734049ddbf42
2016-02-12 16:45:20 -08:00
Aaron Vaage
0d77fecfb5 OEMCrypto Profiler - Merge of Widevine Updates
This change is a merge of the following changes:
1. Remove MultipleSessions (go/wvgerrit/16763)
2. Increase Memory Budget (go/wvgerrit/16764)
3. Fixing Possible Integer Overflow (go/wvgerrit/16765)
4. Creating Call Table (go/wvgerrit/16766)
5. Creating Call History (go/wvgerrit/16767)
6. Connecting Profiled Scope (go/wvgerrit/16768)
7. Adding Call Table Version Number (go/wvgerrit/16780)
8. Add Version Number to Call History (go/wvgerrit/16781)

bug: 27157796

Change-Id: Ia3f088a1714f3f5b426fee6141daa4ea8d832cf4
2016-02-13 00:27:09 +00:00
Rahul Frias
9c82455e8f Modify protos to support HLS
[ Merge of http://go/wvgerrit/16769 ]

Protos have been updated to match the google3 copy. This introduces
protection scheme to support HLS and MetricData to assist
in reporting. Changes have been made to set or consume data
from appropriate fields.

b/27146600

Change-Id: Ic928a406efb8fbb959b95a77dda6848e839b1948
2016-02-11 12:55:26 -08:00
Rahul Frias
4838979f07 Merge "Test Simultaneous decrypt and remove NULL pointer comparison" into nyc-dev 2016-02-11 17:51:42 +00:00
Rahul Frias
3e5b6d7489 Test Simultaneous decrypt and remove NULL pointer comparison
[ Merge of http://go/wvgerrit/16544, http://go/wvgerrit/16639 ]

* This fixes the oemcrypto unit tests to build with the ce cdm.

The unit tests do not build when it is detected that a long (NULL)
is compared to a pointer.

* Remove NULL pointer comparison

On some platforms ASSERT_NE(NULL, ptr) does not work.  This CL
replaces it with ASSERT_TRUE(NULL != ptr).

* Test Simultaneous Decrypt

With the increasing number of devices that support multiple screens or
windows, it is desireable to verify that OEMCrypto can have several
sessions open and actively decrypting at the same time.

Calls to OEMCrypto are still serialized -- this is not a threading
test -- but we still have multiple sessions open and decrypt from each
of them.

* Remove unused variable in initialization_data

Change-Id: I1a4be38fb30a14f610544416db653a81342f16b3
2016-02-11 01:27:12 -08:00
Rahul Frias
7c4eaef227 Merge "Refactor GenerateKeyRequest to reduce number of parameters" into nyc-dev 2016-02-11 08:36:57 +00:00
Rahul Frias
a444571c53 Refactor GenerateKeyRequest to reduce number of parameters
[ Merge of http://go/wvgerrit/16625 and http://go/wvgerrit/16633 ]

Reduce the number of parameters needed by GenerateKeyRequest.
Combining all output values into a single struct.

BUG: 26162546
Change-Id: Ibeb3f4df4a8e877511f8ab2e6c543001a921f285
2016-02-10 17:50:05 -08:00
Edwin Wong
fa4cb04a00 Set umask to ensure sensitive files are only accessible by owner.
[Merge of http://go/wvgerrit/16626]
[Cherrypick from http://go/ag/858552 to nyc-dev branch]

Setting umask to ensure only owner can access sensitive files.
Fixes request_license_test which creates directories and files
accessible by group and others.

bug: 26567162
Change-Id: I63553ec9210f3a4c160cd4c4f2a49c9e0a4157db
2016-02-10 14:30:19 -08:00
Kyle Alexander
c7e92b68e6 Update canary test with latest Android version string.
This silences the canary test to match the Android version string
change from NYC to N. properties_android.cpp has already previously
been updated for N, so no need to bump the Widevine Android version
number at this time (see: go/ag/800077)

Matching Widevine cl: go/wvgerrit/16664

Bug: 26901110
Change-Id: Ib8f47f77bbb4dd2c7c302102fe43007059af2d50
2016-02-04 20:47:12 +00:00
Rahul Frias
e0da404b14 Use Jsmn to parse json data
[ Merge of http://go/wvgerrit/16628 ]

Jsmn will replace a local method that parsed json init data.
Added a fix to include all key Ids in the WidevineCencHeader rather than
just the first. Also modified the content_id to reflect that it is a
base64 encoded value.

b/20630275

Change-Id: I7080c8cea21be4dea09a4905a96b4cc03e584c1d
2016-01-29 13:38:32 -08:00
Rahul Frias
7be45a9011 Unittests for HLS media playlist EXT-X-KEY format changes
[ Merge for http://go/wvgerrit/16617 ]

This adds additional test coverage to verify HLS EXT-X-KEY attribute
lists.

b/20630275

Change-Id: I72d7aa13b9b190728a56668ab79fa5e93bfa0d8b
2016-01-27 17:38:54 -08:00
Aaron Vaage
8ecc290a23 Fixing missing include path for OEMCrypto Profiler
This is a merge of:
http://go/wvgerrit/16616 Fixing Android Makefile to Profiler

Change-Id: I2b4741fc02896927b5ed16ce68cca55d69bb5ade
2016-01-27 16:47:35 -08:00
Aaron Vaage
a03e1cee4d Merge "OEMCrypto Profiler" 2016-01-28 00:05:06 +00:00
Rahul Frias
77241489c3 HLS media playlist EXT-X-KEY format changes
[ Merged of http://go/wvgerrit/16576 ]

The WV EXT-X-KEY attribute list earlier expected a cenc PSSH box in the
URI field, in a hexadecimal sequence format. To ease the burden on
content providers, the URI field will now contain init data in a json
format and base64 encoded. The platform will assume responsibility
to parse this data and create a widevine init data protobuf that
can be included in the license request.

b/20630275

Change-Id: I49e270bedbe96791fc9b282214a9a358d95d163e
2016-01-27 11:17:10 -08:00
Aaron Vaage
a249c67504 OEMCrypto Profiler
This CL is a merge from the widevine repo of:
http://go/wvgerrit/16491 Circular Buffer
http://go/wvgerrit/16512 Circular Buffer Tests
http://go/wvgerrit/16493 Entry Writer
http://go/wvgerrit/16495 Profiled Scope
http://go/wvgerrit/16500 Stats Collection
http://go/wvgerrit/16543 Disallow Stats Copy or Assign
http://go/wvgerrit/16514 Moving OEM Function Enum
http://go/wvgerrit/16501 Defining Session Interface
http://go/wvgerrit/16502 Session Definitions
http://go/wvgerrit/16573 Remove code to num bytes table
http://go/wvgerrit/16556 Connecting Profiler to Profiled Scope
http://go/wvgerrit/16557 Android Reading Profiler History
http://go/wvgerrit/16574 Adding Get Stats Method
http://go/wvgerrit/16606 Seperating Session Parsing
http://go/wvgerrit/16607 Adding get stats method to DRMPlugin
http://go/wvgerrit/16608 Fixing Linux Build Failure
http://go/wvgerrit/16612 Stop Clearing History
http://go/wvgerrit/16613 Accessing profiler information using session id
http://go/wvgerrit/16614 Making All Session Subsets of Global Session

BUG: 25123303
BUG: 26027857
Change-Id: Ie2422e644aa631871852ea0e461695aeb7060f88
2016-01-27 10:14:46 -08:00
Rahul Frias
1d805385ce Merge "Add standard Base64 encoding support" 2016-01-25 18:52:05 +00:00
Rahul Frias
b15ea1150d Add standard Base64 encoding support
[ Merge of http://go/wvgerrit/16550 ]

This is in addition to Web safe Base64 encode/decode support by core.

Change-Id: I9ed51721b138a7f15fb4d216796deadd5d5b31a2
2016-01-22 18:08:19 -08:00
Fred Gylys-Colwell
e6aa70410b OEMCrypto v11 Refrence Code and Unit Tests
This CL is a merge from the widevine repo of
http://go/wvgerrit/16553 Prebuilt Level 3 OEMCrypto for Android
http://go/wvgerrit/16238 Require OEMCrypto v11 for Android N Unit Tests
http://go/wvgerrit/16484 Shared License Tests (OEMCrypto v11)
http://go/wvgerrit/16448 Pattern Decrypt Unit Tests and Reference Implementation
http://go/wvgerrit/16489 Enforce UNUSED Variables
http://go/wvgerrit/16479 Pattern Decrypt for Level 3 OEMCrypto
http://go/wvgerrit/16280 Correctly handle bad RSA key
http://go/wvgerrit/16315 Security Patch Level - haystack version
http://go/wvgerrit/16282 Correctly handle null pointer in GetKeyData
http://go/wvgerrit/16294 Initialize data for generation number

It contains the Level 3 implementation, as well.
mips/libwvlevel3.a  Level3 Library Jan 22 2016 14:30:27
arm/libwvlevel3.a  Level3 Library Jan 22 2016 15:03:55
x86/libwvlevel3.a  Level3 Library Jan 22 2016 13:52:29

b/26692954 [DRM] OEMCrypto v11 needed for Nexus devices

Change-Id: Ibb1384959620f63a1be1e82ce2952ec9f48f0d3e
2016-01-22 15:30:42 -08:00
John Bruce
2c39fce2c8 Merge "HLS, CBC, and Pattern for Android Glue Layer" 2016-01-22 23:21:08 +00:00
Fred Gylys-Colwell
35a080a57d Test Simultaneous Decrypt
Merge from Widevine repo of http://go/wvgerrit/16499

With the increasing number of devices that support multiple screens or
windows, it is desireable to verify that OEMCrypto can have several
sessions open and actively decrypting at the same time.

Calls to OEMCrypto are still serialized -- this is not a threading
test -- but we still have multiple sessions open and decrypt from each
of them.

Change-Id: I5b24f4a464ed05a5b21625c66fe7989644b67a5a
2016-01-22 11:38:58 -08:00
John "Juce" Bruce
a61e0e01b1 HLS, CBC, and Pattern for Android Glue Layer
[This is a merge of http://go/wvgerrit/16522 ]

This commit adds support for CBC and Pattern Mode to the MediaCrypto
implementation. These are the only changes needed to support HLS. (No
change is needed for MediaDrm, as it already passes HLS initialization
data along to the core without closely inspecting it, as it should.)

Following this change, the glue layer also supports the CENC, CBC1,
CENS, and CBCS modes from the forthcoming update to the ISO-CENC spec.

Note that, in order to differentiate CBC1 and CBCS, we have to cue on
the presence or absence of a pattern, which may not continue to be
sufficient in the future if a third CBC mode using patterns is ever
added.

Note that the unit tests for this code remain disabled for now. New
unit tests are forthcoming in a separate commit.

Bug: 25666017
Change-Id: I5942a8b70393e63b4de9d7dab985c4c2a98a20b3
2016-01-21 18:56:26 -08:00
Rahul Frias
280a9e47a0 Merge "Verify cipher block mode during decryption" 2016-01-20 22:16:10 +00:00
Rahul Frias
ae99bb6d11 Verify cipher block mode during decryption
[ Merge from http://go/wvgerrit/16498 ]

The CDM now supports AES CTR and CBC block cipher modes. The license
specifies the mode to be used in the key container. The mode is
also specified in mediaCrypto when calling decrypt. This adds
verification for the cipher block mode.

Change-Id: I2587fc1e4b6d77161f2f8653f8516024c73dd8ac
2016-01-19 16:23:40 -08:00
Rahul Frias
e3724815c6 Only pass whole clear frames to OEMCrypto_CopyBuffer
[ Merge from http://go/wvgerrit/16499 ]

Passing clear subsamples to OEMCrypto_CopyBuffer and encrypted subsamples
to OEMCrypto_DecryptCTR was causing performance issues as a lack of crypto
session information made it hard to associate clear and encrypted
subsamples with each other.

[ Based on a patch from Kelly Ren/Qualcomm ]

b/26538744

Change-Id: I4644f197b2ec481f6aa89d3fce29b22ebb7b0c06
2016-01-19 15:32:09 -08:00
Rahul Frias
f07494fce9 Merge "Consolidate proto parsing into DeviceFiles::RetrieveHashedFile" 2016-01-19 22:58:06 +00:00
Rahul Frias
8ceea06476 Merge "Generate key set ID on initialization and interface clean up" 2016-01-19 22:57:54 +00:00
Rahul Frias
8f4834856c Merge "Store key set ID with usage info" 2016-01-19 22:32:16 +00:00
Rahul Frias
02751bcc91 Consolidate proto parsing into DeviceFiles::RetrieveHashedFile
[ Merge of http://go/wvgerrit/16251 ]

Change-Id: I7aa849ccf0271c862d9b6a7c639da88cb0deff7d
2016-01-15 17:15:52 -08:00
Rahul Frias
84a14f2561 Generate key set ID on initialization and interface clean up
This is a merge of squashed CLs.

* Cdm Session and Engine interface clean up

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

Key Set Ids have been removed from the CdmSession interface
(GenerateKeyRequest, Addkey) as they can be queried by an accessor.

The CdmEngine interface now allows one to specify or retrieve a session ID,
since both were not being used in a single call. Key set IDs are no longer
returned though GenerateKeyRequest as they was not being used.

* Generate key set ID when session is initialized

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

Key set IDs are currently generated at different times in the
CdmSession lifecycle. Android generates key set IDs when the license
is received, while the CE CDM generates (or overrides them)
when the session is constructed.

The key set IDs are now generated when the session is initialized.
Key set generation cannot occur earlier as it has a dependency on
security level and in turn on crypto session initialization which
occurs when the session is initialized.

Depenencies on Session ID has caused other activities, construction of
PolicyEngine, CdmLicense, setting property CDM client sets to be
deferred from CdmSession constructor to Init().

Android will still retrieve the key set IDs after the offline license is
processed. For streaming requests, the key set will be
unreserved and discarded when the session is terminated.

Change-Id: Ib802d1c043742d62efa9a2c901fcd113e836c33d
2016-01-15 17:09:09 -08:00
John "Juce" Bruce
1a6f22da71 Warn on Verity
(This is a merge of http://go/wvgerrit/16496 )

run_all_unit_tests.sh now aborts and alerts the user if they have
Verity on, as opposed to its current behavior of failing later when
the tests don't copy over successfully.

Bug: 23420350
Change-Id: Ib01d32caaac462974b051f5d019888f7c47bc745
2016-01-15 15:06:19 -08:00
Rahul Frias
d2dc2e3670 Store key set ID with usage info
[ Merge of http://go/wvgerrit/16241 and http://go/wvgerrit/16364 ]

This will allow a usage session to be loaded later by key set ID.
This is needed for EME-style secure stop in the new CE CDM API.

b/25816911

Change-Id: I916340047492fbc0556d0e90bd2eac0f3eafe597
2016-01-15 12:59:40 -08:00
Rahul Frias
72a85eb747 Merge "Add cipher mode and pattern encryption support" 2016-01-15 19:17:52 +00:00
Fred Gylys-Colwell
f89a0efe7d Merge "Remove gtest and boringssl from android unit test build script" 2016-01-14 20:12:39 +00:00
Fred Gylys-Colwell
34dfb112f1 Remove gtest and boringssl from android unit test build script
Merge of http://go/wvgerrit/16300

This CL removes gtest and boringssl from
build_and_run_all_unit_tests.sh.  Instead, we change each "mm"
to "mm || mma".  Thus, if mm fails, we assume it is because of a
missing dependency and try mma which builds all dependencies.

bug: 25297287

Change-Id: Ief76fa4077e4cd8653da9306cc92ed14cf080564
2016-01-13 18:14:12 -08:00