diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-11-02 14:04:19 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-11-02 14:04:19 +0200 |
commit | 31317fd66633930b82d51d1c2e65121e24f9df19 (patch) | |
tree | 89fd583ab03ac9871b893e0d762a30ce8986539e | |
parent | ad13f25691565d5e711e6acab615455ed1279419 (diff) |
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)
^~~~~~~~~~~~~~~~~~~~
-rw-r--r-- | ext/dtls/gstdtlsagent.c | 26 | ||||
-rw-r--r-- | ext/dtls/gstdtlssrtpdec.c | 3 |
2 files changed, 19 insertions, 10 deletions
diff --git a/ext/dtls/gstdtlsagent.c b/ext/dtls/gstdtlsagent.c index c18212387..6ec39fcbc 100644 --- a/ext/dtls/gstdtlsagent.c +++ b/ext/dtls/gstdtlsagent.c @@ -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]; diff --git a/ext/dtls/gstdtlssrtpdec.c b/ext/dtls/gstdtlssrtpdec.c index 300fb9c8f..983621001 100644 --- a/ext/dtls/gstdtlssrtpdec.c +++ b/ext/dtls/gstdtlssrtpdec.c @@ -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; |