Commit Graph

152 Commits

Author SHA1 Message Date
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
Vicky Min
a6de51a3b4 Update headers for deprecated functions
Bug: 295956275
Change-Id: Ic2711e4671a1e8ffcf9220fcd1de4471fa6b2ec3
2024-02-22 15:13:54 -08:00
Fred Gylys-Colwell
94c547eef9 Fix markdown link
Change-Id: Ib0e44a5bca0d3e430051086dd8b42f09c605a254
2024-02-22 15:12:40 -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
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
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
8d77db54d0 Update version number in OEMCrypto header
Bug: 298719677
Change-Id: Icae24704cdb8bdd801635d879c34f917fb3d4468
2024-02-22 14:46:07 -08:00
Cong Lin
df6d73f021 Add header functions for GetBCCType
Add new OEMCrypto_GetBCCType() function in v19.
Re-generate serialization and test files.

Test: opk_ta, opk_linux_ipc_ta, run_fake_l1_tests
Bug: 297918188
Change-Id: Id5f422776cd50c71ab483c06bbe3ac399461fb31
2024-02-22 14:33:12 -08:00
Vicky Min
417a9c7b77 Add header functions for license release
Bug: 295956275
Change-Id: I223937ea25544cfb562bc063e75b359e4d908984
2024-02-22 14:33:03 -08:00
Jacob Trimble
4b32cb4b10 Implement license protocol 2.2 for OEMCrypto v19
This updates the code and tests to allow for using license protocol 2.2
when using OEMCrypto v19.

Issue: 80428549
Issue: 121031064
Issue: 232464183
Change-Id: Ib6bb61f86dd310b566227462658530bca5940b88
2024-02-22 14:31:54 -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
3933be3650 Update OEMCrypto_PrepAndSignLicenseRequest() documentation
OEMCrypto_PrepAndSignLicenseRequest() documentation needs to be updated
to match the current behavior.

Bug: 296608852
Change-Id: Ib76dc2f1afa705b5f71e654afa2889b2dcca36ce
2024-02-22 13:52:28 -08:00
Vicky Min
18369730b9 Refactor OEMCrypto_SetDecryptHash
The current implementation of OEMCrypto_SetDecryptHash gives developers
flexibility to use different types of hashes. However, all the
implementations we have seen thus far use crc32. Because of this, crc32
should be sufficient and we can refactor OEMCrypto_SetDecryptHash to
only use the crc32 hash.

Bug: 287706586
Change-Id: I4aaa253b2656dfd9c984f77dfb08fe160b23b47c
2024-02-22 13:52:26 -08:00
Junfeng Yang
93c19cd8de Fix the parameter direction
The output_descriptor parameter of OEMCrypto_FreeSecureBuffer should be
marked as [in,out].

Bug: 321346771
Change-Id: I4ba1a7f0b0f12a068d655a0d0b8b43a0818980dc
2024-02-19 01:01:26 -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
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
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
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
2f45350921 Update oemcrypto unit tests version number
Merge from Widevine repo of http://go/wvgerrit/169074

And update a few scripts that check for version number.

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

Bug: 275264353
Test: luci tests
Change-Id: Ic3c16323e993075c9bfe206fc73bf82c0e67f65b
2023-03-28 20:30:22 +00:00
John "Juce" Bruce
d3183f504e Remove V17 backwards-compatibility decrypt functions
Merge from Widevine repo of http://go/wvgerrit/169066

Now that we only have to support the v18 API, we can drop the v17
versions of these functions. For SelectKey, the new function fully
replaces it, so it has been removed. For the other functions, the v18
functions were calling the v17 functions previously. Now, they have been
rolled together.

These functions were not actually deprecated in the OEMCryptoCENC.h
header to allow OPK's serialization generator to still support them for
backwards-compatibility. Now that they are gone, this patch also
deprecates the functions.

Bug: 240995221
Merged from https://widevine-internal-review.googlesource.com/167338

Change-Id: I10261142121d4de8c96e2cd5fac570f7b536a82e
2023-03-28 20:30:22 +00:00
Fred Gylys-Colwell
322355dbbf Update documentation for Cast
Merge from Widevine repo of http://go/wvgerrit/169044

Document changes needed for supporting cast and provisioning
4.0 at the same time.

Bug: 259454830
Merged from https://widevine-internal-review.googlesource.com/166459

Change-Id: Iebf50d856c18f29db66352041b2b0429c43bd594
2023-03-28 20:28:57 +00:00
Fred Gylys-Colwell
9e7877a95d Document lacking signature of Prov 3.0 message
Merge from Widevine repo of http://go/wvgerrit/169039

Bug: 243734378
Merged from https://widevine-internal-review.googlesource.com/166458

Change-Id: I3eae16d09cf42e554d450f746390744ef580ac03
2023-03-28 20:28:57 +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
Kyle Zhang
11255b7426 Pick widevine oemcrypto-v18 change
No-Typo-Check: From a third party header file
Bug: 260918793
Test: unit tests
Test: atp v2/widevine-eng/drm_compliance
Change-Id: I36effd6a10a99bdb2399ab1f4a0fad026d607c70
2022-12-21 00:03:50 +00:00
Kyle Zhang
af0168dbed Merge cdm changes to android repo
Bug: 251924225
Test: GtsMediaTestCases
Change-Id: I1b4e64c0abf701fe1f5017f14dc72b72c3ea6770
2022-10-11 00:40:42 +00:00
Alex Dale
41d307ed9e Misc fixes for Windows
[ Merge of http://go/wvgerrit/152510 ]

Bug: 236317198
Change-Id: I67ac7d7c903ecfbb659595699c5bfe38f4d781df
2022-07-20 14:47:42 -07:00
Alex Dale
073f478239 Implement GetDeviceId for prov4
[ Merge of http://go/wvgerrit/150349 ]

The device id for prov4 is hash of the encoded device public key
(COSE_key).

Also replaced a few bug numbers if it is prov3 specific (not related to prov4).

Bug: 225216277
Bug: 236317198
Test: oemcrypto_test
Change-Id: Ica1c8579c0a3ef83c70f331283c9cce629c6bb3f
2022-06-23 14:48:19 -07:00
Alex Dale
dd2f063254 Change ERROR_INVALID_RSA_KEY to ERROR_INVALID_KEY
[ Merge of http://go/wvgerrit/149269 ]

This mostly affects tests and documentation.

Bug: 201581141
Bug: 236317198
Change-Id: I1bc0ec4c3767106c01dfac9956f83ccfbffc49b7
2022-06-16 18:12:16 -07:00
Cong Lin
9935fae50d Loosen KCB encryption checks in L3
This is a merge from:
https://widevine-internal-review.googlesource.com/c/cdm/+/152372

The L3 source change which produced these libraries is:
https://widevine-internal-review.googlesource.com/c/cdm/+/152371/

Original commit message:
To address the bug with certain 16.4.x SDK versions returning a
clear key control block (KCB) for clients newer than 16.5, the
exact version check to determine whether key control blocks are
clear or not has been loosened.

Original behavior:
- ODK version >= 16.5.x --> Assume clear
- ODK version <= 16.4.x --> Assume encrypted
New behavior:
- No KCB IV --> Assume clear
- Otherwise --> Assume encrypted

This CL also includes a change to oemcrypto/include/OEMCryptoCENC.h
The changes to OEMCryptoCENC.h in the CL are comments or variable name
change. So it should be safe.
This change was merged to wv tm-dev here:
https://widevine-internal-review.googlesource.com/c/cdm/+/148411
So, adding it to Android tm-dev.

Test: run_level3_static_tests, CdmDecryptTest/CdmTestWithDecryptParam.* against LS SDK 16.4.2 & 17.0
Bug: 232557453
Change-Id: I2bbb5ab3ea33a16bd6c198077e5aefe960737ea0
2022-05-22 06:35:22 +00:00
Rahul Frias
85310dfbf6 Change the signature format requirement of OEMCrypto_GenerateCertificateKeyPair
[ Merge of http://go/wvgerrit/147593 ]

As we have decided to use hw_bcc service in Trusty to generate BCC and
sign the generated certificate public key, we need to change the
signature format to cose-sign1, which is defined by hw_bcc API.

Bug: 221496117
Test: GtsMediaTestCase on sunfish
Change-Id: I30739a0f0ae49291d343db46ad9e898663985cc8
2022-03-16 01:39:00 -07:00
Rahul Frias
5f45485175 Merge oemcrypto-v17 to master
[ Merge of http://go/wvgerrit/144530 ]

It's time to copy all the v17 work to our main branch.
I had to re-run clang-format to match local style.

Merge from commit b14f08374f9a48aed49850cc230daf384725b15f
Fix allow_null for key control iv in L3 v17

Bug: 161477208
Test: GtsMediaTestCases on sunfish
Change-Id: I97caa851e9e65eb0e42034d2f4a28dfb7499df0d
2022-03-16 01:33:23 -07:00
Edwin
3c3da01d58 Use aidl interface for Widevine service.
The interface is defined in
hardware/interfaces/drm/aidl(http://go/ag/15329852).

Test: build
  m android.hardware.drm-service.widevine -j128

Test: build_and_run_all_unit_tests.sh
  for hidl tests

Test: atest VtsAidlHalDrmTargetTest

Test:   atest vts_treble_vintf_vendor_test:vts_treble_vintf_vendor_test.DeviceManifest/SingleManifestTest#ManifestAidlHalsServed/0 -- --abi x86_64

Bug: 200055138
Bug: 170964303
Change-Id: I5654d90d8a4b0bae4b4a78e79b27c1cafec36be7
2022-02-01 22:20:04 -08:00
Yohei Yukawa
a4d835af3a Revert "Use aidl interface for Widevine service."
This reverts commit 96a8ccd4a1.

Reason for revert:
Could break DeviceManifest/SingleManifestTest#ManifestAidlHalsServed

Bug: 200055138
Bug: 170964303
Bug: 217241995
Change-Id: I9c42df15defec428c9ef8c62439c63d4a603fee6
2022-01-31 22:01:25 +00:00
Edwin
96a8ccd4a1 Use aidl interface for Widevine service.
The interface is defined in
hardware/interfaces/drm/aidl(http://go/ag/15329852).

Test: build
  m android.hardware.drm-service.widevine -j128

Test: build_and_run_all_unit_tests.sh
  for hidl tests

Test: atest VtsAidlHalDrmTargetTest

Bug: 200055138
Bug: 170964303
Change-Id: If2f2a129914436ba5cef1c46f6cb9415e12c3d1c
2022-01-28 20:29:14 -08:00