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
Merge from master branch of Widevine repo of http://go/wvgerrit/66074
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/65102
Currently, the string only contains the mac_key_server, which isn't an
issue currently because we just get the offset into the message for the
enc_mac_keys pointer when calling LoadKeys, and rely on OEMCrypto to
read the 64 bytes. However, v15 will need the length of the enc_mac_keys
to reflect the true size.
Test: tested as part of http://go/ag/5501993
Bug: 115874964
Change-Id: Id76e91feb176755467c0433e6b0e87d2bb221033
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
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
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
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
Merge from master branch of Widevine repo of http://go/wvgerrit/66069
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/62420
This is the full API -- not just the delta.
Bug: 111939411
Test: docs only
Test: tested as part of http://go/ag/5501993
Change-Id: Id839bf10666e271c882fc437f9ebbd3941d23784
Merge from master branch of Widevine repo of http://go/wvgerrit/66068
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/62066
Bug: 111939411
Test: docs only
Test: tested as part of http://go/ag/5501993
Change-Id: Ic682b603cd6d90b10df433b76c071c303b4e35cc
Merge from master branch of Widevine repo of http://go/wvgerrit/66067
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63002
The OEMCryptoCENC.h comments are now generated from the doc. This corrects
several years of drift caused by small changes to the doc that were not copied
to the header.
Test: tested as part of http://go/ag/5501993
Bug: 111939411
Change-Id: I56ab9c6cf280bc72b39f6ddafc26cf21f6074c98
Merge from master branch of Widevine repo of http://go/wvgerrit/66066
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63628
The error code OEMCrypto_KEY_NOT_LOADED is redundant with
OEMCrypto_ERROR_NO_CONTENT_KEY and OEMCrypto_KEY_NOT_ENTITLED. The
function LoadEntitledContentKey should return KEY_NOT_ENTITLED if it
does not find the corresponding entitlement key in its key table. All
other functions that do not find a key id in the key table should
return OEMCrypto_ERROR_NO_CONTENT_KEY. This includes QueryKeyControl,
SelectKey, and RefreshKeys.
Test: unit tests
Test: tested as part of http://go/ag/5501993
Bug: 115574797
Change-Id: Ida2111f32e331b99f3f0c77fa404a42654d0870c
Merge from master branch of Widevine repo of http://go/wvgerrit/66065
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63080
This is for the reference code, the unit tests, and the oemcrypto adapter.
Bug: 116414218
Test: unit tests
Test: tested as part of http://go/ag/5501993
Change-Id: I05a631f6cfcf1584a748b3a0c9ae48633893589f
Merge from master branch of Widevine repo of http://go/wvgerrit/66064
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63063
This is in the reference code for OEMCrypto, and in the unit tetss.
Bug: 111939411
Test: unit tests
Test: tested as part of http://go/ag/5501993
Change-Id: I2cc2e7028f62d1c375eb632452eef94566fa9ae3
Merge from master branch of Widevine repo of http://go/wvgerrit/66063
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/62960
This CL reorders the functions in the OEMCrypto header to be the same as the
order in the API document.
Test: unit tests
Test: tested as part of http://go/ag/5501993
Bug: 111939411
Change-Id: Ic233b11141bf10f4a34b7d9c9c9288afed67aa14
Merge from master branch of Widevine repo of http://go/wvgerrit/66062
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/62880
This CL updates the OEMCrypto v15 header to add new functions and change the
signatures of functions that need changing.
Note: It does not update all of the comments in the functions. This will be
done in a future CL.
Bug: 111939411
Test: unit tests
Test: tested as part of http://go/ag/5501993
Change-Id: Ie08a8fd4b749f61cbac08fd67ac32dcd404848fc
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
(This is a merge of http://go/wvgerrit/65783)
Straightforward patch to replace our shared_ptr implementation with
std::shared_ptr, which works identically for all our use cases.
Bug: 111851141
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I9e8624dd3cab70a45941a45eb553c1ea0c077d2f
(This is a merge of http://go/wvgerrit/65264)
Now that we have C++11, we can remove Android's hand-rolled UniquePtr in
favor of std::unique_ptr.
Bug: 111851141
Test: Android Unit Tests
Change-Id: I96c2015aa2422da66a4bcbefb927dacc5f6e782f
(This is a merge of http://go/wvgerrit/65263)
Now that C++11 is mandatory, we can drop the OVERRIDE macro which was
inconsistently used in the codebase in favor of using the override
keyword directly.
Bug: 111851141
Test: CE CDM Unit Tests
Test: Android Build
Change-Id: I0b7559624b84feb19740afd63463dadd243412b0
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 of http://go/ag/5334065 and http://go/wvgerrit/65122 ]
Sessions were not being correctly released when CloseCdm() was called.
Broadcom noticed this issue and proposed the fix.
Bug: 117876077
Test: WV unit/integration tests, GtsMediaTestCases and playback tests
Change-Id: I8800744f2396f0955c76d5f3e187a69fe04330f6
[ Merge of http://go/wvgerrit/64682 ]
Looks like we do not delete control_block_
Bug: 117126556
Test: WV unit/integration tests
Change-Id: If0b4db163276bbf016bb81ed7e8ef56fa66ea30e
google::protobuf::uint64 is changing from unsigned long long to
uint64_t, which is sometimes unsigned long long and sometimes
unsigned long. Add a SetValue specialization for unsigned long.
Mark both the unsigned long and unsigned long long specializations
as sometimes unused, they will be unused if uint64_t is the other.
Bug: 117607748
Test: m checkbuild
Change-Id: I8bec0be6cd7e13354cf96a7e510fe2b920aec561
[ Merge of http://go/wvgerrit/64402 ]
Changes to support PSSHs for single content and entitlement licenses in the
same PSSH tightened up validation of PSSHs. Some of the test PSSH had
incorrect length fields which led to VTS test failures.
b/117265150
b/117616791
b/117616861
Test: VtsHalDrmV1_0Target
Change-Id: I86354817eb9060a7bcea774583c4d4155a400fff
[ Merge of http://go/wvgerrit/63782 ]
Add FALLTHROUGH_INTENDED for clang compiler.
Bug: 117675755
Test: build with global -Wimplicit-fallthrough.
Change-Id: I603042152ae8fb7e6518ca24e404df1d63097337
(This is a merge of http://go/wvgerrit/62780)
The EME spec requires that it be possible to do the following flow:
1) Generate a release request for a persistent session.
2) Close the session.
3) Load the persistent session.
4) Update the session with the release response.
This flow is used by Netflix in their API as well. However, our code did
not support this flow, as it rejected attempts to reload
partially-released sessions.
This patch changes attempts to load sessions that have already had
release messages generated into release-retry reloads, allowing them to
be released.
Bug: 113167010
Test: CE CDM Unit Tests
Test: Android CDM Unit Tests
Change-Id: I75bb7c75911e0fad1584bd8dd27f83c17f73bf45
(This is a merge of http://go/wvgerrit/60620)
The license code handles keys larger than 16 bytes correctly, but it
does not properly reject keys smaller than 16 bytes.
This patch adds unit tests not only for the new error case but also
the existing success cases which were not previously being tested. As
part of this, license_unittest was changed to use a Test Peer instead
of making the test fixture a friend class.
Bug: 111069024
Test: CE CDM unit tests
Test: Android unit tests
Change-Id: Idb2deb6fbe0aeb19b530f9818bebff480541f5c8
This log message was printed if initialization data was
not provided, which is actually not an error condition.
bug:116045153
Change-Id: I5597286ddf33d5b6c17f69f9a6a7cdba469b46b6
b/111246860
Merge of http://go/wvgerrit/60040
The libraries were built with the following optimization flags:
arm: -02
arm64: -02
x86: -01
x86_64: -01 (-02 was giving segfaults)
mips: -01
mips64: -01
linux: -02
AES tables are currently obfuscated as part of Haystack, and
deobfuscated everytime they're being used as part of decryption. This
adds a considerable performance hit in constantly loading and unloading
these buffers. Since they're open source code (see:
https://github.com/openssl/openssl/blob/master/crypto/aes/aes_core.c),
obfuscating them doesn't provide much benefit.
[ Merge of http://go/wvgerrit/60240 ]
Since the method is not a general purpose check and only verifies that
the key can be used for a given security level the method
has been renamed PolicyEngine::CanUseKeyForSecurityLevel.
Bug: 115701771
Test: WV unit/integration tests
Change-Id: Icd6789538bb709d2a48c67bbd7bc810f4b000e14
[ Merge of http://go/wvgerrit/54880 ]
Sending clear subsamples but filtering out encrypted ones,
before the keys have been loaded, causes problems during decode.
This is because subsamples that contain the first and last
subsample flags may be filtered out.
Clear subsamples that have first and last subsample flags set
will still be allowed to be passed to the decoder.
Bug: 110251447
Bug: 73447733
Test: WV Unit/integration tests.
Change-Id: I8c91c88f6313ad7b7b21c1c95e4c5787381949c1
Merge from Widevine repo of http://go/wvgerrit/55462
Instead of calling dlclose on liboemcrypto.so after each terminate,
this CL keeps the library loaded. Although the original bug
b/72831885 has been fixed, there is still some lingering worry about
possible hard-to-find resource leaks in dlclose.
For more context, see the discussion around the original bug
b/72831885. The fix that closed this bug has more discussion:
https://boringssl-review.googlesource.com/c/boringssl/+/25784 In
particular, we only fixed a known resource leak in boringssl, not in
any other libraries, and we added a patch that the borringssl team was
not very happy to include because it was not very thread safe.
bug: http://b/72831885 d2i_PKCS8_PRIV_KEY_INFO_bio returns null
test: unit tests on taimen.
Change-Id: I73b5e69bf300e03fe567b8e7e1d8e0e08b6bca37
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