diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 03353d45a..76a565399 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -2550,6 +2550,9 @@ int ValidateDate(const byte* date, byte format, int dateType) struct tm* localTime; struct tm* tmpTime = NULL; int i = 0; + int timeDiff = 0 ; + int diffHH = 0 ; int diffMM = 0 ; + int diffSign = 0 ; #if defined(FREESCALE_MQX) || defined(TIME_OVERRIDES) 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_sec, date, &i); - if (date[i] != 'Z') { /* only Zulu supported for this profile */ - WOLFSSL_MSG("Only Zulu time supported for this profile"); - return 0; + if ((date[i] == '+') || (date[i] == '-')) { + diffSign = date[i++]=='+' ? 1 : -1 ; + 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); if (localTime == NULL) { @@ -9316,4 +9325,3 @@ int ParseCRL(DecodedCRL* dcrl, const byte* buff, word32 sz, void* cm) #endif /* WOLFSSL_SEP */ -