Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions libclamav/clamav.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
65 changes: 0 additions & 65 deletions libclamav/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion libclamav/libclamav.map
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading