FFmpeg
Data Structures | Macros | Functions | Variables
tls_securetransport.c File Reference
#include <errno.h>
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "network.h"
#include "os_support.h"
#include "url.h"
#include "tls.h"
#include "libavcodec/internal.h"
#include "libavutil/avstring.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include <Security/Security.h>
#include <Security/SecureTransport.h>
#include <CoreFoundation/CoreFoundation.h>

Go to the source code of this file.

Data Structures

struct  TLSContext
 

Macros

#define ioErr   -36
 
#define CHECK_ERROR(func, ...)
 

Functions

SecIdentityRef SecIdentityCreate (CFAllocatorRef allocator, SecCertificateRef certificate, SecKeyRef privateKey)
 
static int print_tls_error (URLContext *h, int ret)
 
static int import_pem (URLContext *h, char *path, CFArrayRef *array)
 
static int load_ca (URLContext *h)
 
static int load_cert (URLContext *h)
 
static OSStatus tls_read_cb (SSLConnectionRef connection, void *data, size_t *dataLength)
 
static OSStatus tls_write_cb (SSLConnectionRef connection, const void *data, size_t *dataLength)
 
static int tls_close (URLContext *h)
 
static int tls_open (URLContext *h, const char *uri, int flags, AVDictionary **options)
 
static int map_ssl_error (OSStatus status, size_t processed)
 
static int tls_read (URLContext *h, uint8_t *buf, int size)
 
static int tls_write (URLContext *h, const uint8_t *buf, int size)
 
static int tls_get_file_handle (URLContext *h)
 
static int tls_get_short_seek (URLContext *h)
 

Variables

static const AVOption options []
 
static const AVClass tls_class
 
const URLProtocol ff_tls_protocol
 

Macro Definition Documentation

◆ ioErr

#define ioErr   -36

Definition at line 43 of file tls_securetransport.c.

◆ CHECK_ERROR

#define CHECK_ERROR (   func,
  ... 
)
Value:
do { \
OSStatus status = func(__VA_ARGS__); \
if (status != noErr) { \
ret = AVERROR_UNKNOWN; \
av_log(h, AV_LOG_ERROR, #func ": Error %i\n", (int)status); \
goto fail; \
} \
} while (0)

Definition at line 259 of file tls_securetransport.c.

Function Documentation

◆ SecIdentityCreate()

SecIdentityRef SecIdentityCreate ( CFAllocatorRef  allocator,
SecCertificateRef  certificate,
SecKeyRef  privateKey 
)

Referenced by load_cert().

◆ print_tls_error()

static int print_tls_error ( URLContext h,
int  ret 
)
static

Definition at line 53 of file tls_securetransport.c.

Referenced by tls_read(), and tls_write().

◆ import_pem()

static int import_pem ( URLContext h,
char *  path,
CFArrayRef *  array 
)
static

Definition at line 71 of file tls_securetransport.c.

Referenced by load_ca(), and load_cert().

◆ load_ca()

static int load_ca ( URLContext h)
static

Definition at line 134 of file tls_securetransport.c.

Referenced by tls_open().

◆ load_cert()

static int load_cert ( URLContext h)
static

Definition at line 154 of file tls_securetransport.c.

Referenced by tls_open().

◆ tls_read_cb()

static OSStatus tls_read_cb ( SSLConnectionRef  connection,
void *  data,
size_t *  dataLength 
)
static

Definition at line 197 of file tls_securetransport.c.

Referenced by tls_open().

◆ tls_write_cb()

static OSStatus tls_write_cb ( SSLConnectionRef  connection,
const void *  data,
size_t *  dataLength 
)
static

Definition at line 226 of file tls_securetransport.c.

Referenced by tls_open().

◆ tls_close()

static int tls_close ( URLContext h)
static

Definition at line 246 of file tls_securetransport.c.

Referenced by tls_open().

◆ tls_open()

static int tls_open ( URLContext h,
const char *  uri,
int  flags,
AVDictionary **  options 
)
static

Definition at line 268 of file tls_securetransport.c.

◆ map_ssl_error()

static int map_ssl_error ( OSStatus  status,
size_t  processed 
)
static

Definition at line 348 of file tls_securetransport.c.

Referenced by tls_read(), and tls_write().

◆ tls_read()

static int tls_read ( URLContext h,
uint8_t *  buf,
int  size 
)
static

Definition at line 364 of file tls_securetransport.c.

◆ tls_write()

static int tls_write ( URLContext h,
const uint8_t *  buf,
int  size 
)
static

Definition at line 381 of file tls_securetransport.c.

◆ tls_get_file_handle()

static int tls_get_file_handle ( URLContext h)
static

Definition at line 394 of file tls_securetransport.c.

◆ tls_get_short_seek()

static int tls_get_short_seek ( URLContext h)
static

Definition at line 400 of file tls_securetransport.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ NULL }
}

Definition at line 406 of file tls_securetransport.c.

◆ tls_class

const AVClass tls_class
static
Initial value:
= {
.class_name = "tls",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 411 of file tls_securetransport.c.

◆ ff_tls_protocol

const URLProtocol ff_tls_protocol
Initial value:
= {
.name = "tls",
.url_open2 = tls_open,
.url_read = tls_read,
.url_write = tls_write,
.url_close = tls_close,
.url_get_file_handle = tls_get_file_handle,
.url_get_short_seek = tls_get_short_seek,
.priv_data_size = sizeof(TLSContext),
.priv_data_class = &tls_class,
}

Definition at line 418 of file tls_securetransport.c.

func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:68
TLSContext
Definition: tls_gnutls.c:44
URL_PROTOCOL_FLAG_NETWORK
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:33
tls_open
static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options)
Definition: tls_securetransport.c:268
tls_write
static int tls_write(URLContext *h, const uint8_t *buf, int size)
Definition: tls_securetransport.c:381
AVERROR_UNKNOWN
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:73
TLS_COMMON_OPTIONS
#define TLS_COMMON_OPTIONS(pstruct, options_field)
Definition: tls.h:46
fail
#define fail()
Definition: checkasm.h:189
tls_get_short_seek
static int tls_get_short_seek(URLContext *h)
Definition: tls_securetransport.c:400
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
tls_get_file_handle
static int tls_get_file_handle(URLContext *h)
Definition: tls_securetransport.c:394
tls_read
static int tls_read(URLContext *h, uint8_t *buf, int size)
Definition: tls_securetransport.c:364
tls_class
static const AVClass tls_class
Definition: tls_securetransport.c:411
tls_close
static int tls_close(URLContext *h)
Definition: tls_securetransport.c:246
options
static const AVOption options[]
Definition: tls_securetransport.c:406
status
ov_status_e status
Definition: dnn_backend_openvino.c:100
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
h
h
Definition: vp9dsp_template.c:2070