Fix build with NO_ASN_TIME. Kaleb, add to future build options tests.

This commit is contained in:
David Garske
2017-01-17 10:35:48 -08:00
parent 00fed61d36
commit a0dc8dc8f9

View File

@@ -629,7 +629,6 @@ int GetShortInt(const byte* input, word32* inOutIdx, int* number, word32 maxIdx)
} }
#endif /* !NO_PWDBASED */ #endif /* !NO_PWDBASED */
#ifndef NO_ASN_TIME
/* May not have one, not an error */ /* May not have one, not an error */
static int GetExplicitVersion(const byte* input, word32* inOutIdx, int* version, static int GetExplicitVersion(const byte* input, word32* inOutIdx, int* version,
word32 maxIdx) word32 maxIdx)
@@ -647,7 +646,6 @@ static int GetExplicitVersion(const byte* input, word32* inOutIdx, int* version,
return 0; return 0;
} }
#endif /* !NO_ASN_TIME */
int GetInt(mp_int* mpi, const byte* input, word32* inOutIdx, int GetInt(mp_int* mpi, const byte* input, word32* inOutIdx,
word32 maxIdx) word32 maxIdx)
@@ -2657,7 +2655,6 @@ void FreeDecodedCert(DecodedCert* cert)
#endif /* OPENSSL_EXTRA */ #endif /* OPENSSL_EXTRA */
} }
#ifndef NO_ASN_TIME
static int GetCertHeader(DecodedCert* cert) static int GetCertHeader(DecodedCert* cert)
{ {
int ret = 0, len; int ret = 0, len;
@@ -2704,9 +2701,7 @@ static int StoreRsaKey(DecodedCert* cert)
return 0; return 0;
} }
#endif #endif /* !NO_RSA */
#endif /* !NO_ASN_TIME */
#ifdef HAVE_ECC #ifdef HAVE_ECC
@@ -2727,7 +2722,6 @@ static int StoreRsaKey(DecodedCert* cert)
#endif /* HAVE_ECC */ #endif /* HAVE_ECC */
#ifndef NO_ASN_TIME
static int GetKey(DecodedCert* cert) static int GetKey(DecodedCert* cert)
{ {
int length; int length;
@@ -2868,7 +2862,6 @@ static int GetKey(DecodedCert* cert)
} }
} }
/* process NAME, either issuer or subject */ /* process NAME, either issuer or subject */
static int GetName(DecodedCert* cert, int nameType) static int GetName(DecodedCert* cert, int nameType)
{ {
@@ -3348,6 +3341,7 @@ static int GetName(DecodedCert* cert, int nameType)
} }
#ifndef NO_ASN_TIME
#if !defined(NO_TIME_H) && defined(USE_WOLF_VALIDDATE) #if !defined(NO_TIME_H) && defined(USE_WOLF_VALIDDATE)
/* to the second */ /* to the second */
@@ -3429,7 +3423,7 @@ int GetTimeString(byte* date, int format, char* buf, int len)
return 1; return 1;
} }
#endif /* MYSQL compatibility */ #endif /* WOLFSSL_MYSQL_COMPATIBLE */
int ExtractDate(const unsigned char* date, unsigned char format, int ExtractDate(const unsigned char* date, unsigned char format,
struct tm* certTime, int* idx) struct tm* certTime, int* idx)
@@ -3533,6 +3527,8 @@ int wc_GetTime(void* timePtr, word32 timeSize)
return 0; return 0;
} }
#endif /* !NO_ASN_TIME */
static int GetDate(DecodedCert* cert, int dateType) static int GetDate(DecodedCert* cert, int dateType)
{ {
int length; int length;
@@ -3541,6 +3537,7 @@ static int GetDate(DecodedCert* cert, int dateType)
word32 startIdx = 0; word32 startIdx = 0;
XMEMSET(date, 0, MAX_DATE_SIZE); XMEMSET(date, 0, MAX_DATE_SIZE);
if (dateType == BEFORE) if (dateType == BEFORE)
cert->beforeDate = &cert->source[cert->srcIdx]; cert->beforeDate = &cert->source[cert->srcIdx];
else else
@@ -3565,17 +3562,18 @@ static int GetDate(DecodedCert* cert, int dateType)
else else
cert->afterDateLen = cert->srcIdx - startIdx; cert->afterDateLen = cert->srcIdx - startIdx;
#ifndef NO_ASN_TIME
if (!XVALIDATE_DATE(date, b, dateType)) { if (!XVALIDATE_DATE(date, b, dateType)) {
if (dateType == BEFORE) if (dateType == BEFORE)
return ASN_BEFORE_DATE_E; return ASN_BEFORE_DATE_E;
else else
return ASN_AFTER_DATE_E; return ASN_AFTER_DATE_E;
} }
#endif
return 0; return 0;
} }
static int GetValidity(DecodedCert* cert, int verify) static int GetValidity(DecodedCert* cert, int verify)
{ {
int length; int length;
@@ -3635,7 +3633,6 @@ int DecodeToKey(DecodedCert* cert, int verify)
return ret; return ret;
} }
static int GetSignature(DecodedCert* cert) static int GetSignature(DecodedCert* cert)
{ {
int length; int length;
@@ -3659,7 +3656,6 @@ static int GetSignature(DecodedCert* cert)
return 0; return 0;
} }
#endif /* !NO_ASN_TIME */
static word32 SetDigest(const byte* digest, word32 digSz, byte* output) static word32 SetDigest(const byte* digest, word32 digSz, byte* output)
{ {
@@ -3882,7 +3878,6 @@ int wc_GetCTC_HashOID(int type)
}; };
} }
#ifndef NO_ASN_TIME
/* return true (1) or false (0) for Confirmation */ /* return true (1) or false (0) for Confirmation */
static int ConfirmSignature(const byte* buf, word32 bufSz, static int ConfirmSignature(const byte* buf, word32 bufSz,
const byte* key, word32 keySz, word32 keyOID, const byte* key, word32 keySz, word32 keyOID,
@@ -4324,7 +4319,6 @@ static int ConfirmNameConstraints(Signer* signer, DecodedCert* cert)
#endif /* IGNORE_NAME_CONSTRAINTS */ #endif /* IGNORE_NAME_CONSTRAINTS */
static int DecodeAltNames(byte* input, int sz, DecodedCert* cert) static int DecodeAltNames(byte* input, int sz, DecodedCert* cert)
{ {
word32 idx = 0; word32 idx = 0;
@@ -4518,7 +4512,6 @@ static int DecodeAltNames(byte* input, int sz, DecodedCert* cert)
return 0; return 0;
} }
static int DecodeBasicCaConstraint(byte* input, int sz, DecodedCert* cert) static int DecodeBasicCaConstraint(byte* input, int sz, DecodedCert* cert)
{ {
word32 idx = 0; word32 idx = 0;
@@ -4950,7 +4943,6 @@ static int DecodeNameConstraints(byte* input, int sz, DecodedCert* cert)
return 0; return 0;
} }
#endif /* IGNORE_NAME_CONSTRAINTS */ #endif /* IGNORE_NAME_CONSTRAINTS */
#endif /* NO_ASN_TIME */
#if defined(WOLFSSL_CERT_EXT) && !defined(WOLFSSL_SEP) #if defined(WOLFSSL_CERT_EXT) && !defined(WOLFSSL_SEP)
@@ -5120,7 +5112,6 @@ static int DecodePolicyOID(char *out, word32 outSz, byte *in, word32 inSz)
} }
#endif /* WOLFSSL_SEP */ #endif /* WOLFSSL_SEP */
#ifndef NO_ASN_TIME
static int DecodeCertExtensions(DecodedCert* cert) static int DecodeCertExtensions(DecodedCert* cert)
/* /*
* Processing the Certificate Extensions. This does not modify the current * Processing the Certificate Extensions. This does not modify the current
@@ -5311,7 +5302,6 @@ static int DecodeCertExtensions(DecodedCert* cert)
return criticalFail ? ASN_CRIT_EXT_E : 0; return criticalFail ? ASN_CRIT_EXT_E : 0;
} }
int ParseCert(DecodedCert* cert, int type, int verify, void* cm) int ParseCert(DecodedCert* cert, int type, int verify, void* cm)
{ {
int ret; int ret;
@@ -5345,8 +5335,6 @@ int ParseCert(DecodedCert* cert, int type, int verify, void* cm)
return ret; return ret;
} }
#endif /* !NO_ASN_TIME */
/* from SSL proper, for locking can't do find here anymore */ /* from SSL proper, for locking can't do find here anymore */
#ifdef __cplusplus #ifdef __cplusplus
@@ -5382,7 +5370,6 @@ Signer* GetCAByName(void* signers, byte* hash)
#endif /* WOLFCRYPT_ONLY || NO_CERTS */ #endif /* WOLFCRYPT_ONLY || NO_CERTS */
#ifndef NO_ASN_TIME
int ParseCertRelative(DecodedCert* cert, int type, int verify, void* cm) int ParseCertRelative(DecodedCert* cert, int type, int verify, void* cm)
{ {
word32 confirmOID; word32 confirmOID;
@@ -5523,7 +5510,6 @@ int ParseCertRelative(DecodedCert* cert, int type, int verify, void* cm)
return 0; return 0;
} }
#endif /* !NO_ASN_TIME */
/* Create and init an new signer */ /* Create and init an new signer */
Signer* MakeSigner(void* heap) Signer* MakeSigner(void* heap)