Fix test failures

This commit is contained in:
Eric Blankenhorn
2020-01-30 11:07:04 -06:00
parent 018f313cca
commit 258382048d
4 changed files with 13 additions and 5 deletions

View File

@@ -124,7 +124,6 @@ static int wolfSSL_BIO_MEMORY_read(WOLFSSL_BIO* bio, void* buf, int len)
return sz; return sz;
} }
#ifndef WOLFCRYPT_ONLY #ifndef WOLFCRYPT_ONLY
/* Helper function to read from WOLFSSL_BIO_SSL type /* 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; return ret;
} }
#endif /* WOLFCRYPT_ONLY */
static int wolfSSL_BIO_MD_read(WOLFSSL_BIO* bio, void* buf, int sz) 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; return ret;
} }
#endif /* WOLFCRYPT_ONLY */
/* Used to read data from a WOLFSSL_BIO structure /* 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) { if (bio && bio->type == WOLFSSL_BIO_SSL) {
ret = wolfSSL_BIO_SSL_read(bio, buf, len, front); ret = wolfSSL_BIO_SSL_read(bio, buf, len, front);
} }
#endif
/* data passing through BIO MD wrapper */ /* data passing through BIO MD wrapper */
if (bio && bio->type == WOLFSSL_BIO_MD && ret > 0) { if (bio && bio->type == WOLFSSL_BIO_MD && ret > 0) {
ret = wolfSSL_BIO_MD_read(bio, buf, ret); ret = wolfSSL_BIO_MD_read(bio, buf, ret);
} }
#endif
/* case where front of list is done */ /* case where front of list is done */
if (bio == front) { 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 /* Helper function for writing to a WOLFSSL_BIO_MD type
* *
* returns the amount written in bytes on success (0) * 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; return ret;
} }
#endif /* WOLFCRYPT_ONLY */
/* Writes data to a WOLFSSL_BIO structure /* 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); ret = wolfSSL_BIO_SSL_write(bio, data, len, front);
} }
} }
#endif /* WOLFCRYPT_ONLY */
if (bio && bio->type == WOLFSSL_BIO_MD) { if (bio && bio->type == WOLFSSL_BIO_MD) {
if (bio->next != NULL) { /* data passing through MD BIO */ if (bio->next != NULL) { /* data passing through MD BIO */
ret = wolfSSL_BIO_MD_write(bio, data, len); ret = wolfSSL_BIO_MD_write(bio, data, len);
} }
} }
#endif /* WOLFCRYPT_ONLY */
/* advance to the next bio in list */ /* advance to the next bio in list */
bio = bio->next; bio = bio->next;
@@ -805,6 +806,7 @@ int wolfSSL_BIO_gets(WOLFSSL_BIO* bio, char* buf, int sz)
break; break;
} }
#ifndef WOLFCRYPT_ONLY
/* call final on hash */ /* call final on hash */
case WOLFSSL_BIO_MD: case WOLFSSL_BIO_MD:
if (wolfSSL_EVP_MD_CTX_size(bio->ptr) > sz) { 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; break;
#endif /* WOLFCRYPT_ONLY */
default: default:
WOLFSSL_MSG("BIO type not supported yet with wolfSSL_BIO_gets"); WOLFSSL_MSG("BIO type not supported yet with wolfSSL_BIO_gets");
@@ -1296,6 +1299,7 @@ int wolfSSL_BIO_reset(WOLFSSL_BIO *bio)
} }
return 0; return 0;
#ifndef WOLFCRYPT_ONLY
case WOLFSSL_BIO_MD: case WOLFSSL_BIO_MD:
if (bio->ptr != NULL) { if (bio->ptr != NULL) {
const WOLFSSL_EVP_MD* md = wolfSSL_EVP_MD_CTX_md(bio->ptr); 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); wolfSSL_EVP_DigestInit(bio->ptr, md);
} }
return 0; return 0;
#endif /* WOLFCRYPT_ONLY */
default: default:
WOLFSSL_MSG("Unknown BIO type needs added to reset function"); WOLFSSL_MSG("Unknown BIO type needs added to reset function");

View File

@@ -28726,7 +28726,6 @@ void wolfSSL_AES_cfb128_encrypt(const unsigned char *in, unsigned char* out,
#endif /* NO_AES */ #endif /* NO_AES */
#ifndef NO_FILESYSTEM #ifndef NO_FILESYSTEM
#include <stdarg.h> /* var_arg */
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-nonliteral" #pragma clang diagnostic ignored "-Wformat-nonliteral"

View File

@@ -5672,6 +5672,7 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
EVP_TEST_END: EVP_TEST_END:
XFREE(cipher, NULL, DYNAMIC_TYPE_TMP_BUFFER); XFREE(cipher, NULL, DYNAMIC_TYPE_TMP_BUFFER);
(void)cipherSz;
return ret; return ret;
} }
#endif /* OPENSSL_EXTRA */ #endif /* OPENSSL_EXTRA */

View File

@@ -2010,8 +2010,11 @@ WOLFSSL_API int wolfSSL_want(WOLFSSL*);
WOLFSSL_API int wolfSSL_want_read(WOLFSSL*); WOLFSSL_API int wolfSSL_want_read(WOLFSSL*);
WOLFSSL_API int wolfSSL_want_write(WOLFSSL*); WOLFSSL_API int wolfSSL_want_write(WOLFSSL*);
#ifndef NO_FILESYSTEM
#include <stdarg.h> /* var_arg */
WOLFSSL_API int wolfSSL_BIO_vprintf(WOLFSSL_BIO* bio, const char* format, WOLFSSL_API int wolfSSL_BIO_vprintf(WOLFSSL_BIO* bio, const char* format,
va_list args); va_list args);
#endif
WOLFSSL_API int wolfSSL_BIO_printf(WOLFSSL_BIO*, const char*, ...); 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_BIO_dump(WOLFSSL_BIO *bio, const char*, int);
WOLFSSL_API int wolfSSL_ASN1_UTCTIME_print(WOLFSSL_BIO*, WOLFSSL_API int wolfSSL_ASN1_UTCTIME_print(WOLFSSL_BIO*,