From 8df2ad69de03c61378a85dc08daa1e9a2fa46920 Mon Sep 17 00:00:00 2001 From: Bernd Kuhls Date: Tue, 6 Oct 2026 18:20:10 +0200 Subject: [PATCH] package/clamav: fix build with OpenSSL 4.0.0 Signed-off-by: Bernd Kuhls Signed-off-by: Thomas Petazzoni --- ...-crypto-Remove-cl_ASN1_GetTimeT-1731.patch | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 package/clamav/0001-libclamav-crypto-Remove-cl_ASN1_GetTimeT-1731.patch diff --git a/package/clamav/0001-libclamav-crypto-Remove-cl_ASN1_GetTimeT-1731.patch b/package/clamav/0001-libclamav-crypto-Remove-cl_ASN1_GetTimeT-1731.patch new file mode 100644 index 0000000000..60e29a1fdb --- /dev/null +++ b/package/clamav/0001-libclamav-crypto-Remove-cl_ASN1_GetTimeT-1731.patch @@ -0,0 +1,136 @@ +From 0097a6f99d9f6b78381e12b677a38fb62242c41a Mon Sep 17 00:00:00 2001 +From: sebastianas +Date: Sat, 1 Aug 2026 00:13:13 +0200 +Subject: [PATCH] libclamav/crypto: Remove cl_ASN1_GetTimeT() (#1731) + +The last user has been removed in commit fa15aa98c7d5e ("bb11594 - allow +for compilation against openssl 1.1.0"). This function is only exported +under CLAMAV_PRIVATE to be used within clamav, not by external users. + +Removing the function will not cause an ABI break since it was not part +of the officially exported ABI. As a side effect it will compile against +OpenSSL 4.0 where the ASN1_TIME type has been made opaque. + +Remove cl_ASN1_GetTimeT(). + +Signed-off-by: Sebastian Andrzej Siewior + +Upstream: https://github.com/Cisco-Talos/clamav/commit/0097a6f99d9f6b78381e12b677a38fb62242c41a + +Signed-off-by: Bernd Kuhls +--- + libclamav/clamav.h | 8 ----- + libclamav/crypto.c | 65 ----------------------------------------- + libclamav/libclamav.map | 1 - + 3 files changed, 74 deletions(-) + +diff --git a/libclamav/clamav.h b/libclamav/clamav.h +index 8a3767f78..fa75677ad 100644 +--- a/libclamav/clamav.h ++++ b/libclamav/clamav.h +@@ -2413,14 +2413,6 @@ extern int cl_validate_certificate_chain(char **authorities, char *crlpath, char + */ + extern X509 *cl_load_cert(const char *certpath); + +-/** +- * @brief Parse an ASN1_TIME object. +- * +- * @param timeobj The ASN1_TIME object. +- * @return A pointer to a (struct tm). Adjusted for time zone and daylight savings time. +- */ +-extern struct tm *cl_ASN1_GetTimeT(ASN1_TIME *timeobj); +- + /** + * @brief Load a CRL file into an X509_CRL object. + * +diff --git a/libclamav/crypto.c b/libclamav/crypto.c +index 8b398e402..968264811 100644 +--- a/libclamav/crypto.c ++++ b/libclamav/crypto.c +@@ -1746,71 +1746,6 @@ X509 *cl_load_cert(const char *certpath) + return cert; + } + +-struct tm *cl_ASN1_GetTimeT(ASN1_TIME *timeobj) +-{ +- struct tm *t; +- char *str; +- const char *fmt = NULL; +- time_t localt; +-#ifdef _WIN32 +- struct tm localtm, *ltm; +-#else +- struct tm localtm; +-#endif +- +- if (!(timeobj) || !(timeobj->data)) +- return NULL; +- +- str = (char *)(timeobj->data); +- if (strlen(str) < 12) +- return NULL; +- +- t = (struct tm *)calloc(1, sizeof(struct tm)); +- if (!(t)) +- return NULL; +- +- if (timeobj->type == V_ASN1_UTCTIME) { +- /* two digit year */ +- fmt = "%y%m%d%H%M%S"; +- if (str[3] == '0') { +- str[2] = '0'; +- str[3] = '9'; +- } else { +- str[3]--; +- } +- } else if (timeobj->type == V_ASN1_GENERALIZEDTIME) { +- /* four digit year */ +- fmt = "%Y%m%d%H%M%S"; +- if (str[5] == '0') { +- str[4] = '0'; +- str[5] = '9'; +- } else { +- str[5]--; +- } +- } +- +- if (!(fmt)) { +- free(t); +- return NULL; +- } +- +- if (!strptime(str, fmt, t)) { +- free(t); +- return NULL; +- } +- +- /* Convert to local time */ +- localt = time(NULL); +-#ifdef _WIN32 +- ltm = localtime(&localt); +- memcpy((void *)(&localtm), (void *)ltm, sizeof(struct tm)); +-#else +- localtime_r(&localt, &localtm); +-#endif +- t->tm_isdst = localtm.tm_isdst; +- return t; +-} +- + X509_CRL *cl_load_crl(const char *file) + { + X509_CRL *x = NULL; +diff --git a/libclamav/libclamav.map b/libclamav/libclamav.map +index 809341f42..f3efe1a33 100644 +--- a/libclamav/libclamav.map ++++ b/libclamav/libclamav.map +@@ -271,7 +271,6 @@ CLAMAV_PRIVATE { + cl_verify_signature_hash_x509; + cl_verify_signature_hash_x509_keyfile; + cl_load_cert; +- cl_ASN1_GetTimeT; + cl_load_crl; + cl_sign_data_keyfile; + cl_sign_data; +-- +2.47.3 +