Commit Graph

304 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
7112a5eec3 Add more slack to timing tests
Merge from Widevine repo of http://go/wvgerrit/24042

This CL adjusts the tolerance in tests that check the license_received
time.  This was periodically failing because a nonce flood might delay
the test by 1 second, which was being rounded up to 2.  The tolerance
is now 3.  The time is explicily used when it is available.  Some
extra logging is also added to the mock.

bug:31458046

Change-Id: I450880cb3cd8bd5ef66cba13b94dd963d2663d9a
2017-03-01 06:30:43 +00:00
Fred Gylys-Colwell
eade07c7a9 Minor build updates
This CL removes some unused variables, and changes some integers to
unsigned integers.  On some platforms, we were getting compiler errors
and unit test failures.

Merge from Widevine repo of http://go/wvgerrit/23840
    Use unsigned integer literals

Merge from Widevine repo of http://go/wvgerrit/23767
    Fix Gyp Files

Merge from Widevine repo of http://go/wvgerrit/23500
    Remove unused variables
    
bug: 31458046

Change-Id: I4dfec95ae49187262552fbbf322f3310ab777826
2017-03-01 01:48:56 +00:00
Fred Gylys-Colwell
582d3237c9 More Usage Table Tests
Merge from Widevine repo of http://go/wvgerrit/23865

This adds the following tests to the oemcrypto usage tables suite:
Forbid shrinking the usage table over open sessions.
Shrinking usage table must make it smaller, not larger.
Forbid creation of new usage table while open sessions using old.

Change-Id: Ia97a3f4d3ef53417c4f8c98f8ed6ef9ea06d7fad
2017-02-18 00:19:08 +00:00
Fred Gylys-Colwell
eeaaf311e1 Correct comments and nits from other reviews
Merge from Widevine repo of http://go/wvgerrit/23436

This change is just comment changes: minor rewording and grammar
fixes.

Change-Id: I4cb2ef77715623fdb2567f5b504ffaceb937a480
2017-01-30 15:26:43 -08:00
Fred Gylys-Colwell
e4231fea3b More OEMCrypto Usage Table Unit Tests
Merge from widevine repo of http://go/wvgerrit/23421

This CL adds some more unit tests for big usage tables, and corrects a
problem found in the reference code.

Change-Id: Iae9a4406d79a13362223c2b4da7365b845d92382
2017-01-30 15:26:43 -08:00
Fred Gylys-Colwell
49a61f6270 Merge "OEMCrypto Backwards Compatible Usage Table" 2017-01-30 23:24:52 +00:00
Fred Gylys-Colwell
a118988ecf Merge changes I4e4a6a01,I4e360ea5,I6e08e76f
* changes:
  Refactor OEMCrypto Engine
  Add Shared License bit to key control block
  Reference Code for Big Usage Tables
2017-01-30 23:24:39 +00:00
Fred Gylys-Colwell
9e153438db OEMCrypto Backwards Compatible Usage Table
Merge from widevine of http://go/wvgerrit/23283

This CL adds the backwards compatiblity functions to the new usage
tables in the oemcrypto mock reference code.

b/31458046
b/32554171

Change-Id: I04901d95aceb8910406f7c514c26c29c2c575322
2017-01-30 19:27:14 +00:00
Fred Gylys-Colwell
afb006f960 Merge "Add Unit Tests for Big RSA Keys" 2017-01-30 19:11:10 +00:00
Aaron Vaage
edb9f00df7 Widevine Metrics System
This change is the complete Widevine metrics system. It will
measure and record runtime information about what is happening
in the CDM - such as errors and throughput.

Bug: 33745339
Bug: 26027857
Change-Id: Ic9a82074f1e2b72c72d751b235f8ae361232787d
2017-01-27 16:59:17 -08:00
Fred Gylys-Colwell
650a0fdead Add Shared License bit to key control block
Merge from widevine of http://go/wvgerrit/23184

This adds the shared license bit to the key control block for the
reference code and the unit tests.

b/31458046

Change-Id: I4e360ea5dd2e6cee145663d4ab4f384b65cac427
2017-01-27 15:20:03 -08:00
Fred Gylys-Colwell
3d977d999c Reference Code for Big Usage Tables
Merge from widevine of http://go/wvgerrit/23283

This CL adds some big usage table functionality to the oemcrypto
mock and unit tests.

Still missing are: backwards compatibility, defragging the table,
haystack code, and lots of new unit tests.

The haystack now reports it doesn't support usage tables, so that
the unit tests will pass.  This will be fixed in a future CL.

b/31458046
b/32554171
b/34173776
b/34174907

Change-Id: I6e08e76f7612ffb77e413151e00f830339298c62
2017-01-27 00:11:52 +00:00
Fred Gylys-Colwell
1c5b4175aa Add Unit Tests for Big RSA Keys
Merge from widevine of http://go/wvgerrit/22958/

This adds unit tests for OEMCrypto to check 3072 bit RSA keys.  It
also adds indicates that the mock supports them.

b/32776334

Change-Id: I68a3ff56969a860602e6c230558478dc3577c8f5
2017-01-25 18:21:01 -08:00
Fred Gylys-Colwell
a24acfa928 Clang Format some OEMCrypto Files
Merge from Widevine repo of http://go/wvgerrit/23240

This CL runs clang format on some OEMCrypto test and mock files,
so it is easier to see what really changed in the next CL.

Change-Id: I0abf98fc8d312d5b94ad51c3ef2caae820b931de
2017-01-25 16:30:09 -08:00
Fred Gylys-Colwell
2afe783ce0 Unit Test Updates for v13
Merge from widevine of http://go/wvgerrit/23042

This updates unit tests to account for key control block changes for
OEMCrypto v13.  There are two new bits, restricting SRM version and
restricting analog output.  The verification string is also updated.

Part of this is to include some simple unit tests for the SRM
functions.

b/33815454
b/28955520

Change-Id: I7cc2ce508688fded2b67fc2a4379c7a8d59d8d22
2017-01-23 20:34:13 -08:00
Fred Gylys-Colwell
7152957e42 Replace PST Report with buffer
Merge from Widevine repo of http://go/wvgerrit/23044

On some platforms, the compiler will not pack structures.  This CL
replaces the OECrypto_PST_Report packed structure with a simple buffer
of uint8_t.  This changes the signature of OEMCrypto_ReportUsage as
part of OEMCrypto v13.

There is also a new wrapper class that test code, the mock, and debug
code can use to access data in the report.

The old packed structure definition is moved to the level 3, where we
use a compiler that packs sructs when asked nicely.

arm/libwvlevel3.a  Level3 Library 4445 Jan 20 2017 11:29:15
x86/libwvlevel3.a  Level3 Library 4464 Jan 20 2017 11:10:49
mips/libwvlevel3.a  Level3 Library 4465 Jan 20 2017 10:56:08

b/32180083

Change-Id: Ie138f034cb12780a2f8636888cebf022c52169e5
2017-01-23 19:53:45 +00:00
Fred Gylys-Colwell
a494eeafdc Add InactiveUnused to Usage Report status
Merge from Widevine repo of http://go/wvgerrit/22963

This change kInactive to kInactiveUsed and adds kInactiveUnused to the
possible values for the status field in the Usage Report.  This CL
updates the header, the unit tests, and haystack and reference code.

b/32714323

Change-Id: If8d8e32ea1e3dc18da34e5fae35f578b027de9c7
2017-01-23 19:53:24 +00:00
Fred Gylys-Colwell
b2a3921b37 OEMCrypto v13 Header and Stubs
Merge from Widevine repo of http://go/wvgerrit/22899

This is most of the header changes for OEMCrypto v13.  This updates
just enough of the code that existing unit tests build and pass.

The documentation will be reviewed in http://go/wvgerrit/22887.  When
that CL has been approved, comments in the code will be updated to
match.

Real code will be broken into several other CLs.

bug:31458046

arm/libwvlevel3.a  Level3 Library 4445 Jan 17 2017 20:01:26
x86/libwvlevel3.a  Level3 Library 4464 Jan 17 2017 19:00:37
mips/libwvlevel3.a  Level3 Library 4465 Jan 17 2017 19:24:35

Change-Id: I0318c53235c0b33afb623cba933365e09dec4e61
2017-01-23 03:28:28 +00:00
Fred Gylys-Colwell
a0c1f218c5 Test OEMCrypto with backwards compatible verification
Merge from Widevine repo of http://go/wvgerrit/22571

This adds unit tests to verify that OEMCrypto accepts all key control
block verification strings kctl, kc09, kc10, ....   This is needed now
that the unit tests use the current API for all other unit tests.

b/33253872

Change-Id: Ie6b556fc91cd6cb6e07141bd50da3dbfa1681fec
2017-01-20 16:40:23 -08:00
Fred Gylys-Colwell
50fe997cf2 OEMCrypto_GetDeviceID should return Not Implemented for Prov 3.0
Merge from Widevine repo of http://go/wvgerrit/22402

This CL updates the oemcrypto reference implementation (mock) to
return OEMCrypto_ERROR_NOT_IMPLEMENTED from OEMCrypto_GetDeviceID when
the device is configured to use provisioning 3.0.

This CL also moves unit test for OEMCrypto_GetDeviceID to the section
that is run only for keybox using devices.

b/33178932

Change-Id: Ie4f9346132ce305bdbd47474dc4c0f6268f3d444
2016-11-30 15:54:00 -08:00
Fred Gylys-Colwell
1d5a03cb40 OEMCrypto Refresh License Tests with PST
Merge from widevine repo of http://go/wvgerrit/22409

This CL adds unit tests for refreshing online and offline licenses
that have usage table entries.

b/32609464

Change-Id: I5166a43525ebb324bc2f253cee6b6f34da697cec
2016-11-30 15:52:29 -08:00
Fred Gylys-Colwell
7fc037f1a9 Update Key Control Verification String
Merge from widevine repo of http://go/wvgerrit/22382

This updates the key control verification string in the haystack, in
the reference oemcrypto (mock), and in the oemcrypto unit tests.

The unit tests now set the key control block to be kc12 for all
licenses if the API is set to version 12.  Previously, we only used
the more recent verification codes if the key control block used
recent features.

This should help prevent future incidents like b/32830469.

Change-Id: I6c215b4058445a6d807610af94457598f26d591a
2016-11-29 16:10:13 -08:00
Fred Gylys-Colwell
3e525dfdd3 OEMCrypto rewrap rsa key 3.0 unit tests
Merge from widevine repo of http://go/wvgerrit/21683

This CL adds unit tests for OEMCrypto_RewrapDeviceRSAKey30 for devices
that use provisioning 3.0.

Change-Id: Ib1a5566de343365b2ae3531f375ac2cc6d86ee53
2016-11-29 15:18:19 -08:00
Fred Gylys-Colwell
053ff5bd3c OEMCrypto Tests Provisioning Method
Merge from widevine repo of http://go/wvgerrit/21682

This CL updates oemcrypto/test/oec_device_features.cpp to figure out
the provisioning method and filter out tests that are not relevant to
the device's method.

This CL also introduces unit tests for GetOEMPublicCertificate.

Unit tests for RewrapDeviceRSAKey30 will be in a future CL.

Change-Id: Ib7065ce866d1171ca61b9aa08188fa2ac8d90fc2
2016-11-29 15:15:08 -08:00
Fred Gylys-Colwell
0fb76d5c1b Refactor OEMCrypto Unit Tests
Merge from widevine repo of http://go/wvgerrit/21681

This CL refactors some oemcrypto unit tests in preparation for adding
Provisioning 3.0 tests.

- The signature GenerateNonce has changed.  Instead of the caller
  passing in a pointer for the nonce, we store the nonce in a member
  variable of Session.

- GenerateDerivedKeys is being replaced by InstallTestSessionKeys.
  This sets up and calls the appropriate derive keys method.  This
  function is in the test class, instead of the session class so that
  multiple sessions in a class can share the same wrapped rsa key.
  This will be modified for provisioning 3.0 in a future CL.

- Rename tests that require a keybox.  Some tests are specific for
  using a keybox to request a DRM cert. These tests are renamed so we
  can filter them out on devices that use an OEM Cert.  Corresponding
  tests for devices using provisioning 3.0 will be in a future CL.

- Some member variables and methods in the class Session were not
  used.  They are removed.

- Added openssl smart pointer.

- Comments.  I added comments.

- clang format.

Change-Id: Ib579a322858e0ef92652a42167241b35cf85a041
2016-11-29 15:05:23 -08:00
Fred Gylys-Colwell
a200710d53 Add unit test to verify signature
Merge from widevine repo of http://go/wvgerrit/21521

On devices that use provisioning 3.0, the function
OEMCrypto_GenerateSignature will only be used for a license renewal.
This CL adds a call to OEMCrypto_GenerateSignature to the refresh key
tests.  Otherwise, there would be no coverage at all for that
function.

Change-Id: Icbd568eea3f9f256cc9b0b441f7907b316bb5b69
2016-11-28 21:54:03 -08:00
Fred Gylys-Colwell
47f454839e Unit Test for OEMCrypto_ERROR_KEY_EXPIRED
Merge from widevine repo of http://go/wvgerrit/21141

All of the decrypt calls and the SelectKey call should return
OEMCrypto_ERROR_KEY_EXPIRED on error.  This CL updates the oemcrypto
unit tests, reference mock, and level 3 code.

b/28294273

Change-Id: I7ac6a3652e0b2fe5a46071e1c2eda00daeed7a33
2016-11-28 21:52:11 -08:00
Fred Gylys-Colwell
7214064635 Use fast random for unit tests
Merge from widevine repo of http://go/wvgerrit/21560

For OEMCrypto v12 we explicitly require OEMCrypto_GetRandom to handle
buffers up to 32 bytes long.  This CL relaces the use of GetRandom
with openssl's RAND_psuedo_bytes to fill test vectors.

b/31464102

Change-Id: Ia0006b92bb12b98e9c130068dbb31b5f67281de2
2016-11-28 21:47:44 -08:00
Fred Gylys-Colwell
67b06a70e4 Buffer Size Unit Tests
Merge from widevine repo of http://go/wvgerrit/21260

This CL adds some oemcrypto unit tests for various buffer sizes, as
described in b/28887904 and the OEMCrypto v12 specification.

Encryption and Decryption buffers can be 100k large.  License request
and response messages can be 8k. A provider session token (pst) can be
at most 255 bytes long.

I also passed the code through clang-format.

b/28887904

Change-Id: Ia3e317c0f6466e663461e66b610c9a98a90efb0a
2016-11-28 21:44:36 -08:00
Fred Gylys-Colwell
f0cee3ad20 Require 20 keys per session and 10 sessions
Merge from widevine repo of http://go/wvgerrit/20981

OMECrypto v12 requires at least 20 keys per session and at least 10
sessions.  This CL updates the unit tests to verify this, and updates
level 3 and mock code to conform.

This CL also updates the level 3 oemcrypto to support 16 sessions and
320 keys total.

b/30140448 Minimum 20 keys per OEMCrypto_Session

Change-Id: Idd38d8f2cdfd6acde6fa7622b5912372bee9e488
2016-11-28 21:36:03 -08:00
Fred Gylys-Colwell
3b4e1d80bb Update oemcrypto_test.cpp
This is a merge from the Widevine repo of these three CLs:

http://go/wvgerrit/18008 Update OEMCrypto Performance Unit Test

http://go/wvgerrit/17901 Remove static initialization for member variable

http://go/wvgerrit/17214 Lengthen allowed time for simultaneous decrypt

There's also some code cleanup from http://go/wvgerrit/17971.

Change-Id: I81e1366594e1dbe65260aad96d9c8f77a116f508
2016-10-07 13:09:52 -07:00
Fred Gylys-Colwell
41c20425a8 Merge "Extract Session class from oemcrypto_test." 2016-09-08 18:01:57 +00:00
Fred Gylys-Colwell
626a416e5f Extract Session class from oemcrypto_test.
This allows the OEMCrypto session state to be accessed by
tests in other modules.  For example, keys can be added for testing
encryption and decryption operations in CDM-level tests.

Merge from Widevine repo of http://go/wvgerrit/18127,
http://go/wvgerrit/18591, http://go/wvgerrit/18581 and
http://go/wvgerrit/20802.

Change-Id: Ie0d071a2da610c0856ae6356a0abf054013a1b87
2016-09-07 17:10:09 -07:00
Fred Gylys-Colwell
ed3d0807bc Don't Increment IV for Partial Blocks in Unit Tests am: 3f040e0a9d am: 4b380dfb1b
am: dfd6df5cf9

Change-Id: I2fa15c7971020a7e9c0beed5400450d0206e412a
2016-09-07 18:48:00 +00:00
Fred Gylys-Colwell
3f040e0a9d Don't Increment IV for Partial Blocks in Unit Tests
Merge from widevine repo of http://go/wvgerrit/20660

For CTR encryption mode, when a subsample ends with partial block that
is continued on the next subsample, both blocks should have the same
IV.  This allows an implementation of OEMCrypto to optimize their
decryption algorithm.

b/31114392

Change-Id: I29a998b00f3bfb12c4bbbcb1fa1ebc371473fefd
2016-09-02 15:51:05 -07:00
Dan Albert
7ef26a32b3 Stop hard coding gtest things.
The headers are exported.

Change-Id: If095898ca8d9dfd2a807dcc35bc197e76963fff4
Test: mma
2016-08-17 12:30:17 -07:00
Jeff Tinker
6219322a1e Fix the order of test case name and test name
In the unit tests, the test case name and test name
are logged, but currently the test case and name are
reversed.  This CL orders them correctly, so instead
of, e.g. CheckHDCPCapability.OEMCryptoClientTest, we
get OEMCryptoClientTest.CheckHDCPCapability as intended.

Merge of go/wvgerrit/18045 from widevine repo

Change-Id: I20bb2d47de0c84b3a1f00bb46af5ed0a45d7fc56
2016-06-01 19:07:19 +00:00
Fred Gylys-Colwell
0b2223018d Remove pattern offset tests
Merge from widevine repo of http://go/wvgerrit/17877

The final spec for CENC says that partial encrypted blocks are only
allowed for "cenc" mode, and not for "cens" mode.  Also, the
pattern_offset must be 0 for all calls to OEMCrypto_DecryptCENC.

Review doc changes http://go/wvdelta11 and http://go/oemcrypto

Notice that this CL affects documentation and test code only.  No
production code is affected.

b/28718266
b/28817376

Change-Id: I1d6a38a763a2b693ea0c26bc909e1c721b8facaf
2016-05-17 15:15:18 -07:00
Fred Gylys-Colwell
2717f29707 Specify generic encryption buffer sizes
Merge from widevine repo of http://go/wvgerrit/17463

This CL updates the unit tests to verify that
OEMCrypto_Generic_Encrypt and OEMCrypto_Generic_Decrypt can handle a
buffer size of at least 100k.  It also adds code to the
oemcrypto_dynamic_adapter so that buffer sizes that are larger than
100k are broken into chunks of 100k.

All Nexus devices targeted for N pass these tests.

b/27040752

Change-Id: Iaf5c65d2f0b69e60f03cc99732d1ecab60658049
2016-04-14 15:02:59 -07:00
Fred Gylys-Colwell
2efc6821d2 Change an ASSERT to an EXPECT
Merge from widevine repo of http://go/wvgerrit/17202

This allows more checks in the test to run.  Returning the correct
error code is less important than the next check, which verifies the
signature was not computed.

This helps diagnose b/21708882, but does not fix it.

b/27787064

Change-Id: I65306c54b77370951bc54e8ef9f6140f58bea32c
2016-03-22 10:12:18 -07:00
Fred Gylys-Colwell
6a10503b61 OEMCrypto unit test with sample size = 160N+16
Merge from widevine of http://go/wvgerrit/17128

This CL adds a unit test for an edge case that would be handled
differently for HLS and CENC standards.  We enforce the CENC standard.

b/27524491

Change-Id: Ie3cdfaac0fe37dd0eb991179fd84f4e113e07dae
2016-03-16 11:48:43 -07: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
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
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
Fred Gylys-Colwell
1735b367f3 Level 3 OEMCrypto library
This CL contains the level 3 oemcrypto library built for android.  I
used the toolchain from the mnc-emu-release branch because I'm having
problems with the toolchain on master.

This includes the security patch API, and several bug fixes to the library.

Current versions:
mips/libwvlevel3.a  Level3 Library Dec 17 2015 21:26:57
arm/libwvlevel3.a  Level3 Library Dec 17 2015 21:09:47
x86/libwvlevel3.a  Level3 Library Dec 17 2015 21:19:15

http://go/wvgerrit/16371 Level 3 OEMCrypto library
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
http://go/wvgerrit/16280 Correctly handle bad RSA key

bug: 26089773
bug: 26092100
bug: 26086944
Change-Id: I3ea1b5d219dae0c88deafa742f61d67e97297902
2015-12-18 11:18:16 -08:00
Fred Gylys-Colwell
4a37b21a22 Close session before terminate
Merge from the widevine repo of http://go/wvgerrit/16362

A test class holds a default session that it expects to be able to
close in the tear down.  This was not true in the TimingTest because
it calls OEMCrypto_Terminate which closes all open sessions.

This CL closes the default session, and then reopens it again after
OEMCrypto_Initialize.

Change-Id: Ib4128ec3c0a33794c03aa934174cb6fff448483e
2015-12-16 17:26:26 -08:00
Fred Gylys-Colwell
ce6d392041 Unit Tests for Security Patch Level
Merge of widevine change http://go/wvgerrit/16249

This CL adds unit tests and reference code for the security patch
level, which is a new feature in OEMCrypto v11.  This CL also adjusts
the dynamic and static adapters to still run with devices that have a
v10 OEMCrypto.

The level 3 haystack code will be updated in a future CL.

bug: 26188985

Change-Id: I518ef46b4098cf3718fe0c0390bfb6825db4fb6b
2015-12-16 16:11:13 -08:00
Fred Gylys-Colwell
17faabee44 Fail early in oemcrypto unit tests
Merge from widevine of http://go/wvgerrit/16293

This CL adds ASSERT_NO_FATAL_FAILURE around many subroutines in the
oemcrypto unit tests.  This should help debug tradefed tests because
it will cause a test to stop after the first error.  This is important
for tests that are failing on OpenSession and then spewing garbage
into the log as every other ASSERT fails after that.

I also replaced the home-grown EXPECT_ALMOST with the standard
EXPECT_NEAR.  I also passed the file through clang-format to corect
whitespace problems.

Change-Id: I2c2c1c1dbeac234291dafc9fa8c23da8d270eb4e
2015-12-16 13:39:29 -08:00
Fred Gylys-Colwell
0dc746a380 OEMCrypto v11 Documentation and Headers
Merge from widevine repo of http://go/wvgerrit/16186

These are the OEMCrypto v11 documents and header files. I have updated
just enough code so that existing unit tests pass.  New unit tests,
the reference implementation, and the level 3 implementation are in
future CLs.

Change-Id: I9bbf1909e047f63a5877320a2d06740a3c4a3e32
2015-12-09 13:51:18 -08:00
Fred Gylys-Colwell
a99825b7aa Unit Test for OEMCrypto to Reject Future Key Control Block
Merge from widevine repo of http://go/wvgerrit/16250

The verification string in the key control block has an obvious
pattern that is incremented every time we update the API.  This CL
adds a unit test to make sure an implementation of OEMCrypto is not
casually accepting a future version of the key control block before
the API has even been defined.

Change-Id: I3f837f7346ef7de399441f5fcda9b13b65fa51f4
2015-12-09 09:58:36 -08:00