From 94b7ab92f3e7599b02694f6f93a6fc7517a703ce Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Thu, 15 Feb 2018 15:08:33 -0700 Subject: [PATCH] fix for unused variable --- src/ssl.c | 12 ++---------- wolfcrypt/src/asn.c | 35 ++++++++++++++++++++++++++--------- wolfssl/ssl.h | 4 ++-- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 5cc34202d..7e8825105 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -15039,8 +15039,8 @@ static void ExternalFreeX509(WOLFSSL_X509* x509) } } - -void wolfSSL_FreeX509(WOLFSSL_X509* x509) +/* Frees an external WOLFSSL_X509 structure */ +void wolfSSL_X509_free(WOLFSSL_X509* x509) { WOLFSSL_ENTER("wolfSSL_FreeX509"); ExternalFreeX509(x509); @@ -16199,14 +16199,6 @@ const char* wolfSSL_get_curve_name(WOLFSSL* ssl) #endif #if !defined(NO_CERTS) -/* Frees an external WOLFSSL_X509 structure */ -void wolfSSL_X509_free(WOLFSSL_X509* x509) -{ - WOLFSSL_ENTER("wolfSSL_X509_free"); - ExternalFreeX509(x509); -} - - /* returns a pointer to a new WOLFSSL_X509 structure on success and NULL on * fail */ diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index cc8729da7..1c3e71bdb 100755 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -939,17 +939,34 @@ static word32 SetBitString16Bit(word16 val, byte* output) /* See "ecc_sets" table in ecc.c */ #endif /* HAVE_ECC */ +#ifdef HAVE_AES_CBC /* blkType */ -static const byte blkAes128CbcOid[] = {96, 134, 72, 1, 101, 3, 4, 1, 2}; -static const byte blkAes192CbcOid[] = {96, 134, 72, 1, 101, 3, 4, 1, 22}; -static const byte blkAes256CbcOid[] = {96, 134, 72, 1, 101, 3, 4, 1, 42}; -static const byte blkDesCbcOid[] = {43, 14, 3, 2, 7}; -static const byte blkDes3CbcOid[] = {42, 134, 72, 134, 247, 13, 3, 7}; + #ifdef WOLFSSL_AES_128 + static const byte blkAes128CbcOid[] = {96, 134, 72, 1, 101, 3, 4, 1, 2}; + #endif + #ifdef WOLFSSL_AES_192 + static const byte blkAes192CbcOid[] = {96, 134, 72, 1, 101, 3, 4, 1, 22}; + #endif + #ifdef WOLFSSL_AES_256 + static const byte blkAes256CbcOid[] = {96, 134, 72, 1, 101, 3, 4, 1, 42}; + #endif +#endif /* HAVE_AES_CBC */ + +#ifndef NO_DES3 + static const byte blkDesCbcOid[] = {43, 14, 3, 2, 7}; + static const byte blkDes3CbcOid[] = {42, 134, 72, 134, 247, 13, 3, 7}; +#endif /* keyWrapType */ -static const byte wrapAes128Oid[] = {96, 134, 72, 1, 101, 3, 4, 1, 5}; -static const byte wrapAes192Oid[] = {96, 134, 72, 1, 101, 3, 4, 1, 25}; -static const byte wrapAes256Oid[] = {96, 134, 72, 1, 101, 3, 4, 1, 45}; +#ifdef WOLFSSL_AES_128 + static const byte wrapAes128Oid[] = {96, 134, 72, 1, 101, 3, 4, 1, 5}; +#endif +#ifdef WOLFSSL_AES_192 + static const byte wrapAes192Oid[] = {96, 134, 72, 1, 101, 3, 4, 1, 25}; +#endif +#ifdef WOLFSSL_AES_256 + static const byte wrapAes256Oid[] = {96, 134, 72, 1, 101, 3, 4, 1, 45}; +#endif /* cmsKeyAgreeType */ #ifndef NO_SHA @@ -1489,7 +1506,7 @@ const byte* OidFromId(word32 id, word32 type, word32* oidSz) *oidSz = sizeof(hmacSha256Oid); break; #endif - #ifdef WOLFSSL_SHA284 + #ifdef WOLFSSL_SHA384 case HMAC_SHA384_OID: oid = hmacSha384Oid; *oidSz = sizeof(hmacSha384Oid); diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 9554ed25c..327d80856 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -733,7 +733,6 @@ WOLFSSL_API WOLFSSL_SESSION* wolfSSL_get1_session(WOLFSSL* ssl); /* what's ref count */ WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_new(void); -WOLFSSL_API void wolfSSL_X509_free(WOLFSSL_X509*); #ifdef OPENSSL_EXTRA WOLFSSL_API void wolfSSL_OPENSSL_free(void*); @@ -1470,7 +1469,8 @@ WOLFSSL_API unsigned char* wolfSSL_get_chain_cert(WOLFSSL_X509_CHAIN*, int idx); /* index cert in X509 */ WOLFSSL_API WOLFSSL_X509* wolfSSL_get_chain_X509(WOLFSSL_X509_CHAIN*, int idx); /* free X509 */ -WOLFSSL_API void wolfSSL_FreeX509(WOLFSSL_X509*); +#define wolfSSL_FreeX509(x509) wolfSSL_X509_free((x509)) +WOLFSSL_API void wolfSSL_X509_free(WOLFSSL_X509*); /* get index cert in PEM */ WOLFSSL_API int wolfSSL_get_chain_cert_pem(WOLFSSL_X509_CHAIN*, int idx, unsigned char* buf, int inLen, int* outLen);