X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fbtls%2Fbtls-util.c;h=57fa0fa7813138b5db9ff7422763aa48ac8810d7;hb=HEAD;hp=824b101f34c50ed68b88fd0e804a050ed7add745;hpb=59ddb222e093ce41efe12432a8f0a4ea0785c219;p=mono.git diff --git a/mono/btls/btls-util.c b/mono/btls/btls-util.c index 824b101f34c..57fa0fa7813 100644 --- a/mono/btls/btls-util.c +++ b/mono/btls/btls-util.c @@ -8,32 +8,39 @@ #include #include -#include - -#if defined(__ANDROID__) && !defined(__LP64__) -#include -extern time_t timegm (struct tm* const t); -#endif +// #include extern int asn1_generalizedtime_to_tm (struct tm *tm, const ASN1_GENERALIZEDTIME *d); +extern int64_t btls_timegm64 (const struct tm *date); + + MONO_API void mono_btls_free (void *data) { OPENSSL_free (data); } -long +int64_t mono_btls_util_asn1_time_to_ticks (ASN1_TIME *time) { ASN1_GENERALIZEDTIME *gtime; struct tm tm; - time_t epoch; + int64_t epoch; + int ret; + + memset (&tm, 0, sizeof (tm)); gtime = ASN1_TIME_to_generalizedtime (time, NULL); - asn1_generalizedtime_to_tm (&tm, gtime); + ret = asn1_generalizedtime_to_tm (&tm, gtime); ASN1_GENERALIZEDTIME_free (gtime); - epoch = timegm(&tm); + + /* FIXME: check the return value in managed code */ + if (ret == 0) { + return 0; + } + + epoch = btls_timegm64 (&tm); return epoch; }