[vlc-commits] [Git][videolan/vlc][master] 2 commits: securetransport: always use API available in macOS 10.7

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Oct 18 08:46:24 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
2bc134c6 by Steve Lhomme at 2025-10-18T07:51:22+00:00
securetransport: always use API available in macOS 10.7

It's available on all OS we target.

SSLCopyPeerCertificates is deprecated since 10.9 [^1].

[^1]: https://developer.apple.com/documentation/security/sslcopypeercertificates

- - - - -
13d5a00d by Steve Lhomme at 2025-10-18T07:51:22+00:00
securetransport: always use SSLCreateContext/CFRelease available in macOS 10.8

It's available on all OS we target.

SSLNewContext is deprecated since 10.9 [^1].

[^1]: https://developer.apple.com/documentation/security/1503793-sslnewcontext

- - - - -


1 changed file:

- modules/misc/securetransport.c


Changes:

=====================================
modules/misc/securetransport.c
=====================================
@@ -313,25 +313,6 @@ static int st_validateServerCertificate (vlc_tls_t *session, const char *hostnam
 
     /* get leaf certificate */
     /* SSLCopyPeerCertificates is only available on OSX 10.5 or later */
-#if !TARGET_OS_IPHONE
-    CFArrayRef cert_chain = NULL;
-    ret = SSLCopyPeerCertificates(sys->p_context, &cert_chain);
-    if (ret != noErr || !cert_chain) {
-        result = -1;
-        goto out;
-    }
-
-    if (CFArrayGetCount(cert_chain) == 0) {
-        CFRelease(cert_chain);
-        result = -1;
-        goto out;
-    }
-
-    leaf_cert = (SecCertificateRef)CFArrayGetValueAtIndex(cert_chain, 0);
-    CFRetain(leaf_cert);
-    CFRelease(cert_chain);
-#else
-    /* SecTrustGetCertificateAtIndex is only available on 10.7 or iOS */
     if (SecTrustGetCertificateCount(trust) == 0) {
         result = -1;
         goto out;
@@ -339,8 +320,6 @@ static int st_validateServerCertificate (vlc_tls_t *session, const char *hostnam
 
     leaf_cert = SecTrustGetCertificateAtIndex(trust, 0);
     CFRetain(leaf_cert);
-#endif
-
 
     /* check if leaf already accepted */
     CFIndex max = CFArrayGetCount(sys->p_cred->whitelist);
@@ -637,13 +616,7 @@ static void st_SessionClose (vlc_tls_t *session) {
     msg_Dbg(sys->obj, "close TLS session");
 
     if (sys->p_context) {
-#if TARGET_OS_IPHONE
         CFRelease(sys->p_context);
-#else
-        if (SSLDisposeContext(sys->p_context) != noErr) {
-            msg_Err(sys->obj, "error deleting context");
-        }
-#endif
     }
     free(sys);
 }
@@ -684,18 +657,11 @@ static vlc_tls_t *st_SessionOpenCommon(vlc_object_t *obj,
     tls->ops = &st_ops;
 
     SSLContextRef p_context = NULL;
-#if TARGET_OS_IPHONE
     p_context = SSLCreateContext(NULL, b_server ? kSSLServerSide : kSSLClientSide, kSSLStreamType);
     if (p_context == NULL) {
         msg_Err(obj, "cannot create ssl context");
         goto error;
     }
-#else
-    if (SSLNewContext(b_server, &p_context) != noErr) {
-        msg_Err(obj, "error calling SSLNewContext");
-        goto error;
-    }
-#endif
 
     sys->p_context = p_context;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a97fb5265779a3f6af21d5b706c56fc112e1412a...13d5a00d5301f0150726f290d078fc43bdb2d7e1

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a97fb5265779a3f6af21d5b706c56fc112e1412a...13d5a00d5301f0150726f290d078fc43bdb2d7e1
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list