Commit Graph

8020 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
981c7e97d9 Replace reference to SelectKey with GetKeyHandle in docs
Bug: 300514029
Merged from https://widevine-internal-review.googlesource.com/187930

Change-Id: I3134f9d12692dbd2916c576a872c79c87ad192fe
2024-01-30 16:09:41 -08:00
Fred Gylys-Colwell
797ab111ca Update OEMCrypto version to 18.4 in header
Merged from https://widevine-internal-review.googlesource.com/183806

Change-Id: I0d56b6a1f3056de5985a4acfa24dc2e03a6ac193
2024-01-30 16:09:41 -08:00
Cong Lin
dafd837420 Update documentation of OEMCrypto_GetDeviceSignedCsrPayload()
Clearify usage and paremeters of OEMCrypto_GetDeviceSignedCsrPayload()
and OEMCrypto_GetDeviceInformation().

Bug: 291625901
Merged from https://widevine-internal-review.googlesource.com/179470

Change-Id: I0c69bd6fadded6d749fd6f33553bb4a51d69e719
2024-01-30 16:09:41 -08:00
Fred Gylys-Colwell
dad5b3efb6 Update link in entitlement documentation
Relative links are different for the first sentence of a
group description and the rest of the group
description. That is because the first sentence also appears
in the group overview table. To fix this, I'm taking the
link out of the first sentence.

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

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

Change-Id: I697e1aacd5df683790ec486cc7e429d4981e4140
2024-01-30 16:09:41 -08:00
Matt Feddersen
40becdc349 Add is_factory_build to BuildInformation
Test: GTEST_FILTER="*CheckJsonBuildInformationAPI18*" ./jenkins/opk_ta
Bug: 259595106

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

Change-Id: I51994521fe0b692c1948f98058ef442556a28656
2024-01-30 16:09:41 -08: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
Fred Gylys-Colwell
0a39e71bfb Specify encoding restrictsion for BCC
If the BCC has an RSA key, then it needs to be parsed by
BoringSSL, which expects rsaEncryption as the encoding type.

Bug: 272102162

Change-Id: I9b7dc374d8db80efda062b47f6b17720d9bc2ba2
2024-01-30 16:09:41 -08:00
Fred Gylys-Colwell
0a9bc6534c Document key usage for GenerateCertificateKeyPair
bug: 277124807
Merged from https://widevine-internal-review.googlesource.com/177958

Change-Id: I867d664a73ceba7391b5054365c4352a7c6aa301
2024-01-30 16:09:41 -08:00
Fred Gylys-Colwell
bf5804a103 Format code block in header
Adding some triple tildes makes doxygen format code blocks
correctly.

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

Change-Id: Ie4cce625fbd5f77a2f65191716bd4a2a8cf8b76e
2024-01-30 16:09:41 -08:00
Junfeng Yang
e0dac6f403 Remove a mistaken comment line
It appears there is a mistaken line in the comment for
OEMCrypto_LoadLicense.

Change-Id: I6a265e606052913a1adac317fa8557663897994c
2024-01-30 16:09:41 -08:00
Matt Feddersen
aaa1ce865f Improve documentation for OEMCrypto_GenerateCertificateKeyPair
Bug: 279194702

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

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

Change-Id: I59dfe4c5053c24c011c9222fe516b446df6524e0
2024-01-30 16:09:41 -08:00
Matt Feddersen
89ba99f16d Add new optional fields to OEMCrypto_BuildInformation output
Bug: 273347757

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

Change-Id: I0f878cab8456fa277a453d76e4deb4a2a846ede9
2024-01-30 16:09:41 -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
Cong Lin
30669a7b67 Cdm to expose GetDeviceInformation() and GetDeviceSignedCsrPayload()
GetDeviceInformation() and GetDeviceSignedCsrPayload() are added to
cdm_engine and crypto_session, so that they can be queried by DRM
plugin. This is to allow the wv drm HAL to be able to extract BCC and
CSR payload to build CSR for prov 4 device registration, such that we
don't need a separate RKP HAL to do this job.

Changes to the DRM plugin to use the exposed methods will be in the
coming CL.

Bug: 286556950
Test: request_license_test
Merged from https://widevine-internal-review.googlesource.com/178890

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

Change-Id: Ibafa3a58c99fbb8f1f25f8951d3749110bd32176
2024-01-30 16:09:41 -08:00
Kyle Zhang
c600ccb741 Add Cdm support for Cast provision 4.0 flow
Bug: 259455235
Test: CorePIGTest.CastReceiverProvisioning*
Merged from https://widevine-internal-review.googlesource.com/174150

Change-Id: I8d546a73a64a71a4d61225d9c6d14d893decce22
2024-01-30 16:09:41 -08:00
Fred Gylys-Colwell
f6c1879b4c Add OEMCrypto_FactoryInstallBCCSignature API
This was requested by OEM and SOCs to support Prov 4 signing
model in the factory.

Bug: 275567037
Merged from https://widevine-internal-review.googlesource.com/176310

Change-Id: I2907841c4a16f37ae9a2241a6c9eaad73ff616af
2024-01-30 16:09:41 -08:00
Robert Shih
dd1c01c9dd Merge cdm core changes into Android main
Merged commit:
- short link: go/wvgerrit/177661
  hash: a3cd4bd
  subject: Fix policy engine unittest issues from clang-tidy
  submitted: 2023-07-06

Change-Id: I7f079fccdd2f296d51b08b0a7005a0bb7c930ccb
2024-01-30 16:04:12 -08:00
Robert Shih
cc8f885e2b Merge oemcrypto fuzz tests into Android main
Change-Id: If7fb815fa6193ddfe9a94e925356cc177ae3bacc
2024-01-30 16:03:00 -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
Matt Feddersen
2e7c68440b Bump OEMCrypto API to 18.2 to match ODK
Merged from https://widevine-internal-review.googlesource.com/170295

Change-Id: I9e9cc0c7c3296db71ac31518cf2d3d8608066686
2024-01-29 12:38:34 -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
Vicky Min
c6e7c70a6b Remove reference to OEMCrypto_LoadKeys() in ODK code
PiperOrigin-RevId: 522089097
Merged from https://widevine-internal-review.googlesource.com/168481

Change-Id: I59927c7f5aba52523aeba78c130f4b148d1c363f
2024-01-29 11:20:11 -08:00
Fred Gylys-Colwell
231ff3735c Backport http://go/ag/21276850
Changes to the Android build files.

PiperOrigin-RevId: 512200169
Merged from https://widevine-internal-review.googlesource.com/166925

Change-Id: If6247499693013099d705dd22a123c36a76e0404
2024-01-29 11:06:45 -08:00
Ian Benz
85357db81b Fix policy engine unittest issues from clang-tidy
Merged from https://widevine-internal-review.googlesource.com/177661

Bug: 290112507
Change-Id: Iddf6889640a335d2f6bb7af78790f4a36baaab03
2024-01-29 10:36:34 -08:00
Fred Gylys-Colwell
e9b0196a23 Generate golden data tests for ODK
Generate core message request and responses for
golden data tests.

This CL does not have any golden data. The golden data
will be added to a google3 CL.

To turn on dumping of golden data, set the environment
variable DUMP_GOLDEN_DATA to "yes".

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

Change-Id: I7ae2d76ec7330d9131aae98dfd07b7909d10f726
2024-01-29 10:36:15 -08:00
Ian Benz
cebd90e300 Add clang-tidy support for the CDM
Bug: 256230932
Change-Id: Id3fcf024cd7dcf95218876b81359d6418f5aa067
2024-01-29 10:26:54 -08:00
Fred Gylys-Colwell
b7b423aca3 Reduce clock skew in flaky duration tests
There are three changes here that should help reduce the
amount of duration test failures caused by clock skew.

First, we reported some skew when the test expected playback
to start immediately after loading the license. However,
with round-off, this could easily be more than 1 second. So
this does not warrent even a warning.

Second, the fake and real clocks were only synced after
computing how long to sleep. This is fixed by moving
SleepUntil to the TestSleep class and having it sync before
computing the delta and after doing the sleep.

Third, I am guessing that some failures due to unexpected
lenience were caused by the rental or playback clock being
started at the end of signing the license or the end of the
first decrypt instead of the beginning. We work around this
by recording how long these operations take, and then adding
this extra time at the end of the check for FailDecrypt.

Bug: 275003529
Bug: 279249646
Bug: 207500749
Merged from https://widevine-internal-review.googlesource.com/176070

Change-Id: I6a973565edfbebca53ee7f239b4b93f8f73d1e0a
2024-01-26 17:46:49 -08:00
Rahul Frias
0cd3d185c7 Cleanup vendor projects are proprietary.
[ Merge of http://go/ag/21276850 ]

Test: m droid dist
Merged from https://widevine-internal-review.googlesource.com/166674

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

Change-Id: I0bdec38c4d12710fa97b91665d211ba6c0d4b24d
2024-01-26 17:39:30 -08:00
Kyle Zhang
8fcaa04eab Revise cdm signing api and test
Bug: 279671867
Bug: 279672538
Change-Id: If2e2c6d250c0379c217b3f9b21efb197c9ae4fd6
2024-01-26 17:06:09 -08:00
Kyle Zhang
5070a7b949 Exposing the Cast Signing Algorithm
1. Exposing the Cast Signing Algorithm in cdm core.
2. Update core Cast tests to use new core CDM Cast signing API.

Bug: 279671867
Bug: 279672538
Change-Id: Ia73c4b5e6dd61edf790bca97a321881d310e7a99
2024-01-26 17:05:58 -08:00
Ian Benz
14c5d6ee5f Move internal fuzz target naming scheme to g3doc
Change-Id: I400b0a34c670673aba9dd347ec41060b4b23897a
2024-01-26 16:26:25 -08:00
Ian Benz
e19927f4bf Update OEMCrypto fuzzing documentation
- Add details for triaging crashes and writing fuzz tests.
- Move internal documentation not needed by partners to g3doc.
- Remove infrastructure details covered in the design document.

Change-Id: Ib60b2bea954f4371595b0f891434e2274366fdd2
2024-01-26 16:26:23 -08:00