Commit Graph

20 Commits

Author SHA1 Message Date
Cong Lin
8dc895664a Fix key type used in InstallOemPrivateKeyCanBeUsed test
Merge of https://widevine-internal-review.git.corp.google.com/c/cdm/+/208111

Signature is generated from public_key1, so we should use key_type1 for
signature verification.

Test: opk_ta_p40
Bug: 355011375
Change-Id: If532f3814c7a4b7899d574fc09d3d09b9bb18976
2024-10-08 18:09:22 +00:00
Cong Lin
08fb9ce43b Replace binary cbor object with cppbor builders in oemcrypto tests
Now that the Cppbor library is in place.

Test: opk_ta_p40
Change-Id: I0641e1598d30b178ea2b1feeaf8d4f328be0b23a
2024-02-22 15:16:59 -08:00
Cong Lin
ce2af4e96a Use SignedCsrPayload validator in omecypto provisioning tests
To ensure the ref impl of OEMCrypto_GetDeviceSignedCsrPayload() in OPK
and testbed returns the correct sample format.

Test: opk_ta_p40, run_fake_l1_tests
Bug: 300304834
Change-Id: I6d399774fbaac2e12096cf878d582cd3c1320318
2024-02-22 15:16:00 -08:00
Cong Lin
6c5b9aa271 Device info ref impl to return all required properties
Let the sample device info built by ref implementation include all
required fields to pass device info validation tests.

Test: opk_ta_p40, run_fake_l1_tests
Bug: 307968622
Change-Id: Ib6b7645a1d26347f6992dd3c3bc2f39d4a92b283
2024-02-22 15:13:52 -08:00
Cong Lin
64124a7832 Add BCC validation to oemcrypto unit tests
The returned BCC from OEMCrypto_GetBootCertificateChain() can be
validated by unit tests with BccValidator.

Test: run_fake_l1_tests, opk_ta_p40
Bug: 300304834
Bug: 307968622
Change-Id: I6312cb45548f5d8a711c13ea0356d6ec8db51082
2024-02-22 14:46:30 -08:00
Vicky Min
5f3bc77c52 Remove RestrictFilter() function and RSAPerformance test
Since we want to migrate to using GTEST_SKIP to skip unit tests instead
of GTEST_FILTER, we can remove the RestrictFilter() function which
filters the tests out using GTEST_FILTER. To do this, the RSAPerformance
test needs to be removed, which is acceptable since no one uses this
test anymore. However, b/299135804 is being used to track a new way to
either execute/track permance.

Bug: 251240681, 299135804
Change-Id: Ife59c468ee127f4c39d3be91707ca38a061b7895
2024-02-22 14:31:29 -08:00
Jacob Trimble
488a4647db Merge OEMCrypto KDF and usage functions
Since KDF functions are only used right before specific functions, this
merges them to simplify internal state within OEMCrypto.

Fixes: 299527712
Change-Id: I426cfcdc102bd73cf65cd809b213da2474f44b34
2024-02-22 14:24:35 -08:00
Vicky Min
b04fda2908 Skip API and time rollback tests with GTEST_SKIP
Bug: 251240681
Change-Id: Ie1cee828f239ddca03ad18aac4139e2e42038df3
2024-02-22 13:54:52 -08:00
Ian Benz
35cf9c2f99 Fix OEMCrypto test issues identified by Coverity
Change-Id: Ic9f4982bf022292d10a0a88f10648a46077ec0cf
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
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
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
Vicky Min
51c57c9e11 Small refactoring changes
1) Move some provisioning unit tests into
   oemcrypto_provisioning_test.cpp
2) Remove some test group comments

Bug: 253779846
Merged from https://widevine-internal-review.googlesource.com/176735

Change-Id: I3d02c23b63eb7949fbc6abf60a7dbe32086ef2c9
2024-02-01 13:40:50 -08:00
Matt Feddersen
27421a9161 Add OEMCrypto tests for Cast prov 4 flow
Expected flow, which begins with a device that has already been
provisioned with Prov 4 stage 1:
1. OEMCrypto_InstallOEMPrivateKey()
2. OEMCrypto_GenerateCertificateKeyPair() -> wrapped_csr_priv
3. OEMCrypto_LoadDRMPrivateKey(wrapped_csr_priv)
4. OEMCrypto_PrepAndSignProvisioningRequest() to create a Prov 4
   provisioning request message type with a CAST request in the
   message body
5. Server sends a Prov 2 response. Server side derivation uses CSR keys
   to derive session key, mac keys, and encryption keys.
6. OEMCrypto_DeriveKeysFromSessionKey(), same derivation as server side
7. OEMCrypto_LoadProvisioning(), use derived keys to verify + decrypt

The OEMCrypto_LoadDRMPrivateKey() step can happen before or after the
PrepAndSignProvisioningRequest() call.

Test: tests fail
Bug: 259452440

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

Change-Id: Id5e6737b187339ec93e3d0d03c28e2b379d60747
2024-02-01 13:40:50 -08:00
Vicky Min
a012466156 Use GTEST_SKIP for non keybox devices
Bug: 251240681
Merged from https://widevine-internal-review.googlesource.com/179090

Change-Id: I8c539bfbccde7f22fb732951a95715935935858f
2024-01-30 16:09:41 -08:00
Vicky Min
6d494fa76c Filter RSA 3072 tests
Merge from Widevine repo of http://go/wvgerrit/169089

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. Note: I think part of this CL got lost in
go/wvgerrit/167740, so this is adding the rest in.

Bug: 251240681
Merged from https://widevine-internal-review.googlesource.com/168237

Change-Id: I3002f705f7e3f4b38d0e5efef355e5c3f3529218
2023-03-28 20:30:22 +00:00
Vicky Min
f83698a164 Refactor missed provisioning and renewal tests
Merge from Widevine repo of http://go/wvgerrit/169079

Bug: 253779846
Merged from https://widevine-internal-review.googlesource.com/167738

Change-Id: If8fc484f02fc1544977f1fb3a5fe1fa42d7367d7
2023-03-28 20:30:22 +00:00
Vicky Min
64521717d8 Use GTEST_SKIP to skip prov 3.0 tests
Merge from Widevine repo of http://go/wvgerrit/169068

We want to transition to using GTEST_SKIP to skip unit tests instead of
modifying the GTEST_FILTER variable. This does so for provisioning 3.0
tests.

Bug: 251240681
Merged from https://widevine-internal-review.googlesource.com/167498

Change-Id: I997e1051f3bd7925bc69cf1b269a5bbbae8031b7
2023-03-28 20:30:22 +00:00
Vicky Min
54e6b3d45d Small changes to refactored unit tests
Merge from Widevine repo of http://go/wvgerrit/169064

This CL should cleanup some minor issues that existed after the initial
CLs refactoring the unit tests went in. The issues fixed should be:
1) duplicate decrypt tests
2) decrypt tests added to be run
3) removed unecessary header files
4) refactored some provisioning tests that I had previously overlooked

Bug: 253779846
Merged from https://widevine-internal-review.googlesource.com/167537

Change-Id: Ic474fbcf69a08c0482b5e74d0c80be2cd16702d8
2023-03-28 20:30:22 +00:00
Cong Lin
e8add8eed8 Sync oemcrypto files from cdm udc-dev to Android
Changes included in this CL:

166806: Update OEMCrypto_GetDeviceInformation() | https://widevine-internal-review.googlesource.com/c/cdm/+/166806
166808: Update Android L3 after OEMCrypto_GetDeviceInformation() signature changes | https://widevine-internal-review.googlesource.com/c/cdm/+/166808
166809: Decode device info and write it to CSR payload | https://widevine-internal-review.googlesource.com/c/cdm/+/166809
167158: Fix Android include path and copy_files | https://widevine-internal-review.googlesource.com/c/cdm/+/167158
167159: Fix common typos and use inclusive language suggested by Android linter | https://widevine-internal-review.googlesource.com/c/cdm/+/167159

165618: Explicitly state python3 where needed. | https://widevine-internal-review.googlesource.com/c/cdm/+/165618

166757: Update Android.bp for Android | https://widevine-internal-review.googlesource.com/c/cdm/+/166757
164993: Refactor basic oemcrypto unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/164993
164978: Update OEMCrypto Unit Test Docs | https://widevine-internal-review.googlesource.com/c/cdm/+/164978
166941: Update make files for OEMCrypto | https://widevine-internal-review.googlesource.com/c/cdm/+/166941

165279: Refactor license unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/165279
165318: Refactor provisioning unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/165318
164800: Add extra check for renew on license load unit test | https://widevine-internal-review.googlesource.com/c/cdm/+/164800
165860: Remove duplicate definition of MaybeHex() | https://widevine-internal-review.googlesource.com/c/cdm/+/165860

164889: Updated CoreCommonRequestFromMessage and fix test | https://widevine-internal-review.googlesource.com/c/cdm/+/164889
164967: Add OPK pre-hook and post-hook error codes | https://widevine-internal-review.googlesource.com/c/cdm/+/164967
165140: Add hidden device_id_length to v18 provisioning message | https://widevine-internal-review.googlesource.com/c/cdm/+/165140
165204: Fix memory leak in oemcrypto test | https://widevine-internal-review.googlesource.com/c/cdm/+/165204

165958: Fix oemcrypto_generic_verify_fuzz mutator signature offset | https://widevine-internal-review.googlesource.com/c/cdm/+/165958

166037: Support SHA-256 in OEMCrypto Session Util | https://widevine-internal-review.googlesource.com/c/cdm/+/166037

Test: Run GtsMediaTests on Pixel 7
Bug: 270612144

Change-Id: Iff0820a2de7d043a820470a130af65b0dcadb759
2023-02-28 11:21:05 -08:00