Commit Graph

478 Commits

Author SHA1 Message Date
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
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
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
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
4287df7d3d Merge "Revert "Remove Test Keybox Again"" 2019-02-01 19:23:31 +00:00
Fred Gylys-Colwell
fca89868f8 Revert "Remove Test Keybox Again"
This reverts commit 408509efdc.

Reason for revert: just kidding. We want to run the tests on 
old devices, too.

Change-Id: I920fa825380638122f638e057bcfbe98b5f7b301
2019-01-30 19:17:06 +00:00
John Bruce
fcfa61c71f Merge "Misc Windows fixes." 2019-01-28 17:49:28 +00:00
Jacob Trimble
b3dd9c3711 Misc Windows fixes.
(This is a merge of http://go/wvgerrit/70324)

- Add build settings for Windows.
- Conditionally add pthread.
- Add dummy DLLMain method.
- Fix #if checks for Windows.
- Remove designated initializers which aren't supported in MSVC.
- Remove variable length array.

Test: Android Unit Tests
Bug: 122953649
Change-Id: I14f16e7ce4b3ff17ee0139ea6c2f7243ae999aa1
2019-01-25 15:05:00 -08:00
Fred Gylys-Colwell
408509efdc Remove Test Keybox Again
Merge from Widevine repo of http://go/wvgerrit/69563

This CL also disables unit tests that depend on the old test keybox when run
against OEMCrypto v13 or earlier.

Unit tests that require a particular API level have been
removed.  This requirement for Android is tested in GTS tests.

Bug: 119316243
Test: unit tests
Change-Id: I9a13dbaee1693ecea906fd0184a8e2590dc5beed
2019-01-24 11:59:02 -08:00
John W. Bruce
777abaef01 Add some platform abstractions.
(This is a merge of http://go/wvgerrit/70303)

This adds a platform.h file to abstract some of the differences
between Windows and POSIX platforms.  This includes ntohl, setenv,
and ssize_t.

Bug: 122953649
Test: Android Unit Tests
Change-Id: I3235f3f284b53d24d7365ff3f4a06dcd9b403697
2019-01-16 11:06:55 -08:00
Rahul Frias
ef00d6ffa5 Update property retrival method
[ Merge of http://go/wvgerrit/70203 ]

The earlier property_get() method had a limitation on property length.
Properties of some new devices exceed that length. An error message
is returned rather than a truncated string. Replace its use with
android::base::GetProperty() which does not have a length limitation.

Bug: 115358798
Test: WV unit/integration tests
Change-Id: I46ce9a7e77bcd031225d0082f83c57d484fe5405
2019-01-15 00:24:52 -08:00
Srujan Gaddam
80166b37e2 Remove shared license code from OEMCrypto
Bug: b/119881112
Merge of http://go/wvgerrit/68983
Test: Android + Linux tests for ref and L3

This CL removes tests from OEMCrypto that test shared license
functionality and code in the ref and L3 that handle shared licenses.

Change-Id: Ia11510d8db3fa6e471a4ebbdb371fd76b0812984
2019-01-09 13:50:33 -08:00
Srujan Gaddam
2870210598 Merge changes I09cec674,Iee28fa90,I1ef35e15
* changes:
  Modify Level 3 full decrypt path testing for 15.1
  Remove OEMCrypto_InitializeDecryptHash
  Update OEMCrypto documentation to 15.1
2019-01-08 17:32:14 +00:00
Fred Gylys-Colwell
9c95e4caae Remove OEMCrypto_InitializeDecryptHash
Merge from Widevine repo of http://go/wvgerrit/68464

The Full Decrypt Path Testing design has changed to remove
OEMCrypto_InitializeDecryptHash.  This CL updates the unit tests and
reference code.

Bug: 120795057
Test: unit tests

Change-Id: Iee28fa9034dc21cee81c5b894c192e260375eeee
2019-01-07 09:53:07 -08:00
John W. Bruce
9e82eccc2e Add Missing \n to OEC Log
(This is a merge of http://go/wvgerrit/69165)

This printf() in the OEMCrypto Unit Tests was causing two log messages
to run together in the log.

Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I5a981e201de347fc8fbdc50a94c7227f944f9e8c
2019-01-04 16:30:14 -08:00
Fred Gylys-Colwell
e5161a318e Verify double call to OEMCrypto_DeactivateUsageEntry
Merge of http://go/wvgerrit/68187

This adds a unit test to verify that OEMCrypto_DeactivateUsageEntry
may be called several times without an error or changing the entry's
state.

Bug: 80540710
Test: unit tests
Change-Id: I594594bfde75c3e38a3b9efc51a667613a5da6ed
2018-12-19 12:08:43 -08:00
Rahul Frias
25d29fd22b Use the std::chrono to get the time.
[ Merge of http://go/wvgerrit/67985 ]

Now that we can use C++11, we should use the cross-platform types for
clocks instead of the platform-specific versions.

Test: WV unit/integration tests.
Change-Id: I50318e3d1caf9e814f33f497f83c19c9f3c154a1
2018-12-13 12:09:04 -08:00
Rahul Frias
3c350b677f Use vec.data() instead of &vec[0].
[ Merge of http://go/wvgerrit/67984 ]

Getting the address of the first element is invalid when the size is
0.  Calling data() is valid when the size is zero so long as we
don't use the resulting pointer.  This is important when we pass the
pointer to low-level functions like memcpy.

Also, MSVC is stricter about this and doesn't allow indexing the 0-th
element when it is empty.  But GCC/Clang seem to be fine with it so
long as the object isn't used.

Test: WV unit/integration tests

Change-Id: Ic5d11da41dd3a185a63f86a6ea91e9b954fd699a
2018-12-13 12:05:56 -08:00
Srujan Gaddam
b10d5c2a8f Merge changes from topic "level_3_oecv15"
* changes:
  Changes to adapter + gyp to support v15
  Add full decrypt path testing functionality to Level 3
  Update pointers to substrings in Level 3
  Update level 3 reference API for v15
2018-12-11 19:54:39 +00:00
Srujan Gaddam
732c077f79 Changes to adapter + gyp to support v15
Bug: b/117558570
Test: Android, CE CDM, and Linux tests
Merge of http://go/wvgerrit/67566

This CL adds changes to support the Level 3 upgrade to v15 with both the
dynamic and static adapters. It also rearranges the wvcrc.cpp files so
that the tests have their own copy and Level 3 can just use the one in
ref/src.

Change-Id: Ieee2859601881aa1800622454e6ce0345eb94aa7
2018-12-06 23:04:12 +00:00
John W. Bruce
b771d93514 Google-style override & virtual
(This is a merge of http://go/wvgerrit/66625)

Google C++ Style dictates that methods which override base class or
interface methods should be declared "override" but not "virtual". Since
our codebase has not had access to "override" until now, many of our
classes do not follow this rule. I've updated as many places as I could
find to follow Google C++ Style, which should hopefully help us catch
errors better in the future.

Bug: 111851141
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: Ic23e2e482e967256da306791532b5fec7b81b2f2
2018-12-06 09:01:18 -08:00
Fred Gylys-Colwell
e59b976625 Update comments and unit tests for InstallKeyboxOrCert
Merge from Widevine repo of http://go/wvgerrit/66865

This CL updates the comments for the code that uses
InstallKeyboxOrCert to install a keybox or oem cert at runtime.  There
is also a new unit test for the device id.  There are not many unit
tests because we don't want to accidentally overwrite the production
keybox or cert on a device when running tests.

bug: 111725154
test: unit tests
Change-Id: Ide9b3d4732f3f96a723a128907babe7e59c02ffc
2018-11-26 14:08:17 -08:00
TreeHugger Robot
f76387d1fc Merge "Fix for off by one error and correct comments" 2018-11-26 06:11:21 +00:00
Fred Gylys-Colwell
0f57ebb5b4 Unit test for pointer alignment
Merge from Widevine repo of http://go/wvgerrit/66708

This adds a unit test to verify that LoadKeys still works if the message is not
word alligned.

Test: unit tests on desktop and taimen (x86 and arm)
Bug: 68783727
Change-Id: Ib081a2c21af710b294772513c2c777ef1ac0daf0
2018-11-20 14:51:28 -08:00
Fred Gylys-Colwell
3a3307242d Fix for off by one error and correct comments
Merge from Widevine repo of http://go/wvgerrit/66711

This addresses review comments for the OEMCrypto v15 CLs, as documented in
b/119685652.

Test: unit tests
Bug: 119685652
Change-Id: I0e7ce13dd80335eb1a12240df5c1df2c34ba4298
2018-11-18 14:00:28 -08:00
Fred Gylys-Colwell
f18ac47d71 Update oemcrypto adapter for v15 -> v14
Merge from master branch of Widevine repo of http://go/wvgerrit/66081
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/65962

This CL changes function names in the v14 level 3 libraries to work with
the dynamic adapter.  I also excluded several OEMCrypto unit tests from
running with a v14 oemcrypto because they require error code changes
introduced in v15.

Bug: 117888897 Fix backwards compatibility
Bug: 119313532 Integration test failing

Test: unit tests on taimen.  Play Movies, ExoPlayer, Netflix play on taimen.
Some unit tests do not pass because Taimen uses a v13 oemcrypto. Most pass.

Change-Id: Ib8eb8a89591fdba3055064c4bdf90523b01309a8
2018-11-16 17:14:02 -08:00
Fred Gylys-Colwell
246621c5ce Full decrypt path testing
Merge from master branch of Widevine repo of http://go/wvgerrit/66080
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64002

This CL updates OEMCrypto reference code and unit tests to support full decrypt
path testing.

Test: unit tests
Test: tested as part of http://go/ag/5501993
Bug: 34078913
Change-Id: Ia67374599d6619698a336f41513068ad04294e7f
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
4fa255ea51 Add Sandbox ID support
Merge from master branch of Widevine repo of http://go/wvgerrit/66078
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64022

This CL updates OEMCrypto ref code, unit tests, and core code for
setting the sandbox id before initializing OEMCrypto.

Test: unit tests only
Test: tested as part of http://go/ag/5501993
Bug: 115834255
Change-Id: Id9831680fe4db1c69413815931cae4bc80df0c01
2018-11-16 17:14:00 -08:00
Srujan Gaddam
b7e4b56934 Update OEMCrypto calls to use substrings (addendum)
Merge from master branch of Widevine repo of http://go/wvgerrit/66076
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64743

http://go/wvgerrit/64083 had some refactorings that weren't completely
accurate or slightly changed the meaning of some tests. This CL is an
addendum to that CL to fix those refactorings.

Test: tested as part of http://go/ag/5501993
Bug: 115874964

Change-Id: I37766a4c34de737eb9ca94ef781805435ee30dfd
2018-11-16 17:14:00 -08:00
Srujan Gaddam
4d5e0f961b Add tests for null kc/kc iv
Merge from master branch of Widevine repo of http://go/wvgerrit/66075
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64702

Bug: 118172995

Tests OEMCrypto_LoadKeys when given a KeyObject with NULL KeyControl or
KeyControl iv.
Test: tested as part of http://go/ag/5501993

Change-Id: I1a5d26b1e2ff395fbd5ef7769af1165222c1877e
2018-11-16 17:14:00 -08:00
Srujan Gaddam
e6439255ba Update OEMCrypto calls to use substrings
Merge from master branch of Widevine repo of http://go/wvgerrit/66073
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64083

As part of the update to v15, LoadKeys, RefreshKeys, and
LoadEntitledContentKeys should all use offsets and lengths into the
message rather than a pointer for its parameters. The CDM, tests,
adapters, and OEMCrypto implementations are changed to reflect this.

Test: tested as part of http://go/ag/5501993
Bug: 115874964

Change-Id: I981fa322dec7c565066fd163ca5775dbff71fccf
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
4550979f22 OEMCrypto Resource Rating
Merge from master branch of Widevine repo of http://go/wvgerrit/66072
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63764

This adds the function OEMCrypto_ResourceRatingTier to the oemcrypto referenece
code, dynamic adapter, and unit tests.

Bug: 117110800
Test: tested as part of http://go/ag/5501993

Change-Id: Idf47af405f0c69601108b75c788a97b30abdb39d
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
52b274a3a4 Add HDCP 2.3 to logs
Merge from master branch of Widevine repo of http://go/wvgerrit/66071
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63842

OEMCrypto tests log the HDCP value.  This CL updates those logs to include logs
for HDCP 2.3.

Test: unit tests
Test: tested as part of http://go/ag/5501993
Bug: 78773763
Change-Id: I7a3003e081c3c848b5d595ac241a0b546dacb747
2018-11-16 17:14:00 -08:00
Fred Gylys-Colwell
43a47a60c0 Add session parameter to OEMCrypto_CopyBuffer
Merge from master branch of Widevine repo of http://go/wvgerrit/66070
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63662

To make the threading model more clear, CopyBuffer is now a session function.
This means we need to pass in which session the current thread locks.

Test: unit tests.
Test: tested as part of http://go/ag/5501993
Bug: 113680369
Change-Id: I2fdd2cfcaab99f3793950b3845941463675f5e4c
2018-11-16 17:14:00 -08:00