Revert CDM changes from oemcrypto 18.4

[ Merge of TBD ]

The merge of oemcrypto-v18 cdm branch to udc-widevine-dev
caused a number of CDM/plugin fixes to be lost.

This undoes the non-oemcrypto changes in http://go/ag/26105061

Bug: 290252845
Test: WVTS, unittests on panther
Change-Id: I2bb99f423bda351eee30276cb0e26e3d9e27fa7d
This commit is contained in:
Rahul Frias
2024-02-16 14:36:10 -08:00
parent c5e171867b
commit 8e0a3f5600
4 changed files with 54 additions and 18 deletions

View File

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