dtls: Fix compilation without deprecated APIs on OpenSSL 1.1.x

This commit is contained in:
Rosen Penev 2018-11-14 14:55:37 -08:00
parent e76c61d74c
commit 29d48ce8a1
2 changed files with 11 additions and 4 deletions

View file

@ -121,12 +121,12 @@ _gst_dtls_init_openssl (void)
g_assert_not_reached ();
}
#if OPENSSL_VERSION_NUMBER < 0x10100000L
GST_INFO_OBJECT (NULL, "initializing openssl %lx", OPENSSL_VERSION_NUMBER);
SSL_library_init ();
SSL_load_error_strings ();
ERR_load_BIO_strings ();
#if OPENSSL_VERSION_NUMBER < 0x10100000L
{
gint i;
gint num_locks;
@ -199,7 +199,7 @@ gst_dtls_agent_init (GstDtlsAgent * self)
SSL_CTX_set_cipher_list (priv->ssl_context,
"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
SSL_CTX_set_read_ahead (priv->ssl_context, 1);
#if OPENSSL_VERSION_NUMBER >= 0x1000200fL
#if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && (OPENSSL_VERSION_NUMBER < 0x10100000L)
SSL_CTX_set_ecdh_auto (priv->ssl_context, 1);
#endif
}

View file

@ -45,8 +45,15 @@
#endif
#endif
#include <openssl/bn.h>
#include <openssl/rsa.h>
#include <openssl/ssl.h>
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define X509_getm_notBefore X509_get_notBefore
#define X509_getm_notAfter X509_get_notAfter
#endif
GST_DEBUG_CATEGORY_STATIC (gst_dtls_certificate_debug);
#define GST_CAT_DEFAULT gst_dtls_certificate_debug
@ -238,8 +245,8 @@ init_generated (GstDtlsCertificate * self)
X509_set_version (priv->x509, 2);
ASN1_INTEGER_set (X509_get_serialNumber (priv->x509), 0);
X509_gmtime_adj (X509_get_notBefore (priv->x509), 0);
X509_gmtime_adj (X509_get_notAfter (priv->x509), 31536000L); /* A year */
X509_gmtime_adj (X509_getm_notBefore (priv->x509), 0);
X509_gmtime_adj (X509_getm_notAfter (priv->x509), 31536000L); /* A year */
X509_set_pubkey (priv->x509, priv->private_key);
name = X509_get_subject_name (priv->x509);