diff mbox series

[meta-oe,RFC,11/20] imapfilter: fix build with OpenSSL 4.0

Message ID 20260827185324.78997-12-jaipaul.cheernam@est.tech
State New
Headers show
Series Fix OpenSSL 4.0.1 build failures across meta-openembedded | expand

Commit Message

Jaipaul Cheernam Aug. 27, 2026, 6:53 p.m. UTC
OpenSSL 4.0 makes ASN1_INTEGER opaque. Use ASN1_STRING accessors.

Upstream-Status: Submitted [https://github.com/lefcha/imapfilter/pull/317]
Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
---
 ...NG-accessors-for-opaque-ASN1_INTEGER.patch | 45 +++++++++++++++++++
 .../imapfilter/imapfilter_2.8.5.bb            |  1 +
 2 files changed, 46 insertions(+)
 create mode 100644 meta-oe/recipes-support/imapfilter/imapfilter/0001-Use-ASN1_STRING-accessors-for-opaque-ASN1_INTEGER.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/imapfilter/imapfilter/0001-Use-ASN1_STRING-accessors-for-opaque-ASN1_INTEGER.patch b/meta-oe/recipes-support/imapfilter/imapfilter/0001-Use-ASN1_STRING-accessors-for-opaque-ASN1_INTEGER.patch
new file mode 100644
index 0000000000..4342de42c9
--- /dev/null
+++ b/meta-oe/recipes-support/imapfilter/imapfilter/0001-Use-ASN1_STRING-accessors-for-opaque-ASN1_INTEGER.patch
@@ -0,0 +1,45 @@ 
+From d0e1b29ee5ae0e6e91944fd5c04b943fc810e13c Mon Sep 17 00:00:00 2001
+From: Ravi Kant Sharma <ravi.kant.sharma@canonical.com>
+Date: Mon, 3 Aug 2026 23:02:04 +0200
+Subject: [PATCH] Use ASN1_STRING accessors for opaque ASN1_INTEGER
+
+OpenSSL 4.0 made ASN1_INTEGER opaque. Replace direct struct member
+access (->length, ->type, ->data) with ASN1_STRING_length(),
+ASN1_STRING_type(), ASN1_STRING_get0_data().
+Upstream-Status: Submitted [https://github.com/lefcha/imapfilter/pull/317]
+Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
+---
+ src/cert.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/cert.c b/src/cert.c
+index a6f614a..b188dd0 100644
+--- a/src/cert.c
++++ b/src/cert.c
+@@ -186,21 +186,21 @@ get_serial(X509 *cert)
+ 	serial = X509_get_serialNumber(cert);
+ 	buf = xmalloc(LINE_MAX);
+ 	*buf = '\0';
+-	if (serial->length <= (int)sizeof(long)) {
++	if (ASN1_STRING_length(serial) <= (int)sizeof(long)) {
+ 		num = ASN1_INTEGER_get(serial);
+-		if (serial->type == V_ASN1_NEG_INTEGER) {
++		if (ASN1_STRING_type(serial) == V_ASN1_NEG_INTEGER) {
+ 			snprintf(buf, LINE_MAX, "-%lX", -num);
+ 		} else {
+ 			snprintf(buf, LINE_MAX, "%lX", num);
+ 		}
+ 	} else {
+-		if (serial->type == V_ASN1_NEG_INTEGER) {
++		if (ASN1_STRING_type(serial) == V_ASN1_NEG_INTEGER) {
+ 			snprintf(buf, LINE_MAX, "-");
+ 		}
+-		for (i = 0; i < serial->length; i++) {
++		for (i = 0; i < ASN1_STRING_length(serial); i++) {
+ 			len = strlen(buf);
+ 			snprintf(buf + len, LINE_MAX - len, "%02X",
+-			    serial->data[i]);
++			    ASN1_STRING_get0_data(serial)[i]);
+ 		}
+ 	}
+ 	return buf;
diff --git a/meta-oe/recipes-support/imapfilter/imapfilter_2.8.5.bb b/meta-oe/recipes-support/imapfilter/imapfilter_2.8.5.bb
index 754e793faa..3e449523ca 100644
--- a/meta-oe/recipes-support/imapfilter/imapfilter_2.8.5.bb
+++ b/meta-oe/recipes-support/imapfilter/imapfilter_2.8.5.bb
@@ -6,6 +6,7 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=c9e8d74e78283c6319317d3cb15eded4"
 SRCREV = "23b693f7f7cad8b459beb5cf748078f9cc0e5dc8"
 SRC_URI = "git://github.com/lefcha/imapfilter;protocol=https;branch=master;tag=v${PV} \
            file://ldflags.patch \
+           file://0001-Use-ASN1_STRING-accessors-for-opaque-ASN1_INTEGER.patch \
 "
 
 DEPENDS = "openssl lua libpcre2"