Small cleanup of leftover pre-1.1.0 OpenSSL code

Started by Andreas Karlsson4 days ago7 messageshackers

Thread notes

1 note#refactor
hackorum-bot#refactor
hackorum-bot
2 days ago

@global #refactor

#refactor
Jump to latest
#1Andreas Karlsson
andreas.karlsson@percona.com

Hi,

While reviewing another patch I found this small leftover from before we
bumped the OpenSSL version requirement to 1.1.0. As the
SSL_AD_NO_APPLICATION_PROTOCOL define was introduced in OpenSSL 1.1.0
and in LibreSSL 3.4.0 (not 3.4.3 as the comment I remove implies) we no
longer have to check if it is defined and we can therefore very slightly
simplify our code.

--
Andreas Karlsson
Percona

Attachments:

t259763_1
v1-0001-Remove-backwards-compatibility-ifdef-for-SSL_AD_N.patchtext/x-patch; charset=UTF-8; name=v1-0001-Remove-backwards-compatibility-ifdef-for-SSL_AD_N.patchDownload+1-6
#2Ayush Tiwari
ayushtiwari.slg01@gmail.com
In reply to: Andreas Karlsson (#1)
Re: Small cleanup of leftover pre-1.1.0 OpenSSL code

Hi,

On Wed, 25 Nov 2026 at 08:06, Andreas Karlsson <andreas@proxel.se> wrote:

While reviewing another patch I found this small leftover from before we
bumped the OpenSSL version requirement to 1.1.0. As the
SSL_AD_NO_APPLICATION_PROTOCOL define was introduced in OpenSSL 1.1.0
and in LibreSSL 3.4.0 (not 3.4.3 as the comment I remove implies) we no
longer have to check if it is defined and we can therefore very slightly
simplify our code.

Thanks for the patch! I checked the LibreSSL headers as well, the define
is there in 3.4.0 and not in 3.3.x, so this looks good to me.

Since we are touching this comment anyway, maybe we can also mention that
the OpenSSL issue has been fixed? Newer OpenSSL and LibreSSL versions now
return an error string for this alert on their own, so we only need this
for older versions. Something like:

/*
* Server aborted the connection with TLS "no_application_protocol" alert.
* Older OpenSSL and LibreSSL versions don't give any error string for
* that, so do it ourselves. This was fixed in OpenSSL 3.0.14, 3.1.6,
* 3.2.2 and 3.3.1, and in LibreSSL 4.1.0. See
* https://github.com/openssl/openssl/issues/24300.
*/

This would likely help us in removing that entire block in future.

Regards,
Ayush

#3Andreas Karlsson
andreas.karlsson@percona.com
In reply to: Ayush Tiwari (#2)
Re: Small cleanup of leftover pre-1.1.0 OpenSSL code

On 11/25/26 04:49, Ayush Tiwari wrote:

Since we are touching this comment anyway, maybe we can also mention that
the OpenSSL issue has been fixed? Newer OpenSSL and LibreSSL versions now
return an error string for this alert on their own, so we only need this
for older versions. Something like:

/*
* Server aborted the connection with TLS "no_application_protocol" alert.
* Older OpenSSL and LibreSSL versions don't give any error string for
* that, so do it ourselves. This was fixed in OpenSSL 3.0.14, 3.1.6,
* 3.2.2 and 3.3.1, and in LibreSSL 4.1.0. See
* https://github.com/openssl/openssl/issues/24300.
*/

Makes sense, but I wonder if it would not be enough to mention just
3.3.1 or even 3.4 as we are unlikely to drop this code until we depend
on 3.4 or higher.

--
Andreas Karlsson
Percona

#4Ayush Tiwari
ayushtiwari.slg01@gmail.com
In reply to: Andreas Karlsson (#3)
Re: Small cleanup of leftover pre-1.1.0 OpenSSL code

Hi,

On Wed, 25 Nov 2026 at 09:53, Andreas Karlsson <andreas@proxel.se> wrote:

On 11/25/26 04:49, Ayush Tiwari wrote:

Since we are touching this comment anyway, maybe we can also mention that
the OpenSSL issue has been fixed? Newer OpenSSL and LibreSSL versions now
return an error string for this alert on their own, so we only need this
for older versions. Something like:

/*
* Server aborted the connection with TLS "no_application_protocol" alert.
* Older OpenSSL and LibreSSL versions don't give any error string for
* that, so do it ourselves. This was fixed in OpenSSL 3.0.14, 3.1.6,
* 3.2.2 and 3.3.1, and in LibreSSL 4.1.0. See
* https://github.com/openssl/openssl/issues/24300.
*/

Makes sense, but I wonder if it would not be enough to mention just
3.3.1 or even 3.4 as we are unlikely to drop this code until we depend
on 3.4 or higher.

Agreed, mentioning just 3.4 is enough. I would keep LibreSSL in there
though, since it only got the fix in 4.1. But no hard opinions on it.

Regards,
Ayush

#5Daniel Gustafsson
daniel@yesql.se
In reply to: Ayush Tiwari (#4)
Re: Small cleanup of leftover pre-1.1.0 OpenSSL code

On 25 Nov 2026, at 05:54, Ayush Tiwari <ayushtiwari.slg01@gmail.com> wrote:

Hi,

On Wed, 25 Nov 2026 at 09:53, Andreas Karlsson <andreas@proxel.se> wrote:

On 11/25/26 04:49, Ayush Tiwari wrote:

Since we are touching this comment anyway, maybe we can also mention that
the OpenSSL issue has been fixed? Newer OpenSSL and LibreSSL versions now
return an error string for this alert on their own, so we only need this
for older versions. Something like:

/*
* Server aborted the connection with TLS "no_application_protocol" alert.
* Older OpenSSL and LibreSSL versions don't give any error string for
* that, so do it ourselves. This was fixed in OpenSSL 3.0.14, 3.1.6,
* 3.2.2 and 3.3.1, and in LibreSSL 4.1.0. See
* https://github.com/openssl/openssl/issues/24300.
*/

Makes sense, but I wonder if it would not be enough to mention just
3.3.1 or even 3.4 as we are unlikely to drop this code until we depend
on 3.4 or higher.

Agreed, mentioning just 3.4 is enough. I would keep LibreSSL in there
though, since it only got the fix in 4.1. But no hard opinions on it.

Thanks for the patch, it's indeed a nice potential cleanup. I'll go and apply
it when back in the office.

--
Daniel Gustafsson

#6Andreas Karlsson
andreas.karlsson@percona.com
In reply to: Daniel Gustafsson (#5)
Re: Small cleanup of leftover pre-1.1.0 OpenSSL code

On 11/25/26 15:04, Daniel Gustafsson wrote:

On 25 Nov 2026, at 05:54, Ayush Tiwari <ayushtiwari.slg01@gmail.com> wrote:
Agreed, mentioning just 3.4 is enough. I would keep LibreSSL in there
though, since it only got the fix in 4.1. But no hard opinions on it.

Thanks for the patch, it's indeed a nice potential cleanup. I'll go and apply
it when back in the office.

Thanks, both. Here is a version incorporating the suggested changes to
the comment.

--
Andreas Karlsson
Percona

Attachments:

t259763_6
v2-0001-Remove-backwards-compatibility-ifdef-for-SSL_AD_N.patchtext/x-patch; charset=UTF-8; name=v2-0001-Remove-backwards-compatibility-ifdef-for-SSL_AD_N.patchDownload+3-8
#7Daniel Gustafsson
daniel@yesql.se
In reply to: Andreas Karlsson (#6)
Re: Small cleanup of leftover pre-1.1.0 OpenSSL code

On 25 Nov 2026, at 17:53, Andreas Karlsson <andreas@proxel.se> wrote:

On 11/25/26 15:04, Daniel Gustafsson wrote:

On 25 Nov 2026, at 05:54, Ayush Tiwari <ayushtiwari.slg01@gmail.com> wrote:
Agreed, mentioning just 3.4 is enough. I would keep LibreSSL in there
though, since it only got the fix in 4.1. But no hard opinions on it.

Thanks for the patch, it's indeed a nice potential cleanup. I'll go and apply
it when back in the office.

Thanks, both. Here is a version incorporating the suggested changes to the comment.

Pushed, thanks.

--
Daniel Gustafsson