Commit Graph

8039 Commits

Author SHA1 Message Date
Kyle Alexander
213e66d6c2 Adding missing tests to run_all_unit_tests.sh
Merge of go/wvgerrit/191191

Test: ./build_and_run_all_unit_tests.sh

Bug: 324304830
Change-Id: I0fb65acbfde8a98c060fce03c2a0f83b1a10b55c
2024-02-08 21:43:32 +00:00
Rahul Frias
735476e96b Add a flag to enable Rikers
[ Merge of http://go/wvgerrit/191113 ]

Rikers will replace haystack for L3 protection. Haystack will still
be present to support offline licenses that were downloaded using
haystack in prior releases.

Bug: 262635528
Test: WVTS and unit tests
Change-Id: Idffa0002b2c7694df595fa9cac694806673377b8
2024-02-07 21:54:35 -08:00
Rahul Frias
10f6252e4d Add feature flag to change the CDM version to 18.0.2
[ Merge of http://go/wvgerrit/191139 ]

Adding an initial flag that include identifiable differences when
the feature is enabled or disabled.

Bug: 311951236
Test: WVTS tests
Change-Id: I57a8e05d3b7c0cb6b43cbef022b436330985fe11
2024-02-07 21:33:22 -08:00
Robert Shih
35d09f3f00 Move wv service relative_install_path to defaults
Bug: 323289757
Test: TreeHugger
Change-Id: I4dfd8836527f4c2d376ee9dd7f3dbf04a058a233
2024-02-01 13:40:53 -08:00
Alex Dale
57d231db1b Check if license exists before calling remove.
[ Partial cherry-pick of http://go/wvgerrit/186230 ]

The removeOfflineLicense() API in the Media DRM plug would attempt
to remove the specified license from L1, then retry L3 if L1 failed
for any reason.  This causes error emitted by L1 to be masked by
errors emitted from L3.  In particular, if an internal error occurs
on L1 when removing the license, because the plugin would then
try L3 which does not contain the license, the app will receive either
a "does not exist" or "needs provisioning" error from L3.

This CL changes the plugin to first determines which security level
the license exists for.  Then only attempts removal on that security
level.

Bug: 301910628
Bug: 291181955
Bug: 296300842
Bug: 302612540
Test: MediaDrmParameterizedTests GTS on bluejay
Merged from https://widevine-internal-review.googlesource.com/187611

Merged from https://widevine-internal-review.googlesource.com/187832

Change-Id: I3d3975f945d2e97cfa9d866baf6ca5cf901f8af5
2024-02-01 13:40:53 -08:00
Alex Dale
1183ae813f Filter out key set IDs based on ATSC mode.
[ Partial cherry-pick of http://go/wvgerrit/185854 ]

Certain GTS tests do not fully consider restrictions on ATSC devices.
In particular, GTS assumes if there are any key set IDs returned to
the app via the MediaDrm API, then the device must already be
provisioned.  ATSC license are special in that they may be available,
but the CDM is not provisioned while outside of ATCS mode.

To work around this assumption made by GTS, we filter out ATSC licenses
returned by getOfflineLicenseKeySetIds() when the device is not in
ATSC mode, and filter out non-ATSC license when it is in ATSC mode.

This is only a soft enforcement mechanism as calling the API with a
valid ATSC license while outside ATSC mode (or a non-TSC license in
ATSC mode) will continue to result in the failures experienced by
certain OEMs.

Bug: 301910628
Bug: 291181955
Bug: 296300842
Bug: 302612540
Test: MediaDrmParameterizedTests GTS on oriole
Merged from https://widevine-internal-review.googlesource.com/187610

Merged from https://widevine-internal-review.googlesource.com/187831

Change-Id: Id1508571ebb5c466f43bca99a2d79dc402a2134f
2024-02-01 13:40:53 -08:00
Matt Feddersen
c02de3f0e6 Update CHANGELOG link for v17.2
Merged from https://widevine-internal-review.googlesource.com/183778

In addition to the merge from oemcrypto-v17, this CL fixes a few header
indents and v18 tag links.

Merged from https://widevine-internal-review.googlesource.com/183782

Change-Id: I781aa69314acdeb48bff1af3c291c847f6a664ea
2024-02-01 13:40:53 -08:00
Cong Lin
5d72262eda Update OEMCrypto CHANGELOG for v18.4
Bug: 294440012
Merged from https://widevine-internal-review.googlesource.com/181191

Change-Id: I4d0726058b938a7d9767bbecd8553c92e81841da
2024-02-01 13:40:52 -08:00
Cong Lin
2db837bce4 Update OEMCrypto CHANGELOG.md for v17.2
Bug: 241146324
Merged from https://widevine-internal-review.googlesource.com/178978

Merged from https://widevine-internal-review.googlesource.com/179710

Change-Id: I385cab041e795d9ef2a5cb01e7ee71fe3290c84d
2024-02-01 13:40:52 -08:00
Matt Feddersen
5715fb527a Update changelog for 18.3
Merged from https://widevine-internal-review.googlesource.com/178050

Change-Id: Id4417754bdb9acabbbdbebbf913e4de87c933054
2024-02-01 13:40:52 -08:00
Matt Feddersen
6243410069 Remove WTPI_MaxBufferSizeForDecrypt and WTPI_ApplyCGMS
Bug: 277115746

Merged from https://widevine-internal-review.googlesource.com/170050

Change-Id: I744f4fe1837b776b50693a40535484e8fae092c4
2024-02-01 13:40:52 -08:00
Fred Gylys-Colwell
f8e8efe1d6 Log more license information
This CL logs some extra policy information from a license.

Bug: 305794515
Bug: 311529487

Merged from https://widevine-internal-review.googlesource.com/187887

Change-Id: I707afbb01b5467d2551c68a9152ca078815544eb
2024-02-01 13:40:52 -08:00
Robert Shih
7abdd4d0ae Misc formatting fix
Bug: 323289757
Test: TreeHugger
Change-Id: I26ec60855bf19a3ef87ca7bc86f3cb024e393c2b
2024-02-01 13:40:52 -08:00
Alex Dale
95917053f3 Added test printer for std::future_status.
Bug: 297082009
Test: run_zimperium_dev
Change-Id: I65904821de45a7d5bd515388dcaf9cace53a4893
(cherry picked from commit 61dd2b7951ace38a0710909928028144462db165)
2024-02-01 13:40:52 -08:00
Fred Gylys-Colwell
c53047bd1b Document huge buffer tests in separate group
Explain how the huge buffer tests work. In particular, state
that we expect that OEMCrypto returns an error on huge
buffers.

Staged here:
https://developers.devsite.corp.google.com/widevine/drm/client/oemcrypto/v18/oemcrypto-test/group/security

Bug: 300645748
Merged from https://widevine-internal-review.googlesource.com/188034

Change-Id: Iba9d652dfe57df6786b0ab60931f02f8ce9b8180
2024-02-01 13:40:52 -08:00
John "Juce" Bruce
3316870a0a Sony Patch to LicenseKeys::GetAllowedUsage()
Sony has identified a 5-year-old copy-and-paste error in
LicenseKeys::GetAllowedUsage(). For entitled keys, it was calling
CanDecryptContent() instead of GetAllowedUsage() on the entitlement key
session. This meant that for entitled keys, the allowed_usage parameter
was never updated and the return value of the function was indicating
something different than intended.

Bug: 280902715
Test: x86-64
Merged from https://widevine-internal-review.googlesource.com/174671

Merged from https://widevine-internal-review.googlesource.com/175296

Merged from https://widevine-internal-review.googlesource.com/175299

Merged from https://widevine-internal-review.googlesource.com/175350

Change-Id: Ic6f34a5110c7144778d5773d5c1cc5768f953e41
2024-02-01 13:40:52 -08:00
Geoffrey Alexander
17a1de8d2d Apply string obfuscation to license and provisioning strings
String obfuscation hides string literals from static analysis but
requires string literals be used inside protected functions.

- Enable string obfuscation for all function groups.
- Change some global `std::string` to `const char[]` to ensure that
  the `std::string` is constructed inside a protected function so
  that string obfuscation correctly applies to the string literal.

Bug: 270566889
Merged from https://widevine-internal-review.googlesource.com/168485

Merge conflicts were caused by formating changes. Resolved by taking
the newer version.

Merged from https://widevine-internal-review.googlesource.com/169511

Change-Id: Ie7f3e94f89671a34e4792efa174f96a17d713f9e
2024-02-01 13:40:52 -08:00
Robert Shih
a28f8bcf19 privacy_crypto_fuzzer: aes encrypt uses const iv
Bug: 323289757
Test: privacy_crypto_fuzzer
Change-Id: If3cde207fa726f6cbf8805cae0caa82a441c4173
2024-02-01 13:40:52 -08:00
Robert Shih
f3e9794a00 Use updated ProvisioningHolder ctor in test
Bug: 323289757
Test: core_integration_test
Change-Id: I1403b4779c434ce23f98fae3e1c061b06fdd4008
2024-02-01 13:40:52 -08:00
Robert Shih
fd90f4bc76 Find odk_serialize.h in Android integration test builds
Bug: 290252845
Test: cdm integration tests
Change-Id: Ie904543ea3df143a17845202cb01089fee7eb5f6
2024-02-01 13:40:52 -08:00
Cong Lin
dff87f04a9 Use LOGW when membarrier_function is not present in L3
membarrier_function() for clearing cache in L3 is optional and good to
have. Currently we log it as error if it is not available, which caused
some confusion for CE CDM L3 partners building their own L3.

Also corrected a typo in the function name.

Test: build L3 and run dynamic level3 tests
Change-Id: If20bcb1fe2bace33c43aa178af699f3b190a1fd2
2024-02-01 13:40:52 -08:00
Cong Lin
6327211db6 WVDrmPlugin changes to query device CSR payload for prov 4
Plugin to provide getPropertyByteArray("deviceSignedCsrPayload")
which returns the signed CSR payload for device registration. It
queries both BCC and device info to be set in plugin before calling this
getPropertyByteArray("deviceSignedCsrPayload") method. The returned csr
payload will be used by assemble the device CSR by the caller for device
registration.

Bug: 286556950
Test: build WV DRM plugin
Merged from https://widevine-internal-review.googlesource.com/178891

Merged from https://widevine-internal-review.googlesource.com/179731

Change-Id: I65d89ed998dd292fc656af2f91f4472c1b5ec33c
2024-02-01 13:40:52 -08:00
Ian Benz
a0f6b99cbe Fix TestSleep integer overflows identified by Coverity
Change-Id: Ibbc218100ea8a58c201bc6812cabc88dfd16f36e
2024-02-01 13:40:52 -08:00
John "Juce" Bruce
c232299f78 Allow CE CDM integrators to specify their own logging
This patch adds a new interface that partners must provide to
Cdm::initialize(), ILogger. ILogger replaces stderr as the sink to which
logging messages are sent. For partners that still want to log to
stderr, a reference implementation that logs to stderr is provided.

As a side-effect of this, many test-related source files had to be
updated to thread the new parameter to Cdm::initialize() through them.
This also necessitated adding a new variant of FormatString() that can
be called with a va_list directly so it can be called from other
functions that take varargs.

Bug: 201446862
Merged from https://widevine-internal-review.googlesource.com/177270

Change-Id: Ie31a10162773883b337f3a6144cf180a2b100139
2024-02-01 13:40:52 -08:00
Ian Benz
8e48e36554 Fix uninitialized variable in Provisioning40CastRoundTrip
- Initialize allowed_schemes_ since it is used by CreateDefaultResponse.
- Issue was detected by Coverity.

Change-Id: I368c4773f6316b65196aaa39e23e70717299c570
2024-02-01 13:40:51 -08:00
Ian Benz
35cf9c2f99 Fix OEMCrypto test issues identified by Coverity
Change-Id: Ic9f4982bf022292d10a0a88f10648a46077ec0cf
2024-02-01 13:40:51 -08:00
Cong Lin
28c2345413 Fix error check in ForbidPrepAndSign test
OEMCrypto_ERROR_INVALID_RSA_KEY is deprecated in v17. But
v16 oemcrypto can still return it. Unit test should allow
this error for now.

Test: run_dynamic_oemcrypto_v16.4, run_dynamic_oemcrypto_v16.3
Bug: 307668988

Change-Id: I950b62c8b3e02ea09d4795839a3d69573ab718aa
2024-02-01 13:40:51 -08:00
Fred Gylys-Colwell
8f3ee84c1b Unit tests for forbidden RSA key usage
This CL adds unit tests to verify that the following
forbidden uses of an RSA private key do not work:

- ForbidPrepAndSign -- A cast cert key cannot sign a license
  request.
- ForbidUseAsDRMCert -- A cast cert cannot be used with the
  DRM cert's padding scheme and it cannot be used to derive
  keys from a session key.
- *ForbidRSASignatureForDRMKey* -- A DRM cert key cannot be
  used with GenerateRSASignature.
- *OEMCertForbidGenerateRSASignature* -- An OEM cert key
  cannot be used with GenerateRSASignature.

Bug: 251875110
Change-Id: Ic2b23e3fd279e878c190a8294078a8d092126a29
2024-02-01 13:40:51 -08:00
Ian Benz
343324e97c Add missing #include to fix the OPK Linux build
Merged from https://widevine-internal-review.googlesource.com/185856
Merged from https://widevine-internal-review.googlesource.com/185910

Change-Id: I51d7a0fed2475333f459030005e796c2055fecc7
2024-02-01 13:40:51 -08:00
Fred Gylys-Colwell
36d4c4c4b7 Pretty print BuildInformation in unit tests
Change-Id: I1f702edc731454c84667c79e05c94b4360a40111
2024-02-01 13:40:51 -08:00
Alex Dale
ac5f0135d5 Cleanup install_keybox_tool
This tool will soon be used in LUCI tests.  It seemed necessary to
clean it up to make the build cop's job easier if there is a problem.

The following was completed:
* Removed stub for install XML based keyboxes
  * This is handled externally
* Improved error checking
* Replace C-style prints with C++ styled prints
  * Keybox information is still printed to stdout
  * Major erros are printed to stderr
* Updated to follow Google style guide
* Fixed header includes
  * Removed unused headers
  * Added headers that are used, but were included indirectly
* Ensures OEMCrypto_Terminate() is called
  * Particularly if there is an error encountered.

Bug: 299108238
Test: Tested in later CL
Change-Id: Ie6dafc44d050d0c6ae288f88cd5d6f3737d4a88c
2024-02-01 13:40:51 -08:00
Fred Gylys-Colwell
e0d30c5fc0 Rename LoadWithAllowedSchemes to LoadCastCertificateKey
The unit test helper function LoadWithAllowedSchemes should
only be used to load a Cast Certificate. So it has been
renamed to make that clear.

The only unit test that used the old function with the
non-cast padding scheme has been removed. A replacement will
be added in the next CL of the chain.

Change-Id: Id4aa2f420435baff664324ee4b3dcb74ab9ffe8a
2024-02-01 13:40:51 -08:00
Fred Gylys-Colwell
c89ca732f0 Clean up OEMCrypto unit tests for Android
Remove some stale tests.

Bug: 175122314
Change-Id: Ie110ffc28353fcdafaf7774d81a625f5d99f4213
2024-02-01 13:40:51 -08:00
Fred Gylys-Colwell
fd28f10559 Update OEMCrypto unit test date
This corresponds to the release date of v18.4

Merged from https://widevine-internal-review.googlesource.com/184139

Change-Id: I5e2714822932c52a82bd1f287111c11a4001f985
2024-02-01 13:40:51 -08:00
Fred Gylys-Colwell
b99d1213df Clean up logging of device id
It helps in debugging and scanning logs if the device id is
human readable.

Bug: 299108238
Change-Id: Ib358b71514b2ddcc61bc6239ff802d87dad7d3ef
2024-02-01 13:40:51 -08:00
Fred Gylys-Colwell
7bb0b06c03 Refactor provisioning unit tests
There was some confusion about which tests loaded a cert and
which ones just used a cert. This distinction is important
when testing devices with a baked-in-cert.

Merged from https://widevine-internal-review.googlesource.com/183333

Change-Id: I3c2b119c3355b3a9190799637ff0860b6153b35b
2024-02-01 13:40:51 -08:00
Vicky Min
5b831fc4f1 Skip entitlement session tests that are only supported on CAS devices
Bug: 297497167, 297244784
Merged from https://widevine-internal-review.googlesource.com/183690

Merged from https://widevine-internal-review.googlesource.com/183710

Change-Id: I09e5a961550467ceacd043b22c4d21085df82571
2024-02-01 13:40:51 -08:00
Fred Gylys-Colwell
05f3d0c524 Add install keybox tool and test
This adds an install keybox tool to the OEMCrypto unit test
directory. It is built when we build the OPK w/linux IPC.

This CL also adds some scripts to use this tool when running
the OPK Linux TA, and then runs the standard tests.

Bug: 295371549
Change-Id: I11e59faa3b24d906f573bcd3f4855e73a4aa5fdf
2024-02-01 13:40:51 -08:00
Vicky Min
e7017475b7 Use GTEST_SKIP for generic crypto tests
Bug: 251240681
Merged from https://widevine-internal-review.googlesource.com/180050

Change-Id: I5aebcf10f9c8bad5ff21c22bc882040ecd0b390a
2024-02-01 13:40:51 -08:00
Vicky Min
68eb8ee824 Skip Android tests after initialization
Bug: 297123471
Merged from https://widevine-internal-review.googlesource.com/183551

Change-Id: I742ad6115bb3d4dd3490eb7b18e4f62bfcc1447b
2024-02-01 13:40:51 -08:00
Ian Benz
ab6944dc59 Fix uninitialized field identified by clang-tidy
Merged from https://widevine-internal-review.googlesource.com/181950
Merged from https://widevine-internal-review.googlesource.com/182050

Change-Id: I87f1401a02c6e475b7c728c625fbe5fc7c71dea6
2024-02-01 13:40:51 -08:00
Matt Feddersen
0dbc42f10e CAS demo app
Adds a new `cas` directory to the ports/linux project. This contains
an end-to-end demo of OEMCrypto CAS functionality, using the Linux
tee_simulator as a base.

Test: from ports/linux/cas dir: `CDM_DIR=~/work/cdm-dupe ./scripts/build.sh && CDM_DIR=~/work/cdm-dupe ./scripts/run.sh`

Merged from https://widevine-internal-review.googlesource.com/178250

Change-Id: I781b403100ad2e069d99650d9ddae8e7acbc309a
2024-02-01 13:40:50 -08:00
Vicky Min
7d989e3448 Filter RSA 3072 tests
We want to transition to using GTEST_SKIP to skip unit tests instead of
modifying the GTEST_FILTER variable. This does so for tests that require
RSA 3072 support.

Bug: 251240681
Change-Id: I048d31e25316d621771efb5d472f651bff40bf75
2024-02-01 13:40:50 -08:00
Vicky Min
afbbad9aa5 Use GTEST_SKIP for session tests
Bug: 251240681
Merged from https://widevine-internal-review.googlesource.com/180010

Change-Id: I39e5c0365a5e0c2ddf62e6f68426f6baa3ddd1a1
2024-02-01 13:40:50 -08:00
Vicky Min
678b3332db Allow ODKs to be tested against older versions for Qualcomm
Bug: 276889732
Merged from https://widevine-internal-review.googlesource.com/179801
(cherry picked from commit af81eefde596cf1644e5451b03230c77cfde410b)

Change-Id: I7a99d3c3104f16898258785d17a9b9b7a2f53ad1
2024-02-01 13:40:50 -08:00
Vicky Min
e5aa80df88 Use GTEST_SKIP for non prov 4.0 tests
Bug: 251240681
Merged from https://widevine-internal-review.googlesource.com/179570

Change-Id: Ieb3e2dc0de3ad33c6407ee4cbcfbd39641b6df4c
2024-02-01 13:40:50 -08:00
Cong Lin
9d97c2bf60 Implement OEMCrypto_LoadCasECMKeys() with TODO WTPIs
Add function body of OEMCrypto_LoadCasECMKeys() with a few TODOs. At the
end, Cas content keys and IVs shall be installed to key slot by WTPIs,
which will be declared in the next CL.

Test: opk_ta
Bug: 241146324
Merged from https://widevine-internal-review.googlesource.com/169378

Merged from https://widevine-internal-review.googlesource.com/178139

Change-Id: Idf3930ec916e95012067741e46254018fc6e4381
2024-02-01 13:40:50 -08:00
Cong Lin
695b204545 Add test for zero subsample size
Decrypting zero subsample size should return success.

Test: opk_ta, run_fake_l1_tests, run_dynamic_level3
Bug: 279999069
Merged from https://widevine-internal-review.googlesource.com/178138

Change-Id: I3bbad9c63ee72bd6e8ea3b796d231116e59afdc7
2024-02-01 13:40:50 -08:00
Fred Gylys-Colwell
5c05e8a387 Lock OEMCrypto v18.3 API
Bug: 290252845
Merged from https://widevine-internal-review.googlesource.com/178093

Change-Id: I5067df6724b43e9e7d9e67b1a60e0e209f51adbd
2024-02-01 13:40:50 -08:00
Vicky Min
3ee5d69a91 Disable Android Keybox tests for prov 4.0
Bug: 288404945
Merged from https://widevine-internal-review.googlesource.com/178053

Change-Id: I339e7089efaa5082aae348f26ee853d7993fe1d3
2024-02-01 13:40:50 -08:00