diff mbox

[FFmpeg-devel,2/2] lavf/tls_securetransport: build on iOS

Message ID 20171025181500.6261-2-ffmpeg@tmm1.net
State Accepted
Commit fd18d310ec200fa7ace29cbfc725d451663bf49c
Headers show

Commit Message

Aman Gupta Oct. 25, 2017, 6:15 p.m. UTC
From: Aman Gupta <aman@tmm1.net>

This works as expected on iOS, except for the ca_file feature which
is disabled because SecItemImport is not available.
---
 configure                         | 6 +++++-
 libavformat/tls_securetransport.c | 4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Aman Gupta Nov. 12, 2017, 10:43 p.m. UTC | #1
On Wed, Oct 25, 2017 at 11:15 AM, Aman Gupta <ffmpeg@tmm1.net> wrote:

> From: Aman Gupta <aman@tmm1.net>
>
> This works as expected on iOS, except for the ca_file feature which
> is disabled because SecItemImport is not available.
> ---
>  configure                         | 6 +++++-
>  libavformat/tls_securetransport.c | 4 ++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index c86e5788fa..a867077d66 100755
> --- a/configure
> +++ b/configure
> @@ -2039,6 +2039,7 @@ SYSTEM_FUNCS="
>      posix_memalign
>      pthread_cancel
>      sched_getaffinity
> +    SecItemImport
>      SetConsoleTextAttribute
>      SetConsoleCtrlHandler
>      setmode
> @@ -6164,9 +6165,12 @@ fi
>
>  enabled securetransport &&
>      check_func SecIdentityCreate "-Wl,-framework,CoreFoundation
> -Wl,-framework,Security" &&
> -    check_lib securetransport "Security/SecureTransport.h
> Security/Security.h" "SSLCreateContext SecItemImport"
> "-Wl,-framework,CoreFoundation -Wl,-framework,Security" ||
> +    check_lib securetransport "Security/SecureTransport.h
> Security/Security.h" "SSLCreateContext" "-Wl,-framework,CoreFoundation
> -Wl,-framework,Security" ||
>          disable securetransport
>
> +enabled securetransport &&
> +    check_func SecItemImport "-Wl,-framework,CoreFoundation
> -Wl,-framework,Security"
> +
>  enabled schannel &&
>      check_func_headers "windows.h security.h" InitializeSecurityContext
> -DSECURITY_WIN32 -lsecur32 &&
>      check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" &&
> diff --git a/libavformat/tls_securetransport.c b/libavformat/tls_
> securetransport.c
> index 9ea588ae3a..69672f7676 100644
> --- a/libavformat/tls_securetransport.c
> +++ b/libavformat/tls_securetransport.c
> @@ -69,6 +69,9 @@ static int print_tls_error(URLContext *h, int ret)
>
>  static int import_pem(URLContext *h, char *path, CFArrayRef *array)
>  {
> +#if !HAVE_SECITEMIMPORT
> +    return AVERROR_PATCHWELCOME;
> +#else
>      AVIOContext *s = NULL;
>      CFDataRef data = NULL;
>      int64_t ret = 0;
> @@ -124,6 +127,7 @@ end:
>      if (s)
>          avio_close(s);
>      return ret;
> +#endif
>  }
>
>  static int load_ca(URLContext *h)
>

Pushed after OK from rcombs on IRC. Patch 1/2 is still pending.


> --
> 2.14.2
>
>
diff mbox

Patch

diff --git a/configure b/configure
index c86e5788fa..a867077d66 100755
--- a/configure
+++ b/configure
@@ -2039,6 +2039,7 @@  SYSTEM_FUNCS="
     posix_memalign
     pthread_cancel
     sched_getaffinity
+    SecItemImport
     SetConsoleTextAttribute
     SetConsoleCtrlHandler
     setmode
@@ -6164,9 +6165,12 @@  fi
 
 enabled securetransport &&
     check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
-    check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" ||
+    check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" ||
         disable securetransport
 
+enabled securetransport &&
+    check_func SecItemImport "-Wl,-framework,CoreFoundation -Wl,-framework,Security"
+
 enabled schannel &&
     check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 &&
     check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" &&
diff --git a/libavformat/tls_securetransport.c b/libavformat/tls_securetransport.c
index 9ea588ae3a..69672f7676 100644
--- a/libavformat/tls_securetransport.c
+++ b/libavformat/tls_securetransport.c
@@ -69,6 +69,9 @@  static int print_tls_error(URLContext *h, int ret)
 
 static int import_pem(URLContext *h, char *path, CFArrayRef *array)
 {
+#if !HAVE_SECITEMIMPORT
+    return AVERROR_PATCHWELCOME;
+#else
     AVIOContext *s = NULL;
     CFDataRef data = NULL;
     int64_t ret = 0;
@@ -124,6 +127,7 @@  end:
     if (s)
         avio_close(s);
     return ret;
+#endif
 }
 
 static int load_ca(URLContext *h)