Snap for 11954976 from 89b565a453 to 24Q3-release

Change-Id: I869666a5bdcfb088efa2ccc044a19b0985b7596b
This commit is contained in:
Android Build Coastguard Worker 2024-06-11 23:26:43 +00:00
commit ee9c5582fa
3 changed files with 23 additions and 0 deletions

View file

@ -267,3 +267,17 @@ CborResult<Array> getCsr(std::string_view componentName, IRemotelyProvisionedCom
return getCsrV3(componentName, irpc, selfTest);
}
}
bool isRemoteProvisioningSupported(IRemotelyProvisionedComponent* irpc) {
RpcHardwareInfo hwInfo;
auto status = irpc->getHardwareInfo(&hwInfo);
if (status.isOk()) {
return true;
}
if (status.getExceptionCode() == EX_UNSUPPORTED_OPERATION) {
return false;
}
std::cerr << "Unexpected error when getting hardware info. Description: "
<< status.getDescription() << "." << std::endl;
exit(-1);
}

View file

@ -53,3 +53,7 @@ getCsr(std::string_view componentName,
void selfTestGetCsr(
std::string_view componentName,
aidl::android::hardware::security::keymint::IRemotelyProvisionedComponent* irpc);
// Returns true if the given IRemotelyProvisionedComponent supports remote provisioning.
bool isRemoteProvisioningSupported(
aidl::android::hardware::security::keymint::IRemotelyProvisionedComponent* irpc);

View file

@ -78,6 +78,11 @@ void writeOutput(const std::string instance_name, const Array& csr) {
}
void getCsrForIRpc(const char* descriptor, const char* name, IRemotelyProvisionedComponent* irpc) {
// AVF RKP HAL is not always supported, so we need to check if it is supported before
// generating the CSR.
if (std::string(name) == "avf" && !isRemoteProvisioningSupported(irpc)) {
return;
}
auto [request, errMsg] = getCsr(name, irpc, FLAGS_self_test);
auto fullName = getFullServiceName(descriptor, name);
if (!request) {