int64_t mono_btls_util_asn1_time_to_ticks (ASN1_TIME *time) { ASN1_GENERALIZEDTIME *gtime; struct tm tm; int64_t epoch; int ret; memset (&tm, 0, sizeof (tm)); gtime = ASN1_TIME_to_generalizedtime (time, NULL); ret = asn1_generalizedtime_to_tm (&tm, gtime); ASN1_GENERALIZEDTIME_free (gtime); epoch = btls_timegm64 (&tm); return epoch; }
static int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *t) { if (t == NULL) { time_t now_t; time(&now_t); if (OPENSSL_gmtime(&now_t, tm)) return 1; return 0; } if (t->type == V_ASN1_UTCTIME) return asn1_utctime_to_tm(tm, t); else if (t->type == V_ASN1_GENERALIZEDTIME) return asn1_generalizedtime_to_tm(tm, t); return 0; }
int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *d) { return asn1_generalizedtime_to_tm(NULL, d); }