Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b77dbe37 authored by Janis Danisevskis's avatar Janis Danisevskis
Browse files

Check for unimplemented keymaster function delete_key

delete_key is optional and may not be implemented by
a legacy hal. So the function pointer must be checked for
nullptr prior to being used.

Bug: 36500704
Test: run VTS tests with legacy hal that does not implement delete_key
Change-Id: Ie51dd173314826ef260319153c7df96d88b8a42f
parent a43c1d31
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -583,6 +583,9 @@ Return<void> KeymasterDevice::upgradeKey(const hidl_vec<uint8_t>& keyBlobToUpgra
}

Return<ErrorCode> KeymasterDevice::deleteKey(const hidl_vec<uint8_t>& keyBlob) {
    if (keymaster_device_->delete_key == nullptr) {
        return ErrorCode::UNIMPLEMENTED;
    }
    auto kmKeyBlob = hidlVec2KmKeyBlob(keyBlob);
    return legacy_enum_conversion(keymaster_device_->delete_key(keymaster_device_, &kmKeyBlob));
}