X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fasn1%2Fa_time.c;fp=crypto%2Fasn1%2Fa_time.c;h=4b9a0641fb10627c9f8713b663e403166999139e;hp=e9df23af920decca55a6ee5e7cb23d69f5e518a1;hb=0176fc78d090210cd7e231a7c2c4564464509506;hpb=065442165a3d339a7de469b4cd18a3f902c73443 diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c index e9df23af92..4b9a0641fb 100644 --- a/crypto/asn1/a_time.c +++ b/crypto/asn1/a_time.c @@ -597,11 +597,17 @@ int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b) # define timezone _timezone #endif +#ifdef __FreeBSD__ +# define USE_TIMEGM +#endif + time_t asn1_string_to_time_t(const char *asn1_string) { ASN1_TIME *timestamp_asn1 = NULL; struct tm *timestamp_tm = NULL; +#ifndef USE_TIMEGM time_t timestamp_local; +#endif time_t timestamp_utc; timestamp_asn1 = ASN1_TIME_new(); @@ -619,10 +625,15 @@ time_t asn1_string_to_time_t(const char *asn1_string) return -1; } +#ifdef USE_TIMEGM + timestamp_utc = timegm(timestamp_tm); + OPENSSL_free(timestamp_tm); +#else timestamp_local = mktime(timestamp_tm); OPENSSL_free(timestamp_tm); timestamp_utc = timestamp_local - timezone; +#endif ASN1_TIME_free(timestamp_asn1); return timestamp_utc;