summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-11-02 14:04:19 +0200
committerTim-Philipp Müller <tim@centricular.com>2016-11-12 16:00:53 +0000
commit6ac07f44a1b579016df6174e7ae20c552e468b64 (patch)
tree092c7f6610b565383d94f787994f19ed46ad215d
parent18658969f97874b016778930eb3f9603f04bcf59 (diff)
downloadgstreamer-plugins-bad-6ac07f44a1b579016df6174e7ae20c552e468b64.tar.gz
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.c26
-rw-r--r--ext/dtls/gstdtlssrtpdec.c3
2 files changed, 19 insertions, 10 deletions
diff --git a/ext/dtls/gstdtlsagent.c b/ext/dtls/gstdtlsagent.c
index af5b75c2b..29aaa3f15 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 0a3bead21..633fc0f6e 100644
--- a/ext/dtls/gstdtlssrtpdec.c
+++ b/ext/dtls/gstdtlssrtpdec.c
@@ -175,8 +175,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;