Cherry pick 18.4 changes to udc-widevine-dev

Get the udc-widevine-dev Android branch and oemcrypto-v18 cdm branch in
sync. The commit ID for 18.4 on oemcrypto-v18 is
https://widevine-internal.git.corp.google.com/cdm/+/a2f23a2281e5e06dc2867585bdc516fa132b639.

Merged from go/wvgerrit/190151

Bug: 290252845
Test: unit tests passing on Panther device
Change-Id: I63fa3f1c784f737ca1480e5febe4f3f5a8a49948
This commit is contained in:
Vicky Min
2024-02-01 19:18:44 +00:00
parent 540c8dfd50
commit 4129b3ac9f
48 changed files with 1491 additions and 330 deletions

View File

@@ -154,12 +154,10 @@ HdcpLevel mapHdcpLevel(const std::string& level) {
}
}
bool isCsrAccessAllowed() {
const uid_t AID_ROOT = 0;
const uid_t AID_SYSTEM = 1000;
const uid_t AID_SHELL = 2000;
bool isRootOrShell() {
const uid_t AID_ROOT = 0, AID_SHELL = 2000;
const uid_t uid = AIBinder_getCallingUid();
return (uid == AID_ROOT || uid == AID_SYSTEM || uid == AID_SHELL);
return (uid == AID_ROOT || uid == AID_SHELL);
}
bool IsAtscKeySetId(const CdmKeySetId& keySetId) {
@@ -1279,7 +1277,7 @@ static WvStatus getDeviceSignedCsrPayload(
value = StrToVector(serialized_metrics);
}
}
} else if (name == "bootCertificateChain" && isCsrAccessAllowed()) {
} else if (name == "bootCertificateChain" && isRootOrShell()) {
std::string boot_certificate_chain;
CdmResponseType res = mCDM->QueryStatus(
wvcdm::kLevelDefault, wvcdm::QUERY_KEY_DEBUG_BOOT_CERTIFICATE_CHAIN,
@@ -1291,7 +1289,7 @@ static WvStatus getDeviceSignedCsrPayload(
} else {
value = StrToVector(boot_certificate_chain);
}
} else if (name == "verifiedDeviceInfo" && isCsrAccessAllowed()) {
} else if (name == "verifiedDeviceInfo" && isRootOrShell()) {
std::string verified_device_info;
CdmResponseType res = mCDM->QueryStatus(wvcdm::kLevelDefault,
wvcdm::QUERY_KEY_DEVICE_INFORMATION,
@@ -1303,7 +1301,7 @@ static WvStatus getDeviceSignedCsrPayload(
} else {
value = StrToVector(verified_device_info);
}
} else if (name == "deviceSignedCsrPayload" && isCsrAccessAllowed()) {
} else if (name == "deviceSignedCsrPayload" && isRootOrShell()) {
std::string signed_csr_payload;
status =
getDeviceSignedCsrPayload(mCDM, mCertificateSigningRequestChallenge,
@@ -1505,10 +1503,10 @@ static WvStatus getDeviceSignedCsrPayload(
} else {
return toNdkScopedAStatus(Status::BAD_VALUE);
}
} else if (name == "certificateSigningRequestChallenge" && isCsrAccessAllowed()) {
} else if (name == "certificateSigningRequestChallenge" && isRootOrShell()) {
mCertificateSigningRequestChallenge =
std::string(_value.begin(), _value.end());
} else if (name == "deviceInfo" && isCsrAccessAllowed()) {
} else if (name == "deviceInfo" && isRootOrShell()) {
mDeviceInfo = std::string(_value.begin(), _value.end());
} else {
ALOGE("App set unknown byte array property %s", name.c_str());