Commit Graph

3341 Commits

Author SHA1 Message Date
John W. Bruce
1bc1bad1f0 Improvements to TestBase
This patch merges some features that were added to TestBase in
http://go/wvgerrit/92349 in the Widevine Repo. Certain parameters to
TestBase that could have been const but weren't now are. The caller to
Initialize() can now specify additional, platform-specific help text to
be displayed after the generic help text. And some missing headers were
added to test_base.h.

The Android code does not yet take advantage of any of this, but it
could in the future.

Bug: 145013234
Test: Android Unit Tests
Change-Id: I3c54532a39641622d454256b25979ad89727d43f
2020-01-30 16:15:46 -08:00
John W. Bruce
169c5b3d10 Revert "Fix IV handling for pattern encryption."
(This is a merge of http://go/wvgerrit/92191)

This reverts commit 8fe569cc1265021e275a9bccbc362ebd2ba3be5f.

The ISO-CENC spec is ambiguous about how to handle the early truncation
of the pattern in the 'cens' and 'cbcs' schema. We originally
interpreted it to mean "follow the pattern until you run out of full
crypto blocks" and shipped the Android and OEMCrypto code accordingly.
Later, however, other engineers at Google asserted that it should mean
"follow the pattern until you run out of enough crypto blocks to follow
the encrypted part of the pattern", which is subtly different when the
number of encrypted blocks in the pattern is greater than 1. We made
changes to start accommodating this. However, after further discussion,
everyone is in agreement that the original behavior was correct. So I am
reverting the "fixes" that had already been made.

This has no practical effect, since it only affects 'cens' content with
a pattern that has more than one encrypted block, and as far as we know,
no one has ever generated content like that. Shaka Packager is not
capable of generating content like that.

Bug: 111001481
Test: No new Android Unit Tests failures
Change-Id: I8f0292b1222d6af9a0ae33d6cb91707fd40101f4
2020-01-15 16:42:52 -08:00
Marco Nelissen
13a2504840 Link with actual headers instead of symlinks
Bug: 143245419
Test: build
Change-Id: I5981593697229c1f3314a4a8a4d0c447d7cbe808
2020-01-07 15:26:14 -08:00
Marco Nelissen
8af30972b2 Link with actual headers instead of symlinks
Bug: 143245419
Test: build
Change-Id: Iff096c2d3568f2db4260a1d2a86d2746ea4824ed
2020-01-07 13:21:05 -08:00
Alex Dale
75ecbc4dd2 Merge "Included metrics for LRU replacement." 2019-12-18 18:38:34 +00:00
Alex Dale
aa0d93bf36 Included metrics for LRU replacement.
[ Merge of http://go/wvgerrit/88016 ]

In the event of an LRU replacement event on AddKey, we gather some
metrics on what the state of the usage table is and some info on the
the entry that was removed.

Metrics collected:
 - How many usage info (streaming license) in the table
 - How many offline licenses in the table
 - What type of entry was evicted from the table
 - How stale (time since last use) was the evicted entry

This also enables unit tests for marshalling the metrics into proto
message on Android unit test.

Bug: 135046978
Test: Android and Linux unit tests
Change-Id: If8e562ae6f98270a0e6c5aa4251127ce9b79a8b0
2019-12-16 17:38:50 -08:00
Robert Shih
8fce3e316b wv hidl: upgrade Drm/Crypto factories to v1.3
Bug: 139134043
Test: MediaDrmTest
Change-Id: I94d1cc8a323c144805d74d5568944dd48ae80e60
2019-12-16 01:19:49 -08:00
Robert Shih
2443fe807a odk: core serialization structs & functions
odk directory copied from wvgerrit.
branch oemcrypto-v16
commit 0c9a7dc

Bug: 140758896
Test: odk_test
Change-Id: I0c631f771b794468a63e4395f6b9c3b60a1dfd4f
2019-12-13 01:32:03 +00:00
Robert Shih
9ea47dc64a Convert libcdm, libcdm_protos build to Android.bp
Bug: 144357647
Test: mm
Change-Id: I8fe167659382303079cb43cff72fbcc06ead8f20
2019-12-11 23:41:49 +00:00
Alex Dale
061b0e7caf Merge CDM LRU change to Android.
[ Merge of http://go/wvgerrit/81903 ]
[ Merge of http://go/wvgerrit/87473 ]
[ Merge of http://go/wvgerrit/82568 ]
[ Merge of http://go/wvgerrit/87266 ]
[ Merge of http://go/wvgerrit/87474 ]
[ Merge of http://go/wvgerrit/87475 ]

Bug: 135046978
Test: GTS and Android unit tests
Change-Id: Iff2ff62cea21eeb36d7b56c8bb852fce8447ff89
2019-12-06 13:23:26 -08:00
Rahul Frias
e24b1ef824 Merge "Correct GetDecryptHashSupport signature" 2019-12-06 18:25:56 +00:00
Rahul Frias
09b16a0b17 Correct GetDecryptHashSupport signature
[ Merge of http://go/wvgerrit/89906 ]

The change allows the GetDecryptHashSupport method to return
an error.

Bug: 144851430
Test: WV android unit/integration tests
Change-Id: Ib3b95788adb21b5ed0daee51ad338f9674b04c3c
2019-12-06 01:28:25 -08:00
Rahul Frias
b8a6035298 Address compilation warnings
[ Merge of http://go/wvgerrit/90350 ]

Bug: 145244554
Test: wv android unit/integration tests
Change-Id: I5cd8a132836ce097a7b539fffdcef574f64cbdcf
2019-12-02 17:44:56 -08:00
Alex Dale
176096a2d3 Merge "Removed a few more log prefixes in core/" 2019-11-27 21:04:53 +00:00
Rahul Frias
198b68aa62 Merge "Simplify parameter validation" 2019-11-27 19:41:00 +00:00
Rahul Frias
923e774efa Merge "Correct unit/integration tests being aborted" 2019-11-27 19:39:02 +00:00
Alex Dale
093fd4718c Removed a few more log prefixes in core/
[ Merge of http://go/wvgerrit/89705 ]

Test: Android and Linux unit tests
Bug: 134460638
Change-Id: Ieb84296eefd00478260ebc42d242f9bef2d8c8d1
2019-11-26 13:19:28 -08:00
Rahul Frias
10eb4da035 Simplify parameter validation
[ Merge of http://go/wvgerrit/89888 ]

A macro validates parameters in CryptoSession and return a
specified error code. Some error codes have been retired and replaced with
the error code PARAMETER_NULL.

Bug: 136123217
Test: Android unit/integration tests
Change-Id: I6ecbad53e87cce04dfd9ea27861400e83044cf5e
2019-11-22 12:05:52 -08:00
Rahul Frias
1014e0d189 Correct unit/integration tests being aborted
[ Merge of http://go/wvgerrit/90244 ]

Tests now link with the dynamic rather than static version of libcrypto.

Bug: 145007632
Test: Unit/integration test
Change-Id: I62e34cac8fdbb8fcf7da5dc8bea142bf2aa76a2f
2019-11-22 11:40:03 -08:00
Rahul Frias
0e6398469d Merge "Add metrics_dump, a tool to format drm metrics" 2019-11-22 19:17:51 +00:00
Rahul Frias
8723859570 Add metrics_dump, a tool to format drm metrics
[ Merge of http://go/wvgerrit/59022 ]

Android metrics are output by the adb shell command
|dumpsys media.metrics|. They appear in bugreports
and can also be requested interactively. Both the
widevine and framework mediadrm metrics are base64
encoded protobufs detailing each of the metrics
items. This tool prints them in a readable format.

Test: wv android unit/integration tests
Change-Id: Id1bc05b34693a3ca44dd3872a28a2337b3ce4d79
2019-11-21 15:39:30 -08:00
Alex Dale
7ab69e7768 CdmRandomGenerator meets UniformRandomBitGenerator named requirements.
[ Merge of http://go/wvgerrit/89766 ]

Certain C++11 (and newer) standard library functions and classes which
utilize random number generators require that the random number
generators meet the specifications of C++11's UniformRandomBitGenerator
name requirements.  This is especially important as C++17 will remove
support non-compliant alternatives.

This change updates CdmRandomGenerator to meet these requirements.

Bug: 143494945
Test: Linux and Android unit tests
Change-Id: Ib6df44da4969ad7596b16d447c3f8bd9864698f6
2019-11-20 14:12:49 -08:00
Robert Shih
84061e93d6 wv hidl factories: cleanup includes & logging
Addresses code review comments from http://go/wvgerrit/89383
* Use WVCdm LOG_TAG
* Cleanup includes

Bug: 134787536
Test: build
Change-Id: I2576127489205de62902d6c290f9293947976094
2019-11-13 02:40:45 +00:00
Robert Shih
e083240191 wv hidl factories: getCallingSid logging
[ Merge of http://go/wvgerrit/89383 ]

Bug: 134787536
Test: check calling sid in logs
Change-Id: If47ccaf9296a157b72181fb2bd00318bb957c15c
2019-11-10 01:59:37 +00:00
Robert Shih
bb093eee1e wv hidl: setRequestingSid to true
HALs need to getCallingSid to verify clients.

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

Bug: 134787536
Test: log calling sid
Change-Id: I9cfbddfc274457a6802d9c8f37470d656771acc6
2019-11-07 12:22:58 -08:00
Fred Gylys-Colwell
ea539673a4 FDPT: Full Decrypt Path Testing Application
Cherry pick of http://go/ag/9326830

This is a merge of the full decrypt path testing CLs from the Widevine
repo: http://go/wvgerrit/q/topic:FDPT-subsamples

This is the Full Decrypt Path Testing application that can be used by
device makers to verify that OEMCrypto is correctly decrypting content
to secure buffers.

Testing: Ran App.
Bug: 113594822

Change-Id: Icbb1e2f2e762bac3cc1b7b20749922c14ea24449
2019-10-28 14:57:22 -07:00
Alistair Delva
2ee373e251 Merge "Add Widevine L3 drm service to cuttlefish" 2019-10-24 21:54:13 +00:00
Edwin Wong
45bf972dcf Add Widevine L3 drm service to cuttlefish
Cuttlefish includes GMS core, Widevine is required.
Add Widevine security level 3 drm service to cuttlefish.

Since we do not want to include vendor Widevine as open code
in cuttlefish's manifest, we will use LOGCAL_VINTF_FRAGMENTS
to refer to Widevine hal in Android.mk here.

Test: tests from gts WidevineDashPolicyTests classs
  ANDROID_BUILD_TOP= ./android-gts/tools/gts-tradefed run gts-dev \
  -m GtsMediaTestCases \
  --test com.google.android.media.gts.WidevineDashPolicyTests \
  #testL3LongLicenseShortPlayback

bug: 141621537
Change-Id: Ibaf5b77ba337c778a45560b20ca752a19724cc9d
2019-10-23 17:00:33 -07:00
Rahul Frias
af15f8c83d Send spoids in provisioning requests
[ Merge of http://go/wvgerrit/87283 ]

SPOIDs (Stable Per-Origin IDentifiers) were not correctly being
set during CdmEngine construction. This resulted in SPOID values not
being sent in provisioning requests. This caused the serial number in
the drm certificate to not be stable after a reprovision.
This behaviour appears to be true going back to O.

CdmEngine no longer takes a SPOID in the constructor since not all
callers use SPOIDs. A setter has been added in its place. Previously
spoid had a default argument to the constructor.

Bug: 142368328
Test: android unit/integration tests
Change-Id: I711346df609636ecf1475dc37873454a7ef000c0
2019-10-23 00:17:24 -07:00
Rahul Frias
2e22e2321e clang-format core/test files
[ Merge of http://go/wvgerrit/88006 ]

Certain test files have yet to be formatted since we introduced
clang-formatting.

Test: android unit/integration tests
Bug: 134365840
Change-Id: I2d30ad367d76a9dfbf389614e1b31ed39fa17c72
2019-10-22 17:30:23 -07:00
Rahul Frias
0acde10d1a Add certificate_provisioning_unittest
[ Merge of http://go/wvgerrit/87964 ]

A preliminary test has been added, more to follow.

Bug: 142747616
Test: android unit tests
Change-Id: Ida8eb853c14f73f60f7bc354f14a02224c2ce66c
2019-10-17 18:03:00 -07:00
Rahul Frias
8769e12b01 Consolidate provisioning related protobuf parsing
[ Merge of http://go/wvgerrit/87905 ]

Protobuf parsing of the provisioning message has been centralized in
certificate_provisioning.cpp since it will be invoked from
multiple locations. This will also ease maintainability of the code.

Bug: 142731300
Test: android unit/integration tests
Change-Id: Idebf6b0145b317698559cac1cf18a3a0b98315ad
2019-10-16 18:43:30 -07:00
Edwin Wong
3cfd0ae668 Merge "Add CTS/GTS tests for TH presumbit." 2019-10-10 17:38:52 +00:00
Alex Dale
940aea20fe Merge "Ran clang-format on android/cdm/ files." 2019-10-04 16:24:02 +00:00
Alex Dale
e68aa203ea Merge "Ran clang-format on android/cdm/util files." 2019-10-04 16:23:22 +00:00
TreeHugger Robot
51d66b2957 Merge "Remove libhwbinder/libhidltransport deps" 2019-10-03 20:05:56 +00:00
Edwin Wong
18498ae065 Add CTS/GTS tests for TH presumbit.
Define CTS/GTS filters in TEST_MAPPING.

Test: time atest
bug: 138259722
Change-Id: I4a64071c1dc41bf011bbc38524ad5bde3043e83e
2019-10-02 17:38:05 -07:00
Alex Dale
06388368cc Ran clang-format on android/cdm/util files.
[ Merge of http://go/wvgerrit/87143 ]

Certain android files have yet to be formated since we introduced
clang-formatting.

Test: Android unit tests
Bug: 134365840
Change-Id: I0e58fb7e5b5525f1e2885ce89b222561a971ab27
2019-10-02 13:49:54 -07:00
Steven Moreland
6f556199db Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: Ie7052b17c1d468f63250755f3ffa5099760c9602
2019-10-02 12:53:59 -07:00
Alex Dale
bdcb79a442 Ran clang-format on android/cdm/ files.
[ Merge of http://go/wvgerrit/87123 ]

Certain android files have yet to be formated since we introduced
clang-formatting.

Test: built for android
Bug: 134365840
Change-Id: Ia316b039e7469f7cf803464ee95a919fe7966450
2019-10-02 12:50:59 -07:00
John Bruce
78e84dcd3b Merge "Usage Table Failure Creates Broken CryptoSession" 2019-10-02 18:19:51 +00:00
Robert Shih
48b2622017 Merge "Add Widevine HIDL service to "system" group" 2019-10-01 22:03:09 +00:00
Alex Dale
0f25034907 Reordering Android WV error codes in mapper.
[ Merge of http://go/wvgerrit/86243 ]

Sorted the case-return blocks in the error map function.  Used two iterations
of a bucket sort algorithm.  First by the case label, then a binary sort on
whether the return value is in the `android` namespace or not.  There are some
exception (such as the first and last block).

The majority of the sorting was done using a script:
  https://paste.googleplex.com/6390453727395840

Bug: 34648626
Test: Linux unit tests and compiled on Android
Change-Id: I524e0d0d93df8b0a3dc1155980eec22cf43156b6
2019-10-01 10:54:46 -07:00
Alex Dale
6272ba2dfe Fixed RemoveAllUsageInfo returned error code.
[ Merge of http://go/wvgerrit/86444 ]

When the CDM engine attemped to remove all usage information across
both L1 and L3, a failure in L1 was being ignored if L3 removal
succeeded.

For this fix, L1 failure codes are prioritized over L3 failure codes
(should both L1 and L3 fail).

Bug: 141272019
Test: Linux unit test and Android unit tests
Change-Id: I2df6d47a2a57c373c6c76903ab33ebbf649005b3
2019-09-30 13:08:26 -07:00
John W. Bruce
d7b17c469b Usage Table Failure Creates Broken CryptoSession
(This is a merge of http://go/wvgerrit/86383)

When Key Sessions were added to CryptoSession, the initialization of the
initial Key Session was placed at the end of the initialization of the
owning CryptoSession. That's all well and good except the block right
before that assumed that it was safe to abort initialization early in
order to swallow errors when setting up usage tables. As a result, if
anything caused usage table initialization to fail, it would leave the
CryptoSession without a Key Session, resulting in an inevitable segfault
further down the line.

There's no reason the Key Session can't be initialized first. This
change moves initialziation order around to avoid the bug.

Bug: 141021960
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: Ic78005c831d2a24d7d6de22df54462b2bd7085f0
2019-09-25 18:02:56 -07:00
Edwin Wong
314d5a8745 [automerger skipped] Link dynamic libcrypto.so to resolve FIPS cert breakage. am: 42893d22b6
am: f07529cbc4 -s ours
am skip reason: change_id I16a7de4dab69bf3b4b550bb2ee202f4600682837 with SHA1 0c7dfda7e1 is in history

Change-Id: I89a2ca3aeba455dc45b63fc9d8313d8dc3018032
2019-09-23 15:04:10 -07:00
Edwin Wong
f07529cbc4 Link dynamic libcrypto.so to resolve FIPS cert breakage.
am: 42893d22b6

Change-Id: Ib996ee659471d9ba357ea3b02e443bdbc1d766b4
2019-09-23 14:56:08 -07:00
Edwin Wong
42893d22b6 Link dynamic libcrypto.so to resolve FIPS cert breakage.
Switch Widevine service to link dynamic libcrypto.so.

Merge from http://go/wvgerrit/86323

Test: Play Movies & TV, Netflix, ExoPlayer, GTS
bug: 141082724
Change-Id: I16a7de4dab69bf3b4b550bb2ee202f4600682837
Merged-In: I16a7de4dab69bf3b4b550bb2ee202f4600682837
(cherry picked from commit 0c7dfda7e1)
2019-09-23 20:57:27 +00:00
Edwin Wong
cacd51938d Merge "Link dynamic libcrypto lib for Widevine unit tests." 2019-09-21 00:55:07 +00:00
Rahul Frias
eb54612580 Merge "Move utils unit tests to a utils specific test dir" 2019-09-20 21:00:32 +00:00