From 0776a437885cc28671c55862ee8e7631d9919476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 11 Apr 2014 12:25:45 +0200 Subject: [PATCH] Use UTC to heck certificate validity --- ChangeLog | 1 + library/x509.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83f152807..0c18ff7bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ Changes * x509_crt_info() now prints information about parsed extensions as well * pk_verify() now returns a specific error code when the signature is valid but shorter than the supplied length. + * Use UTC time to check certificate validity. Security * Avoid potential timing leak in ecdsa_sign() by blinding modular division. diff --git a/library/x509.c b/library/x509.c index 57de5450d..54623a0d7 100644 --- a/library/x509.c +++ b/library/x509.c @@ -627,7 +627,7 @@ static void x509_get_current_time( x509_time *now ) #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) SYSTEMTIME st; - GetLocalTime(&st); + GetSystemTime(&st); now->year = st.wYear; now->mon = st.wMonth; @@ -640,7 +640,7 @@ static void x509_get_current_time( x509_time *now ) time_t tt; tt = time( NULL ); - localtime_r( &tt, < ); + gmtime_r( &tt, < ); now->year = lt.tm_year + 1900; now->mon = lt.tm_mon + 1;