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
This commit is contained in:
Cong Lin
2023-02-27 18:25:02 -08:00
parent 3f7ecbc43e
commit e8add8eed8
44 changed files with 302003 additions and 298675 deletions

View File

@@ -275,7 +275,10 @@ typedef OEMCryptoResult (*L1_GetDTCP2Capability_t)(
OEMCrypto_DTCP2_Capability* capability);
typedef OEMCrypto_WatermarkingSupport (*L1_GetWatermarkingSupport_t)();
typedef OEMCryptoResult (*L1_GetDeviceInformation_t)(
uint8_t* device_info, size_t* device_info_length,
uint8_t* device_info, size_t* device_info_length);
typedef OEMCryptoResult (*L1_GetDeviceSignedCsrPayload_t)(
const uint8_t* challenge, size_t challenge_length,
const uint8_t* encoded_device_info, size_t encoded_device_info_length,
uint8_t* signed_csr_payload, size_t* signed_csr_payload_length);
typedef OEMCryptoResult (*L1_GetKeyHandle_t)(OEMCrypto_SESSION session,
const uint8_t* content_key_id,
@@ -405,6 +408,7 @@ struct FunctionPointers {
L1_ProcessOTAKeybox_t ProcessOTAKeybox;
// new v18 functions.
L1_GetDeviceInformation_t GetDeviceInformation;
L1_GetDeviceSignedCsrPayload_t GetDeviceSignedCsrPayload;
L1_GetKeyHandle_t GetKeyHandle;
L1_DecryptCENC_t DecryptCENC;
L1_Generic_Encrypt_t Generic_Encrypt;
@@ -1065,6 +1069,7 @@ class Adapter {
LOOKUP_ALL(17, GetWatermarkingSupport, OEMCrypto_GetWatermarkingSupport);
LOOKUP_ALL(18, GetDeviceInformation, OEMCrypto_GetDeviceInformation);
LOOKUP_ALL(18, GetDeviceSignedCsrPayload, OEMCrypto_GetDeviceSignedCsrPayload);
LOOKUP_ALL(18, GetKeyHandle, OEMCrypto_GetKeyHandle);
LOOKUP_ALL(18, DecryptCENC, OEMCrypto_DecryptCENC);
LOOKUP_ALL(18, Generic_Encrypt, OEMCrypto_Generic_Encrypt);
@@ -1183,6 +1188,7 @@ class Adapter {
level3_.GetDTCP2Capability = Level3_GetDTCP2Capability;
level3_.GetWatermarkingSupport = Level3_GetWatermarkingSupport;
level3_.GetDeviceInformation = nullptr;
level3_.GetDeviceSignedCsrPayload = nullptr;
level3_.GetKeyHandle = nullptr;
level3_.DecryptCENC = nullptr;
level3_.Generic_Encrypt = nullptr;
@@ -2842,16 +2848,28 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateCertificateKeyPair(
}
extern "C" OEMCryptoResult OEMCrypto_GetDeviceInformation(
uint8_t* device_info, size_t* device_info_length,
uint8_t* signed_csr_payload, size_t* signed_csr_payload_length) {
uint8_t* device_info, size_t* device_info_length) {
if (!gAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(kLevelDefault);
if (!fcn) return OEMCrypto_ERROR_NOT_IMPLEMENTED;
if (fcn->GetDeviceInformation == nullptr)
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
return fcn->GetDeviceInformation(device_info, device_info_length,
signed_csr_payload,
signed_csr_payload_length);
return fcn->GetDeviceInformation(device_info, device_info_length);
}
extern "C" OEMCryptoResult OEMCrypto_GetDeviceSignedCsrPayload(
const uint8_t* challenge, size_t challenge_length,
const uint8_t* encoded_device_info, size_t encoded_device_info_length,
uint8_t* signed_csr_payload, size_t* signed_csr_payload_length) {
if (!gAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(kLevelDefault);
if (!fcn) return OEMCrypto_ERROR_NOT_IMPLEMENTED;
if (fcn->GetDeviceSignedCsrPayload == nullptr)
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
return fcn->GetDeviceSignedCsrPayload(
challenge, challenge_length, encoded_device_info,
encoded_device_info_length, signed_csr_payload,
signed_csr_payload_length);
}
extern "C" OEMCryptoResult OEMCrypto_InstallOemPrivateKey(

View File

@@ -45,7 +45,9 @@ LOCAL_C_INCLUDES := \
vendor/widevine/libwvdrmengine/oemcrypto/odk/kdo/include \
vendor/widevine/libwvdrmengine/oemcrypto/util/include \
LOCAL_C_INCLUDES += external/protobuf/src
LOCAL_C_INCLUDES += \
external/protobuf/src \
external/googletest/googlemock/include \
LOCAL_STATIC_LIBRARIES := \
libcdm \