Commit Graph

463 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
88934aa322 Log oemcrypto unit test version number
Merge from Widevine repo of http://go/wvgerrit/95483

This adds a log message to the oemcrypto unit tests so that if
somebody sends us a log, we can tell which version they are
running.

With this CL, the version string is
OEMCrypto unit tests for API 16.2. Tests last updated 2020-03-18

This can be found in the logs and in stdout when running the unit test
OEMCryptoClientTest.VersionNumber. One can verify the executable on
android using
strings $OUT/data/nativetest/oemcrypto_test | grep -i "oemcrypto unit tests"

Test: ran oemcrypto_test and verified version string
Bug: 144713981
Change-Id: Ie10b2f270b783ed10a3ff9855b7ca32a5327ea1c
2020-03-18 15:13:57 -07:00
Cong Lin
78fddc230a (WV to Android) Fix un-initialized-value warning as error in odk_test
Merge from Widevine repo of http://go/wvgerrit/95968

Un-initialized int array allocated on heap is detected by MemorySanitizer using this command:

rabbit test --config=msan --keep_going --compilation_mode=opt --runs_per_test=1 //video/widevine/export/common/oemcrypto_core_message/odk:odk_test

Bug: 151339875
Test: cdm and odk unit tests
Change-Id: Ic3329b918636a58eccb518ded7b262c4d98c3644
2020-03-17 21:44:17 +00: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
TreeHugger Robot
042efc971d Merge "Match usage entry to header" into rvc-dev 2020-03-12 18:00:06 +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
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
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
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
John W. Bruce
a62886b925 Combined Decrypt Calls
(This is a merge of http://go/wvgerrit/93829,
http://go/wvgerrit/93830, http://go/wvgerrit/93832,
http://go/wvgerrit/93833, and http://go/wvgerrit/93834 from the
Widevine repo.)

This implements the CDM code changes necessary to take advantage of
Combined Decrypt Calls on OEMCrypto v16. The result of this is that
WVCryptoPlugin is much lighter now because it can pass the full sample
down to the core in one call, but CryptoSession is heavier, as it now
has to handle more complex fallback logic when devices can't handle
multiple subsamples at once.

This patch also removes support for the 'cens' and 'cbc1' schema, which
are being dropped in OEMCrypto v16. This fixes an overflow in the code
for handling those schemas by removing it entirely.

This patch also fixes the "in chunks" legacy decrypt path to use larger
chunk sizes on devices with higher resource rating tiers.

Bug: 135285640
Bug: 123435824
Bug: 138584971
Bug: 139257871
Bug: 78289910
Bug: 149361893
Test: no new CE CDM Unit Test failures
Test: Google Play plays
Test: Netflix plays
Test: no new GTS failures
Change-Id: Ic4952c9fa3bc7fd5ed08698e88254380a7a18514
2020-02-19 11:44:35 -08:00
Fred Gylys-Colwell
2446b85322 Remove unused parameters
Merge from Widevine repo of http://go/wvgerrit/94043

Remove some unused parameters from test code. These had been
generating compiler warnings.

Bug: 149592532
Test: built and ran unit tests on crosshatch
Change-Id: If1325edc3418f77d620ce3765496ef17156bc624
2020-02-15 12:15:06 -08:00
Fred Gylys-Colwell
d7492082c6 Fix logging for buildbot
Merge from Widevine repo of http://go/wvgerrit/93686

This CL changes some test logging so that it is always on a single
line, even if verbose logging is turned on.

Test: unit tests
Bug: 149119926

Change-Id: I9473f6e559ff543ced47a7fa3900615866a25688
2020-02-14 23:00:28 +00:00
TreeHugger Robot
6a0cc01e0f Merge "Address review comments and sync branches" 2020-02-07 23:27:36 +00:00
Fred Gylys-Colwell
a3477aab03 Address review comments and sync branches
This CL merges some missed pieces of the merge from Widevine repo of
http://go/wvgerrit/93405

Test: unit tests
Bug: 147879734, 147396294, 141247171
Change-Id: I3b92b983f68f6a529f109bc5dec91b313e3fd7fb
2020-02-07 14:12:26 -08:00
Alex Dale
d07a784afa Merge "Small fixes leftover from V16 merge." 2020-02-07 21:25:17 +00:00
Alex Dale
8977119d05 Small fixes leftover from V16 merge.
[ Merge of http://go/wvgerrit/93505 ]

During the merge process there were a few CL comments (ag/10122083)
that were not able to be addressed.  Most changes in the CL are
spelling / grammar corrections.

Bug: 148907684
Bug: 141247171
Test: CDM unit tests
Change-Id: I9a8648525bbe5ed319521ebf01741a958ab69ae2
2020-02-06 17:44:45 -08:00
Fred Gylys-Colwell
de06052c7c Update version number in OEMCrypto header
Merge from Widevine repo of http://go/wvgerrit/93507

Test: comment only change
Bug: 147038692
Change-Id: I5a5f1818594dfd95d916c7d1d3ae2795d3b6477f
2020-02-05 16:30:27 -08:00
Fred Gylys-Colwell
db2050dff1 OEMCrypto v16.2
Merge from Widevine repo of http://go/wvgerrit/93404

This is the unit tests, reference code, and documentation for
OEMCrypto v16.2. Backwards compatibility should work for a v15
OEMCrypto.

Some review comments will be addressed in future CLs.

Bug: 141247171
Test: Unit tests
Test: Media GTS tests on bonito
Change-Id: I9d427c07580e180c0a4cfdc4a68f538d351c0ddd
2020-02-04 20:33:16 -08:00
Fred Gylys-Colwell
7665614b2e OEMCrypto v16.1
Merge of http://go/wvgerrit/93404

This CL updates the Widevine CDM to support OEMCrypto v16.1

Test: Tested in 16.2 CL
Bug: 141247171
Change-Id: I69bd993500f6fb63bf6010c8b0250dc7acc3d71b
2020-02-03 14:45:32 -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
Colin Cross
fbd73c59c4 Use libcrypto_static instead of libcrypto am: 36e943c1ae
am: 94c13796f2

Change-Id: I42383da031eedb9849174c6da08318e399bf3e3d
2019-09-19 15:22:33 -07:00
Colin Cross
36e943c1ae Use libcrypto_static instead of libcrypto
Replace libcrypto with libcrypto_static, which can be protected through
visibility to ensure only modules that don't affect FIPS certification
can use it.

Bug: 141248879
Test: m checkbuild
Change-Id: I53757b813fe2984261a3bde963cac1886523dfdf
2019-09-19 00:40:10 +00:00
Fred Gylys-Colwell
334d966f12 Merge "Unify log level for tests" 2019-07-11 02:19:25 +00:00
Fred Gylys-Colwell
b60f75805d Unify log level for tests
Merge from Widevine repo of http://go/wvgerrit/79463 and
http://go/wvgerrit/82383

Several tests explicitly set the log level. This CL unifies that a
little bit. When running the unit tests by hand, on android or for ce
cdm, the log level is 0 (ERROR) and can be incremented on the command
line using the "--verbose" switch.

When running on the desktop, you can set the environment variable
VERBOSE_LOG to "yes", and the log level is set to VERBOSE.  This is
done by the buildbot so you can see full logs in the build archive.

When running with the test bed (i.e. Mod Mock) you can edit the
options.txt file and set log_level to 0=ERROR up to 4=VERBOSE. if you
are using the run_current_tests script, you can create a file in the
linux directory called override_options.txt and add the line
log_level 4

This CL only changes test code.

bug: 124390006
Test: unit tests
Change-Id: I1e042004692750e218b8c4220bce3ec1e387004e
2019-07-10 14:02:45 -07:00
Fred Gylys-Colwell
8223d0e8b7 Clean OEMCrypto unit tests
Merge from Widevine repo of http://go/wvgerrit/79243
Modify failures for LoadKeyWithSuspiciousIV and SelectKeyNotThereAPI15
This turns on some unit tests that were disabled for Q release.

Merge from Widevine repo of http://go/wvgerrit/77948
Mod Mock: Dump entitlement keys - this allows some logging when
running in a test environment.

Merge from Widevine repo of http://go/wvgerrit/75763
Refactor OEMCrypto Decrypt Tests

This CL refactors the oemcyrpto decryption tests.  A bunch of boiler
plate code was moved to a common test setup.  Also, buffer handling
was streamlined so that it will be easier to use these test with
secure output buffers.

Bug: 131281966
Bug: 129432708
Test: unit tests
Change-Id: Iebf62611a16e0a4def9c4daed1c6cdf12686ba74
2019-06-20 23:07:02 +00:00
Fred Gylys-Colwell
aa7f7d3ac4 Remove test keybox one more time
Merge from Widevine repo of http://go/wvgerrit/78883

Bug: 119316243
Test: unit tests
Change-Id: Ic6748a6e020c2a4058510fb5c6c5a821e57cc5fd
2019-05-22 00:25:56 +00:00
Fred Gylys-Colwell
b56e01cd2f Merge "Disable failures for LoadKeyWithSuspiciousIV and SelectKeyNotThereAPI15" into qt-dev am: 3454ccf51e am: d579bbf511
am: 5a9ef9a128

Change-Id: I56452ec76a98895d3dd077222e72030f40192f5a
2019-05-17 14:19:57 -07:00
Fred Gylys-Colwell
29becbc2bf Disable failures for LoadKeyWithSuspiciousIV and SelectKeyNotThereAPI15
Merge from Widevine repo of http://go/wvgerrit/78949

LoadKeyWithSuspiciousIV is a new test for OEMCrypto v15.2.  It is
being disabled since we do not require 15.2 for the Q release.

SelectKeyNotThereAPI15 was failing because the error code is
delayed. This is acceptable.

Bug: 132720732
Test: unit tests on taimen
Change-Id: Iea3fabfb3afd800065119ce812fb454be1e82644
2019-05-14 22:32:54 -07:00
Fred Gylys-Colwell
843c8ab83a Merge "Fix OEMCrypto UsageTableTest.GenerateReportWrongPST" into qt-dev am: 127f87770c am: e4eef77a01
am: 8a104ddc65

Change-Id: Ifbb57ea1111add3c018a6c115f9337c5594d6b79
2019-05-14 16:56:10 -07:00
TreeHugger Robot
127f87770c Merge "Fix OEMCrypto UsageTableTest.GenerateReportWrongPST" into qt-dev 2019-05-14 22:01:11 +00:00
Fred Gylys-Colwell
cb12eacfc4 Merge "Update unit tests for v15.2" into qt-dev am: 2f79fe2773
am: d0b62c1b8d

Change-Id: I537e6e9c0161084cc0b12a32779fa52c275421cd
2019-05-08 11:38:46 -07:00
Fred Gylys-Colwell
2f79fe2773 Merge "Update unit tests for v15.2" into qt-dev 2019-05-08 17:36:36 +00:00
Fred Gylys-Colwell
a35722f358 Test MAC signature after license reload am: 407d39699b
am: a3d5e7be6a

Change-Id: Ia110288e7d06dcbe7aaebe6c54e42a64402f1a4f
2019-05-08 00:53:00 -07:00
Fred Gylys-Colwell
96431e9c2d Update unit tests for v15.2
Merge from Widevine repo of http://go/wvgerrit/77609

For v15.2 we require that nonces not collide across sessions and there are
restrictions placed on the mac key's IV in LoadKeys.

Test: ran unit tests on reference code

Bug: 131325434
Bug: 131326334

Change-Id: I1bb01c30d8c15d66d762c28b57d7700c44daa835
2019-05-07 22:50:06 -07:00
Fred Gylys-Colwell
407d39699b Test MAC signature after license reload
Merge from Widevine repo of http://go/wvgerrit/78143

This verifies that the correct mac keys are used to sign a message when
generating a usage report or secure stop.

Test: unit tests on ref code and taimen
Bug: 111261264
Change-Id: I7d56a6ff0aae68a5554f7ce84d467697d1f9997b
2019-05-07 19:09:53 +00:00
Fred Gylys-Colwell
29dac7ac57 Merge "Test loading second call to LoadKeys fails" into qt-dev am: a1e94e2eb1
am: 4e75bcfce8

Change-Id: I97d50a3137867235c1fcc20e449ce54460dbbaf8
2019-05-06 20:49:44 -07:00
TreeHugger Robot
a1e94e2eb1 Merge "Test loading second call to LoadKeys fails" into qt-dev 2019-05-07 02:18:17 +00:00
Fred Gylys-Colwell
b10697a95c Merge "Update docs for OEMCrypto v15.2" into qt-dev am: 3b9b77c7c7
am: 2abed930c7

Change-Id: Ia49b0d7b8d3d7773bf9a9a6aa4dfeb3a1569b5d2
2019-05-06 12:56:59 -07:00
Fred Gylys-Colwell
d4801531e4 Fix OEMCrypto UsageTableTest.GenerateReportWrongPST
Merge from Widevine repo of http://go/wvgerrit/78063

This test incorrectly asserted a buffer size.

Bug: 131864150
Test: Unit tests ran on taimen.
Change-Id: If53fdd4cce9d6b3dfa85f50a3dbc08c99bceebfb
2019-05-06 11:41:21 -07:00
Fred Gylys-Colwell
c7a4c0c7db Test loading second call to LoadKeys fails
Merge from Widevine repo of http://go/wvgerrit/78144

This CL verifies that LoadKeys cannot be called twice a second time in
an OEMCrypto session.

Bug: 131359743
Test: unit tests on refernce code and taimen
Change-Id: I3da1c7639ed163799ee5996fd9f7f8b427c7ed30
2019-05-06 09:42:18 -07:00
Fred Gylys-Colwell
db534a6a05 Update docs for OEMCrypto v15.2
Merge from Widevine repo of http://go/wvgerrit/77604

Test: ran unit tests

Bug: 131326334 Nonce collision should be avoided in open sessions
Bug: 131325434 mac key iv should not be 16 bytes before encrypted mac key
Bug: 129368634 HDCP 2.3 and 2.2 are not distinguishable
Bug: 127423611 Question about OEMCrypto V15 API
Bug: 124312571 Picture-in-Picture -- is it really needed for Android TV?
Bug: 131175454 Extend Provisioning 3.0 Schedule
Bug: 131359743 Do not allow multiple LoadKeys in a session

Change-Id: I8db4ec921978ea918adb17420db86de69e806120
2019-05-05 21:42:35 -07:00
John W. Bruce
ea4e6d8c37 Add Windows support for clock-change test.
(This is a merge of http://go/wvgerrit/70363)

Test: Android Unit Tests
Bug: 122953649
Change-Id: I47d2120b4d280be316072c38fd7282e14f68c6a0
2019-04-19 22:20:23 +00:00
John W. Bruce
5ea429ee2b Don't Use StringStream When It's Overkill
(This is a merge of http://go/wvgerrit/76063)

Now that we have C++11, many places that do string formatting or parsing
can be replaced with std::to_string() or one of the std::sto*() family
of functions. This patch updates places that do simple stringifying or
parsing to use these functions. Some parts of the code are left
untouched because they were using StringStream to do more complex
actions, such as constructing more complex output or checking the status
of the parsing.

Bug: 120599938
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I482dc234ecd7c6014fa9b6874387ff51e04b772f
2019-04-17 17:46:31 -07:00
Fred Gylys-Colwell
5f7803dedd Add comments to unit tests
Merge from Widevine repo of http://go/wvgerrit/73383

Partners have been requesting more explanation for what each test is
doing.  This is an attempt to clarify some of the tests.

Bug: 119640588
Test: unit tests
Change-Id: I270203b4e8fa7e65abb55297788e4d55856e7dcd
2019-03-03 21:16:55 -08:00
Fred Gylys-Colwell
d925048c35 Merge "Set max output buffer size in Mod Mock" 2019-02-21 22:30:46 +00:00
Fred Gylys-Colwell
36e845d00d Merge "Keep OEMCrypto testbed singleton after terminate" 2019-02-21 22:30:35 +00:00
Rahul Frias
088c5afa02 Move WV unit/integration tests to /data/nativetest
[ Merge of http://go/wvgerrit/73044 ]

The tests currently get copied to /data/bin. Changes in location
of system libraries causes test failures when tests are unable to
find dependent dynamic libraries.

Bug: 123879070
Test: WV unit/integration tests
Change-Id: I86edbe33b4753238fcf8b84243ac6e6c058ea145
2019-02-21 09:53:06 -08:00
Fred Gylys-Colwell
4389e262d1 Set max output buffer size in Mod Mock
Merge from Widevine repo of http://go/wvgerrit/72392

This adds the ability of the reference code to set the maximum output
buffer size error discussed in the Recoverable Errors section of
http://go/wvdelta15

Bug: http://b/120572363 Add Recoverable Errors (mod mock)
Change-Id: I688caca22929e29b3548c3f7d1df5de5bd37bfa1
2019-02-14 12:39:37 -08:00