From 27d35d50ccadb584dd8032b9036e456f42c9ee07 Mon Sep 17 00:00:00 2001 From: toddouska Date: Wed, 28 Sep 2011 13:19:05 -0700 Subject: [PATCH] lots o warning fixes for rc3 --- configure.ac | 4 +++- ctaocrypt/benchmark/benchmark.c | 4 ++-- ctaocrypt/src/asn.c | 4 +++- ctaocrypt/src/hc128.c | 2 +- ctaocrypt/test/test.c | 2 +- cyassl/internal.h | 2 +- cyassl/ssl.h | 1 + src/internal.c | 28 +++++++++++----------------- src/keys.c | 2 +- src/ssl.c | 2 +- 10 files changed, 25 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index 05c0ae0f6..edc7549f5 100644 --- a/configure.ac +++ b/configure.ac @@ -350,7 +350,7 @@ fi # HC128 AC_ARG_ENABLE(hc128, - [ --enable-certgen Enable HC-128 (default: disabled)], + [ --enable-hc128 Enable HC-128 (default: disabled)], [ ENABLED_HC128=$enableval ], [ ENABLED_HC128=no ] ) @@ -358,6 +358,8 @@ AC_ARG_ENABLE(hc128, if test "$ENABLED_HC128" = "no" then AM_CFLAGS="$AM_CFLAGS -DNO_HC128" +else + AM_CFLAGS="$AM_CFLAGS -DHAVE_HC128" fi AM_CONDITIONAL([BUILD_HC128], [test "x$ENABLED_HC128" = "xyes"]) diff --git a/ctaocrypt/benchmark/benchmark.c b/ctaocrypt/benchmark/benchmark.c index c26018a48..becd6fa1e 100644 --- a/ctaocrypt/benchmark/benchmark.c +++ b/ctaocrypt/benchmark/benchmark.c @@ -75,7 +75,7 @@ int main(int argc, char** argv) bench_aes(1); #endif bench_arc4(); -#if HAVE_HC128 +#ifdef HAVE_HC128 bench_hc128(); #endif #ifndef NO_RABBIT @@ -204,7 +204,7 @@ void bench_arc4() } -#if HAVE_HC128 +#ifdef HAVE_HC128 void bench_hc128() { HC128 enc; diff --git a/ctaocrypt/src/asn.c b/ctaocrypt/src/asn.c index 1f2b7312e..2fc3115f7 100644 --- a/ctaocrypt/src/asn.c +++ b/ctaocrypt/src/asn.c @@ -1194,8 +1194,10 @@ static int GetName(DecodedCert* cert, int nameType) byte joint[2]; int oidSz; - if (GetSet(cert->source, &cert->srcIdx, &dummy, cert->maxIdx) < 0) + if (GetSet(cert->source, &cert->srcIdx, &dummy, cert->maxIdx) < 0) { + (void)b; /* empty body warning w/o messages enabled */ CYASSL_MSG("Cert name lacks set header, trying sequence"); + } if (GetSequence(cert->source, &cert->srcIdx, &dummy, cert->maxIdx) < 0) return ASN_PARSE_E; diff --git a/ctaocrypt/src/hc128.c b/ctaocrypt/src/hc128.c index ca123d3d1..c47645920 100644 --- a/ctaocrypt/src/hc128.c +++ b/ctaocrypt/src/hc128.c @@ -23,7 +23,7 @@ #include #endif -#if HAVE_HC128 +#ifdef HAVE_HC128 #include #ifdef NO_INLINE diff --git a/ctaocrypt/test/test.c b/ctaocrypt/test/test.c index 68c674571..446acb4db 100644 --- a/ctaocrypt/test/test.c +++ b/ctaocrypt/test/test.c @@ -752,7 +752,7 @@ int arc4_test() int hc128_test() { -#if defined(HAVE_HC128) && HAVE_HC128 +#ifdef HAVE_HC128 byte cipher[16]; byte plain[16]; diff --git a/cyassl/internal.h b/cyassl/internal.h index 511b07811..16d901149 100644 --- a/cyassl/internal.h +++ b/cyassl/internal.h @@ -750,7 +750,7 @@ typedef union { #ifdef BUILD_AES Aes aes; #endif -#if HAVE_HC128 +#ifdef HAVE_HC128 HC128 hc128; #endif #ifdef BUILD_RABBIT diff --git a/cyassl/ssl.h b/cyassl/ssl.h index 1d2072083..7b6cc81c2 100644 --- a/cyassl/ssl.h +++ b/cyassl/ssl.h @@ -204,6 +204,7 @@ CYASSL_API long CyaSSL_CTX_set_session_cache_mode(CYASSL_CTX*, long); /* only supports full name from cipher_name[] delimited by : */ CYASSL_API int CyaSSL_CTX_set_cipher_list(CYASSL_CTX*, const char*); +CYASSL_API int CyaSSL_ERR_GET_REASON(int err); CYASSL_API char* CyaSSL_ERR_error_string(unsigned long,char*); CYASSL_API void CyaSSL_ERR_error_string_n(unsigned long e, char* buf, unsigned long sz); diff --git a/src/internal.c b/src/internal.c index 3aa4c260f..d3c61ca71 100644 --- a/src/internal.c +++ b/src/internal.c @@ -53,9 +53,6 @@ #endif -int CyaSSL_negotiate(CYASSL*); - - #ifndef NO_CYASSL_CLIENT static int DoHelloVerifyRequest(CYASSL* ssl, const byte* input, word32*); static int DoServerHello(CYASSL* ssl, const byte* input, word32*); @@ -807,9 +804,6 @@ int InitSSL(CYASSL* ssl, CYASSL_CTX* ctx) } -int CyaSSL_BIO_free(CYASSL_BIO*); /* internal doesn't have */ - - /* In case holding SSL object in array and don't want to free actual ssl */ void SSL_ResourceFree(CYASSL* ssl) { @@ -1821,7 +1815,7 @@ static INLINE void Encrypt(CYASSL* ssl, byte* out, const byte* input, word32 sz) #ifdef BUILD_AES case aes: -#ifdef CYASSL_AESNI + #ifdef CYASSL_AESNI if ((word)input % 16) { byte buffer[MAX_RECORD_SIZE + MAX_COMP_EXTRA+MAX_MSG_EXTRA]; XMEMCPY(buffer, input, sz); @@ -1829,12 +1823,12 @@ static INLINE void Encrypt(CYASSL* ssl, byte* out, const byte* input, word32 sz) XMEMCPY(out, buffer, sz); break; } -#endif + #endif AesCbcEncrypt(&ssl->encrypt.aes, out, input, sz); break; #endif - #if HAVE_HC128 + #ifdef HAVE_HC128 case hc128: Hc128_Process(&ssl->encrypt.hc128, out, input, sz); break; @@ -1874,7 +1868,7 @@ static INLINE void Decrypt(CYASSL* ssl, byte* plain, const byte* input, break; #endif - #if HAVE_HC128 + #ifdef HAVE_HC128 case hc128: Hc128_Process(&ssl->decrypt.hc128, plain, input, sz); break; @@ -4539,7 +4533,7 @@ int SetCipherList(CYASSL_CTX* ctx, const char* list) #ifdef HAVE_ECC - byte SetCurveId(int size) + static byte SetCurveId(int size) { switch(size) { case 20: @@ -4747,16 +4741,16 @@ int SetCipherList(CYASSL_CTX* ctx, const char* list) byte encodedSig[MAX_ENCODED_SIG_SZ]; if (IsAtLeastTLSv1_2(ssl)) { byte* digest; - int hashType; + int hType; int digestSz; /* sha1 for now */ digest = &hash[MD5_DIGEST_SIZE]; - hashType = SHAh; + hType = SHAh; digestSz = SHA_DIGEST_SIZE; signSz = EncodeSignature(encodedSig, digest, digestSz, - hashType); + hType); signBuffer = encodedSig; } ret = RsaSSL_Sign(signBuffer, signSz, output + idx, sigSz, @@ -5563,13 +5557,13 @@ int SetCipherList(CYASSL_CTX* ctx, const char* list) #ifdef HAVE_ECC } else if (ssl->specs.kea == ecc_diffie_hellman_kea) { word32 size; - word32 length = input[*inOutIdx]; /* one byte length */ + word32 bLength = input[*inOutIdx]; /* one byte length */ *inOutIdx += 1; - ret = ecc_import_x963(&input[*inOutIdx], length, &ssl->peerEccKey); + ret = ecc_import_x963(&input[*inOutIdx], bLength, &ssl->peerEccKey); if (ret != 0) return ECC_PEERKEY_ERROR; - *inOutIdx += length; + *inOutIdx += bLength; ssl->peerEccKeyPresent = 1; size = sizeof(ssl->arrays.preMasterSecret); diff --git a/src/keys.c b/src/keys.c index 880cf58bd..ea37c0db4 100644 --- a/src/keys.c +++ b/src/keys.c @@ -565,7 +565,7 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs, } #endif -#if HAVE_HC128 +#ifdef HAVE_HC128 if (specs->bulk_cipher_algorithm == hc128) { if (side == CLIENT_END) { Hc128_SetKey(&enc->hc128, keys->client_write_key, diff --git a/src/ssl.c b/src/ssl.c index 6ffe6d641..caafd8ffe 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -3286,7 +3286,7 @@ int CyaSSL_set_compression(CYASSL* ssl) } - void CYASSL_SESSION_free(CYASSL_SESSION* session) + void CyaSSL_SESSION_free(CYASSL_SESSION* session) { (void)session; }