diff --git a/src/bio.c b/src/bio.c index 39f160a63..aa02a9ada 100644 --- a/src/bio.c +++ b/src/bio.c @@ -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) diff --git a/src/ssl.c b/src/ssl.c index c31de34ff..0a6177259 100644 --- a/src/ssl.c +++ b/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) ) diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index 2afb5645f..434248fd7 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -43,6 +43,10 @@ #include #endif +#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) + #include +#endif + #ifdef _MSC_VER /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */ #pragma warning(disable: 4996) diff --git a/wolfssl/internal.h b/wolfssl/internal.h index 44fdb36b4..d6709dd9d 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -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 */ diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 522d6759f..b8f377ebc 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -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);