Skip to contentSkip to conversation

package/drogon: fix optional TLS dependency

PATCH Applied Dario Binacchi 2 participants 7 messages Oct 27 – Nov 6

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/drogon: fix optional TLS dependency

The trantor library bundled in drogon looks for a TLS library at configure time, and uses OpenSSL or Botan if it finds one. Since drogon.mk does not declare any dependency on them, TLS support ends up depending on whether OpenSSL or Botan happens to be built before drogon.

Select the TLS library explicitly, following the same order as trantor, so that OpenSSL is preferred over Botan.

host-drogon only provides drogon_ctl, which does not need TLS, so disable it there to avoid picking up the TLS libraries of the build machine.

---
 package/drogon/drogon.mk | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
package/drogon/drogon.mk +12 -1
index 03cba45ceb34..8c51d16ac0d7 100644
@@ -21,7 +21,8 @@ DROGON_CONF_OPTS = \
 HOST_DROGON_CONF_OPTS = \
 	-DBUILD_CTL=ON \
 	-DBUILD_EXAMPLES=OFF \
-	-DBUILD_TESTS=OFF
+	-DBUILD_TESTS=OFF \
+	-DTRANTOR_USE_TLS=none
 
 ifeq ($(BR2_PACKAGE_DROGON_BROTLI),y)
 DROGON_DEPENDENCIES += brotli
@@ -57,6 +58,16 @@ else
 DROGON_CONF_OPTS += -DBUILD_ORM=OFF
 endif
 
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+DROGON_DEPENDENCIES += openssl
+DROGON_CONF_OPTS += -DTRANTOR_USE_TLS=openssl
+else ifeq ($(BR2_PACKAGE_BOTAN),y)
+DROGON_DEPENDENCIES += botan
+DROGON_CONF_OPTS += -DTRANTOR_USE_TLS=botan
+else
+DROGON_CONF_OPTS += -DTRANTOR_USE_TLS=none
+endif
+
 ifeq ($(BR2_PACKAGE_DROGON_YAML_CONFIG),y)
 DROGON_DEPENDENCIES += yaml-cpp
 DROGON_CONF_OPTS += -DBUILD_YAML_CONFIG=ON
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/drogon: fix build with LibreSSL

The trantor library bundled in drogon 1.9.14 fails to build against LibreSSL, because it uses SSL_CTX_set_cert_cb(), which LibreSSL does not provide.

Add the patch submitted upstream, which disables that call when building against LibreSSL. The patch description explains the details.

Fixes:
- https://autobuild.buildroot.org/results/f1c7a336f3fabb2d2a2793930573b69bc47c3ee7
- https://autobuild.buildroot.org/results/795c9ab125a029f0d90a267147cb6d6d80887688

---
 ...0001-trantor-fix-build-with-LibreSSL.patch | 73 +++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 package/drogon/0001-trantor-fix-build-with-LibreSSL.patch
package/drogon/0001-trantor-fix-build-with-LibreSSL.patch new file +73 -0
new file mode 100644
index 000000000000..d608efbc23cb
@@ -0,0 +1,73 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Dario Binacchi <[email protected]>
+Date: Tue, 27 Oct 2026 11:39:26 +0100
+Subject: [PATCH] Fix build with LibreSSL
+
+The Buildroot autobuilders reported that trantor, built as part of
+drogon, fails to compile against LibreSSL [1]. This patch fixes the
+two errors below.
+
+1) SSL_CTX_set_cert_cb() is not declared
+
+OpenSSLProvider.cc:1623:9: error: 'SSL_CTX_set_cert_cb' was not declared in this scope
+
+Commit 7d3aac802ff5 ("Fixes and update to TLS subsystem (#411)") calls
+SSL_CTX_set_cert_cb() to choose the server certificate during the TLS
+handshake but LibreSSL does not provide this function.
+
+The same commit also registers a servername callback, which LibreSSL
+supports and which chooses the server certificate as well, but only
+when the client sends SNI. With LibreSSL, clients that do not send SNI
+therefore get no certificate.
+
+2) lastOpenSSLError() is defined but not used
+
+OpenSSLProvider.cc:261:20: error: 'std::string internal::lastOpenSSLError()' defined but not used [-Werror=unused-function]
+
+lastOpenSSLError() is only called by code that is not built with
+LibreSSL. With LibreSSL the function is unused, and -Werror turns the
+resulting warning into an error.
+
+[1] https://autobuild.buildroot.org/results/f1c7a336f3fabb2d2a2793930573b69bc47c3ee7
+
+Upstream: https://github.com/an-tao/trantor/pull/422
+Signed-off-by: Dario Binacchi <[email protected]>
+---
+ trantor/net/inner/tlsprovider/OpenSSLProvider.cc | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/trantor/trantor/net/inner/tlsprovider/OpenSSLProvider.cc b/trantor/trantor/net/inner/tlsprovider/OpenSSLProvider.cc
+index e876ee97faf1..7b6f42d88d32 100644
+--- a/trantor/trantor/net/inner/tlsprovider/OpenSSLProvider.cc
++++ b/trantor/trantor/net/inner/tlsprovider/OpenSSLProvider.cc
+@@ -258,6 +258,7 @@ static bool isDirectory(const std::string &path)
+ #endif
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static std::string lastOpenSSLError()
+ {
+     const auto error = ERR_get_error();
+@@ -267,6 +268,7 @@ static std::string lastOpenSSLError()
+     ERR_error_string_n(error, message.data(), message.size());
+     return message.data();
+ }
++#endif
+ 
+ static void freeCertificateNames(STACK_OF(X509_NAME) * names)
+ {
+@@ -1620,9 +1622,14 @@ SSLContextPtr trantor::newSSLContext(const TLSPolicy &policy, bool isServer)
+             ctx->ctx(),
+             static_cast<int (*)(SSL *, int *, void *)>(
+                 &OpenSSLProvider::selectServerCertificate));
++#ifndef LIBRESSL_VERSION_NUMBER
++        // LibreSSL lacks SSL_CTX_set_cert_cb(). There, the certificate is
++        // selected by the servername callback only, so clients not sending
++        // SNI won't get a certificate.
+         SSL_CTX_set_cert_cb(ctx->ctx(),
+                             &OpenSSLProvider::configureServerCertificate,
+                             nullptr);
++#endif
+         // A resumed handshake may not select a certificate at all. Do not
+         // resume one without consulting the current runtime provider.
+         SSL_CTX_set_session_cache_mode(ctx->ctx(), SSL_SESS_CACHE_OFF);
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/2] package/drogon: fix build with LibreSSL

Quoted 4 lines · Dario Binacchi

The trantor library bundled in drogon 1.9.14 fails to build against LibreSSL, because it uses SSL_CTX_set_cert_cb(), which LibreSSL does not provide.

Quoted 8 lines

Add the patch submitted upstream, which disables that call when building against LibreSSL. The patch description explains the details.

Fixes:
- https://autobuild.buildroot.org/results/f1c7a336f3fabb2d2a2793930573b69bc47c3ee7
- https://autobuild.buildroot.org/results/795c9ab125a029f0d90a267147cb6d6d80887688

I am not super comfortable applying this one, I'd really like to see upstream's feedback before applying. Of course, if another Buildroot maintainer is comfortable with what the patch is doing, don't hesitate to apply.

Best regards,

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH 2/2] package/drogon: fix build with LibreSSL

Hi Thomas

Quoted 12 lines · Thomas Petazzoni
Quoted 9 lines · Dario Binacchi

The trantor library bundled in drogon 1.9.14 fails to build against LibreSSL, because it uses SSL_CTX_set_cert_cb(), which LibreSSL does not provide.

Add the patch submitted upstream, which disables that call when building against LibreSSL. The patch description explains the details.

Fixes:
-

https://autobuild.buildroot.org/results/f1c7a336f3fabb2d2a2793930573b69bc47c3ee7

Quoted 1 line

-

Quoted 9 lines

https://autobuild.buildroot.org/results/795c9ab125a029f0d90a267147cb6d6d80887688

Quoted 2 lines

I am not super comfortable applying this one, I'd really like to see upstream's feedback before applying. Of course, if another Buildroot maintainer is comfortable with what the patch is doing, don't hesitate to apply.

The fix has now been merged upstream, unchanged:
https://github.com/an-tao/trantor/commit/a77cc3651d5950f2f8aeceab80f74f31870f4017

I sent a v2 that points to the upstream commit.

Thanks and regards,
Dario

Quoted 8 lines

Best regards,

Thomas Petazzoni
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

Signature · 9 lines
*Dario Binacchi*
Senior Embedded Software Engineer
M. +39 328 0625246
[email protected]
―――――――――――――――
Amarula Solutions SRL
 Via Felice Cavallotti 25D, 41012 Carpi, MO, IT
[email protected]
www.amarulasolutions.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH 2/2] package/drogon: fix build with LibreSSL

Quoted 5 lines · Dario Binacchi

The fix has now been merged upstream, unchanged:
[5]https://github.com/an-tao/trantor/commit/
a77cc3651d5950f2f8aeceab80f74f31870f4017

I sent a v2 that points to the upstream commit.

Excellent, thanks a lot!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw
In reply to Dario Binacchi
Quoted 6 lines · Dario Binacchi

The trantor library bundled in drogon looks for a TLS library at configure time, and uses OpenSSL or Botan if it finds one. Since drogon.mk does not declare any dependency on them, TLS support ends up depending on whether OpenSSL or Botan happens to be built before drogon.

Quoted 8 lines

Select the TLS library explicitly, following the same order as trantor, so that OpenSSL is preferred over Botan.

host-drogon only provides drogon_ctl, which does not need TLS, so disable it there to avoid picking up the TLS libraries of the build machine.

Applied to master after adding a Fixes: tag pointing to the commit that added the drogon package. Thanks!

Best regards,

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw
In reply to Dario Binacchi

In reply of:

Quoted 6 lines

The trantor library bundled in drogon looks for a TLS library at configure time, and uses OpenSSL or Botan if it finds one. Since drogon.mk does not declare any dependency on them, TLS support ends up depending on whether OpenSSL or Botan happens to be built before drogon.

Quoted 8 lines

Select the TLS library explicitly, following the same order as trantor, so that OpenSSL is preferred over Botan.

host-drogon only provides drogon_ctl, which does not need TLS, so disable it there to avoid picking up the TLS libraries of the build machine.

Applied to 2026.08.x. Thanks

Quoted 25 lines
---
 package/drogon/drogon.mk | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
package/drogon/drogon.mk +5 -1
index 03cba45ceb34..8c51d16ac0d7 100644
@@ -21,7 +21,8 @@ DROGON_CONF_OPTS = \
 HOST_DROGON_CONF_OPTS = \
 	-DBUILD_CTL=ON \
 	-DBUILD_EXAMPLES=OFF \
-	-DBUILD_TESTS=OFF
+	-DBUILD_TESTS=OFF \
+	-DTRANTOR_USE_TLS=none
 
 ifeq ($(BR2_PACKAGE_DROGON_BROTLI),y)
 DROGON_DEPENDENCIES += brotli
@@ -57,6 +58,16 @@ else
 DROGON_CONF_OPTS += -DBUILD_ORM=OFF
 endif
 
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+DROGON_DEPENDENCIES += openssl
+DROGON_CONF_OPTS += -DTRANTOR_USE_TLS=openssl

package/drogon/drogon.mk else · line 73

Quoted 10 lines
package/drogon/drogon.mk +7 -0
+else ifeq ($(BR2_PACKAGE_BOTAN),y)
+DROGON_DEPENDENCIES += botan
+DROGON_CONF_OPTS += -DTRANTOR_USE_TLS=botan
+else
+DROGON_CONF_OPTS += -DTRANTOR_USE_TLS=none
+endif
+
 ifeq ($(BR2_PACKAGE_DROGON_YAML_CONFIG),y)
 DROGON_DEPENDENCIES += yaml-cpp
 DROGON_CONF_OPTS += -DBUILD_YAML_CONFIG=ON

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot