mirror of https://github.com/wolfSSL/wolfssl.git
account for BIO with no filesystem and rebase commits
parent
f7737fdc55
commit
ed5ff77e4f
|
@ -333,9 +333,11 @@ int wolfSSL_BIO_reset(WOLFSSL_BIO *bio)
|
|||
}
|
||||
|
||||
switch (bio->type) {
|
||||
#ifndef NO_FILESYSTEM
|
||||
case BIO_FILE:
|
||||
XREWIND(bio->file);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
case BIO_BIO:
|
||||
bio->rdIdx = 0;
|
||||
|
@ -412,7 +414,7 @@ int wolfSSL_BIO_write_filename(WOLFSSL_BIO *bio, char *name)
|
|||
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
#endif /* NO_FILESYSTEM */
|
||||
|
||||
|
||||
int wolfSSL_BIO_seek(WOLFSSL_BIO *bio, int ofs)
|
||||
{
|
||||
|
@ -429,6 +431,7 @@ int wolfSSL_BIO_seek(WOLFSSL_BIO *bio, int ofs)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* NO_FILESYSTEM */
|
||||
|
||||
|
||||
long wolfSSL_BIO_set_mem_eof_return(WOLFSSL_BIO *bio, int v)
|
||||
|
|
14
src/ssl.c
14
src/ssl.c
|
@ -10055,6 +10055,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
}
|
||||
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
WOLFSSL_BIO_METHOD* wolfSSL_BIO_s_file(void)
|
||||
{
|
||||
static WOLFSSL_BIO_METHOD file_meth;
|
||||
|
@ -10064,6 +10065,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
|
||||
return &file_meth;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
WOLFSSL_BIO_METHOD* wolfSSL_BIO_f_ssl(void)
|
||||
|
@ -10077,7 +10079,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
}
|
||||
|
||||
|
||||
const WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_socket(void)
|
||||
WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_socket(void)
|
||||
{
|
||||
static WOLFSSL_BIO_METHOD meth;
|
||||
|
||||
|
@ -10213,11 +10215,13 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
CloseSocket(bio->fd);
|
||||
}
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
if (bio->type == BIO_FILE && bio->close == BIO_CLOSE) {
|
||||
if (bio->file) {
|
||||
XFCLOSE(bio->file);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (bio->mem)
|
||||
XFREE(bio->mem, bio->heap, DYNAMIC_TYPE_OPENSSL);
|
||||
|
@ -10266,12 +10270,14 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
return wolfSSL_BIO_BIO_read(bio, buf, len);
|
||||
}
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
if (bio && bio->type == BIO_FILE) {
|
||||
return (int)XFREAD(buf, 1, len, bio->file);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* already got eof, again is error */
|
||||
if (front->eof)
|
||||
if (bio && front->eof)
|
||||
return SSL_FATAL_ERROR;
|
||||
|
||||
while(bio && ((ssl = bio->ssl) == 0) )
|
||||
|
@ -10324,12 +10330,14 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
return wolfSSL_BIO_BIO_write(bio, data, len);
|
||||
}
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
if (bio && bio->type == BIO_FILE) {
|
||||
return (int)XFWRITE(data, 1, len, bio->file);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* already got eof, again is error */
|
||||
if (front->eof)
|
||||
if (bio && front->eof)
|
||||
return SSL_FATAL_ERROR;
|
||||
|
||||
while(bio && ((ssl = bio->ssl) == 0) )
|
||||
|
|
|
@ -43,6 +43,10 @@
|
|||
#include <wolfssl/wolfcrypt/port/atmel/atmel.h>
|
||||
#endif
|
||||
|
||||
#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
|
||||
#include <wolfssl/openssl/evp.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */
|
||||
#pragma warning(disable: 4996)
|
||||
|
|
|
@ -1264,7 +1264,9 @@ struct WOLFSSL_BIO_METHOD {
|
|||
/* wolfSSL BIO type */
|
||||
struct WOLFSSL_BIO {
|
||||
WOLFSSL* ssl; /* possible associated ssl */
|
||||
#ifndef NO_FILESYSTEM
|
||||
XFILE file;
|
||||
#endif
|
||||
WOLFSSL_BIO* prev; /* previous in chain */
|
||||
WOLFSSL_BIO* next; /* next in chain */
|
||||
WOLFSSL_BIO* pair; /* BIO paired with */
|
||||
|
|
|
@ -519,9 +519,12 @@ WOLFSSL_API long wolfSSL_BIO_set_fd(WOLFSSL_BIO* b, int fd, int flag);
|
|||
WOLFSSL_API void wolfSSL_set_bio(WOLFSSL*, WOLFSSL_BIO* rd, WOLFSSL_BIO* wr);
|
||||
WOLFSSL_API int wolfSSL_add_all_algorithms(void);
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
WOLFSSL_API WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_file(void);
|
||||
#endif
|
||||
|
||||
WOLFSSL_API WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_bio(void);
|
||||
WOLFSSL_API const WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_socket(void);
|
||||
WOLFSSL_API WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_socket(void);
|
||||
|
||||
WOLFSSL_API long wolfSSL_BIO_ctrl(WOLFSSL_BIO *bp, int cmd, long larg, void *parg);
|
||||
WOLFSSL_API long wolfSSL_BIO_int_ctrl(WOLFSSL_BIO *bp, int cmd, long larg, int iarg);
|
||||
|
|
Loading…
Reference in New Issue