Use portable friendly XVALIDATE_DATE in ssl.c and add wc_ to default

This commit is contained in:
kaleb-himes
2020-07-10 09:43:24 -06:00
parent 8d37f57990
commit 64c0d53a2d
4 changed files with 5 additions and 5 deletions

View File

@ -22994,11 +22994,11 @@ int wolfSSL_X509_verify_cert(WOLFSSL_X509_STORE_CTX* ctx)
afterDate = ctx->current_cert->notAfter.data;
beforeDate = ctx->current_cert->notBefore.data;
if (ValidateDate(afterDate, (byte)ctx->current_cert->notAfter.type,
if (XVALIDATE_DATE(afterDate, (byte)ctx->current_cert->notAfter.type,
AFTER) < 1) {
error = X509_V_ERR_CERT_HAS_EXPIRED;
}
else if (ValidateDate(beforeDate,
else if (XVALIDATE_DATE(beforeDate,
(byte)ctx->current_cert->notBefore.type, BEFORE) < 1) {
error = X509_V_ERR_CERT_NOT_YET_VALID;
}

View File

@ -6344,7 +6344,7 @@ static WC_INLINE int DateLessThan(const struct tm* a, const struct tm* b)
/* like atoi but only use first byte */
/* Make sure before and after dates are valid */
int ValidateDate(const byte* date, byte format, int dateType)
int wc_ValidateDate(const byte* date, byte format, int dateType)
{
time_t ltime;
struct tm certTime;

View File

@ -1118,7 +1118,7 @@ WOLFSSL_LOCAL int GetAsnTimeString(void* currTime, byte* buf, word32 len);
WOLFSSL_LOCAL int ExtractDate(const unsigned char* date, unsigned char format,
wolfssl_tm* certTime, int* idx);
WOLFSSL_LOCAL int DateGreaterThan(const struct tm* a, const struct tm* b);
WOLFSSL_LOCAL int ValidateDate(const byte* date, byte format, int dateType);
WOLFSSL_LOCAL int wc_ValidateDate(const byte* date, byte format, int dateType);
WOLFSSL_LOCAL int wc_OBJ_sn2nid(const char *sn);
/* ASN.1 helper functions */

View File

@ -688,7 +688,7 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
#endif
#if !defined(XVALIDATE_DATE) && !defined(HAVE_VALIDATE_DATE)
#define USE_WOLF_VALIDDATE
#define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t))
#define XVALIDATE_DATE(d, f, t) wc_ValidateDate((d), (f), (t))
#endif
/* wolf struct tm and time_t */