wolfSSL_get_rbio,wolfSSL_get_wbio.

fix to check XBADFILE in wolfSSL_BIO_write_file.
This commit is contained in:
Go Hosohara
2018-07-13 19:51:54 +09:00
parent fd01659baa
commit fd634141bd
4 changed files with 11 additions and 6 deletions

View File

@ -1046,7 +1046,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
#if (defined(HAVE_ECC) && !defined(ALT_ECC_SIZE)) \ #if (defined(HAVE_ECC) && !defined(ALT_ECC_SIZE)) \
|| defined(SESSION_CERTS) || defined(SESSION_CERTS)
/* big enough to handle most cases including session certs */ /* big enough to handle most cases including session certs */
byte memory[320000]; byte memory[370000];
#else #else
byte memory[80000]; byte memory[80000];
#endif #endif

View File

@ -1117,7 +1117,7 @@ int wolfSSL_BIO_write_filename(WOLFSSL_BIO *bio, char *name)
} }
bio->file = XFOPEN(name, "w"); bio->file = XFOPEN(name, "w");
if (bio->file == NULL) { if (bio->file == XBADFILE) {
return WOLFSSL_FAILURE; return WOLFSSL_FAILURE;
} }
bio->close = BIO_CLOSE; bio->close = BIO_CLOSE;

View File

@ -33177,11 +33177,13 @@ int wolfSSL_SSL_CTX_remove_session(WOLFSSL_CTX *ctx, WOLFSSL_SESSION *s)
BIO *wolfSSL_SSL_get_rbio(const WOLFSSL *s) BIO *wolfSSL_SSL_get_rbio(const WOLFSSL *s)
{ {
WOLFSSL_ENTER("wolfSSL_SSL_get_rbio"); WOLFSSL_ENTER("wolfSSL_SSL_get_rbio");
(void)s;
/* Nginx sets the buffer size if the read BIO is different to write BIO. /* Nginx sets the buffer size if the read BIO is different to write BIO.
* The setting buffer size doesn't do anything so return NULL for both. * The setting buffer size doesn't do anything so return NULL for both.
*/ */
return NULL; if (s == NULL)
return NULL;
return s->biord;
} }
BIO *wolfSSL_SSL_get_wbio(const WOLFSSL *s) BIO *wolfSSL_SSL_get_wbio(const WOLFSSL *s)
{ {
@ -33190,7 +33192,10 @@ BIO *wolfSSL_SSL_get_wbio(const WOLFSSL *s)
/* Nginx sets the buffer size if the read BIO is different to write BIO. /* Nginx sets the buffer size if the read BIO is different to write BIO.
* The setting buffer size doesn't do anything so return NULL for both. * The setting buffer size doesn't do anything so return NULL for both.
*/ */
return NULL; if (s == NULL)
return NULL;
return s->biowr;
} }
int wolfSSL_SSL_do_handshake(WOLFSSL *s) int wolfSSL_SSL_do_handshake(WOLFSSL *s)

View File

@ -106,7 +106,7 @@ WOLFSSL_API int wolfSSL_GetAllocators(wolfSSL_Malloc_cb*,
#define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3456,4544,24576 #define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3456,4544,24576
#else #else
/* increase 23k for object member of WOLFSSL_X509_NAME_ENTRY */ /* increase 23k for object member of WOLFSSL_X509_NAME_ENTRY */
#define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3456,4544,23088 #define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3456,4544,23248
#endif #endif
#endif #endif
#ifndef WOLFMEM_DIST #ifndef WOLFMEM_DIST