Commit Graph

8138 Commits

Author SHA1 Message Date
Cong Lin
0e165f6d54 L3 v19: Rebuild Android L3 and update .bp files
Regenerate L3 after fixes and add new source to .bp files.

Test: Build Widevine apex in Android main
Change-Id: I93fd5cf22437a2c8e6d2b60d9994dbf97f4ba213
2024-02-23 08:47:13 -08:00
Cong Lin
47ef97c747 L3 v19: Add missing v19 function declarations
OEMCrypto_PrepAndSignReleaseRequest() and OEMCrypto_LoadRelease()
declarations are needed for L3 static adapter to build.

Test: run_level3_static_tests
Bug: 323957284
Change-Id: I9ccb4e51fd404b6a49e865545e9a5b4f22169cf7
2024-02-23 08:41:07 -08:00
Cong Lin
3ab4591953 L3 v19: Fix OEMCrypto_SetDecryptHash signature
OEMCrypto_SetDecryptHash() is refactored in v19 to take less parameters.
The implemention of this function has been done here:
https://widevine-internal-review.git.corp.google.com/c/cdm/+/180670

Function signature in the leve3_adapter needs to be updated.

Test: run_dynamic_level3
Bug: 320525541
Change-Id: Ieb3f3868f1753c246d1d5c36d069f8ef59fafdea
2024-02-23 08:40:08 -08:00
Cong Lin
5f7bbf0013 Update L3 LoadLicense() and LoadProvisioning() to work with new KDF
functions

In CL https://widevine-internal-review.git.corp.google.com/c/cdm/+/183531
KDF was merged into new OEMCrypto_LoadLicense() and
OEMCrypto_LoadProvisioning().

This change renames L3 existing old functions with suffix _V18, and adds
the two new functions.

Note: jenkins/run_dynamic_level3 and jenkis/run_level3_static_tests
can't be enabled util https://b.corp.google.com/issues/320525541 is
resolved.

Test: the generated L3 from this CL can pass static and dynamic adapter
tests with commit ID 567069f2fb800c4ec4e844e03273d1924ae6673b. More
updates may be need to L3 source for it to work with the latest
oemcrypto-v19 branch.
Bug: 299333403

Change-Id: If6dec630c00b65468d4194196f3ff6f308c6dbe8
2024-02-23 08:39:49 -08:00
Jacob Trimble
c5d06cb7c7 Remove namespace from Level3 aliases
Since the L3 functions are meant to alias the OEMCrypto functions,
they shouldn't appear in a namespace.

Change-Id: I8d11279ff86c5b5c9eab0598d134f6904f0021ad
2024-02-23 08:39:35 -08:00
Jacob Trimble
955c89315e Add basic Level3 adapter
As part of the new L3, we need to select between the new Zimperium-based
CDM and Haystack.  This will happen with an adapter; this adds a
basic adapter that only calls to haystack directly.

Bug: 315358872
Change-Id: I970646d687dadbe4ae04bdf0da00730fd882cd65
2024-02-23 08:35:26 -08:00
Cong Lin
13dab7dd61 Fix oemcrypto v19 android test and cppbor dependency
OEMCrypto_LoadProvisioning() has changed signature in v19.
Added lipcppbor library and utils to Android tests.

Test: build_all_unit_tests.sh
Bug: 324147162
Change-Id: Id890f97602f684e38d6e42cace9d5dc225958bec
2024-02-22 17:14:19 -08:00
Ian Benz
6d56eed754 Fix oemcrypto-v19 issues identified by Coverity
Change-Id: Idd79f02337640047979f5a41dd922d14c78c3b2e
2024-02-22 17:13:42 -08:00
Cong Lin
4638259a0c Add X509 BCC type to protobuf and update oemcrypto adapter
BCC supports two types of format: CBOR and X509. The latter will be
used by Chrome OS. In case of Prov4, BCC type will be queried by
OEMCrypto_GetBCCType() and the returned value is populated in the
provisioning request.

This CL adds X509 type to protobuf, a call from CDM to query BCC type
and OEMCrypto adapter changes for this call.

Test: run_fake_l1_tests, opk_ta_p40
Bug: 307969500
Change-Id: I88acc36da6cb413d537a9ea9dfd2a150d4557595
2024-02-22 17:13:30 -08:00
Cong Lin
baedda469b Fix GenerateDerivedKeys_V18 call in dynamic adpater for prov4
The deprecated GenerateDerivedKeys_V18() should only be called by
OEMCrypto_PrepAndSignProvisioningRequest() in case of prov2.

Test: run_dynamic_oemcrypto_v18_p40
Bug: 317900423
Change-Id: Iff75c26a3ea107fb01e636c53528e845e24193bd
2024-02-22 17:12:41 -08:00
Fred Gylys-Colwell
7491e5e486 Add odk golden tests to Android.bp
Bug: 323289757
Test: Android TreeHugger

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

PiperOrigin-RevId: 605786801
Change-Id: Iceb495308cf1942ef916120d2fed059366e897ec
2024-02-22 17:12:41 -08:00
Googler
5f980424e2 Fix 12 IncludeCleaner findings:
* Used header "video/widevine/export/common/oemcrypto_core_message/odk/include/OEMCryptoCENCCommon.h" is not included directly (4 times)
* Used header "video/widevine/export/common/oemcrypto_core_message/odk/include/core_message_features.h" is not included directly (3 times)
* Used header "video/widevine/protos/public/certificate_provisioning.proto.h" is not included directly (2 times)
* Used header "video/widevine/export/common/oemcrypto_core_message/odk/include/odk_structs.h" is not included directly
* Used header "video/widevine/export/common/oemcrypto_core_message/odk/include/odk_target.h" is not included directly
* Used header "third_party/absl/log/log.h" is not included directly

* See go/include-cleaner for more information about the tool that generated this change.
* The global approvers for this change category are currently piloting the go/reviewbot tool so you may see global-review-bot-composite as the approver. Please contact code-health-team@google.com if you have any questions/concerns about the approval process.

See go/include-cleaner-lsc-approval for more information on why you've received this change and why it is important.

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/include-cleaner-bug for category IncludeCleaner if there's an issue with the CL content.
* File a bug under go/rosie-bug if there's an issue with how the CL was managed.
* For all other issues such as the formatting of the CL, please file a bug under
go/clrobot-bug.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/METADATA by
following go/clrobot#how-to-opt-in. Anything wrong with the signup? File a bug
at go/clrobot-bug.

#codehealth

Tested:
    Local presubmit tests passed.
PiperOrigin-RevId: 605228343
Change-Id: I7f5f581b6b2e2b359317324df7097f9da101ab94
2024-02-22 17:11:57 -08:00
Googler
e53e8ced89 Fix potential integer overflows identified by Coverity
Convert ODK_LAST_STRESSABLE_TYPE to an aliased enum value so that
ODK_FieldLength always returns a valid value instead of SIZE_MAX.

PiperOrigin-RevId: 602823670
Change-Id: I7a843cacca8201677c0f31249112c04f6c3e04cb
2024-02-22 16:33:43 -08:00
Matt Feddersen
b239b11b60 Edit copybara rules to remove absl::Span
PiperOrigin-RevId: 601558492
Change-Id: Id09178209b9258c810b61c749582c995fac518b1
2024-02-22 15:17:19 -08:00
Googler
6bf182af45 Fix 2 AbslSpanParams findings:
* This is a change required to migrate function parameters to absl::Span from const std::vector (2 times)

See go/vector2span for more information on why you've received this change and why it is important.

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/absl-span-params-bug for category AbslSpanParams if there's an issue with the CL content.
* File a bug under go/rosie-bug if there's an issue with how the CL was managed.
* For all other issues such as the formatting of the CL, please file a bug under
go/clrobot-bug.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/METADATA by
following go/clrobot#how-to-opt-in. Anything wrong with the signup? File a bug
at go/clrobot-bug.

#codehealth

Tested:
    Local presubmit tests passed.
PiperOrigin-RevId: 601411040
Change-Id: I4235e711867fde7cf3c9f27bb0cae3453853394d
2024-02-22 15:17:19 -08:00
Googler
8bf106f188 Fix 1 AbslSpanParams finding:
* This is a change required to migrate function parameters to absl::Span from const std::vector

See go/vector2span for more information on why you've received this change and why it is important.

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/absl-span-params-bug for category AbslSpanParams if there's an issue with the CL content.
* File a bug under go/rosie-bug if there's an issue with how the CL was managed.
* For all other issues such as the formatting of the CL, please file a bug under
go/clrobot-bug.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/METADATA by
following go/clrobot#how-to-opt-in. Anything wrong with the signup? File a bug
at go/clrobot-bug.

#codehealth

Tested:
    Local presubmit tests passed.
PiperOrigin-RevId: 601343954
Change-Id: I1d138aee430e96915a238464ee3b2277ce9b6772
2024-02-22 15:17:19 -08:00
Cong Lin
cd104160bd Fix session id in dynamic adapter for OEMCrypto_LoadLicense()
Missing "pair." for a few spots.

Test: oemcrypto unit tests
Bug: 299333403
Change-Id: I99ecb7fc42f88b431d293b3edeb5903b8f24e1e7
2024-02-22 15:17:12 -08:00
Matt Feddersen
4626fa18ce Check provisioning method in LoadProvisioningCast v18 dynamic adapter
Test:GTEST_FILTER="*TestSignaturePKCS1*" ./jenkins/run_dynamic_oemcrypto_v18
Bug: 317900212

Change-Id: I9829cf59b13320d69fddadaaba0a013e241f0b16
2024-02-22 15:16:59 -08:00
Googler
fb380d9a0e padding_u32 appears to be dead and not tested.
This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/scythe-bug for category DeadCode if there's an issue with the CL content.
  See also go/scythe-known-issues.
* See go/abandoned-code for more information on what is considered dead code and why removing it is important.
* File a bug under go/rosie-bug if there's an issue with how the CL was managed.
* For all other issues such as the formatting of the CL, please file a bug under
go/clrobot-bug.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/video/METADATA by
following go/clrobot#how-to-opt-in. Anything wrong with the signup? File a bug
at go/clrobot-bug.

#codehealth

Tested:
    Local presubmit tests passed.
PiperOrigin-RevId: 596797565
Change-Id: I01cbdf234c27c10cca092afda94858c2ed35cacf
2024-02-22 15:16:59 -08:00
Jacob Trimble
11a7b0236a Update Android.bp for new L3
The new vendor code requires some new header libraries to work correctly.

PiperOrigin-RevId: 596077868
Change-Id: I7d12f113f8457dfc3317f2a602c65cf7fe9bd703
2024-02-22 15:16:59 -08:00
Googler
a893d56248 Fix 3 ClangTidyPerformance findings:
* do not use 'std::endl' with streams; use '\n' instead For more info see go/clang_tidy/checks/performance-avoid-endl (3 times)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/clang-tidy-bug for category ClangTidyPerformance if there's an issue with the CL content.
* File a bug under go/rosie-bug if there's an issue with how the CL was managed.
* For all other issues such as the formatting of the CL, please file a bug under
go/clrobot-bug.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/video/METADATA by
following go/clrobot#how-to-opt-in. Anything wrong with the signup? File a bug
at go/clrobot-bug.

#codehealth

Tested:
    Local presubmit tests passed.
PiperOrigin-RevId: 595366848
Change-Id: If21671ab8613c5efd069071d5bf93bf294004423
2024-02-22 15:16:59 -08: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
Matt Feddersen
dd506a5c5b Update setup.sh to allow third party libcppbor use
Change-Id: I2d92ba22c31908a317d20fd87c7d900c5b6bf300
2024-02-22 15:16:57 -08:00
Matt Feddersen
4fdeaf41b0 Update lock file for v19.0
Change-Id: I342bcc70f013e421f1a6351612a776f09fb75cc7
2024-02-22 15:16:48 -08:00
Matt Feddersen
fc361dd566 Update "tests last updated" date
Change-Id: Ibe9edd6f66137c8d414b24aedf366e1d0f61bc7e
2024-02-22 15:16:46 -08:00
Fred Gylys-Colwell
8c4978e5a3 Explain error OEMCrypto_ERROR_TOO_MANY_SESSIONS
Bug: 310668207
Bug: 297917375
Change-Id: I6b1333b890e7cca63516389561146e79d7198d92
2024-02-22 15:16:24 -08:00
Fred Gylys-Colwell
34ac11b187 Document OEMCrypto_LoadProvisioningCast
Bug: 314222872
Change-Id: I05031d1eacefceb73931b979ef69e69fdba871a7
2024-02-22 15:16:09 -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
778d4f7026 Add Signed CSR payload validator to oemcrypto util and unit tests
Validator that can parse and validate SignedCsrPayload Cbor object.
The SignedCsrPayload is generated by
OEMCrypto_GetDeviceSignedCsrPayload() and will be put into prov4 CSR
request during factory uploading.

Test: opk_ta_p40
Bug: 300304834

Change-Id: Ib569dc22fe76dbaa98657e96aa4c93a272bbcd1b
2024-02-22 15:15:05 -08:00
Matt Feddersen
d89faef0f3 Add CHANGELOG for OPK v19.0 release
Change-Id: I1fd79428c357b8e0f9fd2a4ec857d7b3489eea64
2024-02-22 15:14:17 -08:00
Vicky Min
4c9a8e32a5 OPK implementation for license release
Bug: 295956275
Change-Id: I68dda02997f8897043c13ae261dde45276e66cc9
2024-02-22 15:14:07 -08:00
Vicky Min
a6de51a3b4 Update headers for deprecated functions
Bug: 295956275
Change-Id: Ic2711e4671a1e8ffcf9220fcd1de4471fa6b2ec3
2024-02-22 15:13:54 -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
Fred Gylys-Colwell
94c547eef9 Fix markdown link
Change-Id: Ib0e44a5bca0d3e430051086dd8b42f09c605a254
2024-02-22 15:12:40 -08:00
Vicky Min
3f48387e1c Fix dynamic adapter for license release
Bug: 315186308
Change-Id: If80760d8db4929f1c23917b0e3a86ed38309b487
2024-02-22 15:12:39 -08:00
Cong Lin
d8ce542ff9 Add Device info validator to oemcrypto util and unit tests
Validator that can parse and validate device info Cbor object.
This is to support better prov40 unit tests regarding
OEMCrypto_GetDeviceInformation() later.

Test: opk_ta_p40
Bug: 300304834
Change-Id: Ic260a6626dffcbef5d6b386263839499f83a69db
2024-02-22 15:12:37 -08:00
Vicky Min
d5157c536d OEMCrypto unit tests for license release
Bug: 295956275
Change-Id: I3c8fc5fcadeae051cc734a64378e473492437c34
2024-02-22 15:10:08 -08:00
Cong Lin
f94a8dfac9 Update documentation for BCC signature generation
Including the option of signing by keybox and some disclaimers..

Bug: 297918188
Change-Id: Ic6294ea9f04f6fa6dd721242c8539341157c1292
2024-02-22 15:09:57 -08:00
Vicky Min
746bab1712 Remove unecessary fields from ODK_ParseRelease
PiperOrigin-RevId: 588908051
Change-Id: Ia71536902cb19be29de1f984a74355d348de397e
2024-02-22 15:09:47 -08:00
Vicky Min
d2963a8cc5 Update dynamic adapter for license release
Bug: 295956275
Change-Id: Ia166becdd519c8bb21f1f8d132dee2c6bb97e06b
2024-02-22 15:09:47 -08:00
Cong Lin
8fe7612f2b Update OEMCrypto_GetDeviceInformation() doc
Add canonicalization requirements and a few more required fields.
Fixed a few typos.

Bug: 314882572
Change-Id: I3fe74c5b78292378fe146afa7236ece2c30942ae
2024-02-22 15:09:47 -08:00
Vicky Min
9e26c42882 OEMCrypto implementation of OEMCrypto_PrepAndSignReleaseRequest
Bug: 295956275
Change-Id: I1f3e7f83c644c16419cc99862c9147d321cfdb5f
2024-02-22 15:09:05 -08:00
Vicky Min
49debffe63 Use absl::string_view in ODK
Since enabling C++17 for Widevine, we should be able to use absl::string_view since copybara can automatically translate between absl::string_view and std::string_view.

PiperOrigin-RevId: 586780379
Change-Id: I94d04bd3ab75085c482682539cf4bb2f046db864
2024-02-22 14:56:30 -08:00
Fred Gylys-Colwell
9e08fd15cf Fix title of Prov 4 doxygen group
Bug: 572398489
Change-Id: I729ba7bbe6e0c813296d54df9ea34ee300ea88c6
2024-02-22 14:56:30 -08:00
Fred Gylys-Colwell
d867518bea Update docs about subsamples
We should talk about protected and unprotected regions in a
subsample instead of talking about encrypted and clear subsamples.

Bug: 148230379
Change-Id: Id19e693948cdbd332fa965c9d8775148d10e8368
2024-02-22 14:56:30 -08:00
Fred Gylys-Colwell
adfaf69d1a Clarify that FDPT hash covers the last sample
Bug: 193266271
Change-Id: Ic769c05c6481d0d3f9eb08bce5fea2f39ac7ebe2
2024-02-22 14:56:30 -08:00
Fred Gylys-Colwell
1dc4377cde Move CAS unit tests to the doxygen group cas
This groups the tests together on the devsite.

staged at
https://developers.devsite.corp.google.com/widevine/drm/client/oemcrypto/v19/oemcrypto-test/group/cas

Bug: 298719677
Change-Id: I9d4303ee6397917c0f8ce53c3d591860ac29ad3d
2024-02-22 14:56:29 -08:00
Fred Gylys-Colwell
d4dae79a0e Clean up some test docs
Some tests were not in a doxygen group, so they were not
showing up on the dev site.

Bug: 298719677
Change-Id: Ic86b7999ac7ab324eb40a30023b74897f87d97e5
2024-02-22 14:56:27 -08:00
Googler
05926646f0 Fully-qualify using-declaration (in the SDK) that refers to a top-level name, per go/c-readability-advice#fully-qualify-using
Steps
- `google3/video/widevine/export$ find . -type f -name "*.cc" -exec sed -i -E 's/^using ([a-zA-Z]+)/using ::\1/g' {} +`
- `google3/video/widevine/export$ find . -type f -name "*.h" -exec sed -i -E 's/^using ([a-zA-Z]+)/using ::\1/g' {} +`
- Review and revert changes to some files

PiperOrigin-RevId: 584441667
Change-Id: I90b23801b804d3975ac99eb62e6307918175f503
2024-02-22 14:46:43 -08:00
Vicky Min
726f2d51e9 ODK unit tests for release request
PiperOrigin-RevId: 584427947
Change-Id: I7a131739c5ea0d27c2f9e9c5ecb7b138176ce049
2024-02-22 14:46:43 -08:00