forked from wolfSSL/wolfssl
Adding UTC Time Differential in ValidateDate
This commit is contained in:
@@ -2550,6 +2550,9 @@ int ValidateDate(const byte* date, byte format, int dateType)
|
|||||||
struct tm* localTime;
|
struct tm* localTime;
|
||||||
struct tm* tmpTime = NULL;
|
struct tm* tmpTime = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
int timeDiff = 0 ;
|
||||||
|
int diffHH = 0 ; int diffMM = 0 ;
|
||||||
|
int diffSign = 0 ;
|
||||||
|
|
||||||
#if defined(FREESCALE_MQX) || defined(TIME_OVERRIDES)
|
#if defined(FREESCALE_MQX) || defined(TIME_OVERRIDES)
|
||||||
struct tm tmpTimeStorage;
|
struct tm tmpTimeStorage;
|
||||||
@@ -2580,11 +2583,17 @@ int ValidateDate(const byte* date, byte format, int dateType)
|
|||||||
GetTime((int*)&certTime.tm_min, date, &i);
|
GetTime((int*)&certTime.tm_min, date, &i);
|
||||||
GetTime((int*)&certTime.tm_sec, date, &i);
|
GetTime((int*)&certTime.tm_sec, date, &i);
|
||||||
|
|
||||||
if (date[i] != 'Z') { /* only Zulu supported for this profile */
|
if ((date[i] == '+') || (date[i] == '-')) {
|
||||||
WOLFSSL_MSG("Only Zulu time supported for this profile");
|
diffSign = date[i++]=='+' ? 1 : -1 ;
|
||||||
return 0;
|
GetTime((int*)&diffHH, date, &i);
|
||||||
|
GetTime((int*)&diffMM, date, &i);
|
||||||
|
timeDiff = diffSign * (diffHH*60 + diffMM) * 60 ;
|
||||||
|
} else if (date[i] != 'Z') {
|
||||||
|
WOLFSSL_MSG("UTCtime, niether Zulu or time differential") ;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ltime -= timeDiff ;
|
||||||
localTime = XGMTIME(<ime, tmpTime);
|
localTime = XGMTIME(<ime, tmpTime);
|
||||||
|
|
||||||
if (localTime == NULL) {
|
if (localTime == NULL) {
|
||||||
@@ -9316,4 +9325,3 @@ int ParseCRL(DecodedCRL* dcrl, const byte* buff, word32 sz, void* cm)
|
|||||||
|
|
||||||
|
|
||||||
#endif /* WOLFSSL_SEP */
|
#endif /* WOLFSSL_SEP */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user