diff mbox

[FFmpeg-devel,V1,2/2] lavf/tls_openssl: support both pre-1.1.0 and post-1.1.0 init

Message ID 1575986573-5561-2-git-send-email-mypopydev@gmail.com
State New
Headers show

Commit Message

Jun Zhao Dec. 10, 2019, 2:02 p.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

supporting both pre-1.1.0 and post-1.1.0 version of the OpenSSL
library as the link:
https://wiki.openssl.org/index.php/Library_Initialization

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavformat/tls_openssl.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

James Almer Dec. 10, 2019, 7:47 p.m. UTC | #1
On 12/10/2019 11:02 AM, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao@tencent.com>
> 
> supporting both pre-1.1.0 and post-1.1.0 version of the OpenSSL
> library as the link:
> https://wiki.openssl.org/index.php/Library_Initialization
> 
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
>  libavformat/tls_openssl.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
> index 7ae71bd..1f57353 100644
> --- a/libavformat/tls_openssl.c
> +++ b/libavformat/tls_openssl.c
> @@ -70,8 +70,12 @@ int ff_openssl_init(void)
>  {
>      ff_lock_avformat();
>      if (!openssl_init) {
> +#if OPENSSL_VERSION_NUMBER < 0x10100000L
>          SSL_library_init();
>          SSL_load_error_strings();
> +#else
> +        OPENSSL_init_ssl(0, NULL);
> +#endif
>  #if HAVE_THREADS
>          if (!CRYPTO_get_locking_callback()) {
>              int i;

OPENSSL_init_ssl() is supposedly optional, so why not just execute the
upper chunk when version < 1.1.0?
mypopy@gmail.com Dec. 11, 2019, 1:36 a.m. UTC | #2
On Wed, Dec 11, 2019 at 3:47 AM James Almer <jamrial@gmail.com> wrote:
>
> On 12/10/2019 11:02 AM, Jun Zhao wrote:
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> > supporting both pre-1.1.0 and post-1.1.0 version of the OpenSSL
> > library as the link:
> > https://wiki.openssl.org/index.php/Library_Initialization
> >
> > Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> > ---
> >  libavformat/tls_openssl.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> >
> > diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
> > index 7ae71bd..1f57353 100644
> > --- a/libavformat/tls_openssl.c
> > +++ b/libavformat/tls_openssl.c
> > @@ -70,8 +70,12 @@ int ff_openssl_init(void)
> >  {
> >      ff_lock_avformat();
> >      if (!openssl_init) {
> > +#if OPENSSL_VERSION_NUMBER < 0x10100000L
> >          SSL_library_init();
> >          SSL_load_error_strings();
> > +#else
> > +        OPENSSL_init_ssl(0, NULL);
> > +#endif
> >  #if HAVE_THREADS
> >          if (!CRYPTO_get_locking_callback()) {
> >              int i;
>
> OPENSSL_init_ssl() is supposedly optional, so why not just execute the
> upper chunk when version < 1.1.0?
Will follow the review and add some comments
diff mbox

Patch

diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index 7ae71bd..1f57353 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -70,8 +70,12 @@  int ff_openssl_init(void)
 {
     ff_lock_avformat();
     if (!openssl_init) {
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
         SSL_library_init();
         SSL_load_error_strings();
+#else
+        OPENSSL_init_ssl(0, NULL);
+#endif
 #if HAVE_THREADS
         if (!CRYPTO_get_locking_callback()) {
             int i;