1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-11 02:13:38 +09:00

Bump iOS/tvOS minimum version to 11.0, cleanup some code (#81965)

In .NET 8 the minimum Apple OS versions we're supporting are iOS/tvOS 11.0 and macOS 10.15.

This bumps the version settings in various files and cleans up code that can now assume it's running on a later OS version. For example, it allows us to get rid of a couple `dlsym()` calls in System.Security.Cryptography.Native.Apple.

We can also stop building the iOS arm and iOSSimulator x86 runtime packs since 32bit platforms aren't supported by iOS 11
This commit is contained in:
Alexander Köplinger 2023-02-13 16:18:56 +01:00 committed by GitHub
parent 79941e4568
commit 8cb3cfc360
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 69 additions and 218 deletions

View file

@ -45,7 +45,20 @@
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
<Platform Condition="'$(Platform)' == '' and '$(InferPlatformFromTargetArchitecture)' == 'true'">$(TargetArchitecture)</Platform>
</PropertyGroup>
<PropertyGroup Label="SetOSTargetMinVersions">
<!-- Minimum Apple target OS versions, keep in sync with src/native/libs/build-native.sh -->
<iOSVersionMin>11.0</iOSVersionMin>
<tvOSVersionMin>11.0</tvOSVersionMin>
<watchOSVersionMin>2.0</watchOSVersionMin>
<watchOS64_32VersionMin>5.1</watchOS64_32VersionMin>
<macOSVersionMin>10.15</macOSVersionMin>
<macOSVersionMin Condition="('$(TargetOS)' == 'osx' or '$(TargetOS)' == 'maccatalyst') and '$(TargetArchitecture)' == 'arm64'">11.0</macOSVersionMin>
<!-- Minimum version of the Android API level we target, keep in sync with eng/native/build-commons.sh -->
<AndroidApiLevelMin>21</AndroidApiLevelMin>
</PropertyGroup>
<PropertyGroup>
<!-- Set OutDirName (Arcade specific property that must be set before the Arcade SDK is imported) to change the BaseOutputPath and
BaseIntermediateOutputPath properties to include the ref subfolder. -->

View file

@ -84,7 +84,7 @@ build_native()
exit 1
fi
# keep ANDROID_PLATFORM in sync with src/mono/Directory.Build.props
# keep ANDROID_PLATFORM in sync with SetOSTargetMinVersions in the root Directory.Build.props
cmakeArgs="-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-21 $cmakeArgs"
# Don't try to set CC/CXX in init-compiler.sh - it's handled in android.toolchain.cmake already

View file

@ -653,25 +653,6 @@ jobs:
helixQueueGroup: ${{ parameters.helixQueueGroup }}
${{ insert }}: ${{ parameters.jobParameters }}
# iOS arm
- ${{ if containsValue(parameters.platforms, 'ios_arm') }}:
- template: xplat-setup.yml
parameters:
jobTemplate: ${{ parameters.jobTemplate }}
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
variables: ${{ parameters.variables }}
osGroup: ios
archType: arm
targetRid: ios-arm
platform: ios_arm
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
jobParameters:
runtimeFlavor: mono
buildConfig: ${{ parameters.buildConfig }}
helixQueueGroup: ${{ parameters.helixQueueGroup }}
${{ insert }}: ${{ parameters.jobParameters }}
# iOS arm64
- ${{ if containsValue(parameters.platforms, 'ios_arm64') }}:
@ -710,25 +691,6 @@ jobs:
helixQueueGroup: ${{ parameters.helixQueueGroup }}
${{ insert }}: ${{ parameters.jobParameters }}
# iOS Simulator x86
- ${{ if containsValue(parameters.platforms, 'iossimulator_x86') }}:
- template: xplat-setup.yml
parameters:
jobTemplate: ${{ parameters.jobTemplate }}
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
variables: ${{ parameters.variables }}
osGroup: iossimulator
archType: x86
targetRid: iossimulator-x86
platform: iossimulator_x86
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
jobParameters:
runtimeFlavor: mono
buildConfig: ${{ parameters.buildConfig }}
helixQueueGroup: ${{ parameters.helixQueueGroup }}
${{ insert }}: ${{ parameters.jobParameters }}
# iOS Simulator arm64
- ${{ if containsValue(parameters.platforms, 'iossimulator_arm64') }}:

View file

@ -360,7 +360,6 @@ jobs:
# - maccatalyst_x64
# - iossimulator_x64
# - ios_arm64
# - ios_arm
# jobParameters:
# buildArgs: -s mono+libs+host+packs -c $(_BuildConfig)
# nameSuffix: Maui_Packs_Mono
@ -386,7 +385,6 @@ jobs:
# - Build_android_x64_release_Maui_Packs_Mono
# - Build_maccatalyst_x64_release_Maui_Packs_Mono
# - Build_iossimulator_x64_release_Maui_Packs_Mono
# - Build_ios_arm_release_Maui_Packs_Mono
# - Build_ios_arm64_release_Maui_Packs_Mono
buildArgs: -s mono -c $(_BuildConfig)
nameSuffix: MACiOSAndroidMauiNet7

View file

@ -82,13 +82,6 @@ steps:
# overwriteExistingFiles: true
# cleanDestinationFolder: false
#- task: ExtractFiles@1
# displayName: Extract ios-arm runtime
# inputs:
# archiveFilePatterns: $(Build.SourcesDirectory)/MauiTesting/ArtifactPacks/Microsoft.NETCore.App.Runtime.Mono.ios-arm.*.zip
# destinationFolder: $(Build.SourcesDirectory)/MauiTesting/ArtifactPacks/Microsoft.NETCore.App.Runtime.Mono.ios-arm
# overwriteExistingFiles: true
# cleanDestinationFolder: false
#- task: ExtractFiles@1
# displayName: Extract ios-arm64 runtime
# inputs:
# archiveFilePatterns: $(Build.SourcesDirectory)/MauiTesting/ArtifactPacks/Microsoft.NETCore.App.Runtime.Mono.ios-arm64.*.zip

View file

@ -117,9 +117,7 @@ extends:
- tvossimulator_arm64
- tvos_arm64
- iossimulator_x64
- iossimulator_x86
- iossimulator_arm64
- ios_arm
- ios_arm64
- osx_x64
- osx_arm64
@ -496,10 +494,8 @@ extends:
- Build_android_x86_release_AllSubsets_Mono
- Build_android_x64_release_AllSubsets_Mono
- Build_browser_wasm_Linux_release_AllSubsets_Mono
- Build_ios_arm_release_AllSubsets_Mono
- Build_ios_arm64_release_AllSubsets_Mono
- Build_iossimulator_x64_release_AllSubsets_Mono
- Build_iossimulator_x86_release_AllSubsets_Mono
- Build_iossimulator_arm64_release_AllSubsets_Mono
- Build_maccatalyst_arm64_release_AllSubsets_Mono
- Build_maccatalyst_x64_release_AllSubsets_Mono

View file

@ -364,7 +364,6 @@ extends:
runtimeFlavor: mono
platforms:
- tvossimulator_x64
- iossimulator_x86
- linux_arm
jobParameters:
testGroup: innerloop
@ -383,7 +382,6 @@ extends:
buildConfig: Release
runtimeFlavor: mono
platforms:
- ios_arm
- linux_musl_x64
jobParameters:
testGroup: innerloop

View file

@ -45,7 +45,7 @@
RuntimeFrameworkName="$(LocalFrameworkOverrideName)"
LatestRuntimeFrameworkVersion="$(ProductVersion)"
RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.Mono.**RID**"
RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86;browser-wasm;wasi-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86"
RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86;browser-wasm;wasi-wasm;ios-arm64;iossimulator-arm64;iossimulator-x64;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86"
RuntimePackLabels="Mono"
Condition="'@(KnownRuntimePack)' == '' or !@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"/>
<KnownCrossgen2Pack Include="$(LocalFrameworkOverrideName).Crossgen2"

View file

@ -5,7 +5,7 @@
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+android+'))">$(MonoAotTargets);android-x64;android-arm64;android-x86;android-arm</MonoAotTargets>
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+browser+'))">$(MonoAotTargets);browser-wasm</MonoAotTargets>
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+tvos+'))">$(MonoAotTargets);tvossimulator-x64;tvossimulator-arm64;tvos-arm64</MonoAotTargets>
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+ios+'))">$(MonoAotTargets);iossimulator-x64;iossimulator-arm64;iossimulator-x86;ios-arm64;ios-arm</MonoAotTargets>
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+ios+'))">$(MonoAotTargets);iossimulator-x64;iossimulator-arm64;ios-arm64</MonoAotTargets>
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+maccatalyst+'))">$(MonoAotTargets);maccatalyst-x64;maccatalyst-arm64</MonoAotTargets>
</PropertyGroup>

View file

@ -6,7 +6,7 @@
<conclusion file="conclusion.html" mime-type="text/html" />
<volume-check>
<allowed-os-versions>
<os-version min="10.13" />
<os-version min="10.15" />
</allowed-os-versions>
</volume-check>
</installer-gui-script>

View file

@ -26,7 +26,7 @@ internal static partial class Interop
out SafeCFStringHandle cfSubjectSummaryOut);
[LibraryImport(Libraries.AppleCryptoNative)]
private static partial int AppleCryptoNative_X509GetPublicKey(SafeSecCertificateHandle cert, out SafeSecKeyRefHandle publicKey, out int pOSStatus);
private static partial int AppleCryptoNative_X509GetPublicKey(SafeSecCertificateHandle cert, out SafeSecKeyRefHandle publicKey);
internal static X509ContentType X509GetContentType(ReadOnlySpan<byte> data)
=> X509GetContentType(ref MemoryMarshal.GetReference(data), data.Length);
@ -125,8 +125,7 @@ internal static partial class Interop
internal static SafeSecKeyRefHandle X509GetPublicKey(SafeSecCertificateHandle cert)
{
SafeSecKeyRefHandle publicKey;
int osStatus;
int ret = AppleCryptoNative_X509GetPublicKey(cert, out publicKey, out osStatus);
int ret = AppleCryptoNative_X509GetPublicKey(cert, out publicKey);
if (ret == 1)
{
@ -135,11 +134,6 @@ internal static partial class Interop
publicKey.Dispose();
if (ret == 0)
{
throw CreateExceptionForOSStatus(osStatus);
}
Debug.Fail($"Unexpected return value {ret}");
throw new CryptographicException();
}

View file

@ -12,24 +12,12 @@
</PropertyGroup>
<PropertyGroup>
<!-- Minimum target OS version, keep in sync with src/native/libs/build-native.sh -->
<iOSVersionMin>10.0</iOSVersionMin>
<tvOSVersionMin>10.0</tvOSVersionMin>
<watchOSVersionMin>2.0</watchOSVersionMin>
<watchOS64_32VersionMin>5.1</watchOS64_32VersionMin>
<macOSVersionMin>10.14</macOSVersionMin>
<!-- FIXME: when we're building ios or tvOS cross-compilers hosted on OSX/arm64 targeting ios/arm64 we should set the min macOS version to 11.0, also -->
<macOSVersionMin Condition="('$(TargetOS)' == 'osx' or '$(TargetOS)' == 'maccatalyst') and '$(TargetArchitecture)' == 'arm64'">11.0</macOSVersionMin>
<!-- Version of the OS SDK we target -->
<!-- Version of the Apple OS SDKs we target. Usually empty so the latest version is used but can be overriden externally. -->
<iOSVersion></iOSVersion>
<tvOSVersion></tvOSVersion>
<watchOSVersion></watchOSVersion>
<watchOS64_32Version></watchOS64_32Version>
<macOSVersion></macOSVersion>
<!-- Minimum version of the Android API level we target, keep in sync with eng/native/build-commons.sh -->
<AndroidApiLevelMin>21</AndroidApiLevelMin>
</PropertyGroup>
<!-- Output paths -->

View file

@ -80,7 +80,7 @@ ac_check_funcs (
sched_getaffinity sched_setaffinity chmod lstat getdtablesize ftruncate msync
getpeername utime utimes openlog closelog atexit popen strerror_r inet_pton inet_aton
poll getfsstat mremap posix_fadvise vsnprintf statfs statvfs setpgid system
fork execv execve waitpid localtime_r mkdtemp getrandom execvp strlcpy stpcpy strtok_r rewinddir
fork execv execve waitpid localtime_r mkdtemp getrandom getentropy execvp strlcpy stpcpy strtok_r rewinddir
vasprintf strndup getprotobyname getprotobyname_r getaddrinfo mach_absolute_time
gethrtime read_real_time gethostbyname gethostbyname2 getnameinfo getifaddrs
access inet_ntop Qp2getifaddrs getpid mktemp)
@ -99,9 +99,9 @@ endif()
check_include_files("sys/types.h;sys/user.h" HAVE_SYS_USER_H)
if(NOT HOST_DARWIN)
# getentropy was introduced in macOS 10.12 / iOS 10.0
ac_check_funcs (getentropy)
if(HOST_IOS OR HOST_MACCAT)
# getentropy isn't allowed in the AppStore: https://github.com/rust-lang/rust/issues/102643
set(HAVE_GETENTROPY 0)
endif()
if(NOT DISABLE_THREADS)
@ -248,7 +248,6 @@ if(HOST_WIN32)
elseif(HOST_IOS)
set(HAVE_SYSTEM 0)
set(HAVE_SYS_USER_H 0)
set(HAVE_GETENTROPY 0)
if(HOST_TVOS)
set(HAVE_PTHREAD_KILL 0)
set(HAVE_KILL 0)

View file

@ -12,7 +12,7 @@
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+android+'))">$(MonoAotTargets);android-x64;android-arm64;android-x86;android-arm</MonoAotTargets>
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+browser+'))">$(MonoAotTargets);browser-wasm</MonoAotTargets>
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+tvos+'))">$(MonoAotTargets);tvossimulator-x64;tvossimulator-arm64;tvos-arm64</MonoAotTargets>
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+ios+'))">$(MonoAotTargets);iossimulator-x64;iossimulator-arm64;iossimulator-x86;ios-arm64;ios-arm</MonoAotTargets>
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+ios+'))">$(MonoAotTargets);iossimulator-x64;iossimulator-arm64;ios-arm64</MonoAotTargets>
<MonoAotTargets Condition="$(_MonoCrossAOTTargetOS.contains('+maccatalyst+'))">$(MonoAotTargets);maccatalyst-x64;maccatalyst-arm64</MonoAotTargets>
</PropertyGroup>

View file

@ -52,11 +52,9 @@
"abstract": true,
"description": "iOS Mono Runtime and AOT Workload",
"packs": [
"Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm",
"Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm64",
"Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-arm64",
"Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x64",
"Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x86"
"Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x64"
],
"extends": [ "runtimes-ios" ],
"platforms": [ "win-x64", "win-arm64", "osx-arm64", "osx-x64" ]
@ -65,11 +63,9 @@
"abstract": true,
"description": "iOS Mono Runtime Packs",
"packs": [
"Microsoft.NETCore.App.Runtime.Mono.ios-arm",
"Microsoft.NETCore.App.Runtime.Mono.ios-arm64",
"Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64",
"Microsoft.NETCore.App.Runtime.Mono.iossimulator-x64",
"Microsoft.NETCore.App.Runtime.Mono.iossimulator-x86"
"Microsoft.NETCore.App.Runtime.Mono.iossimulator-x64"
],
"extends": [ "microsoft-net-runtime-mono-tooling" ],
"platforms": [ "win-x64", "win-arm64", "osx-arm64", "osx-x64" ]
@ -247,10 +243,6 @@
"kind": "framework",
"version": "${PackageVersion}",
},
"Microsoft.NETCore.App.Runtime.Mono.ios-arm" : {
"kind": "framework",
"version": "${PackageVersion}"
},
"Microsoft.NETCore.App.Runtime.Mono.ios-arm64" : {
"kind": "framework",
"version": "${PackageVersion}"
@ -263,10 +255,6 @@
"kind": "framework",
"version": "${PackageVersion}",
},
"Microsoft.NETCore.App.Runtime.Mono.iossimulator-x86" : {
"kind": "framework",
"version": "${PackageVersion}",
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.tvos-arm64": {
"kind": "Sdk",
"version": "${PackageVersion}",
@ -319,14 +307,6 @@
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvossimulator-x64"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm": {
"kind": "Sdk",
"version": "${PackageVersion}",
"alias-to": {
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm",
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm",
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm64": {
"kind": "Sdk",
"version": "${PackageVersion}",
@ -351,14 +331,6 @@
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-x64"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x86": {
"kind": "Sdk",
"version": "${PackageVersion}",
"alias-to": {
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-x86",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-x86"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.browser-wasm": {
"kind": "Sdk",
"version": "${PackageVersion}",

View file

@ -79,11 +79,9 @@
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Runtime.MonoTargets.Sdk" />
</ImportGroup>
<ImportGroup Condition="'$(TargetsCurrent)' == 'true' and '$(TargetPlatformIdentifier)' == 'ios' and $([MSBuild]::IsOSPlatform('osx'))">
<Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm" />
<Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm64" />
<Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-arm64" />
<Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x64" />
<Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x86" />
</ImportGroup>
<ImportGroup Condition="'$(TargetsCurrent)' == 'true' and '$(TargetPlatformIdentifier)' == 'maccatalyst'">

View file

@ -126,9 +126,8 @@ int32_t AppleCryptoNative_X509StoreRemoveCertificate(CFTypeRef certOrIdentity, u
SecCertificateRef cert = (SecCertificateRef)CONST_CAST(void*, certOrIdentity);
SecKeyRef publicKey = NULL;
CFTypeRef publicKeyLabel = NULL;
int32_t dummyStatus;
if (AppleCryptoNative_X509GetPublicKey(cert, &publicKey, &dummyStatus))
if (AppleCryptoNative_X509GetPublicKey(cert, &publicKey))
{
CFDictionaryRef attrs = SecKeyCopyAttributes(publicKey);
publicKeyLabel = CFRetain(CFDictionaryGetValue(attrs, kSecAttrApplicationLabel));

View file

@ -123,8 +123,7 @@ static CFStringRef GetSignatureAlgorithmIdentifier(PAL_HashAlgorithm hashAlgorit
}
}
// Requires macOS 10.13+ or iOS 11+
/*if (signatureAlgorithm == PAL_SignatureAlgorithm_RSA_Pss)
if (signatureAlgorithm == PAL_SignatureAlgorithm_RSA_Pss)
{
switch (hashAlgorithm)
{
@ -133,7 +132,7 @@ static CFStringRef GetSignatureAlgorithmIdentifier(PAL_HashAlgorithm hashAlgorit
case PAL_SHA384: return kSecKeyAlgorithmRSASignatureDigestPSSSHA384;
case PAL_SHA512: return kSecKeyAlgorithmRSASignatureDigestPSSSHA512;
}
}*/
}
if (signatureAlgorithm == PAL_SignatureAlgorithm_RSA_Raw)
{

View file

@ -6,14 +6,6 @@
#include "coretls_structs.h"
// 10.13.4 introduced public API but linking would fail on all prior versions.
// For that reason we use function pointers instead of direct call.
// This can be revisited after we drop support for 10.12 and iOS 10
static OSStatus (*SSLSetALPNProtocolsPtr)(SSLContextRef context, CFArrayRef protocols) = NULL;
static OSStatus (*SSLCopyALPNProtocolsPtr)(SSLContextRef context, CFArrayRef* protocols) = NULL;
// end of ALPN.
SSLContextRef AppleCryptoNative_SslCreateContext(int32_t isServer)
{
if (isServer != 0 && isServer != 1)
@ -229,14 +221,12 @@ int32_t AppleCryptoNative_SSLSetALPNProtocols(SSLContextRef sslContext,
if (sslContext == NULL || protocols == NULL || pOSStatus == NULL)
return -1;
if (!SSLSetALPNProtocolsPtr)
{
// not available.
*pOSStatus = 0;
return 1;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// The underlying call handles NULL inputs, so just pass it through
*pOSStatus = (*SSLSetALPNProtocolsPtr)(sslContext, protocols);
*pOSStatus = SSLSetALPNProtocols(sslContext, protocols);
#pragma clang diagnostic pop
return *pOSStatus == noErr;
}
@ -245,13 +235,6 @@ int32_t AppleCryptoNative_SSLSetALPNProtocol(SSLContextRef sslContext, void* pro
if (sslContext == NULL || protocol == NULL || length <= 0 || pOSStatus == NULL)
return -1;
if (!SSLSetALPNProtocolsPtr)
{
// not available.
*pOSStatus = errSecNotAvailable;
return 1;
}
CFStringRef value = CFStringCreateWithBytes(NULL, protocol, length, kCFStringEncodingASCII, 0);
if (!value)
{
@ -267,8 +250,11 @@ int32_t AppleCryptoNative_SSLSetALPNProtocol(SSLContextRef sslContext, void* pro
return -2;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
*pOSStatus = SSLSetALPNProtocols(sslContext, protocolList);
#pragma clang diagnostic pop
*pOSStatus = (*SSLSetALPNProtocolsPtr)(sslContext, protocolList);
if (*pOSStatus == 0)
{
struct SSLContext* ctx = (struct SSLContext*)sslContext;
@ -298,14 +284,12 @@ int32_t AppleCryptoNative_SslGetAlpnSelected(SSLContextRef sslContext, CFDataRef
return -1;
*protocol = NULL;
if (!SSLCopyALPNProtocolsPtr)
{
// not available.
return 0;
}
CFArrayRef protocols = NULL;
OSStatus osStatus = (*SSLCopyALPNProtocolsPtr)(sslContext, &protocols);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
OSStatus osStatus = SSLCopyALPNProtocols(sslContext, &protocols);
#pragma clang diagnostic pop
if (osStatus == noErr && protocols != NULL && CFArrayGetCount(protocols) > 0)
{
@ -705,28 +689,17 @@ int32_t AppleCryptoNative_SslSetEnabledCipherSuites(SSLContextRef sslContext, co
}
}
// This API is present on macOS 10.5 and newer only
static OSStatus (*SSLSetCertificateAuthoritiesPtr)(SSLContextRef context, CFArrayRef certificates, int32_t replaceExisting) = NULL;
PALEXPORT int32_t AppleCryptoNative_SslSetCertificateAuthorities(SSLContextRef sslContext, CFArrayRef certificates, int32_t replaceExisting)
{
#if defined(TARGET_OSX)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// The underlying call handles NULL inputs, so just pass it through
if (!SSLSetCertificateAuthoritiesPtr)
{
// not available.
return 0;
}
return SSLSetCertificateAuthoritiesPtr(sslContext, certificates, replaceExisting);
return SSLSetCertificateAuthorities(sslContext, certificates, replaceExisting);
#pragma clang diagnostic pop
}
__attribute__((constructor)) static void InitializeAppleCryptoSslShim(void)
{
SSLSetCertificateAuthoritiesPtr = (OSStatus(*)(SSLContextRef, CFArrayRef, int32_t))dlsym(RTLD_DEFAULT, "SSLSetCertificateAuthorities");
SSLSetALPNProtocolsPtr = (OSStatus(*)(SSLContextRef, CFArrayRef))dlsym(RTLD_DEFAULT, "SSLSetALPNProtocols");
SSLCopyALPNProtocolsPtr = (OSStatus(*)(SSLContextRef, CFArrayRef*))dlsym(RTLD_DEFAULT, "SSLCopyALPNProtocols");
#else
return 0;
#endif
}

View file

@ -42,55 +42,27 @@ AppleCryptoNative_X509DemuxAndRetainHandle(CFTypeRef handle, SecCertificateRef*
return 1;
}
#if !defined(TARGET_MACCATALYST)
static void InitCertificateCopy(void)
{
#if defined(TARGET_IOS) || defined(TARGET_TVOS)
// SecCertificateCopyPublicKey on iOS/tvOS has same function prototype as SecCertificateCopyKey
secCertificateCopyKey = (SecKeyRef (*)(SecCertificateRef))dlsym(RTLD_DEFAULT, "SecCertificateCopyKey");
if (secCertificateCopyKey == NULL)
{
secCertificateCopyKey = (SecKeyRef (*)(SecCertificateRef))dlsym(RTLD_DEFAULT, "SecCertificateCopyPublicKey");
}
#else
secCertificateCopyKey = (SecKeyRef (*)(SecCertificateRef))dlsym(RTLD_DEFAULT, "SecCertificateCopyKey");
secCertificateCopyPublicKey = (OSStatus (*)(SecCertificateRef, SecKeyRef*))dlsym(RTLD_DEFAULT, "SecCertificateCopyPublicKey");
#endif
}
#endif
int32_t
AppleCryptoNative_X509GetPublicKey(SecCertificateRef cert, SecKeyRef* pPublicKeyOut, int32_t* pOSStatusOut)
AppleCryptoNative_X509GetPublicKey(SecCertificateRef cert, SecKeyRef* pPublicKeyOut)
{
if (pPublicKeyOut != NULL)
*pPublicKeyOut = NULL;
if (pOSStatusOut != NULL)
*pOSStatusOut = noErr;
if (cert == NULL || pPublicKeyOut == NULL || pOSStatusOut == NULL)
if (cert == NULL || pPublicKeyOut == NULL)
return kErrorUnknownState;
#if !defined(TARGET_MACCATALYST)
pthread_once(&once, InitCertificateCopy);
// SecCertificateCopyPublicKey was deprecated in 10.14, so use SecCertificateCopyKey on the systems that have it (10.14+),
// and SecCertificateCopyPublicKey on the systems that dont.
if (secCertificateCopyKey != NULL)
if (__builtin_available(macOS 10.14, iOS 12, tvOS 12, *))
{
*pPublicKeyOut = (*secCertificateCopyKey)(cert);
}
else if (secCertificateCopyPublicKey != NULL)
{
*pOSStatusOut = (*secCertificateCopyPublicKey)(cert, pPublicKeyOut);
*pPublicKeyOut = SecCertificateCopyKey(cert);
}
#if defined(TARGET_IOS) || defined(TARGET_TVOS)
else
{
return kErrorBadInput;
*pPublicKeyOut = SecCertificateCopyPublicKey(cert);
}
return (*pOSStatusOut == noErr);
#else
*pPublicKeyOut = SecCertificateCopyKey(cert);
return 1;
#endif
return 1;
}
PAL_X509ContentType AppleCryptoNative_X509GetContentType(uint8_t* pbData, int32_t cbData)

View file

@ -30,10 +30,9 @@ Returns 1 on success, 0 on failure, any other value on invalid state.
Output:
pPublicKeyOut: Receives a CFRetain()ed SecKeyRef for the public key
pOSStatusOut: Receives the result of SecCertificateCopyKey or SecCertificateCopyPublicKey, depending on the OS version.
*/
PALEXPORT int32_t
AppleCryptoNative_X509GetPublicKey(SecCertificateRef cert, SecKeyRef* pPublicKeyOut, int32_t* pOSStatusOut);
AppleCryptoNative_X509GetPublicKey(SecCertificateRef cert, SecKeyRef* pPublicKeyOut);
/*
Determines the data type of the provided input.

View file

@ -93,8 +93,8 @@ elif [[ "$__TargetOS" == linux-bionic && -z "$ROOTFS_DIR" ]]; then
__CMakeArgs="-DFORCE_ANDROID_OPENSSL=1 -DANDROID_STL=none $__CMakeArgs"
elif [[ "$__TargetOS" == iossimulator ]]; then
# set default iOS simulator deployment target
# keep in sync with src/mono/Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_DEPLOYMENT_TARGET=10.0 $__CMakeArgs"
# keep in sync with SetOSTargetMinVersions in the root Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 $__CMakeArgs"
if [[ "$__TargetArch" == x64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"x86_64\" $__CMakeArgs"
elif [[ "$__TargetArch" == x86 ]]; then
@ -107,8 +107,8 @@ elif [[ "$__TargetOS" == iossimulator ]]; then
fi
elif [[ "$__TargetOS" == ios ]]; then
# set default iOS device deployment target
# keep in sync with src/mono/Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_DEPLOYMENT_TARGET=10.0 $__CMakeArgs"
# keep in sync with SetOSTargetMinVersions in the root Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 $__CMakeArgs"
if [[ "$__TargetArch" == arm64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $__CMakeArgs"
elif [[ "$__TargetArch" == arm ]]; then
@ -119,8 +119,8 @@ elif [[ "$__TargetOS" == ios ]]; then
fi
elif [[ "$__TargetOS" == tvossimulator ]]; then
# set default tvOS simulator deployment target
# keep in sync with src/mono/Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_DEPLOYMENT_TARGET=10.0 $__CMakeArgs"
# keep in sync with SetOSTargetMinVersions in the root Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 $__CMakeArgs"
if [[ "$__TargetArch" == x64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"x86_64\" $__CMakeArgs"
elif [[ "$__TargetArch" == arm64 ]]; then
@ -131,8 +131,8 @@ elif [[ "$__TargetOS" == tvossimulator ]]; then
fi
elif [[ "$__TargetOS" == tvos ]]; then
# set default tvOS device deployment target
# keep in sync with src/mono/Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_DEPLOYMENT_TARGET=10.0 $__CMakeArgs"
# keep in sync with the root Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 $__CMakeArgs"
if [[ "$__TargetArch" == arm64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $__CMakeArgs"
else

View file

@ -181,7 +181,7 @@ internal sealed class Xcode
targetName = Target.ToString();
break;
}
var deployTarget = (Target == TargetNames.MacCatalyst) ? " -DCMAKE_OSX_ARCHITECTURES=" + XcodeArch : " -DCMAKE_OSX_DEPLOYMENT_TARGET=10.1";
var deployTarget = (Target == TargetNames.MacCatalyst) ? " -DCMAKE_OSX_ARCHITECTURES=" + XcodeArch : " -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0";
var cmakeArgs = new StringBuilder();
cmakeArgs
.Append("-S.")

View file

@ -21,8 +21,6 @@
Condition="'%(ResolvedRuntimePack.FrameworkName)' == 'Microsoft.NETCore.App' and '%(ResolvedRuntimePack.RuntimeIdentifier)' == 'android-x86'" />
<ResolvedRuntimePack PackageDirectory="$(MicrosoftNetCoreAppRuntimePackDir)/Microsoft.NETCore.App.Runtime.Mono.android-x64"
Condition="'%(ResolvedRuntimePack.FrameworkName)' == 'Microsoft.NETCore.App' and '%(ResolvedRuntimePack.RuntimeIdentifier)' == 'android-x64'" />
<ResolvedRuntimePack PackageDirectory="$(MicrosoftNetCoreAppRuntimePackDir)/Microsoft.NETCore.App.Runtime.Mono.ios-arm"
Condition="'%(ResolvedRuntimePack.FrameworkName)' == 'Microsoft.NETCore.App' and '%(ResolvedRuntimePack.RuntimeIdentifier)' == 'ios-arm'" />
<ResolvedRuntimePack PackageDirectory="$(MicrosoftNetCoreAppRuntimePackDir)/Microsoft.NETCore.App.Runtime.Mono.ios-arm64"
Condition="'%(ResolvedRuntimePack.FrameworkName)' == 'Microsoft.NETCore.App' and '%(ResolvedRuntimePack.RuntimeIdentifier)' == 'ios-arm64'" />
<ResolvedRuntimePack PackageDirectory="$(MicrosoftNetCoreAppRuntimePackDir)/Microsoft.NETCore.App.Runtime.Mono.maccatalyst-x64"