Fix load_file/load_buffer enables. Fix error in load_buffer with “ret”.

This commit is contained in:
David Garske
2017-04-04 11:45:55 -07:00
parent e0a4758c0f
commit deb80e5ddb

View File

@ -1100,6 +1100,8 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity,
#if !defined(NO_CERTS) #if !defined(NO_CERTS)
#if !defined(NO_FILESYSTEM) || \
(defined(NO_FILESYSTEM) && defined(FORCE_BUFFER_TEST))
/* reads file size, allocates buffer, reads into buffer, returns buffer */ /* reads file size, allocates buffer, reads into buffer, returns buffer */
static INLINE int load_file(const char* fname, byte** buf, size_t* bufLen) static INLINE int load_file(const char* fname, byte** buf, size_t* bufLen)
@ -1145,7 +1147,6 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity,
return ret; return ret;
} }
#if defined(NO_FILESYSTEM) && defined(FORCE_BUFFER_TEST)
enum { enum {
WOLFSSL_CA = 1, WOLFSSL_CA = 1,
WOLFSSL_CERT = 2, WOLFSSL_CERT = 2,
@ -1159,8 +1160,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity,
byte* buff = NULL; byte* buff = NULL;
size_t sz = 0; size_t sz = 0;
ret = load_file(fname, &buff, &sz); if (load_file(fname, &buff, &sz) != 0) {
if (ret != 0) {
err_sys("can't open file for buffer load " err_sys("can't open file for buffer load "
"Please run from wolfSSL home directory if not"); "Please run from wolfSSL home directory if not");
} }
@ -1193,8 +1193,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity,
if (buff) if (buff)
free(buff); free(buff);
} }
#endif /* NO_FILESYSTEM && FORCE_BUFFER_TEST */ #endif /* !NO_FILESYSTEM || (NO_FILESYSTEM && FORCE_BUFFER_TEST) */
#endif /* !NO_CERTS */ #endif /* !NO_CERTS */
#ifdef VERIFY_CALLBACK #ifdef VERIFY_CALLBACK