diff mbox series

[meta-oe,v2] librelp: upgrade 1.14.0 -> 1.15.0

Message ID 20261201015427.3533499-1-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe,v2] librelp: upgrade 1.14.0 -> 1.15.0 | expand

Commit Message

Khem Raj Dec. 1, 2026, 1:54 a.m. UTC
librelp is now licensed entirely under Apache-2.0. Earlier releases
were GPL-3.0-or-later (with part of the files already Apache-2.0 in
1.14.0); code whose contributors could not be cleared was rewritten.
COPYING now states the license and points to COPYING.ASL20, which holds
the license text, so track both.

This is the last 1.x release and the last to support OpenSSL 1.0.2 and
1.1.0. The API is extended in a backward compatible way and the soname
is unchanged.

Behaviour changes:
- servers accept at most 500 sessions, an incomplete session open must
  finish within 30 s and an idle session is closed after 3600 s; new
  relpEngineSetMaxSessions(), relpEngineSetOpenTimeout() and
  relpEngineSetIdleTimeout() change the limits
- OpenSSL clients in "certvalid" and "name" auth modes verify the
  certificate chain, each client and listener with its own SSL context
- a TLS listener no longer falls back to plain TCP in a build without
  TLS support
- client-only commands are rejected, and syslog messages are not
  acknowledged when the host callback is missing or fails

Fixes: no SIGPIPE on plain TCP sends to a closed peer, the default
listen port, a listener leak on failed startup, the connect timeout
(monotonic clock, EINTR) and relpTcpWaitWriteable() timing. The GnuTLS
fingerprint matcher is rewritten, and librelp.h can be included from
C++.

Add a patch for building with OpenSSL 4.1: 1.15.0 calls the now
deprecated ASN1_STRING_length() and passes the const X509_NAME * that
X509_get_issuer_name() returns to a non-const parameter, both errors
under the -Werror the build uses.

License-Update: relicensed from GPL-3.0-or-later to Apache-2.0

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
v2: Rework 0002-tcp-build-with-OpenSSL-4.1.patch to match upstream PR
    rsyslog/librelp#360 (relpOsslAsn1StrLen() helper with a size_t SAN
    length, const X509_NAME * for relpTcpCertNameText()), keeping the
    pre-1.1.0 OpenSSL code paths that 1.15.0 still supports, and mark it
    Upstream-Status: Submitted. Commit message unchanged.

 .../0002-tcp-build-with-OpenSSL-4.1.patch     | 96 +++++++++++++++++++
 .../{librelp_1.14.0.bb => librelp_1.15.0.bb}  |  8 +-
 2 files changed, 101 insertions(+), 3 deletions(-)
 create mode 100644 meta-oe/recipes-extended/rsyslog/librelp/0002-tcp-build-with-OpenSSL-4.1.patch
 rename meta-oe/recipes-extended/rsyslog/{librelp_1.14.0.bb => librelp_1.15.0.bb} (91%)
diff mbox series

Patch

diff --git a/meta-oe/recipes-extended/rsyslog/librelp/0002-tcp-build-with-OpenSSL-4.1.patch b/meta-oe/recipes-extended/rsyslog/librelp/0002-tcp-build-with-OpenSSL-4.1.patch
new file mode 100644
index 0000000000..b745d36770
--- /dev/null
+++ b/meta-oe/recipes-extended/rsyslog/librelp/0002-tcp-build-with-OpenSSL-4.1.patch
@@ -0,0 +1,96 @@ 
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Khem Raj <khem.raj@oss.qualcomm.com>
+Date: Mon, 30 Nov 2026 15:38:30 -0800
+Subject: [PATCH] tcp: build with OpenSSL 4.1
+
+OpenSSL 4.0 makes X509_get_issuer_name() and X509_get_subject_name()
+return a const X509_NAME *, and OpenSSL 4.1 deprecates
+ASN1_STRING_length() in favour of ASN1_STRING_get_length(). With
+-Werror, the build fails with:
+
+  src/tcp.c:395:14: error: 'ASN1_STRING_length' is deprecated: Since OpenSSL 4.1; use ASN1_STRING_get_length() [-Werror,-Wdeprecated-declarations]
+  src/tcp.c:485:22: error: passing 'const X509_NAME *' (aka 'const struct X509_name_st *') to parameter of type 'X509_NAME *' (aka 'struct X509_name_st *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
+
+This takes the two corresponding changes from upstream PR #360: the
+relpOsslAsn1StrLen() helper, with the SAN length as a size_t, and a
+const X509_NAME * for relpTcpCertNameText(). The PR is stacked on #354,
+which drops support for OpenSSL older than 1.1.1, so its hunks do not
+apply to 1.15.0. Here the older code paths are kept, and
+X509_NAME_oneline() gets a cast for OpenSSL before 1.1.0, where it takes
+a non-const name. The rest of the PR (SSL_get1_peer_certificate(), the
+SSL_CTX_set_ecdh_auto() removal and a CI job) is not needed to build.
+
+Upstream-Status: Submitted [https://github.com/rsyslog/librelp/pull/360]
+Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
+---
+ src/tcp.c | 28 ++++++++++++++++++++++++----
+ 1 file changed, 24 insertions(+), 4 deletions(-)
+
+diff --git a/src/tcp.c b/src/tcp.c
+index e748b3f..d6b3aeb 100644
+--- a/src/tcp.c
++++ b/src/tcp.c
+@@ -338,6 +338,21 @@ finalize_it:
+ 	LEAVE_RELPFUNC;
+ }
+ 
++/* Length of an ASN1_STRING. OpenSSL 4.1 deprecates ASN1_STRING_length()
++ * in favour of ASN1_STRING_get_length(). A negative legacy result maps to
++ * SIZE_MAX, which callers reject as too long.
++ */
++static size_t
++relpOsslAsn1StrLen(const ASN1_STRING *const str)
++{
++#if OPENSSL_VERSION_NUMBER >= 0x40100000L && !defined(LIBRESSL_VERSION_NUMBER)
++	return ASN1_STRING_get_length(str);
++#else
++	const int len = ASN1_STRING_length(str);
++	return (len < 0) ? SIZE_MAX : (size_t) len;
++#endif
++}
++
+ /* Check the peer's ID in name auth mode. */
+ static int
+ relpTcpChkPeerName_ossl(relpTcp_t *const pThis, void *vcert)
+@@ -357,7 +372,7 @@ relpTcpChkPeerName_ossl(relpTcp_t *const pThis, void *vcert)
+ 	int gtype;
+ 	ASN1_STRING *asDnsName;
+ 	const unsigned char *sanData;
+-	int sanLen;
++	size_t sanLen;
+ 	char sanName[1024];
+ 
+ 	ENTER_RELPFUNC;
+@@ -392,14 +407,14 @@ relpTcpChkPeerName_ossl(relpTcp_t *const pThis, void *vcert)
+ 					continue;
+ 				if(asDnsName == NULL)
+ 					ABORT_FINALIZE(RELP_RET_AUTH_CERT_INVL);
+-				sanLen = ASN1_STRING_length(asDnsName);
++				sanLen = relpOsslAsn1StrLen(asDnsName);
+ 
+ #				if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ 				sanData = ASN1_STRING_get0_data(asDnsName);
+ #				else
+ 				sanData = ASN1_STRING_data(asDnsName);
+ #				endif
+-				if(sanLen <= 0 || (size_t)sanLen >= sizeof(sanName) || sanData == NULL
++				if(sanLen == 0 || sanLen >= sizeof(sanName) || sanData == NULL
+ 				   || memchr(sanData, '\0', sanLen) != NULL)
+ 					ABORT_FINALIZE(RELP_RET_AUTH_CERT_INVL);
+ 				memcpy(sanName, sanData, sanLen);
+@@ -448,9 +463,14 @@ finalize_it:
+  * A missing certificate or name yields "(none)".
+  */
+ static void
+-relpTcpCertNameText(X509_NAME *const name, char *const buf, const size_t lenBuf)
++relpTcpCertNameText(const X509_NAME *const name, char *const buf, const size_t lenBuf)
+ {
++#	if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ 	if(name == NULL || X509_NAME_oneline(name, buf, (int) lenBuf) == NULL) {
++#	else
++	/* before OpenSSL 1.1.0, X509_NAME_oneline() takes a non-const name */
++	if(name == NULL || X509_NAME_oneline((X509_NAME *) name, buf, (int) lenBuf) == NULL) {
++#	endif
+ 		snprintf(buf, lenBuf, "(none)");
+ 	}
+ }
diff --git a/meta-oe/recipes-extended/rsyslog/librelp_1.14.0.bb b/meta-oe/recipes-extended/rsyslog/librelp_1.15.0.bb
similarity index 91%
rename from meta-oe/recipes-extended/rsyslog/librelp_1.14.0.bb
rename to meta-oe/recipes-extended/rsyslog/librelp_1.15.0.bb
index 55dbef2509..3ee31be3ec 100644
--- a/meta-oe/recipes-extended/rsyslog/librelp_1.14.0.bb
+++ b/meta-oe/recipes-extended/rsyslog/librelp_1.15.0.bb
@@ -1,17 +1,19 @@ 
 SUMMARY = "A reliable logging library"
 HOMEPAGE = "https://github.com/rsyslog/librelp"
 
-LICENSE = "GPL-3.0-only"
-LIC_FILES_CHKSUM = "file://COPYING;md5=1fb9c10ed9fd6826757615455ca893a9"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=12b2b1deab5b47f85769b01d9a339204 \
+                    file://COPYING.ASL20;md5=3b83ef96387f14655fc854ddc3c6bd57"
 
 DEPENDS = "gmp libidn zlib"
 
 SRC_URI = "git://github.com/rsyslog/librelp.git;protocol=https;branch=main;tag=v${PV} \
            file://run-ptest \
            file://0001-tests-skip-tls-ossl-connect-failure-vg.sh-without-li.patch \
+           file://0002-tcp-build-with-OpenSSL-4.1.patch \
 "
 
-SRCREV = "87a447e3f656d3e4d6e5f9d1f0e72a16527d342d"
+SRCREV = "9212985f9309413d520558a0682bcb29cd6a0cdc"
 
 CVE_PRODUCT = "rsyslog:librelp"