Skip to content
Snippets Groups Projects
Commit 7c4ee7ec authored by Alexandre Janniaux's avatar Alexandre Janniaux Committed by Jean-Baptiste Kempf
Browse files

securetransport: use __builtin_available tagging

The SSL*ALPNProtocols were introduced in recent OS version, and dynamic
lookup (using ld64 option -Wl,-U) was used to make it work during
link-time and potentially not have the function available.

However, -Wl,-U is not compatible with bitcode support, whereas
availability targeting is, and availability targeting provides more
information about when it's not supported.

MacOSX 10.13.4 is the minimal version target in cURL too. The
SSL*ALPNProtocols functions are documented as supported since 10.13 but
they were not included in the initial 10.13 releases.
parent 505f0955
No related branches found
No related tags found
1 merge request!182Improve bitcode support in VLC
......@@ -441,12 +441,11 @@ static int st_Handshake (vlc_tls_t *session,
(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || \
(TARGET_OS_TV && __TV_OS_VERSION_MAX_ALLOWED >= 110000) || \
(TARGET_OS_WATCH && __WATCH_OS_VERSION_MAX_ALLOWED >= 40000)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
/* Handle ALPN data */
if (alp != NULL) {
if (SSLCopyALPNProtocols != NULL) {
if (__builtin_available(iOS 11, macOS 10.13.4, tvOS 11, watchOS 4, *))
{
CFArrayRef alpnArray = NULL;
OSStatus res = SSLCopyALPNProtocols(sys->p_context, &alpnArray);
if (res == noErr && alpnArray) {
......@@ -462,7 +461,6 @@ static int st_Handshake (vlc_tls_t *session,
}
}
#pragma clang diagnostic pop
#else
/* No ALPN support */
......@@ -745,12 +743,11 @@ static vlc_tls_t *st_ClientSessionOpen(vlc_tls_client_t *crd, vlc_tls_t *sock,
(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || \
(TARGET_OS_TV && __TV_OS_VERSION_MAX_ALLOWED >= 110000) || \
(TARGET_OS_WATCH && __WATCH_OS_VERSION_MAX_ALLOWED >= 40000)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
/* Handle ALPN */
if (alpn != NULL) {
if (SSLSetALPNProtocols != NULL) {
if (__builtin_available(iOS 11, macOS 10.13.4, tvOS 11, watchOS 4, *))
{
CFMutableArrayRef alpnValues = alpnToCFArray(alpn);
if (alpnValues == NULL) {
......@@ -768,7 +765,6 @@ static vlc_tls_t *st_ClientSessionOpen(vlc_tls_client_t *crd, vlc_tls_t *sock,
}
}
#pragma clang diagnostic pop
#else
/* No ALPN support */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment