mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-06 16:36:16 +08:00
@@ -1193,7 +1193,7 @@ int asn1_utc_time_from_der_ex(int tag, time_t *t, const uint8_t **pin, size_t *p
|
||||
}
|
||||
if (len == sizeof("YYMMDDHHMMSSZ")-1) {
|
||||
#ifdef WIN32
|
||||
asn1_generalizedtime_to_tm(&tm_val, buf);
|
||||
asn1_generalizedtime_to_tm(buf, &tm_val);
|
||||
*t = GMSSL_timegm(&tm_val);
|
||||
#else
|
||||
if (!strptime(buf, "%Y%m%d%H%M%SZ", &tm_val)) {
|
||||
|
||||
@@ -143,7 +143,7 @@ int GMSSL_gmtime_adj(struct tm *tm, long offset_sec)
|
||||
}
|
||||
|
||||
//convert generalizedtime to tm
|
||||
int asn1_generalizedtime_to_tm(struct tm *tm, char *gtime)
|
||||
int asn1_generalizedtime_to_tm(char *gtime,struct tm *tm)
|
||||
{
|
||||
static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 };
|
||||
static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 };
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
int GMSSL_gmtime(const time_t *timep, struct tm *tm_time);
|
||||
time_t GMSSL_timegm(struct tm *tm);
|
||||
int GMSSL_gmtime_adj(struct tm *tm, long offset_sec);
|
||||
int asn1_generalizedtime_to_tm(struct tm *tm,char *gtime);
|
||||
int asn1_generalizedtime_to_tm(char *gtime,struct tm *tm);
|
||||
int asn1_utctime_to_tm(struct tm *tm, char *utime);
|
||||
int asn1_tm_to_generalizedtime(struct tm *tm, char *gtime);
|
||||
int asn1_tm_to_utctime(struct tm *tm, char *utime);
|
||||
|
||||
@@ -589,7 +589,7 @@ int main(void)
|
||||
if (test_asn1_utf8_string() != 1) goto err;
|
||||
if (test_asn1_ia5_string() != 1) goto err;
|
||||
if (test_asn1_utc_time() != 1) goto err;
|
||||
//if (test_asn1_generalized_time() != 1) goto err;
|
||||
if (test_asn1_generalized_time() != 1) goto err;
|
||||
printf("%s all tests passed\n", __FILE__);
|
||||
return 0;
|
||||
err:
|
||||
|
||||
Reference in New Issue
Block a user