imapfilter: fix build with OpenSSL 4.0

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>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Jaipaul Cheernam
2026-08-27 23:33:15 -07:00
committed by Khem Raj
parent e335b7e6c8
commit d6c472cc16
2 changed files with 46 additions and 0 deletions
@@ -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;
@@ -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"