From 258382048d35185e4c3770bd6a8dc920945b5b69 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Thu, 30 Jan 2020 11:07:04 -0600 Subject: [PATCH] Fix test failures --- src/bio.c | 13 +++++++++---- src/ssl.c | 1 - wolfcrypt/test/test.c | 1 + wolfssl/ssl.h | 3 +++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/bio.c b/src/bio.c index 2158ff39c..27193df26 100644 --- a/src/bio.c +++ b/src/bio.c @@ -124,7 +124,6 @@ static int wolfSSL_BIO_MEMORY_read(WOLFSSL_BIO* bio, void* buf, int len) return sz; } - #ifndef WOLFCRYPT_ONLY /* Helper function to read from WOLFSSL_BIO_SSL type * @@ -157,7 +156,6 @@ static int wolfSSL_BIO_SSL_read(WOLFSSL_BIO* bio, void* buf, return ret; } -#endif /* WOLFCRYPT_ONLY */ static int wolfSSL_BIO_MD_read(WOLFSSL_BIO* bio, void* buf, int sz) { @@ -176,6 +174,7 @@ static int wolfSSL_BIO_MD_read(WOLFSSL_BIO* bio, void* buf, int sz) } return ret; } +#endif /* WOLFCRYPT_ONLY */ /* Used to read data from a WOLFSSL_BIO structure @@ -238,12 +237,12 @@ int wolfSSL_BIO_read(WOLFSSL_BIO* bio, void* buf, int len) if (bio && bio->type == WOLFSSL_BIO_SSL) { ret = wolfSSL_BIO_SSL_read(bio, buf, len, front); } - #endif /* data passing through BIO MD wrapper */ if (bio && bio->type == WOLFSSL_BIO_MD && ret > 0) { ret = wolfSSL_BIO_MD_read(bio, buf, ret); } + #endif /* case where front of list is done */ if (bio == front) { @@ -455,6 +454,7 @@ static int wolfSSL_BIO_MEMORY_write(WOLFSSL_BIO* bio, const void* data, } +#ifndef WOLFCRYPT_ONLY /* Helper function for writing to a WOLFSSL_BIO_MD type * * returns the amount written in bytes on success (0) @@ -480,6 +480,7 @@ static int wolfSSL_BIO_MD_write(WOLFSSL_BIO* bio, const void* data, int len) } return ret; } +#endif /* WOLFCRYPT_ONLY */ /* Writes data to a WOLFSSL_BIO structure @@ -593,13 +594,13 @@ int wolfSSL_BIO_write(WOLFSSL_BIO* bio, const void* data, int len) ret = wolfSSL_BIO_SSL_write(bio, data, len, front); } } - #endif /* WOLFCRYPT_ONLY */ if (bio && bio->type == WOLFSSL_BIO_MD) { if (bio->next != NULL) { /* data passing through MD BIO */ ret = wolfSSL_BIO_MD_write(bio, data, len); } } + #endif /* WOLFCRYPT_ONLY */ /* advance to the next bio in list */ bio = bio->next; @@ -805,6 +806,7 @@ int wolfSSL_BIO_gets(WOLFSSL_BIO* bio, char* buf, int sz) break; } +#ifndef WOLFCRYPT_ONLY /* call final on hash */ case WOLFSSL_BIO_MD: if (wolfSSL_EVP_MD_CTX_size(bio->ptr) > sz) { @@ -820,6 +822,7 @@ int wolfSSL_BIO_gets(WOLFSSL_BIO* bio, char* buf, int sz) } } break; +#endif /* WOLFCRYPT_ONLY */ default: WOLFSSL_MSG("BIO type not supported yet with wolfSSL_BIO_gets"); @@ -1296,6 +1299,7 @@ int wolfSSL_BIO_reset(WOLFSSL_BIO *bio) } return 0; +#ifndef WOLFCRYPT_ONLY case WOLFSSL_BIO_MD: if (bio->ptr != NULL) { const WOLFSSL_EVP_MD* md = wolfSSL_EVP_MD_CTX_md(bio->ptr); @@ -1303,6 +1307,7 @@ int wolfSSL_BIO_reset(WOLFSSL_BIO *bio) wolfSSL_EVP_DigestInit(bio->ptr, md); } return 0; +#endif /* WOLFCRYPT_ONLY */ default: WOLFSSL_MSG("Unknown BIO type needs added to reset function"); diff --git a/src/ssl.c b/src/ssl.c index 18f09bc15..1f40611dd 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -28726,7 +28726,6 @@ void wolfSSL_AES_cfb128_encrypt(const unsigned char *in, unsigned char* out, #endif /* NO_AES */ #ifndef NO_FILESYSTEM - #include /* var_arg */ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wformat-nonliteral" diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 6b1e5e035..4050da655 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -5672,6 +5672,7 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key, EVP_TEST_END: XFREE(cipher, NULL, DYNAMIC_TYPE_TMP_BUFFER); + (void)cipherSz; return ret; } #endif /* OPENSSL_EXTRA */ diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 2155bedb5..c009911dd 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -2010,8 +2010,11 @@ WOLFSSL_API int wolfSSL_want(WOLFSSL*); WOLFSSL_API int wolfSSL_want_read(WOLFSSL*); WOLFSSL_API int wolfSSL_want_write(WOLFSSL*); +#ifndef NO_FILESYSTEM +#include /* var_arg */ WOLFSSL_API int wolfSSL_BIO_vprintf(WOLFSSL_BIO* bio, const char* format, va_list args); +#endif WOLFSSL_API int wolfSSL_BIO_printf(WOLFSSL_BIO*, const char*, ...); WOLFSSL_API int wolfSSL_BIO_dump(WOLFSSL_BIO *bio, const char*, int); WOLFSSL_API int wolfSSL_ASN1_UTCTIME_print(WOLFSSL_BIO*,