Commit Graph

104 Commits

Author SHA1 Message Date
Matt Feddersen
985eaacfb9 Update ODK version to 19.1
[ Merge of http://go/wvgerrit/195352 ]

PiperOrigin-RevId: 618915151
Merged from https://widevine-internal-review.googlesource.com/195050

Change-Id: Ieff901a961c3f965497b62a655c3ddb536e112a0
2024-04-16 10:59:48 -07:00
John Bruce
53d0f5cd6a Label unused parameters in ODK
This is necessary so we can remove `-Wno-unused-parameter` in the CDM and OPK builds.

PiperOrigin-RevId: 618255022
Merged from https://widevine-internal-review.googlesource.com/194110

Change-Id: I67b9b8cd27422c4b62d361d627fd1c05ed0cbdef
2024-03-28 13:57:46 -07:00
Rahul Frias
8046719c10 Correct copyright header
[ Merge of http://go/wvgerrit/186825 ]

Remove the words ` All rights reserved.` from Widevine's
existing copyright headers.

For context, see cl/578224540

Bug: 330655176
Test: WVTS

PiperOrigin-RevId: 580020267
Change-Id: I43e845b83f438e4ef7f0f542c2f4e427a188ab06
2024-03-20 23:24:17 -07:00
Vicky Min
882c80783b Update ODK version to 18.4
[ Merge of http://go/wvgerrit/192493 ]

Bug: 311951236
Test: WVTS

Change-Id: Ia59bfacf91d812f36f7a198632f7fa3462d0b8df
2024-03-20 20:45:43 -07: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
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
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
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
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
Vicky Min
c8ac9c5cd7 Fix empty struct error
I added an empty ODK_ParsedRelease struct in ODK in case we want to add fields for release requests in the future but this is causing an error in C. Removing it for now. Will add it if needed for future unit tests.

PiperOrigin-RevId: 581059171
Change-Id: Ic547cf3cef3cf89f503f39cff27888d77056eddc
2024-02-22 14:34:00 -08:00
Vicky Min
4d7025e517 ODK implementation for license release
PiperOrigin-RevId: 580643396
Change-Id: I588ef20587acc347b510dfb7fd9e372d221100a0
2024-02-22 14:34:00 -08:00
Googler
de3cac4f90 Remove the words All rights reserved. from Widevine's existing copyright headers, under google3/video/widevine/export/common/oemcrypto_core_message/
For context, see cl/578224540

This CL is produced via
- Do the removal
    - `$ /google/src/head/depot/google3/devtools/scripts/csearch_apply --includefile 'video/widevine/export/common/oemcrypto_core_message/' --search='Copyright \d{4} Google LLC. All rights reserved.' --apply='s,\ All rights reserved\.,,g'`
- Manually deleted a few periods. I.e., for cases where the comment is ONLY "Copyright <year> Google LLC.", I removed the period at the end.

PiperOrigin-RevId: 580020267
Change-Id: I4b2f647d6e3bbb34868e1822591bc953a94cca42
2024-02-22 14:33:58 -08:00
Alex Dale
1daf69dc6f Update widevine apex min_sdk_version to 34
Change is based on http://go/wvgerrit/186390

PiperOrigin-RevId: 576682220
Change-Id: Ic0fa38982ba1bb83577e01d3d579367c8bda2019
2024-02-22 14:33:25 -08:00
Vicky Min
51c537e265 Fix potential signed integer overflow in ODK
PiperOrigin-RevId: 573265338
Change-Id: I33dbced572941c9646f7496e20b8d9a49bca5811
2024-02-22 14:32:51 -08:00
Jacob Trimble
078e1f6555 Add utility for generating KDF contexts
Starting in v19, OEMCrypto implementers will need to implement KDF generation in OEMCrypto.  To make it easier, this adds a utility to generate them based on the request context.

PiperOrigin-RevId: 572693987
Change-Id: Ife382bf35ceede508499e3677de115ef12999dcc
2024-02-22 14:32:00 -08:00
Vicky Min
54da9e91cd Create function header for ODK_PrepareCoreLicenseRelease
PiperOrigin-RevId: 571975120
Change-Id: Ie9eac57389298b03348137078b5c63432a3d50d8
2024-02-22 14:31:56 -08:00
Vicky Min
065d4d151e Update C function/field documentation to match behavior in ODK
PiperOrigin-RevId: 560780563
Change-Id: Ibd88398b06cca7a51d152fb6da95afd40cdd5a8b
2024-02-22 13:52:28 -08:00
Jacob Trimble
660a20ed5c Always use static_assert on MSVC
MSVC supports static_assert but won't always set __STDC_VERSION__ correctly.  So we just assume it is supported.

PiperOrigin-RevId: 559166904
Change-Id: I9a62094686405c58fe9be202bce0f4fefb764d48
2024-02-22 13:52:28 -08:00
Vicky Min
c26d6d3c97 Update core_message_util_test LicenseResponse18 unit test for variable max num keys change
PiperOrigin-RevId: 557685272
Change-Id: Ib9e1b6c38d1f135c757e734c1c9f36d3913a21ca
2024-02-22 13:52:11 -08:00
Vicky Min
41942e1014 Roll ODK version number to 19.0
PiperOrigin-RevId: 551966786
Change-Id: Ib3eb3423112a340abb25cddfdc2d6d43ad2ce6f1
2024-02-22 13:44:51 -08:00
Ronish Kalia
d0f454d91c [DON'T BLOCK] Test ownership migration rules
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.

For more details please refer to the link below,
<add g3 doc link>

Bug: 304529413
Test: N/A
Change-Id: I204c137da43a021bcebe316759d1aadaec99fe2a
2024-02-14 14:19:08 +00:00
Jacob Trimble
91c7a8cffe Misc Fixes
- Code protection fixes for v18
- Fix MSVC error with static_assert
- Fix RSA with Cobalt
- Workaround SCP errors with string concatenation
    - Use snprintf instead

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

Change-Id: If2e9ee3403e313fd8c7dffccca6f8d3f7b0b0afb
2024-01-30 16:09:41 -08:00
Vicky Min
e123e25a9e Add comments referencing both places that need to be updated with new minor version releases.
PiperOrigin-RevId: 552584184
Change-Id: I3eaba4e9b4cf83e70c5dfc2edcfbbeace789d49a
(cherry picked from commit 589feafd7b572319ddbae97eb1778d760a739dd3)
2024-01-29 12:40:18 -08:00
Cong Lin
7277331f92 Update ODK version to 18.4 and unit tests
Test: odk tests, opk_ta, fake_l1_tests
Bug: 294440012
Merged from https://widevine-internal-review.googlesource.com/181150

Change-Id: Ia33962f9d244333b1ca17c9a64efc29de35db093
2024-01-29 12:40:11 -08:00
Fred Gylys-Colwell
10d9bc272f Mark some ODK types as undocumented, and document others
Bug: 293188660
PiperOrigin-RevId: 551019650
Merged from https://widevine-internal-review.googlesource.com/180470

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

Change-Id: I28aa1d82437128ac2862cf0d6de325644e4af067
2024-01-29 12:39:48 -08:00
Vicky Min
e765453b35 Update ODK minor version to match when major version is updated
PiperOrigin-RevId: 551930047
Merged from https://widevine-internal-review.googlesource.com/180430
(cherry picked from commit d85aa8107dbe292490f9897b1e76f72bc0144bff)

Change-Id: If973113886a19cb720ad635e68830b9afbcf22b5
2024-01-29 12:39:48 -08:00
Fred Gylys-Colwell
06ad24bce0 Update ODK and test version to 18.3
PiperOrigin-RevId: 546349606

Merged from
https://widevine-internal-review.googlesource.com/178000
and
https://widevine-internal-review.googlesource.com/178061

Bug: 290252863
Change-Id: I0d6d9a0214d556ae39efe8a720df8ac60c1e67fb
2024-01-29 12:39:46 -08:00
Fred Gylys-Colwell
84e27c660d Initialize renewal request time
The `time_of_renewal_request` field in the clock_values struct was not being initialized. With this CL, we use a value of 0 to indicate a renewal has not been requested yet.

We also modify the check in `ODK_ParseRenewal` to use a value of 0 for the `time_of_renewal_request` to skip the check for a stale renewal. This is done because now that a "renew on license load" license starts the playback clock immediately, we need a different way to decide if a renewal from a previous session can be loaded.

PiperOrigin-RevId: 546129556
Merged from https://widevine-internal-review.googlesource.com/177998

Change-Id: I17282cf918d0cdb4d9b5108a41914ecd7d87cc8f
2024-01-29 12:31:37 -08:00
Fred Gylys-Colwell
d0752047fc Document b/290249855 in ODK
PiperOrigin-RevId: 546118816
Merged from https://widevine-internal-review.googlesource.com/177992

Change-Id: I6ab0b599a2d858f9451a5fbd3e3612275b729ee6
2024-01-29 12:31:36 -08:00
Vicky Min
414e928238 Remove version check in ODK_InitializeSessionValues
It seems ODK_InitializeSessionValues is only used in initializing the session in OEMCrypto, so we can remove this check.

PiperOrigin-RevId: 545729842
Merged from https://widevine-internal-review.googlesource.com/169914

Change-Id: Idcc58166f64116214540591dc71a774f3ce3f3d1
2024-01-29 12:31:36 -08:00
Alex Dale
48b1aed404 Set min_sdk_version for the Widevine APEX on ODK
This change brings the odk/Android.bp in sync with the Android repo.  Change was originally made in ag/22120778

PiperOrigin-RevId: 540398693
Merged from https://widevine-internal-review.googlesource.com/177000

Change-Id: Id3bf7193da8de3b9942da052c32065f031102d9b
2024-01-29 12:31:03 -08:00
Vicky Min
ff80927f90 Allow server to send license with larger ODK_MAX_NUM_KEYS
PiperOrigin-RevId: 538676411
Merged from https://widevine-internal-review.googlesource.com/175915

Change-Id: Iadef2115fe3f9001034223e647cbfa6228484281
2024-01-29 12:31:03 -08:00
Fred Gylys-Colwell
57e997fe19 Add golden test data for ODK
This data was generated using the code in CLs go/wvgerrit/163726 (for v16),
go/wvgerrit/171730 (for v17), and go/wvgerrit/171750 (for v18).

PiperOrigin-RevId: 535679470
Change-Id: Ib644bbed7e7329dfea30ce25d325fd0556fdb7a7
2024-01-29 12:30:15 -08:00
John Bruce
db670e7bcc Add tests for ODK overflow functions
Merged from http://go/wvgerrit/175855

This includes testing overflow functions that are only used in the Widevine client repository.

This patch also includes the following fix for the previous commit:

Add type casting for ODK overflow function unit tests

Merged from http://go/wvgerrit/175893

The new ODK overflow unit tests are causing some unit test failures in oemcrypto-v18 due to mismatched type comparisons.

PiperOrigin-RevId: 535308670
PiperOrigin-RevId: 534890798
Change-Id: I8bb67e47193a92191a91c83bf8a0de61e1b87793
2024-01-29 11:51:41 -08:00
Vicky Min
8f6dbdb94e Set rental clock if not already set in ODK_ParseLicense
PiperOrigin-RevId: 535020833
Merged from https://widevine-internal-review.googlesource.com/175851

Change-Id: Idc5e2123e56346b9d7c036683c184057f49ea58a
2024-01-29 11:51:41 -08:00
Vicky Min
d5afa3fd99 Cleanup design of ODK_ParsedLicense handling and maintain backwards compatibility
PiperOrigin-RevId: 529531139
Merged from https://widevine-internal-review.googlesource.com/172870

Change-Id: Id07dc82a8c2729cdbf10a9c8680ed979f8de51b5
2024-01-29 11:51:41 -08:00
Vicky Min
6c953ab651 Fix license response default values error in CreateCoreLicenseResponse
PiperOrigin-RevId: 529588784
Merged from https://widevine-internal-review.googlesource.com/174260

# Conflicts:
#	oemcrypto/odk/include/odk_structs.h

Change-Id: I96f348bfc9b5be7113ddb2af18a38c36d337697c
2024-01-29 11:51:41 -08:00
Vicky Min
f71014507d Set renewal_delay_base in function CreateCoreLicenseResponseFromProto
PiperOrigin-RevId: 525261485
Merged from https://widevine-internal-review.googlesource.com/170810

Change-Id: I96f16639a728db9b6922d3f23e0212fa2902602e
2024-01-29 11:51:41 -08:00
Vicky Min
152f2144f9 Fix ODK warning errors for WV DRM
PiperOrigin-RevId: 525266553
Merged from https://widevine-internal-review.googlesource.com/169640

Change-Id: Id92dac068a2b2f767287641170f7b522f54588e4
2024-01-29 11:51:41 -08:00
Fred Gylys-Colwell
ae0134b21d Make the server send ODK v18 messages by default
The core message had been throttled to only generate v17 messages because we wanted to stabilize the format before making the code live.

PiperOrigin-RevId: 524309559
Merged from https://widevine-internal-review.googlesource.com/170311

Change-Id: I2d09c9f6c73f844fd509531e86285ad71d22690f
2024-01-29 11:51:41 -08:00
Googler
89666aeb89 Fix issues identified by clang-tidy
- Replace assert with odk_static_assert for checks that can be handled
  at compile time.
- Use explicit bool conversion with memcmp.

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

PiperOrigin-RevId: 524277743
Change-Id: I8b32e886e780e80406afceea562be2033d75d340
2024-01-29 11:51:41 -08:00
Matt Feddersen
a2a27c44ef Correctly parse v18.0 provisioning requests
The previous code fixed a backwards compatibility error for v18 provisioning requests being parsed by a v17 or older server. This bumped the minor version number to v18.1. v17 servers are still expected to fail when trying to parse v18.0 provisioning requests, and v18.1 requests will pass.

However, it did not correctly account for existing v18.0 requests on v18.1+ servers. v18.0 messages were naively detected by a failure to parse, and the parse function was not run again. This left the resulting nonce and session_id values uninitialized.

This CL fixes that by explicitly handling the v18.0 and v18.1+ cases, ensuring that the parse function succeeds and all relevant information is copied over. Furthermore, the unit test that was meant to catch this edge case has been improved to validate the resulting parsed message.

All code changes affect the server. This does not affect the client code eg OEMCrypto

PiperOrigin-RevId: 523714529
Merged from https://widevine-internal-review.googlesource.com/170110

Change-Id: I21911c4bb4304de2d93f092f356402bbd4240874
2024-01-29 11:20:20 -08:00