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