# [PATCH] imap-send.c: Avoid deprecated openssl 1.1.0 API

3 messages from 2017-01-12 to 2017-01-12. Participants: eroen, Jack Bates.
Thread: https://gitlist.dev/t/44861

## eroen, 2017-01-12 10:42

Subject: [PATCH] imap-send.c: Avoid deprecated openssl 1.1.0 API
Message-ID: <20170112104219.563497-1-git-scm@occam.eroen.eu>
URL: https://gitlist.dev/e/20170112104219.563497-1-git-scm%40occam.eroen.eu

```
Library initialization functions are deprecated in openssl 1.1.0 API, as
initialization is handled by openssl internally.

Symbols for deprecated functions are not exported if openssl is built with
`--api=1.1 disable-deprecated`, so their use will cause a build failure.

Reported-by: Lars Wendler (Polynomial-C)

X-Gentoo-Bug: 592466
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=592466
---
 imap-send.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/imap-send.c b/imap-send.c
index 5c7e27a89..98774360e 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -284,8 +284,10 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
 	int ret;
 	X509 *cert;
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
 	SSL_library_init();
 	SSL_load_error_strings();
+#endif
 
 	meth = SSLv23_method();
 	if (!meth) {
-- 
2.11.0


```

## Jack Bates, 2017-01-12 16:53

Subject: Re: [PATCH] imap-send.c: Avoid deprecated openssl 1.1.0 API
Message-ID: <27751523-bcc3-4f4b-c833-fc5113af356d@nottheoilrig.com>
URL: https://gitlist.dev/e/27751523-bcc3-4f4b-c833-fc5113af356d%40nottheoilrig.com
In-Reply-To: <20170112104219.563497-1-git-scm@occam.eroen.eu>

```
You might need the following, to still build with LibreSSL.
That was my experience anyway, when I recently prepared similar fixes 
for OpenSSL 1.1 and Apache Traffic Server.

#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)

On 12/01/17 03:42 AM, eroen wrote:
> Library initialization functions are deprecated in openssl 1.1.0 API, as
> initialization is handled by openssl internally.
>
> Symbols for deprecated functions are not exported if openssl is built with
> `--api=1.1 disable-deprecated`, so their use will cause a build failure.
>
> Reported-by: Lars Wendler (Polynomial-C)
>
> X-Gentoo-Bug: 592466
> X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=592466
> ---
>  imap-send.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/imap-send.c b/imap-send.c
> index 5c7e27a89..98774360e 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -284,8 +284,10 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
>  	int ret;
>  	X509 *cert;
>
> +#if OPENSSL_VERSION_NUMBER < 0x10100000L
>  	SSL_library_init();
>  	SSL_load_error_strings();
> +#endif
>
>  	meth = SSLv23_method();
>  	if (!meth) {
>

```

## Jack Bates, 2017-01-12 16:55

Subject: Re: [PATCH] imap-send.c: Avoid deprecated openssl 1.1.0 API
Message-ID: <66967e0e-8bd9-f4b6-d2d4-ccce9004f42e@nottheoilrig.com>
URL: https://gitlist.dev/e/66967e0e-8bd9-f4b6-d2d4-ccce9004f42e%40nottheoilrig.com
In-Reply-To: <20170112104219.563497-1-git-scm@occam.eroen.eu>

```
You might need the following, to still build with LibreSSL.
That was my experience anyway, when I recently prepared similar fixes 
for OpenSSL 1.1 and Apache Traffic Server.

#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)

On 12/01/17 03:42 AM, eroen wrote:
> Library initialization functions are deprecated in openssl 1.1.0 API, as
> initialization is handled by openssl internally.
>
> Symbols for deprecated functions are not exported if openssl is built with
> `--api=1.1 disable-deprecated`, so their use will cause a build failure.
>
> Reported-by: Lars Wendler (Polynomial-C)
>
> X-Gentoo-Bug: 592466
> X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=592466
> ---
>  imap-send.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/imap-send.c b/imap-send.c
> index 5c7e27a89..98774360e 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -284,8 +284,10 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
>  	int ret;
>  	X509 *cert;
>
> +#if OPENSSL_VERSION_NUMBER < 0x10100000L
>  	SSL_library_init();
>  	SSL_load_error_strings();
> +#endif
>
>  	meth = SSLv23_method();
>  	if (!meth) {
>

```
