1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

mbedtls_x509_time_gmtime() to fill struct w/ time

Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
This commit is contained in:
Glenn Strauss
2022-06-30 05:25:56 -04:00
committed by David Horstmann
parent 5aef2971e6
commit 61d99304da
2 changed files with 19 additions and 7 deletions

View File

@ -1011,17 +1011,11 @@ int mbedtls_x509_time_cmp(const mbedtls_x509_time *t1,
}
#if defined(MBEDTLS_HAVE_TIME_DATE)
/*
* Set the time structure to the current time.
* Return 0 on success, non-zero on failure.
*/
static int x509_get_current_time(mbedtls_x509_time *now)
int mbedtls_x509_time_gmtime(mbedtls_time_t tt, mbedtls_x509_time *now)
{
struct tm *lt, tm_buf;
mbedtls_time_t tt;
int ret = 0;
tt = mbedtls_time(NULL);
lt = mbedtls_platform_gmtime_r(&tt, &tm_buf);
if (lt == NULL) {
@ -1038,6 +1032,11 @@ static int x509_get_current_time(mbedtls_x509_time *now)
return ret;
}
static int x509_get_current_time(mbedtls_x509_time *now)
{
return mbedtls_x509_time_gmtime(mbedtls_time(NULL), now);
}
int mbedtls_x509_time_is_past(const mbedtls_x509_time *to)
{
mbedtls_x509_time now;