Merge commit '61cec5adaacb358783c18aa07362f15824c1b274'

* commit '61cec5adaacb358783c18aa07362f15824c1b274':
  tls: Hide backend implementation details from users

Also includes ed434be106
Changes were made to support schannel and securetransport.

Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2017-11-01 16:26:36 -03:00
commit 4600b0619a
9 changed files with 25 additions and 29 deletions

18
configure vendored
View File

@ -3160,21 +3160,14 @@ rtmpte_protocol_suggest="zlib"
rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
rtmpts_protocol_suggest="zlib"
rtp_protocol_select="udp_protocol"
schannel_conflict="openssl gnutls"
sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags"
sctp_protocol_select="network"
securetransport_conflict="openssl gnutls"
srtp_protocol_select="rtp_protocol srtp"
tcp_protocol_select="network"
tls_gnutls_protocol_conflict="tls_schannel_protocol tls_securetransport_protocol"
tls_gnutls_protocol_deps="gnutls"
tls_gnutls_protocol_select="tcp_protocol"
tls_openssl_protocol_conflict="tls_schannel_protocol tls_securetransport_protocol tls_gnutls_protocol"
tls_openssl_protocol_deps="openssl"
tls_openssl_protocol_select="tcp_protocol"
tls_schannel_protocol_deps="schannel"
tls_schannel_protocol_select="tcp_protocol"
tls_securetransport_protocol_deps="securetransport"
tls_securetransport_protocol_select="tcp_protocol"
tls_protocol_deps_any="tls_schannel_protocol tls_securetransport_protocol tls_gnutls_protocol tls_openssl_protocol"
tls_protocol_deps_any="gnutls openssl schannel securetransport"
tls_protocol_select="tcp_protocol"
udp_protocol_select="network"
udplite_protocol_select="network"
unix_protocol_deps="sys_un_h"
@ -3752,6 +3745,9 @@ map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST
enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
enabled_all gnutls openssl &&
die "GnuTLS and OpenSSL must not be enabled at the same time."
# Disable all the library-specific components if the library itself
# is disabled, see AVCODEC_LIST and following _LIST variables.

View File

@ -586,10 +586,11 @@ OBJS-$(CONFIG_SRTP_PROTOCOL) += srtpproto.o srtp.o
OBJS-$(CONFIG_SUBFILE_PROTOCOL) += subfile.o
OBJS-$(CONFIG_TEE_PROTOCOL) += teeproto.o tee_common.o
OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o
OBJS-$(CONFIG_TLS_GNUTLS_PROTOCOL) += tls_gnutls.o tls.o
OBJS-$(CONFIG_TLS_OPENSSL_PROTOCOL) += tls_openssl.o tls.o
OBJS-$(CONFIG_TLS_SCHANNEL_PROTOCOL) += tls_schannel.o tls.o
OBJS-$(CONFIG_TLS_SECURETRANSPORT_PROTOCOL) += tls_securetransport.o tls.o
TLS-OBJS-$(CONFIG_GNUTLS) += tls_gnutls.o
TLS-OBJS-$(CONFIG_OPENSSL) += tls_openssl.o
TLS-OBJS-$(CONFIG_SECURETRANSPORT) += tls_securetransport.o
TLS-OBJS-$(CONFIG_SCHANNEL) += tls_schannel.o
OBJS-$(CONFIG_TLS_PROTOCOL) += tls.o $(TLS-OBJS-yes)
OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o
OBJS-$(CONFIG_UDPLITE_PROTOCOL) += udp.o
OBJS-$(CONFIG_UNIX_PROTOCOL) += unix.o

View File

@ -29,25 +29,29 @@
int ff_tls_init(void)
{
#if CONFIG_TLS_OPENSSL_PROTOCOL
#if CONFIG_TLS_PROTOCOL
#if CONFIG_OPENSSL
int ret;
if ((ret = ff_openssl_init()) < 0)
return ret;
#endif
#if CONFIG_TLS_GNUTLS_PROTOCOL
#if CONFIG_GNUTLS
ff_gnutls_init();
#endif
#endif
return 0;
}
void ff_tls_deinit(void)
{
#if CONFIG_TLS_OPENSSL_PROTOCOL
#if CONFIG_TLS_PROTOCOL
#if CONFIG_OPENSSL
ff_openssl_deinit();
#endif
#if CONFIG_TLS_GNUTLS_PROTOCOL
#if CONFIG_GNUTLS
ff_gnutls_deinit();
#endif
#endif
}
int ff_network_inited_globally;

View File

@ -56,10 +56,7 @@ extern const URLProtocol ff_srtp_protocol;
extern const URLProtocol ff_subfile_protocol;
extern const URLProtocol ff_tee_protocol;
extern const URLProtocol ff_tcp_protocol;
extern const URLProtocol ff_tls_gnutls_protocol;
extern const URLProtocol ff_tls_schannel_protocol;
extern const URLProtocol ff_tls_securetransport_protocol;
extern const URLProtocol ff_tls_openssl_protocol;
extern const URLProtocol ff_tls_protocol;
extern const URLProtocol ff_udp_protocol;
extern const URLProtocol ff_udplite_protocol;
extern const URLProtocol ff_unix_protocol;

View File

@ -26,8 +26,6 @@
#include "url.h"
#include "libavutil/opt.h"
#define CONFIG_TLS_PROTOCOL (CONFIG_TLS_GNUTLS_PROTOCOL | CONFIG_TLS_OPENSSL_PROTOCOL | CONFIG_TLS_SECURETRANSPORT_PROTOCOL | CONFIG_TLS_SCHANNEL_PROTOCOL)
typedef struct TLSShared {
char *ca_file;
int verify;

View File

@ -260,7 +260,7 @@ static const AVClass tls_class = {
.version = LIBAVUTIL_VERSION_INT,
};
const URLProtocol ff_tls_gnutls_protocol = {
const URLProtocol ff_tls_protocol = {
.name = "tls",
.url_open2 = tls_open,
.url_read = tls_read,

View File

@ -339,7 +339,7 @@ static const AVClass tls_class = {
.version = LIBAVUTIL_VERSION_INT,
};
const URLProtocol ff_tls_openssl_protocol = {
const URLProtocol ff_tls_protocol = {
.name = "tls",
.url_open2 = tls_open,
.url_read = tls_read,

View File

@ -595,7 +595,7 @@ static const AVClass tls_class = {
.version = LIBAVUTIL_VERSION_INT,
};
const URLProtocol ff_tls_schannel_protocol = {
const URLProtocol ff_tls_protocol = {
.name = "tls",
.url_open2 = tls_open,
.url_read = tls_read,

View File

@ -393,7 +393,7 @@ static const AVClass tls_class = {
.version = LIBAVUTIL_VERSION_INT,
};
const URLProtocol ff_tls_securetransport_protocol = {
const URLProtocol ff_tls_protocol = {
.name = "tls",
.url_open2 = tls_open,
.url_read = tls_read,