Merge from Widevine repo of http://go/wvgerrit/65922
This CL puts the old 4121 test keybox back into the unit and android
integration tests so that we can run tests on a device with OEMCrypto v13.
This change should not be released, and should not be included in CE CDM. It
should be removed once we have more test devices with v14 or v15.
Bug: 119313532
Bug: 119316243
Test: unit tests
Test: tested as part of http://go/ag/5501993
Change-Id: If6a459e11176e07c66fbe6fc45c63d87595a20dc
Merge from Widevine repo of http://go/wvgerrit/62782
There were still some old test keyboxes in the unit tests for older devices and
in the mod mock. These are removed. Also, the cert with system id 7346 has
been removed.
The new test keybox has system ID 7912.
The new test cert has system id 7913.
bug: 76435251
Test: unit tests (unit tests do not pass on v13 oemcrypto)
Test: tested as part of http://go/ag/5501993
Change-Id: I6007b6650162d9dc9d01384faaafc87acdf8ebd7
Merge from Widevine repo of http://go/wvgerrit/61262
This CL helps the CE CDM unit tests provision by providing a helper code to
determine if OEMCrypto is L1 or L3.
Test: unit tests
Test: tested as part of http://go/ag/5501993
Bug: 37286053
Change-Id: Ibe358e0eb628b4051f2db3406eaa6fcfc07f07ff
(This is a merge of http://go/wvgerrit/65782)
We have had our own scoped_ptr implementation that is used throughout
the codebase. Now that we support C++11, we can replace these with
std::unique_ptr.
Doing this replacement exposed a few places where the two were not
interchangeable. OEMCrypto Ref was doing some unsafe things with passing
scoped_ptrs to functions and has been updated to use move semantics. And
a few constructors were explicitly constructing a scoped_ptr with NULL,
which is ambiguous with std::unique_ptr. These have been replaced with
default constructor calls.
Bug: 111851141
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I37d6d7aad4906709381c74f0c5439f826d2be768
Bug: b/117897682
Test: unit tests
Merge of http://go/wvgerrit/65223
Gtest setup does not call the base class' setup if it's defined in the
derived class. As a result, the WvCdmEngineTests were not installing the
test root of trusts in the OEMCrypto, which leads to segfaults when
using a key derived from the root of trust when a real root of trust
doesn't exist. The test class' setup is changed to use its base class'
methods, and logging is added to handle empty derived keys.
Change-Id: Ia574c4ade48206d771d6079fb3b67ccd7653428c
Merge from Widevine repo of http://go/wvgerrit/55460
This test ensures that different oemcrypto sessions can use different RSA keys.
bug: 110319198 Test concurrent sessions can use different DRM certificates
test: unit tests on taimen
Change-Id: Id75eedea347d453987dfe42894a8a7301e345674
Merge from Widevine repo of http://go/wvgerrit/57640
Add a unit test for OEMCrypto to handle a small buffer.
Test: unit tests
bug: 78233951
Change-Id: I5efe088705e2d248ab9ea45d8576daf69ad8bcdb
Merge from Widevine repo of http://go/wvgerrit/43660
This CL adds parameters to the mod mock to control various analog
output behaviour.
bug: 38005556
Change-Id: I308b300a2dd73f6bb7fb798d56c2c631a09f3765
Merge from Widevine repo of http://go/wvgerrit/58820
This adds an option to the oemcrypto mod mock so that it will limit
the usage table to the specified size. It returns the resource limit
error code when the maximum size is reached.
bug: 111260263
test: unit tests
Change-Id: I166b06855fba77ae8ddd13a922fe05be93f2c8f6
Merge from Widevine repo of http://go/wvgerrit/55461
This CL allows provisioning 3.0 devices to install their OEM certs
from an initialization partition. This method is already used for
keyboxes on Android -- we are just adding the ability to use it for
OEM certs, also.
Also, for v15, we require OEMCrypto to report a valid certificate in
the unit tests.
bug: 111725154
test: unit tests
Change-Id: I142c84a1a67bdb4cee943cfd12a632421901eb24
Merge from Widevine repo of http://go/wvgerrit/58200
This CL removes code from the testbed that is duplicated in the
reference code using inheritance.
bug: 76393338 Split mock into reference code and testbed code
test: unit tests
Change-Id: I7b5f5330a595fa1756e6dfdf75bc07addb6107a8
Merge from Widevine repo of http://go/wvgerrit/57720
Now that we have oemcrypto mock split into reference and testbed code, it is
time to remove the part of testbed that is an exact copy of the reference code
and just use the reference code.
Test: unit tests
Bug: 76393338
Change-Id: I3831a3f0118221c21ff1c28e6b6101b27b889012
Merge from Widevine repo of http://go/wvgerrit/57584
This CL is part of the long slog to split the mock into safer
reference code and dangerous test code.
bug: 76393338 (Step 4) Split mock into reference code and testbed
bug: 36515266 OEMCrypto Logging Cleanup
test: unit tests
Change-Id: Idbbf704a5947e2f161af7b71c328423f02982378
Merge from Widevine repo of http://go/wvgerrit/56526
This CL removes the test keybox from OEMCrypto reference code.
Test: unit tests
Bug: 76393338 split mock into ref and testbed
Change-Id: I4bf0eb777c6851191d0ac9ccf8e2b42c55c8f6b9
Merge from Widevine repo of http://go/wvgerrit/56523
In OEMCrypto v14, SelectKey can also return KEY_NOT_LOADED if the key
id is not found. This was added to help with entitlement licenses.
However, SelectKey in crypto session converts this to an unknown
error.
In this CL we change that to a NO_CONTENT_KEY_3 error. This is
probably only important because the generic crypto tests expect
NO_CONTENT_KEY_3 when we try to use an undefined key.
Test: existing unit tests pass, and some future unit tests pass.
Bug: 72354901 Turn on generic crypto tests
Change-Id: I3c0b7e6306cafd3feabc8aac7e47983c89194a26
Merge from Widevine repo of http://go/wvgerrit/56520
This CL adds a test base that installs a test keybox and catches nonce
flood errors for all CDM tests.
In order to do this, a new class is added called a
CryptoSessionFactory. The default factory just creates a new
CryptoSession. All places in the code that create a new CryptoSession
now call the static method MakeCryptoSession, which uses the current
factory to create a CryptoSession. If MakeCryptoSession is called and
there is no current factory, a default factory is created.
The CryptoSession constructor is now private, so that we do not
accidentally try to create one without using the factory.
For the new test base, we first create a special test
CryptoSessionFactory that creates a TestCryptoSession. The test
factory catches the first call to MakeCryptoSession and injects an
installation of the test keybox after OEMCrypto_Initialize is called.
The TestCryptoSession injects a sleep statement and a retry whenever
it detects a nonce flood.
Test: current unit tests still pass.
bug: 72354901 Fix Generic Crypto tests.
bug: 111361440 Remove #ifdef from unit tests
Change-Id: I248e7f3c53721c04d2af412ef835e19bb4d15d9a
Merge from widevine of http://go/wvgerrit/48885
iOS prohibits using clock_settime. In order to make the test consistent,
we set time using settimeofday instead.
Test: tested as part of http://go/ag/4674759
Change-Id: I8812b9b099fa8160591fafece070c34afeed82fa
Merge from Widevine repo of http://go/wvgerrit/46204
Refactor utility code - split the mock, step 1
Merge from Widevine repo of http://go/wvgerrit/46205
Move some OEMCrypto types to common header - split the mock, step 2
Merge from Widevine repo of http://go/wvgerrit/46206
Split mock into two -- step 3
Merge from Widevine repo of http://go/wvgerrit/47460
Split the mock into two -- step 3.5
The CL moves several files used by oemcrypto and cdm into a common
subdirectory, so that it may more easily be shared with partners.
The CORE_DISALLOW_COPY_AND_ASSIGN macro was moved to its own header in
the util/include directory.
This CL removes some references to the mock from other code, and puts
some constants and types, such as the definition of the keybox, into a
header in oemcrypto.
Test: tested as part of http://go/ag/4674759
bug: 76393338
Change-Id: I75b4bde7062ed8ee572c97ebc2f4da018f4be0c9
Merge from Widevine repo of http://go/wvgerrit/58440
This CL modifies the oemcrypto test TwoHundredEntries so that it
attempts to create more than 200 entries. A device is allowed to fail
when such an attempt is made, but it must return an insufficient
resources error.
The test then verifies that each of the entries that were succesfully
created can be used to reload its license and the keys can be used for
decryption.
It then shrinks the usage table header, and verifies that the
remaining licenses can still be used for decryption.
bug: 112486006
test: unit tests (test code only)
Change-Id: I6e6edfb00f0553724e0f99fb4e5ea5c817450937
To be compatible with latest googletest.
Test: compile
Change-Id: I15d857ce7b9b28ba5f75c84c61f1c6a970012ca7
Merged-In: I15d857ce7b9b28ba5f75c84c61f1c6a970012ca7
Some documentation updates.
Merge from Widevine repo of http://go/wvgerrit/50941
bug: 79940606 OEMCrypto_PST_Report are network byte order
bug: 79874942 [Documentation] PST_Report struct layout differs from documentation
bug: 74010869 CGMS Best Effort
test: documentation change only
Change-Id: I1e9149efcfa5d91c503b74e6776ebb8f25cda15c
Merge from Widevine repo of http://go/wvgerrit/50600
The entry count was really 201 -- it should be 200.
test: This code is unit tests only -- no production code.
bug: 79875327
Change-Id: Ib81253ce9d51a7157ea0a64cddeb6cc266b3e25e
Merge from Widevine repo of http://go/wvgerrit/50422
This CL adds unit tests to verify that a usage report can have the status
kInactiveUnused.
bug: 79556142
test: unit test code only
Change-Id: I10f71ac2e585ef33727aa8f80d867d80fe156ab8
Merge from Widevine repo of http://go/wvgerrit/49302
This CL adds some unit tests to verify that several OEMCrypto sessions
do not share nonce tables.
bug: 64850992
test: unit tests run on sailfish, taimen, and walleye.
Change-Id: I06cf3fdafb84f8b09cf2f0e58c1866bac511a293
Merge from Widevine repo of http://go/wvgerrit/49805
This aligns the oemcrypto reference code and unit tests to match the
API design doc: http://go/oemcrypto
bug: 79375509
test: unit tests pass
Change-Id: I13761a7384a17e99d88e61aaf80b4a22941fd172
Merge from http://go/wvgerrit/47640
Test: unit/integration tests
Bug: b/62058202
The usage table keeps track of license duration by using the current
system time. However, if a user were to rollback the time, they can
effectively continue offline playback indefinitely. This changes the way
we compute time by computing offsets by which the user rollbacked the
time and adding it to the current time. This change also includes a test
to verify protection against rollback for usage entries that is only run
when the user is root.
Change-Id: I97c430e1443747b0f9759ae5390b8f5d06bdebf1
Merge from Widevine repo of http://go/wvgerrit/47860
This CL updates the copyright notice to indicate that files
shared with partners are shared under the Widevine Master
License Agreement.
bug: 77926774
test: comment change only
Change-Id: I0423668111578b80fb39a932d763df2827e2dfc3
Merge of http://go/wvgerrit/45521/
Bug: b/73818548
Test: request_license_tests and GTS tests on sailfish and taimen
This change loads the mac keys into the session to be used in
GenerateSignature from the last call to one of: DeriveKeysFromSessionKey,
GenerateDerivedKeys, LoadKeys, and LoadUsageEntry. OEMCrypto tests are
changed to reflect this as well (specifically the order in which we call
the above methods).
Merge from Widevine repo of http://go/wvgerrit/44502
OEMCrypto v14 is no longer required for Pi, so this CL disables the
unit test verifying that version. The test will be re-enabled for
MR1.
test: unit tests
bug: 74003607
Change-Id: I76f9b66e1652ffb1f8a5bfc7be572e3c7a4cff83
Merge from Widevine repo of http://go/wvgerrit/43721
This CL allows the tester to change the nonce flood rate from the
default of 20. A tester would want this value to be larger to make
tests run more quickly.
Setting the rate to 1 makes every other nonce request a flood error.
A tester wants to do this in order to verify cdm code responds to
nonce flood correctly. Several failing oemcrypto tests have also been
corrected.
This CL changes test code only.
bug: 73607610
test: unit tests
Change-Id: I3f52ff7ea9bcc1db7bc0e010da0b64a12d3b4dd3
Merge from Widevine repo of http://go/wvgerrit/42942
This CL changes test code only.
Bug: 73132054
test: unit tests
Change-Id: Ic9ca1879a942b0cad8ea15a98ed263a5fd170b4c
Merge from Widevine repo of http://go/wvgerrit/42403
This CL changes the names of some unit tests so that they don't run
when testing an older version of oemcrypto.
bug: 68275290
test: ran unit tests against v8-v14 oemcrypto.
Change-Id: I773350adf4df3f3b310478400cd4d4e85789fc37
Merge from Widevine repo of http://go/wvgerrit/42402
This changes the AES key size back to 128 for keys that are not
entitlment keys.
bug: 72904259
test: unit tests
Change-Id: I07cc56050cafb82c65b67c56df3f18d375047eb8
Merge from Widevine repo of http://go/wvgerrit/42281
This cleans up some of the oemcrypto mock code. This code is only
used for testing.
bug: 72831885
bug: 69271232
Change-Id: I8add162839d6febe56a89df84e8ae0cf0b97a2d9
Merge from Widevine repo of http://go/wvgerrit/42064
This adds a unit test to verify that OEMCrypto can load a certificate
with an RSA private key generated using the Carmichael Totient.
bug: 67309725
test: No new failures. This code is part of unit tests only.
Change-Id: I492cf6bcff0ac2d1a838e7aa334c4b2b580ac5c7
Merge from Widevine repo of http://go/wvgerrit/42063
The dynamic adapter could not load old LoadKeys functions because the
spelling was wrong.
bug: 72646612
Change-Id: Ia6d917a17a95c48925496c5959ddb2bdff771241
Merge from Widevine repo of http://go/wvgerrit/42020
This CL fixes the OEMCrypto unit tests for refresh license.
Test: ran unit tests
bug: 64851667
bug: 72497813
Change-Id: Ice1661fd832793358b725be9016d85465f6b8d14
Merge from Widevine repo of http://go/wvgerrit/41680
These changes change the signature of LoadKeys to LoadKeys_V13 for the
Level 3. This change will be reverted once we update Level 3 to v14.
level3/x86/libl3oemcrypto.cpp Level3 Library 4464 Jan 23 2018 13:22:20
level3/arm/libl3oemcrypto.cpp Level3 Library 4445 Jan 23 2018 12:12:32
level3/mips64/libl3oemcrypto.cpp Level3 Library 7285 Jan 23 2018 15:48:51
level3/arm64/libl3oemcrypto.cpp Level3 Library 7283 Jan 23 2018 12:47:26
level3/mips/libl3oemcrypto.cpp Level3 Library 4465 Jan 23 2018 15:13:13
level3/x86_64/libl3oemcrypto.cpp Level3 Library 7284 Jan 23 2018 13:50:10
test: Play Movies plays on sailfish.
Change-Id: Ia492463cd15178b12908faa24af7fbbcfef22e77