PR merged https://github.com/Cisco-Talos/clamav/pull/1731.patch
fix compat openssl-4
From 1739c129a4ba9ea60c9ab3da4e4de3296d1f223a Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Date: Thu, 4 Jun 2026 20:39:11 +0200
Subject: [PATCH] libclamav/crypto: Remove cl_ASN1_GetTimeT()

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 <sebastian@breakpoint.cc>
--- 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.
  *
--- 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;
--- 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;
