diff --git a/cyassl/ctaocrypt/settings.h b/cyassl/ctaocrypt/settings.h index a617400a0..678d03294 100644 --- a/cyassl/ctaocrypt/settings.h +++ b/cyassl/ctaocrypt/settings.h @@ -158,8 +158,15 @@ #define NO_DEV_RANDOM #define NO_CYASSL_DIR #define NO_RABBIT + #ifndef NO_FILESYSTEM + #define LSR_FS + #include "fs.h" + #endif #define CYASSL_LWIP #define CYASSL_SAFERTOS +#endif + +#ifdef CYASSL_SAFERTOS #ifndef SINGLE_THREADED #include "SafeRTOS/semphr.h" #endif diff --git a/src/ssl.c b/src/ssl.c index c2dc26931..875dccae6 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -1214,17 +1214,18 @@ static int ProcessChainBuffer(CYASSL_CTX* ctx, const unsigned char* buff, #define XFCLOSE vf_close #define XSEEK_END VSEEK_END #define XBADFILE -1 -#elif !defined(MICRIUM) - #define XFILE FILE* - #define XFOPEN fopen - #define XFSEEK fseek - #define XFTELL ftell - #define XREWIND rewind - #define XFREAD fread - #define XFCLOSE fclose - #define XSEEK_END SEEK_END - #define XBADFILE NULL -#else +#elif defined(LSR_FS) + #include + #define XFILE struct fs_file* + #define XFOPEN(NAME, MODE) fs_open(NAME); + #define XFSEEK + #define XFTELL(F) (F)->len + #define XREWIND + #define XFREAD(BUF, SZ, AMT, F) fs_read(F, BUF, SZ*AMT) + #define XFCLOSE fs_close + #define XSEEK_END 0 + #define XBADFILE NULL +#elif defined(MICRIUM) #include #define XFILE FS_FILE* #define XFOPEN fs_fopen @@ -1235,6 +1236,17 @@ static int ProcessChainBuffer(CYASSL_CTX* ctx, const unsigned char* buff, #define XFCLOSE fs_fclose #define XSEEK_END FS_SEEK_END #define XBADFILE NULL +#else + /* stdio, default case */ + #define XFILE FILE* + #define XFOPEN fopen + #define XFSEEK fseek + #define XFTELL ftell + #define XREWIND rewind + #define XFREAD fread + #define XFCLOSE fclose + #define XSEEK_END SEEK_END + #define XBADFILE NULL #endif