Commit Graph

3709 Commits

Author SHA1 Message Date
Cong Lin
a9889aafd7 Remove the access to net.hostname
Merge of http://go/wvgerrit/95723

This is to remove the reference to net.hostname in
get_unique_id_android.cpp for L3. Keep ro.serialno, and just change the
net.hostname call to setting the constant string.

Bug: 130028203
Test: Ran unit tests
Change-Id: I90d955c117924c16c71f145dea53fe32644d2875
2020-03-13 14:12:09 -07:00
Edwin Wong
a66d2b392e Clear sessionId regardless of what closeSession returns
After succeeding openSessionCommon(), when the call to
getSecurityLevel() fails, the code calls closeSession()
and only clears the sessionId if closeSession() fails.
We should always clear sessionId in this case.

Also, make it clearer that the status returned by
getSecurityLevel() does not overwrite the value from
openSessionCommon().

Merged from http://go/wvgerrit/95845

Test: unit test
adb shell LD_LIBRARY_PATH="/vendor/lib64" /data/nativetest/libwvdrmdrmplugin_hidl_test

Bug: 151364587
Change-Id: I3a9106ffa44c654d3e072a0b0597398d410fc84f
2020-03-13 11:40:20 -07:00
Cong Lin
5a6a2075f5 ODK: Address review comments
Merge of http://go/wvgerrit/95666

Mostly fixing coding styles and a few vulnerability check.
Updating tests according to the fix.

Bug: 150614088
Bug: 150881959
Test: Ran cdm and odk unit tests
Change-Id: I109a96ee8ded089d59ab49c2f94b6833c932fd1e
2020-03-12 18:25:46 -07:00
Automerger Merge Worker
34ded343ec Merge "openSession_1_1 should return error for wrong security level" into rvc-dev am: fae5d3f7a9 am: a352d99c43
Change-Id: Idd2f7cb1a808bf517ef5e0cadc2107c493450835
2020-03-12 23:40:05 +00:00
Automerger Merge Worker
a352d99c43 Merge "openSession_1_1 should return error for wrong security level" into rvc-dev am: fae5d3f7a9
Change-Id: I8930bafb6c2e3b64508098a60f26f70ab181720e
2020-03-12 23:20:14 +00:00
Edwin Wong
fae5d3f7a9 Merge "openSession_1_1 should return error for wrong security level" into rvc-dev 2020-03-12 23:06:33 +00:00
Rahul Frias
89d19be766 Disable delayed termination on unprovisioning
[ Merge of http://go/wvgerrit/95784 ]

On unprovisioning, all persistent state/files are deleted. If a
provisioning session is opened soon after, |OEMCrypto_Terminate|
and |OEMCrypto_Initialize| will not be called. The (deleted) device
key will remain resident in memory and will not be regenerated until
|OEMCrypto_Initialize| is called. Any L3 licenses created will be
associated with a device key that does not exist, at least after
OEMCrypto is terminated.

By disabling delayed termination of OEMCrypto, OEMCrypto will be
terminated and initialized immediately on unprovisioning.

Bug: 149808504
Test: WV unit/integration tests on L3
Change-Id: Id3fbce621b47a723ff624cf45f1ac203421a8dba
2020-03-12 15:58:33 -07:00
Automerger Merge Worker
24e95938dc Merge "Expect Provisioning ID length of upto 64 bytes" into rvc-dev am: f14dea8b89 am: ea491da7fc
Change-Id: I671b88ee699b239e84caba8b2410eb8b8fefcf6c
2020-03-12 21:49:47 +00:00
Automerger Merge Worker
ea491da7fc Merge "Expect Provisioning ID length of upto 64 bytes" into rvc-dev am: f14dea8b89
Change-Id: Ia2e3f84ff661869eae138057447d2ac35251eb64
2020-03-12 21:39:00 +00:00
Rahul Frias
f14dea8b89 Merge "Expect Provisioning ID length of upto 64 bytes" into rvc-dev 2020-03-12 21:22:35 +00:00
Rahul Frias
a42273e67f Expect Provisioning ID length of upto 64 bytes
[ Merge of http://go/wvgerrit/95508 ]

The provisioning ID length will be 32 bytes when the device supports a
keybox or OEM certificates and does not implement |OEMCrypto_GetDeviceId|.
If a device supports OEM Certificates and implements |OEMCrypto_GetDeviceId|
it may be an arbitrary length upto 64 bytes.

Bug: 150393659
Test: WV unit/integration tests
Change-Id: I5e4dbc8f2f9ca326425d0313f4823b72bd6ac7c0
2020-03-12 12:30:37 -07:00
Automerger Merge Worker
c1fb910476 Merge "Match usage entry to header" into rvc-dev am: 042efc971d am: c43723bb34
Change-Id: I4a986d4c9085c784e2297df70f44e1e4c186a76f
2020-03-12 18:30:51 +00:00
Automerger Merge Worker
c43723bb34 Merge "Match usage entry to header" into rvc-dev am: 042efc971d
Change-Id: Idcd0ba1346a045ef0cdb549bad3c5089bcf27173
2020-03-12 18:13:49 +00:00
TreeHugger Robot
042efc971d Merge "Match usage entry to header" into rvc-dev 2020-03-12 18:00:06 +00:00
Edwin Wong
bdb69f73e8 openSession_1_1 should return error for wrong security level
Currently, if requestedLevel is not the same as the
current security level, openSession_1_1 still returns
Status::OK, we should return an error status.

Merged from http://go/wvgerrit/95507

Test: unit test
  adb shell LD_LIBRARY_PATH="/vendor/lib64" /data/nativetest/libwvdrmdrmplugin_hidl_test

Bug: 150407669

Change-Id: I5673ac7bbe7a234ddd07bb9c145135486fb9e583
2020-03-11 17:39:44 -07:00
Automerger Merge Worker
6d086900d0 L3 oemcrypto: Replace NULL with nullptr am: 5cd0fd7992 am: ace03ffb04
Change-Id: I9d1c26d7275dc03d8f157a76286ae655c3602a88
2020-03-11 23:35:21 +00:00
Automerger Merge Worker
ace03ffb04 L3 oemcrypto: Replace NULL with nullptr am: 5cd0fd7992
Change-Id: I71c41ba43edb99f167435c72d02ec97de4948b34
2020-03-11 23:22:56 +00:00
Cong Lin
5cd0fd7992 L3 oemcrypto: Replace NULL with nullptr
Merge from Widevine repo of https://widevine-internal-review.git.corp.google.com/c/cdm/+/95206

Only one file is affected in Android repo.

Bug: 149050172
Test: Unit tests
Change-Id: I3251b9997733e59b18c0b5727205067dcc3a963c
2020-03-10 19:47:36 -07:00
Automerger Merge Worker
fe39864311 Merge "Update tests for license release" into rvc-dev am: b8570949e4 am: e77b1913c9
Change-Id: Id0f3d0844b25bf282df29637e831f76b58bbfb33
2020-03-10 09:19:09 +00:00
Automerger Merge Worker
e77b1913c9 Merge "Update tests for license release" into rvc-dev am: b8570949e4
Change-Id: I78abac92ac31ba82904058c3c80ccacf3edbbada
2020-03-10 09:01:45 +00:00
TreeHugger Robot
b8570949e4 Merge "Update tests for license release" into rvc-dev 2020-03-10 08:49:47 +00:00
Fred Gylys-Colwell
469c17777e Match usage entry to header
Merge from Widevine repo of http://go/wvgerrit/95463

In the unit tests ReloadUsageTableWithSkew, we load a header that has
a generation number off by 1. This is allowed. However, we then try to
load the current entry, which is newer than the header. Instead, we
should try to load the entry that went with the header.

Bug: 139828114
Test: Ran unit tests
Change-Id: I87261501d8ee2b91a07c2b5dff17fc0ea950244d
2020-03-09 20:40:15 -07:00
Fred Gylys-Colwell
037918aa49 Update tests for license release
Merge from Widevine repo of http://go/wvgerrit/95403

This updates the test code CreateDefaultResponse to make sure that
license releases do not have a core message, and that the key control
block is correctly set for renewals.

Also, the unit test OEMCryptoUsageTableTest.TimingTest is changed to
only a license release when the license is inactive. If the license is
still active, then the license is loaded before generating a usage
report.

Test: Ran full unit tests
Bug: 151092673
Change-Id: I7c01fd17f9b66e88ab3c57aa0f3d40740f13507c
2020-03-09 20:11:23 -07:00
Automerger Merge Worker
6bc1b455f4 Merge "Treat the (0,0) Pattern as 'cbcs'" into rvc-dev am: 2356842fd2 am: d8c7168f43
Change-Id: I42b4df18fa6a4a48fca887a61c8dc6ce93225bb7
2020-03-09 21:42:40 +00:00
Automerger Merge Worker
6889037bb3 Merge "Remove ODK from unused makefiles" into rvc-dev am: 7da5b8be92 am: cbfb68abdc
Change-Id: I40ec39f7a6d9620bcd9af41a3aab4691e95ab582
2020-03-09 21:42:35 +00:00
Automerger Merge Worker
20745a3aca Merge "Cache Max Subsample Size" into rvc-dev am: 0bd6a38096 am: e61f87a18a
Change-Id: I89841afbc2c115664629fce1acf33bf55a59f925
2020-03-09 21:42:13 +00:00
Automerger Merge Worker
d8c7168f43 Merge "Treat the (0,0) Pattern as 'cbcs'" into rvc-dev am: 2356842fd2
Change-Id: I18327a1679ecba78d2ecf465e589713a8b8113cb
2020-03-09 21:32:15 +00:00
TreeHugger Robot
2356842fd2 Merge "Treat the (0,0) Pattern as 'cbcs'" into rvc-dev 2020-03-09 21:22:37 +00:00
Automerger Merge Worker
cbfb68abdc Merge "Remove ODK from unused makefiles" into rvc-dev am: 7da5b8be92
Change-Id: I35e3f958081d8431bacf2d94f2acb0bceb5ec34a
2020-03-09 21:18:06 +00:00
Automerger Merge Worker
e61f87a18a Merge "Cache Max Subsample Size" into rvc-dev am: 0bd6a38096
Change-Id: If860c7bbcc027a1492d7d5f502ee2bca95393eb7
2020-03-09 21:17:54 +00:00
TreeHugger Robot
7da5b8be92 Merge "Remove ODK from unused makefiles" into rvc-dev 2020-03-09 21:05:22 +00:00
TreeHugger Robot
0bd6a38096 Merge "Cache Max Subsample Size" into rvc-dev 2020-03-09 21:03:52 +00:00
Automerger Merge Worker
9423724f4e Merge "Unit test for OEMCrypto_LoadUsageEntry in multiple sessions" into rvc-dev am: bf5c819046 am: 8791b6ff22
Change-Id: Iab1906a1422835ef785c66aba273a07b7123b871
2020-03-09 20:15:47 +00:00
Automerger Merge Worker
8791b6ff22 Merge "Unit test for OEMCrypto_LoadUsageEntry in multiple sessions" into rvc-dev am: bf5c819046
Change-Id: I875f2df0bed5a97192ce702a4be456a573bedb95
2020-03-09 20:10:04 +00:00
Automerger Merge Worker
2f88a021e4 Filter out nonrequired tests for v15 devices am: a11d764d8d am: 6934d3242f
Change-Id: I58e1488e57c76d814edc5272f5cc3528dfd44611
2020-03-09 20:08:23 +00:00
Automerger Merge Worker
6934d3242f Filter out nonrequired tests for v15 devices am: a11d764d8d
Change-Id: I6f57e852368bc8552f3dcbae4a486db99d82a12c
2020-03-09 19:59:15 +00:00
TreeHugger Robot
bf5c819046 Merge "Unit test for OEMCrypto_LoadUsageEntry in multiple sessions" into rvc-dev 2020-03-09 19:20:55 +00:00
Fred Gylys-Colwell
bfde826763 Unit test for OEMCrypto_LoadUsageEntry in multiple sessions
Merge from Widevine repo of http://go/wvgerrit/95283

If an entry is loaded in a second session, the error should be
OEMCrypto_ERROR_INVALID_SESSION.

Bug: 150647218
Test: ran unit tests
  Change-Id: I4e666ce6626303a36b16997f0a012d57a7039697
Change-Id: Id0e73dec5879ec9ec4e8ab8ebe1590c568e7f0af
2020-03-07 10:58:50 -08:00
Fred Gylys-Colwell
a11d764d8d Filter out nonrequired tests for v15 devices
Merge from Widevine repo of http://go/wvgerrit/95263

Some OEMCrypto unit tests are not expected to pass on a v15 device, so
they are being filtered out.

Bug: 149861744
Test: unit tests on taimen
Change-Id: Iadff592f4a0005ab7e5613b315a714e737d7e5e0
2020-03-06 15:49:17 -08:00
Fred Gylys-Colwell
96dc665cd5 Remove ODK from unused makefiles
Merge from Widevine repo of http://go/wvgerrit/95087

The ODK library is used in OEMCrypto, and in test code, but it is not
needed in the CDM layer. As such, it can be removed from the
Android.mk for cdm libraries.

Bug: 150809634
Test: unit tests
Change-Id: If29458e7d3d940f9a383d77e5082e7388e19c32f
2020-03-06 18:58:50 +00:00
Automerger Merge Worker
1cc466e9f6 Merge "Update ODK Library and add license release unit test" into rvc-dev am: 174c57bb59 am: ae5ff19c3a
Change-Id: I19916fdcbd64129e8b0ae208d69ce69375c16555
2020-03-05 21:54:09 +00:00
Automerger Merge Worker
ae5ff19c3a Merge "Update ODK Library and add license release unit test" into rvc-dev am: 174c57bb59
Change-Id: Idb759df35395da86809c221da316de3c4b2ced24
2020-03-05 21:30:54 +00:00
Fred Gylys-Colwell
174c57bb59 Merge "Update ODK Library and add license release unit test" into rvc-dev 2020-03-05 21:16:55 +00:00
Fred Gylys-Colwell
c5b7a01ab5 Update ODK Library and add license release unit test
Merge from Widevine repo of two CLs.

Merge from Widevine repo of http://go/wvgerrit/94743

A license release should not have a core message. This CL adjusts the
existing unit tests to verify this. There is also a new unit test called
SecureStop that explicitly tests sending a secure stop in a new
session without first loading the license.

Merge from Widevine repo of http://go/wvgerrit/94865

This CL has the following changes copied from google3:
http://cr/298871728 Remove odk_static_assert for Message size temporarily
http://cr/298755935 Fix a compiling error during macro expansion
http://cr/298481745 Add missing header for android
http://cr/298448142 Fix odk_test gyp file
http://cr/298419641 Remove header from Android.bp
http://cr/298402053 Separate sizeOf(args) bytes in fuzz tests
http://cr/297730316 No core messages for license release
http://cr/297714346 Add copybara_test and piper_sot_to_gerrit
http://cr/297636713 Adding some comments around boolean conversion code
http://cr/297420679 Autofuzzer when ran with address sanitizer ...
http://cr/296513584 Minor fix with fuzzing odk clock values
http://cr/296322024 Fixing errors in code with how request ...
http://cr/296313159 Fuzzing ODK clock values by setting aside ...
http://cr/295763207 Add more odk tests and move helper functions to test helper
http://cr/294524098 Adding a Build Rule for ODK_KDO_Fuzzer and updating
http://cr/294492213 Address a few review comments of ODK
http://cr/293674368 odk_fuzz: add TODOs & comments
http://cr/293492806 Fix spelling

Bug: 150243585
Bug: 150020278
Bug: 150095506
Bug: 147297226
Bug: 148290294
Bug: 148907684
Bug: 150608451
Test: unit tests
Change-Id: I25fd406f29f4eba40f5cb27e9a1317dce4ffc2f5
2020-03-05 19:06:31 +00:00
Automerger Merge Worker
030aabb66f Merge "Correct log messages" into rvc-dev am: d0d3216eda am: ec2d331246
Change-Id: Icb5d38b207a1a5048ce5b717c49842896f0343fa
2020-03-05 00:27:07 +00:00
Automerger Merge Worker
ec2d331246 Merge "Correct log messages" into rvc-dev am: d0d3216eda
Change-Id: Ib9d57ae301d678b6d2c1ec879aa6b4374ddc9e40
2020-03-05 00:11:01 +00:00
Rahul Frias
d0d3216eda Merge "Correct log messages" into rvc-dev 2020-03-05 00:01:37 +00:00
John W. Bruce
1f1ba94a61 Cache Max Subsample Size
(This is a merge of http://go/wvgerrit/95003.)

To reduce the number of OEMCrypto calls on the decrypt path, the maximum
subsample size will now be cached after the first call to retrieve it.

Bug: 150018606
Test: Android Unit Tests
Test: CE CDM Unit Tests
Test: ExoPlayer high-bitrate playback on OEC v15
Change-Id: I0b5d38d8a082c0a127d2a47f112b76c64085bddb
2020-03-04 12:20:58 -08:00
John W. Bruce
82951b01ef Treat the (0,0) Pattern as 'cbcs'
(This is a merge of http://go/wvgerrit/94928.)

In OEMCrypto v16, we dropped support for 'cens' and 'cbc1'. However, we
did not redefine the pattern (0,0) to be a valid pattern for 'cbcs', even
though it was no longer being used to signal 'cbc1'. Instead, we made
the CDM reject CTR with a pattern ('cens') and CBC with a (0,0) pattern
('cbc1') to mirror the behavior of OEMCrypto v16.

However, some apps have been using 'cbc1' mode to decrypt audio in
'cbcs' content. This is normally not possible but is possible for a
subset of content. Furthermore, it is easy to do by accident because of
the way most packagers package 'cbcs' audio and the special significance
Widevine has historically given the (0,0) pattern.

This patch updates the CDM to not reject CBC with a (0,0) pattern but
instead treat it as 'cbcs' content. To decrypt it correctly, the pattern
is treated specially inside the CDM core and converted to the
recommended equivalent pattern — (10,0) — before passing the content to
OEMCrypto.

For more specifics, please see the design doc: http://go/vclfg

Bug: 150219982
Test: ExoPlayer Demo App 'cbcs' Content
Test: GTS 'cbcs' Content
Change-Id: I334ff15db5f7b7d62040a036ba6d17515c3caee4
2020-03-04 12:11:29 -08:00
Automerger Merge Worker
6e14debce3 hidl WVDrmPlugin openSession: set securityLevel correctly am: 9a530b7f1e am: 23c1be8cee am: 8f127f41cb
Change-Id: Id1e03bc728fb4f119d101e32c3e372136bf66a92
2020-03-04 20:03:17 +00:00