From 31bd844d6f306416a39e3b1c1273221e5cc17119 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Wed, 22 Aug 2018 11:16:57 +1000 Subject: [PATCH] Fix for clang builds with configs not using inline funcs --- src/internal.c | 13 ++++++++++--- src/ssl.c | 2 ++ wolfcrypt/src/aes.c | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/internal.c b/src/internal.c index a5d8be466..fc9e603d9 100644 --- a/src/internal.c +++ b/src/internal.c @@ -199,6 +199,7 @@ static WC_INLINE int IsEncryptionOn(WOLFSSL* ssl, int isSend) } +#if defined(WOLFSSL_DTLS) || !defined(WOLFSSL_NO_TLS12) /* If SCTP is not enabled returns the state of the dtls option. * If SCTP is enabled returns dtls && !sctp. */ static WC_INLINE int IsDtlsNotSctpMode(WOLFSSL* ssl) @@ -213,6 +214,7 @@ static WC_INLINE int IsDtlsNotSctpMode(WOLFSSL* ssl) return result; } +#endif /* DTLS || !WOLFSSL_NO_TLS12 */ #ifdef HAVE_QSH @@ -2902,6 +2904,7 @@ void FreeX509(WOLFSSL_X509* x509) #if !defined(NO_WOLFSSL_SERVER) || !defined(NO_WOLFSSL_CLIENT) +#if !defined(WOLFSSL_NO_TLS12) && !defined(WOLFSSL_NO_CLIENT_AUTH) /* Encode the signature algorithm into buffer. * * hashalgo The hash algorithm. @@ -2943,7 +2946,6 @@ static WC_INLINE void EncodeSigAlg(byte hashAlgo, byte hsType, byte* output) (void)output; } -#if !defined(WOLFSSL_NO_TLS12) && !defined(WOLFSSL_NO_CLIENT_AUTH) static void SetDigest(WOLFSSL* ssl, int hashAlgo) { switch (hashAlgo) { @@ -5485,6 +5487,8 @@ void FreeSSL(WOLFSSL* ssl, void* heap) #if !defined(NO_OLD_TLS) || defined(WOLFSSL_DTLS) || \ ((defined(HAVE_CHACHA) || defined(HAVE_AESCCM) || defined(HAVE_AESGCM)) \ && defined(HAVE_AEAD)) + +#if defined(WOLFSSL_DTLS) || !defined(WOLFSSL_NO_TLS12) static WC_INLINE void GetSEQIncrement(WOLFSSL* ssl, int verify, word32 seq[2]) { if (verify) { @@ -5504,6 +5508,7 @@ static WC_INLINE void GetSEQIncrement(WOLFSSL* ssl, int verify, word32 seq[2]) } } } +#endif /* WOLFSSL_DTLS || !WOLFSSL_NO_TLS12 */ #ifdef WOLFSSL_DTLS @@ -5579,7 +5584,7 @@ static WC_INLINE void DtlsSEQIncrement(WOLFSSL* ssl, int order) } #endif /* WOLFSSL_DTLS */ - +#if defined(WOLFSSL_DTLS) || !defined(WOLFSSL_NO_TLS12) static WC_INLINE void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out) { word32 seq[2] = {0, 0}; @@ -5596,7 +5601,9 @@ static WC_INLINE void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out) c32toa(seq[0], out); c32toa(seq[1], out + OPAQUE32_LEN); } -#endif +#endif /* WOLFSSL_DTLS || !WOLFSSL_NO_TLS12 */ +#endif /* !NO_OLD_TLS || WOLFSSL_DTLS || + * ((HAVE_CHACHA || HAVE_AESCCM || HAVE_AESGCM) && HAVE_AEAD) */ #ifdef WOLFSSL_DTLS diff --git a/src/ssl.c b/src/ssl.c index 0aa2dc6f3..5d6b50a33 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -8715,6 +8715,7 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, } #endif + #if defined(WOLFSSL_DTLS) || !defined(WOLFSSL_NO_TLS12) /* If SCTP is not enabled returns the state of the dtls option. * If SCTP is enabled returns dtls && !sctp. */ static WC_INLINE int IsDtlsNotSctpMode(WOLFSSL* ssl) @@ -8729,6 +8730,7 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, return result; } + #endif /* WOLFSSL_DTLS || !WOLFSSL_NO_TLS12 */ /* please see note at top of README if you get an error from connect */ diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 714e23a14..81829902f 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -1283,6 +1283,7 @@ static const word32 Td[4][256] = { }; +#if defined(HAVE_AES_CBC) || defined(WOLFSSL_AES_DIRECT) static const byte Td4[256] = { 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U, @@ -1318,6 +1319,7 @@ static const byte Td4[256] = 0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U, 0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU, }; +#endif /* HAVE_AES_CBC || WOLFSSL_AES_DIRECT */ #endif /* HAVE_AES_DECRYPT */ #define GETBYTE(x, y) (word32)((byte)((x) >> (8 * (y))))