Hello Eduardo.
I'm going to apply the attached patch to the Debian alpine package,
which is essentially the same patch I received from Ubuntu / Ravi Kant Sharma.
(I changed Forwarded to "yes", which is now true after I send this email :-)
Thanks.
Description: Fix build with OpenSSL 4.0
Use ASN1_STRING_get0_data() accessor instead of directly accessing
the ->data field of ASN1_IA5STRING, which is now an opaque type.
Author: Ravi Kant Sharma <[email protected]>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2154824
Bug-Debian: https://bugs.debian.org/1137386
Forwarded: yes
Last-Update: 2026-06-12
--- a/imap/src/osdep/nt/ssl_libressl.c
+++ b/imap/src/osdep/nt/ssl_libressl.c
@@ -529,7 +529,7 @@
/* older versions of OpenSSL use "ia5" instead of dNSName */
for (i = 0; ret && (i < n); i++)
if ((name = sk_GENERAL_NAME_value (ext,i)) &&
- (name->type = GEN_DNS) && (s = name->d.ia5->data) &&
+ (name->type = GEN_DNS) && (s = (char *) ASN1_STRING_get0_data(name->d.ia5)) &&
ssl_compare_hostnames (host,s)) ret = NIL;
}
#endif /* OPENSSL_1_1_0 */
@@ -552,7 +552,7 @@
/* older versions of OpenSSL use "ia5" instead of dNSName */
for (i = 0; ret && (i < n); i++)
if ((name = sk_GENERAL_NAME_value (ext,i)) &&
- (name->type = GEN_DNS) && (s = name->d.ia5->data) &&
+ (name->type = GEN_DNS) && (s = (char *) ASN1_STRING_get0_data(name->d.ia5)) &&
ssl_compare_hostnames (host,s)) ret = NIL;
}
}
--- a/imap/src/osdep/unix/ssl_unix.c
+++ b/imap/src/osdep/unix/ssl_unix.c
@@ -546,7 +546,7 @@
/* older versions of OpenSSL use "ia5" instead of dNSName */
for (i = 0; ret && (i < n); i++)
if ((name = sk_GENERAL_NAME_value (ext,i)) &&
- (name->type = GEN_DNS) && (s = name->d.ia5->data) &&
+ (name->type = GEN_DNS) && (s = (char *) ASN1_STRING_get0_data(name->d.ia5)) &&
ssl_compare_hostnames (host,s)) ret = NIL;
if(ext) GENERAL_NAMES_free(ext);
}
@@ -571,7 +571,7 @@
/* older versions of OpenSSL use "ia5" instead of dNSName */
for (i = 0; ret && (i < n); i++)
if ((name = sk_GENERAL_NAME_value (ext,i)) &&
- (name->type = GEN_DNS) && (s = name->d.ia5->data) &&
+ (name->type = GEN_DNS) && (s = (char *) ASN1_STRING_get0_data(name->d.ia5)) &&
ssl_compare_hostnames (host,s)) ret = NIL;
if(ext) GENERAL_NAMES_free(ext);
}
--- a/alpine/smime.c
+++ b/alpine/smime.c
@@ -395,9 +395,9 @@
int i;
bs = X509_get_serialNumber(cert);
- if (bs->length <= (int)sizeof(long)){
+ if (ASN1_STRING_length(bs) <= (int)sizeof(long)){
l = ASN1_INTEGER_get(bs);
- if (bs->type == V_ASN1_NEG_INTEGER){
+ if (ASN1_STRING_type(bs) == V_ASN1_NEG_INTEGER){
l = -l;
neg="-";
}
@@ -405,10 +405,10 @@
neg="";
snprintf(buf, sizeof(buf), " %s%lu (%s0x%lx)", neg, l, neg, l);
} else {
- snprintf(buf, sizeof(buf), "%s", bs->type == V_ASN1_NEG_INTEGER ? "(Negative)" : "");
- for (i = 0; i < bs->length; i++)
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%02x%s", bs->data[i],
- i+1 == bs->length ? "" : ":");
+ snprintf(buf, sizeof(buf), "%s", ASN1_STRING_type(bs) == V_ASN1_NEG_INTEGER ? "(Negative)" : "");
+ for (i = 0; i < ASN1_STRING_length(bs); i++)
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%02x%s", ASN1_STRING_get0_data(bs)[i],
+ i+1 == ASN1_STRING_length(bs) ? "" : ":");
}
}
gf_puts(buf, spc);