diff --git a/src/internal.c b/src/internal.c index ab6f3a3e9..26841116c 100644 --- a/src/internal.c +++ b/src/internal.c @@ -7422,8 +7422,9 @@ int SendFinished(WOLFSSL* ssl) #ifndef NO_CERTS int SendCertificate(WOLFSSL* ssl) { - int length, ret = 0; - word32 certSz, certChainSz, headerSz, listSz, maxFragment, payloadSz; + int ret = 0; + word32 certSz, certChainSz, headerSz, listSz, payloadSz; + word32 length, maxFragment; if (ssl->options.usingPSK_cipher || ssl->options.usingAnon_cipher) return 0; /* not needed */ @@ -7448,6 +7449,8 @@ int SendCertificate(WOLFSSL* ssl) length += certChainSz; listSz += certChainSz; } + else + certChainSz = 0; } payloadSz = length; @@ -7472,7 +7475,7 @@ int SendCertificate(WOLFSSL* ssl) while (length > 0 && ret == 0) { byte* output = NULL; - word32 fragSz; /* How much of the certificate data are we copying? */ + word32 fragSz = 0; word32 i = RECORD_HEADER_SZ; int sendSz = RECORD_HEADER_SZ; diff --git a/src/ssl.c b/src/ssl.c index b30e97537..2676c0c17 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -97,17 +97,15 @@ #endif /* WOLFSSSL_HAVE_MIN */ -#ifndef WOLFSSL_HAVE_MAX +#if defined(WOLFSSL_DTLS) && !defined(WOLFSSL_HAVE_MAX) #define WOLFSSL_HAVE_MAX -#ifdef WOLFSSL_DTLS static INLINE word32 max(word32 a, word32 b) { return a > b ? a : b; } -#endif /* WOLFSSL_DTLS */ -#endif /* WOLFSSL_HAVE_MAX */ +#endif /* WOLFSSL_DTLS && !WOLFSSL_HAVE_MAX */ #ifndef WOLFSSL_LEANPSK diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index b525b5d54..da747f017 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -194,9 +194,14 @@ WOLFSSL_LOCAL int UnLockMutex(wolfSSL_Mutex*); /* Windows API defines its own min() macro. */ -#if defined(USE_WINDOWS_API) && defined(min) - #define WOLFSSL_HAVE_MIN -#endif +#if defined(USE_WINDOWS_API) + #ifdef min + #define WOLFSSL_HAVE_MIN + #endif /* min */ + #ifdef max + #define WOLFSSL_HAVE_MAX + #endif /* max */ +#endif /* USE_WINDOWS_API */ #ifdef __cplusplus