Merge from Widevine repo of http://go/wvgerrit/24241
The CL also only modifies existing tests so that they will pass
with an old version of OEMCrypto, or it filters out the tests so
that they do not run. This positions us so that we can more
easily verify how much backwards compatibility we expect to work.
bug: 35877886
Change-Id: Iadc06672d7f9cef75800662ff83389c504a3fd04
Merge from Widevine repo of http://go/wvgerrit/23581
This CL adds some unit tests to oemcrypto to verify that DecryptCENC
and the generic encrypt and decrypt functions behave correctly when
the input and output buffer is the same. i.e. decrypt in place.
The mock and haystack are also updated to pass the tests.
b/34080119
Change-Id: Ie295bdaddbb8058bebb36f6dab092d307f249ecd
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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