remove logging statics if not in debug mode, minor warning fixes

This commit is contained in:
Todd A Ouska
2011-07-13 12:25:08 -07:00
parent 2b01ccd57d
commit 9cd322ba91
6 changed files with 29 additions and 8 deletions

View File

@ -42,7 +42,7 @@
/* Define to 1 or 0, depending whether the compiler supports simple visibility /* Define to 1 or 0, depending whether the compiler supports simple visibility
declarations. */ declarations. */
#define HAVE_VISIBILITY 1 #define HAVE_VISIBILITY 0
/* Define to the sub-directory in which libtool stores uninstalled libraries. /* Define to the sub-directory in which libtool stores uninstalled libraries.
*/ */

View File

@ -29,13 +29,18 @@
CYASSL_API int CyaSSL_Debugging_ON(void); CYASSL_API int CyaSSL_Debugging_ON(void);
CYASSL_API void CyaSSL_Debugging_OFF(void); CYASSL_API void CyaSSL_Debugging_OFF(void);
#ifdef DEBUG_CYASSL
/* Set these to default values initially. */ /* Set these to default values initially. */
static CyaSSL_Logging_cb log_function = 0; static CyaSSL_Logging_cb log_function = 0;
static int loggingEnabled = 0; static int loggingEnabled = 0;
#endif /* DEBUG_CYASSL */
int CyaSSL_SetLoggingCb(CyaSSL_Logging_cb f) int CyaSSL_SetLoggingCb(CyaSSL_Logging_cb f)
{ {
#ifdef DEBUG_CYASSL
int res = 0; int res = 0;
if (f) if (f)
@ -44,6 +49,10 @@ int CyaSSL_SetLoggingCb(CyaSSL_Logging_cb f)
res = BAD_FUNC_ARG; res = BAD_FUNC_ARG;
return res; return res;
#else
(void)f;
return NOT_COMPILED_IN;
#endif
} }
@ -60,7 +69,9 @@ int CyaSSL_Debugging_ON(void)
void CyaSSL_Debugging_OFF(void) void CyaSSL_Debugging_OFF(void)
{ {
#ifdef DEBUG_CYASSL
loggingEnabled = 0; loggingEnabled = 0;
#endif
} }

View File

@ -656,7 +656,7 @@ CYASSL_API int CyaSSL_SetTmpDH(SSL*, unsigned char* p, int pSz,
#ifndef _WIN32 #ifndef _WIN32
#ifndef NO_WRITEV #ifndef NO_WRITEV
#if __PPU #ifdef __PPU
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#else #else

View File

@ -1410,7 +1410,8 @@ static void BuildFinished(SSL* ssl, Hashes* hashes, const byte* sender)
Md5 md5 = ssl->hashMd5; Md5 md5 = ssl->hashMd5;
Sha sha = ssl->hashSha; Sha sha = ssl->hashSha;
#ifndef NO_SHA256 #ifndef NO_SHA256
Sha256 sha256 = {0}; Sha256 sha256;
InitSha256(&sha256);
if (IsAtLeastTLSv1_2(ssl)) if (IsAtLeastTLSv1_2(ssl))
sha256 = ssl->hashSha256; sha256 = ssl->hashSha256;
#endif #endif
@ -2481,7 +2482,8 @@ static void BuildCertHashes(SSL* ssl, Hashes* hashes)
Md5 md5 = ssl->hashMd5; Md5 md5 = ssl->hashMd5;
Sha sha = ssl->hashSha; Sha sha = ssl->hashSha;
#ifndef NO_SHA256 /* for possible future changes */ #ifndef NO_SHA256 /* for possible future changes */
Sha256 sha256 = {0}; Sha256 sha256;
InitSha256(&sha256);
if (IsAtLeastTLSv1_2(ssl)) if (IsAtLeastTLSv1_2(ssl))
sha256 = ssl->hashSha256; sha256 = ssl->hashSha256;
#endif #endif

View File

@ -53,7 +53,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#if __PPU #ifdef __PPU
#include <netex/errno.h> #include <netex/errno.h>
#else #else
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -79,7 +79,7 @@
#define SOCKET_ECONNRESET WSAECONNRESET #define SOCKET_ECONNRESET WSAECONNRESET
#define SOCKET_EINTR WSAEINTR #define SOCKET_EINTR WSAEINTR
#define SOCKET_EPIPE WSAEPIPE #define SOCKET_EPIPE WSAEPIPE
#elif __PPU #elif defined(__PPU)
#define SOCKET_EWOULDBLOCK SYS_NET_EWOULDBLOCK #define SOCKET_EWOULDBLOCK SYS_NET_EWOULDBLOCK
#define SOCKET_EAGAIN SYS_NET_EAGAIN #define SOCKET_EAGAIN SYS_NET_EAGAIN
#define SOCKET_ECONNRESET SYS_NET_ECONNRESET #define SOCKET_ECONNRESET SYS_NET_ECONNRESET

View File

@ -3261,6 +3261,8 @@ int CyaSSL_set_compression(SSL* ssl)
return "TLSv1.1"; return "TLSv1.1";
case TLSv1_2_MINOR : case TLSv1_2_MINOR :
return "TLSv1.2"; return "TLSv1.2";
default:
return "unknown";
} }
} }
else if (ssl->version.major == DTLS_MAJOR) else if (ssl->version.major == DTLS_MAJOR)
@ -3280,6 +3282,7 @@ int CyaSSL_set_compression(SSL* ssl)
{ {
CYASSL_ENTER("SSL_CIPHER_get_name"); CYASSL_ENTER("SSL_CIPHER_get_name");
if (cipher) { if (cipher) {
#ifdef HAVE_ECC
if (cipher->ssl->options.cipherSuite0 == ECC_BYTE) { if (cipher->ssl->options.cipherSuite0 == ECC_BYTE) {
/* ECC suites */ /* ECC suites */
switch (cipher->ssl->options.cipherSuite) { switch (cipher->ssl->options.cipherSuite) {
@ -3299,8 +3302,11 @@ int CyaSSL_set_compression(SSL* ssl)
return "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA"; return "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA";
case TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA : case TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA :
return "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA"; return "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA";
default:
return "NONE";
} }
} else { #endif
if (cipher->ssl->options.cipherSuite0 != ECC_BYTE) {
/* normal suites */ /* normal suites */
switch (cipher->ssl->options.cipherSuite) { switch (cipher->ssl->options.cipherSuite) {
case SSL_RSA_WITH_RC4_128_SHA : case SSL_RSA_WITH_RC4_128_SHA :
@ -3343,7 +3349,9 @@ int CyaSSL_set_compression(SSL* ssl)
return "TLS_NTRU_RSA_WITH_AES_128_CBC_SHA"; return "TLS_NTRU_RSA_WITH_AES_128_CBC_SHA";
case TLS_NTRU_RSA_WITH_AES_256_CBC_SHA : case TLS_NTRU_RSA_WITH_AES_256_CBC_SHA :
return "TLS_NTRU_RSA_WITH_AES_256_CBC_SHA"; return "TLS_NTRU_RSA_WITH_AES_256_CBC_SHA";
} default:
return "NONE";
} /* switch */
} /* normal / ECC */ } /* normal / ECC */
} }