diff options
Diffstat (limited to 'Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift')
-rw-r--r-- | Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift b/Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift index ecb6e1f..0a303f4 100644 --- a/Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift +++ b/Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. +// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved. import NetworkExtension @@ -82,24 +82,22 @@ extension NETunnelProviderProtocol { return true } #elseif os(iOS) - if #available(iOS 15, *) { - /* Update the stored reference from the old iOS 14 one to the canonical iOS 15 one. - * The iOS 14 ones are 96 bits, while the iOS 15 ones are 160 bits. We do this so - * that we can have fast set exclusion in deleteReferences safely. */ - if passwordReference != nil && passwordReference!.count == 12 { - var result: CFTypeRef? - let ret = SecItemCopyMatching([kSecValuePersistentRef: passwordReference!, - kSecReturnPersistentRef: true] as CFDictionary, - &result) - if ret != errSecSuccess || result == nil { - return false - } - guard let newReference = result as? Data else { return false } - if !newReference.elementsEqual(passwordReference!) { - wg_log(.info, message: "Migrating iOS 14-style keychain reference to iOS 15-style keychain reference for '\(name)'") - passwordReference = newReference - return true - } + /* Update the stored reference from the old iOS 14 one to the canonical iOS 15 one. + * The iOS 14 ones are 96 bits, while the iOS 15 ones are 160 bits. We do this so + * that we can have fast set exclusion in deleteReferences safely. */ + if passwordReference != nil && passwordReference!.count == 12 { + var result: CFTypeRef? + let ret = SecItemCopyMatching([kSecValuePersistentRef: passwordReference!, + kSecReturnPersistentRef: true] as CFDictionary, + &result) + if ret != errSecSuccess || result == nil { + return false + } + guard let newReference = result as? Data else { return false } + if !newReference.elementsEqual(passwordReference!) { + wg_log(.info, message: "Migrating iOS 14-style keychain reference to iOS 15-style keychain reference for '\(name)'") + passwordReference = newReference + return true } } #endif |