mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
dtls: Fix compiler warnings with openssl 1.1 or newer
- DTLSv1_method() is deprecated, and since 1.0.2 replaced by DTLS_method(). - CRYPTO_set_locking_callback() and CRYPTO_set_id_callback() are no-ops (empty macros) since 1.1 and are not supposed to be used anymore. gstdtlsagent.c: In function ‘gst_dtls_agent_init’: gstdtlsagent.c:173:3: error: ‘DTLSv1_method’ is deprecated [-Werror=deprecated-declarations] priv->ssl_context = SSL_CTX_new (DTLSv1_method ()); ^~~~ In file included from /usr/include/openssl/ct.h:13:0, from /usr/include/openssl/ssl.h:61, from gstdtlsagent.c:40: /usr/include/openssl/ssl.h:1614:1: note: declared here DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */ ^ At top level: gstdtlsagent.c:103:1: error: ‘ssl_thread_id_function’ defined but not used [-Werror=unused-function] ssl_thread_id_function (void) ^~~~~~~~~~~~~~~~~~~~~~ gstdtlsagent.c:73:1: error: ‘ssl_locking_function’ defined but not used [-Werror=unused-function] ssl_locking_function (gint mode, gint lock_num, const gchar * file, gint line) ^~~~~~~~~~~~~~~~~~~~
This commit is contained in:
parent
ad13f25691
commit
31317fd666
2 changed files with 19 additions and 10 deletions
|
@ -67,6 +67,7 @@ static void gst_dtls_agent_set_property (GObject *, guint prop_id,
|
|||
const GValue *, GParamSpec *);
|
||||
const gchar *gst_dtls_agent_peek_id (GstDtlsAgent *);
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
static GRWLock *ssl_locks;
|
||||
|
||||
static void
|
||||
|
@ -104,13 +105,12 @@ ssl_thread_id_function (void)
|
|||
{
|
||||
return (gulong) g_thread_self ();
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
_gst_dtls_init_openssl (void)
|
||||
{
|
||||
static gsize is_init = 0;
|
||||
gint i;
|
||||
gint num_locks;
|
||||
|
||||
if (g_once_init_enter (&is_init)) {
|
||||
GST_DEBUG_CATEGORY_INIT (gst_dtls_agent_debug, "dtlsagent", 0,
|
||||
|
@ -128,13 +128,19 @@ _gst_dtls_init_openssl (void)
|
|||
SSL_load_error_strings ();
|
||||
ERR_load_BIO_strings ();
|
||||
|
||||
num_locks = CRYPTO_num_locks ();
|
||||
ssl_locks = g_new (GRWLock, num_locks);
|
||||
for (i = 0; i < num_locks; ++i) {
|
||||
g_rw_lock_init (&ssl_locks[i]);
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
{
|
||||
gint i;
|
||||
gint num_locks;
|
||||
num_locks = CRYPTO_num_locks ();
|
||||
ssl_locks = g_new (GRWLock, num_locks);
|
||||
for (i = 0; i < num_locks; ++i) {
|
||||
g_rw_lock_init (&ssl_locks[i]);
|
||||
}
|
||||
CRYPTO_set_locking_callback (ssl_locking_function);
|
||||
CRYPTO_set_id_callback (ssl_thread_id_function);
|
||||
}
|
||||
CRYPTO_set_locking_callback (ssl_locking_function);
|
||||
CRYPTO_set_id_callback (ssl_thread_id_function);
|
||||
#endif
|
||||
|
||||
g_once_init_leave (&is_init, 1);
|
||||
}
|
||||
|
@ -170,7 +176,11 @@ gst_dtls_agent_init (GstDtlsAgent * self)
|
|||
|
||||
ERR_clear_error ();
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x1000200fL
|
||||
priv->ssl_context = SSL_CTX_new (DTLS_method ());
|
||||
#else
|
||||
priv->ssl_context = SSL_CTX_new (DTLSv1_method ());
|
||||
#endif
|
||||
if (ERR_peek_error () || !priv->ssl_context) {
|
||||
char buf[512];
|
||||
|
||||
|
|
|
@ -171,8 +171,7 @@ gst_dtls_srtp_dec_init (GstDtlsSrtpDec * self)
|
|||
"failed to create srtp_dec, is the srtp plugin registered?");
|
||||
return;
|
||||
}
|
||||
self->dtls_srtp_demux =
|
||||
gst_element_factory_make ("dtlssrtpdemux", NULL);
|
||||
self->dtls_srtp_demux = gst_element_factory_make ("dtlssrtpdemux", NULL);
|
||||
if (!self->dtls_srtp_demux) {
|
||||
GST_ERROR_OBJECT (self, "failed to create dtls_srtp_demux");
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue