diff --git a/TrustKit.podspec b/TrustKit.podspec index 0567e74..af0e859 100644 --- a/TrustKit.podspec +++ b/TrustKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "TrustKit" - s.version = "3.0.0" + s.version = "3.0.2" s.summary = 'TrustKit is an open source framework that makes it easy to deploy SSL pinning in any iOS, macOS, tvOS or watchOS App.' s.homepage = "https://datatheorem.github.io/TrustKit" s.documentation_url = 'https://datatheorem.github.io/TrustKit/documentation/' @@ -8,10 +8,10 @@ Pod::Spec.new do |s| s.authors = 'Alban Diquet', 'Angela Chow', 'Eric Castro' s.source = { :git => "https://github.com/datatheorem/TrustKit.git", :tag => "#{s.version}" } - s.ios.deployment_target = '14.0' - s.osx.deployment_target = '11.0' - s.tvos.deployment_target = '14.0' - s.watchos.deployment_target = '7.0' + s.ios.deployment_target = '12.0' + s.osx.deployment_target = '10.13' + s.tvos.deployment_target = '12.0' + s.watchos.deployment_target = '4.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } s.source_files = ['TrustKit', 'TrustKit/**/*.{h,m,c}'] diff --git a/TrustKit/Pinning/pinning_utils.m b/TrustKit/Pinning/pinning_utils.m index 0d6ff9a..29cd9da 100644 --- a/TrustKit/Pinning/pinning_utils.m +++ b/TrustKit/Pinning/pinning_utils.m @@ -18,15 +18,17 @@ void evaluateCertificateChainTrust(SecTrustRef serverTrust, SecTrustResultType * CFErrorRef errorRef; bool certificateEvaluationSucceeded = SecTrustEvaluateWithError(serverTrust, &errorRef); OSStatus status = SecTrustGetTrustResult(serverTrust, trustResult); - if (status != errSecSuccess) - { - certificateEvaluationSucceeded = false; - NSString *errDescription = [NSString stringWithFormat:@"got status %d", status]; - *error = [[NSError alloc] initWithDomain:@"com.datatheorem.trustkit" code:1 userInfo:@{NSLocalizedDescriptionKey:errDescription}]; - } - else if (!certificateEvaluationSucceeded && (error != NULL)) - { - *error = (__bridge_transfer NSError *)errorRef; + if (error != NULL) { + if (status != errSecSuccess) + { + certificateEvaluationSucceeded = false; + NSString *errDescription = [NSString stringWithFormat:@"got status %d", (int)status]; + *error = [[NSError alloc] initWithDomain:@"com.datatheorem.trustkit" code:1 userInfo:@{NSLocalizedDescriptionKey:errDescription}]; + } + else if (!certificateEvaluationSucceeded) + { + *error = (__bridge_transfer NSError *)errorRef; + } } } else @@ -37,7 +39,7 @@ void evaluateCertificateChainTrust(SecTrustRef serverTrust, SecTrustResultType * OSStatus status = SecTrustEvaluate(serverTrust, trustResult); #pragma clang diagnostic pop if (status != errSecSuccess && (error != NULL)) { - NSString *errDescription = [NSString stringWithFormat:@"got status %d", status]; + NSString *errDescription = [NSString stringWithFormat:@"got status %d", (int)status]; *error = [[NSError alloc] initWithDomain:@"com.datatheorem.trustkit" code:2 userInfo:@{NSLocalizedDescriptionKey:errDescription}]; } }