diff mbox

[FFmpeg-devel,4/6] lavf/tls_apple: link to SecIdentityCreate weakly

Message ID 20190611141623.59440-4-rodger.combs@gmail.com
State Withdrawn, archived
Headers show

Commit Message

Rodger Combs June 11, 2019, 2:16 p.m. UTC
This is a private API, so it might go away in a future macOS version.
Linking to it weakly means that if it does, we won't crash during symbol lookup.
---
 libavformat/tls_apple.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libavformat/tls_apple.c b/libavformat/tls_apple.c
index 37d63f3b27..23042eb8ee 100644
--- a/libavformat/tls_apple.c
+++ b/libavformat/tls_apple.c
@@ -38,7 +38,7 @@ 
 #include <CoreFoundation/CoreFoundation.h>
 
 // We use a private API call here; it's good enough for WebKit.
-SecIdentityRef SecIdentityCreate(CFAllocatorRef allocator, SecCertificateRef certificate, SecKeyRef privateKey);
+SecIdentityRef __attribute__((weak)) SecIdentityCreate(CFAllocatorRef allocator, SecCertificateRef certificate, SecKeyRef privateKey);
 #define ioErr -36
 
 typedef struct TLSContext {
@@ -165,6 +165,11 @@  static int load_identity(URLContext *h, SecIdentityRef *identity, CFArrayRef *ce
     if ((ret = import_pem(h, c->tls_shared.key_file, &keyArray)) < 0)
         goto end;
 
+    if (!SecIdentityCreate) {
+        ret = AVERROR_PATCHWELCOME;
+        goto end;
+    }
+
     if (CFGetTypeID(CFArrayGetValueAtIndex(*certArray, 0)) != SecCertificateGetTypeID() ||
         CFGetTypeID(CFArrayGetValueAtIndex(keyArray, 0)) != SecKeyGetTypeID()) {
         ret = AVERROR_INVALIDDATA;