Merge "keystore2 compat: stop crashing without hwservicemanager" into main am: a764eb9f45 am: d640b4c0ee am: 758bec0930 am: d7c817b718

Original change: https://android-review.googlesource.com/c/platform/system/security/+/2736025

Change-Id: Ic9ec7a73726c86a85c0cc6cd6bd1370a45978974
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Devin Moore 2023-09-06 20:23:02 +00:00 committed by Automerger Merge Worker
commit 907c5044b9

View file

@ -1450,7 +1450,12 @@ KeymasterDevices enumerateKeymasterDevices(IServiceManager* serviceManager) {
KeymasterDevices initializeKeymasters() {
auto serviceManager = IServiceManager::getService();
CHECK(serviceManager.get()) << "Failed to get ServiceManager";
if (!serviceManager.get()) {
// New devices no longer have HIDL support, so failing to get hwservicemanager is
// expected behavior.
LOG(INFO) << "Skipping keymaster compat, this system is AIDL only.";
return KeymasterDevices();
}
auto result = enumerateKeymasterDevices<Keymaster4>(serviceManager.get());
auto softKeymaster = result[SecurityLevel::SOFTWARE];
if ((!result[SecurityLevel::TRUSTED_ENVIRONMENT]) && (!result[SecurityLevel::STRONGBOX])) {