Skip to contentSkip to conversation

uw-imap: Add a patch to support newer than TLSv1.0

PATCH In review Zoltán Böszörményi 2 participants 4 messages May 9, 2024 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uw-imap: Add a patch to support newer than TLSv1.0

The patch 0001-Support-OpenSSL-1.1.patch enabled building uw-imap against OpenSSL 1.1.0 or later.

However, TLSv1_client_method() and TLSv1_server_method() restricts uw-imap to TLSv1.0.

These APIs, along with explicitly versioned APIs like TLSv1_1_*_method() and TLSv1_2_*_method() are deprecated in OpenSSL 1.1.0 or later. The replacements are unversioned API functions: TLS_client_method() and TLS_server_method() which support TLS version autonegotiation.

This allows the PHP IMAP extension to work with IMAP servers that enforce TLSv1.2 or higher.

---
 .../uw-imap/uw-imap/uw-imap-newer-tls.patch   | 29 +++++++++++++++++++
 .../recipes-devtools/uw-imap/uw-imap_2007f.bb |  1 +
 2 files changed, 30 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch
meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch new file +29 -0
new file mode 100644
index 000000000..958abc90f
@@ -0,0 +1,29 @@
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Pending
+
+--- imap-2007f/src/osdep/unix/ssl_unix.c.old	2024-05-08 09:41:06.183450584 +0200
++++ imap-2007f/src/osdep/unix/ssl_unix.c	2024-05-08 09:43:38.512931933 +0200
+@@ -220,7 +220,11 @@
+   if (ssl_last_error) fs_give ((void **) &ssl_last_error);
+   ssl_last_host = host;
+   if (!(stream->context = SSL_CTX_new ((flags & NET_TLSCLIENT) ?
++#if OPENSSL_VERSION_NUMBER >= 0x10100000
++				       TLS_client_method () :
++#else
+ 				       TLSv1_client_method () :
++#endif
+ 				       SSLv23_client_method ())))
+     return "SSL context failed";
+   SSL_CTX_set_options (stream->context,0);
+@@ -703,7 +707,11 @@
+   }
+ 				/* create context */
+   if (!(stream->context = SSL_CTX_new (start_tls ?
++#if OPENSSL_VERSION_NUMBER >= 0x10100000
++				       TLS_server_method () :
++#else
+ 				       TLSv1_server_method () :
++#endif
+ 				       SSLv23_server_method ())))
+     syslog (LOG_ALERT,"Unable to create SSL context, host=%.80s",
+ 	    tcp_clienthost ());
meta-oe/recipes-devtools/uw-imap/uw-imap_2007f.bb +1 -0
index dcb59f4ea..17faa3aa6 100644
@@ -15,6 +15,7 @@ SRC_URI = "https://fossies.org/linux/misc/old/imap-${PV}.tar.gz \
            file://0001-Do-not-build-mtest.patch \
            file://0002-tmail-Include-ctype.h-for-isdigit.patch \
            file://0001-Fix-Wincompatible-function-pointer-types.patch \
+           file://uw-imap-newer-tls.patch \
            "
 
 SRC_URI[md5sum] = "2126fd125ea26b73b20f01fcd5940369"
Signature · 1 line
2.45.0
#1 lore raw
Quoted 30 lines · Zoltan Boszormenyi via lists.openembedded.org

The patch 0001-Support-OpenSSL-1.1.patch enabled building uw-imap against OpenSSL 1.1.0 or later.

However, TLSv1_client_method() and TLSv1_server_method() restricts uw-imap to TLSv1.0.

These APIs, along with explicitly versioned APIs like TLSv1_1_*_method() and TLSv1_2_*_method() are deprecated in OpenSSL 1.1.0 or later. The replacements are unversioned API functions: TLS_client_method() and TLS_server_method() which support TLS version autonegotiation.

This allows the PHP IMAP extension to work with IMAP servers that enforce TLSv1.2 or higher.

---
 .../uw-imap/uw-imap/uw-imap-newer-tls.patch   | 29 +++++++++++++++++++
 .../recipes-devtools/uw-imap/uw-imap_2007f.bb |  1 +
 2 files changed, 30 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch
meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch new file +0 -0
new file mode 100644
index 000000000..958abc90f

meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch line 3

Quoted 3 lines
meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch new file +3 -0
@@ -0,0 +1,29 @@
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Pending
+

I think it will be good to submit this patch upstream to uw as well,

Quoted 50 lines
meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch new file +26 -0
+--- imap-2007f/src/osdep/unix/ssl_unix.c.old   2024-05-08 09:41:06.183450584 +0200
++++ imap-2007f/src/osdep/unix/ssl_unix.c       2024-05-08 09:43:38.512931933 +0200
+@@ -220,7 +220,11 @@
+   if (ssl_last_error) fs_give ((void **) &ssl_last_error);
+   ssl_last_host = host;
+   if (!(stream->context = SSL_CTX_new ((flags & NET_TLSCLIENT) ?
++#if OPENSSL_VERSION_NUMBER >= 0x10100000
++                                     TLS_client_method () :
++#else
+                                      TLSv1_client_method () :
++#endif
+                                      SSLv23_client_method ())))
+     return "SSL context failed";
+   SSL_CTX_set_options (stream->context,0);
+@@ -703,7 +707,11 @@
+   }
+                               /* create context */
+   if (!(stream->context = SSL_CTX_new (start_tls ?
++#if OPENSSL_VERSION_NUMBER >= 0x10100000
++                                     TLS_server_method () :
++#else
+                                      TLSv1_server_method () :
++#endif
+                                      SSLv23_server_method ())))
+     syslog (LOG_ALERT,"Unable to create SSL context, host=%.80s",
+           tcp_clienthost ());
meta-oe/recipes-devtools/uw-imap/uw-imap_2007f.bb +1 -1
index dcb59f4ea..17faa3aa6 100644
@@ -15,6 +15,7 @@ SRC_URI = "https://fossies.org/linux/misc/old/imap-${PV}.tar.gz \
            file://0001-Do-not-build-mtest.patch \
            file://0002-tmail-Include-ctype.h-for-isdigit.patch \
            file://0001-Fix-Wincompatible-function-pointer-types.patch \
+           file://uw-imap-newer-tls.patch \
            "
 
 SRC_URI[md5sum] = "2126fd125ea26b73b20f01fcd5940369"
--

2.45.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#110281): https://lists.openembedded.org/g/openembedded-devel/message/110281
Mute This Topic: https://lists.openembedded.org/mt/105996685/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

2024. 05. 09. 8:12 keltezéssel, Khem Raj írta:

Quoted 26 lines
Quoted 23 lines · Zoltan Boszormenyi via lists.openembedded.org

The patch 0001-Support-OpenSSL-1.1.patch enabled building uw-imap against OpenSSL 1.1.0 or later.

However, TLSv1_client_method() and TLSv1_server_method() restricts uw-imap to TLSv1.0.

These APIs, along with explicitly versioned APIs like TLSv1_1_*_method() and TLSv1_2_*_method() are deprecated in OpenSSL 1.1.0 or later. The replacements are unversioned API functions: TLS_client_method() and TLS_server_method() which support TLS version autonegotiation.

This allows the PHP IMAP extension to work with IMAP servers that enforce TLSv1.2 or higher.

---
  .../uw-imap/uw-imap/uw-imap-newer-tls.patch   | 29 +++++++++++++++++++
  .../recipes-devtools/uw-imap/uw-imap_2007f.bb |  1 +
  2 files changed, 30 insertions(+)

create mode 100644 meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch

Quoted 10 lines

meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch line 3

Quoted 9 lines
meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch new file +3 -0
new file mode 100644
index 000000000..958abc90f
@@ -0,0 +1,29 @@
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Pending
+

I think it will be good to submit this patch upstream to uw as well,

Is upstream maintained?

The complaints at https://bugs.php.net/bug.php?id=76928 indicate that it's not and the situation of forks is a mess. For one, the seemingly most uptodate fork at https://repo.or.cz/alpine.git contains changes that break building the PHP IMAP extension.

Quoted 51 lines
Quoted 51 lines
meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch new file +26 -0
+--- imap-2007f/src/osdep/unix/ssl_unix.c.old   2024-05-08 09:41:06.183450584 +0200
++++ imap-2007f/src/osdep/unix/ssl_unix.c       2024-05-08 09:43:38.512931933 +0200
+@@ -220,7 +220,11 @@
+   if (ssl_last_error) fs_give ((void **) &ssl_last_error);
+   ssl_last_host = host;
+   if (!(stream->context = SSL_CTX_new ((flags & NET_TLSCLIENT) ?
++#if OPENSSL_VERSION_NUMBER >= 0x10100000
++                                     TLS_client_method () :
++#else
+                                      TLSv1_client_method () :
++#endif
+                                      SSLv23_client_method ())))
+     return "SSL context failed";
+   SSL_CTX_set_options (stream->context,0);
+@@ -703,7 +707,11 @@
+   }
+                               /* create context */
+   if (!(stream->context = SSL_CTX_new (start_tls ?
++#if OPENSSL_VERSION_NUMBER >= 0x10100000
++                                     TLS_server_method () :
++#else
+                                      TLSv1_server_method () :
++#endif
+                                      SSLv23_server_method ())))
+     syslog (LOG_ALERT,"Unable to create SSL context, host=%.80s",
+           tcp_clienthost ());
meta-oe/recipes-devtools/uw-imap/uw-imap_2007f.bb +1 -1
index dcb59f4ea..17faa3aa6 100644
@@ -15,6 +15,7 @@ SRC_URI = "https://fossies.org/linux/misc/old/imap-${PV}.tar.gz \
             file://0001-Do-not-build-mtest.patch \
             file://0002-tmail-Include-ctype.h-for-isdigit.patch \
             file://0001-Fix-Wincompatible-function-pointer-types.patch \
+           file://uw-imap-newer-tls.patch \
             "
 
  SRC_URI[md5sum] = "2126fd125ea26b73b20f01fcd5940369"
--

2.45.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#110281): https://lists.openembedded.org/g/openembedded-devel/message/110281
Mute This Topic: https://lists.openembedded.org/mt/105996685/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

2024. 05. 09. 8:34 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 38 lines

2024. 05. 09. 8:12 keltezéssel, Khem Raj írta:

Quoted 26 lines
Quoted 23 lines · Zoltan Boszormenyi via lists.openembedded.org

The patch 0001-Support-OpenSSL-1.1.patch enabled building uw-imap against OpenSSL 1.1.0 or later.

However, TLSv1_client_method() and TLSv1_server_method() restricts uw-imap to TLSv1.0.

These APIs, along with explicitly versioned APIs like TLSv1_1_*_method() and TLSv1_2_*_method() are deprecated in OpenSSL 1.1.0 or later. The replacements are unversioned API functions: TLS_client_method() and TLS_server_method() which support TLS version autonegotiation.

This allows the PHP IMAP extension to work with IMAP servers that enforce TLSv1.2 or higher.

---
  .../uw-imap/uw-imap/uw-imap-newer-tls.patch   | 29 +++++++++++++++++++ .../recipes-devtools/uw-imap/uw-imap_2007f.bb |  1 +

  2 files changed, 30 insertions(+)

  create mode 100644 meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch

Quoted 10 lines

meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch line 3

Quoted 9 lines
meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch new file +3 -0
new file mode 100644
index 000000000..958abc90f
@@ -0,0 +1,29 @@
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Pending
+

I think it will be good to submit this patch upstream to uw as well,

Quoted 3 lines

Is upstream maintained?

The complaints at https://bugs.php.net/bug.php?id=76928 indicate that it's not and the situation of forks is a mess. For one, the seemingly most uptodate fork at https://repo.or.cz/alpine.git contains changes that break building the PHP IMAP extension.

Not sure how "upstream" https://github.com/uw-imap/imap is
(https://en.wikipedia.org/wiki/UW_IMAP mentions it) but the patch is now submitted there.

Thanks.

Quoted 55 lines
Quoted 38 lines
Quoted 38 lines
meta-oe/recipes-devtools/uw-imap/uw-imap/uw-imap-newer-tls.patch new file +26 -0
+--- imap-2007f/src/osdep/unix/ssl_unix.c.old   2024-05-08 09:41:06.183450584 +0200
++++ imap-2007f/src/osdep/unix/ssl_unix.c       2024-05-08 09:43:38.512931933 +0200
+@@ -220,7 +220,11 @@
+   if (ssl_last_error) fs_give ((void **) &ssl_last_error);
+   ssl_last_host = host;
+   if (!(stream->context = SSL_CTX_new ((flags & NET_TLSCLIENT) ?
++#if OPENSSL_VERSION_NUMBER >= 0x10100000
++                                     TLS_client_method () :
++#else
+                                      TLSv1_client_method () :
++#endif
+                                      SSLv23_client_method ())))
+     return "SSL context failed";
+   SSL_CTX_set_options (stream->context,0);
+@@ -703,7 +707,11 @@
+   }
+                               /* create context */
+   if (!(stream->context = SSL_CTX_new (start_tls ?
++#if OPENSSL_VERSION_NUMBER >= 0x10100000
++                                     TLS_server_method () :
++#else
+                                      TLSv1_server_method () :
++#endif
+                                      SSLv23_server_method ())))
+     syslog (LOG_ALERT,"Unable to create SSL context, host=%.80s",
+           tcp_clienthost ());
meta-oe/recipes-devtools/uw-imap/uw-imap_2007f.bb +1 -0
index dcb59f4ea..17faa3aa6 100644
@@ -15,6 +15,7 @@ SRC_URI = "https://fossies.org/linux/misc/old/imap-${PV}.tar.gz \
              file://0001-Do-not-build-mtest.patch \
 file://0002-tmail-Include-ctype.h-for-isdigit.patch \
 file://0001-Fix-Wincompatible-function-pointer-types.patch \
+           file://uw-imap-newer-tls.patch \

             "

Quoted 7 lines
Quoted 7 lines

  SRC_URI[md5sum] = "2126fd125ea26b73b20f01fcd5940369"

Signature · 1 line
2.45.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#110284): https://lists.openembedded.org/g/openembedded-devel/message/110284
Mute This Topic: https://lists.openembedded.org/mt/105996685/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-