Skip to content

Commit 8a57936

Browse files
Merge pull request #6801 from julek-wolfssl/zephyr-fixes
Misc zephyr fixes
2 parents 53f729f + 470e839 commit 8a57936

7 files changed

Lines changed: 10 additions & 30 deletions

File tree

wolfcrypt/src/wc_port.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,7 @@ XFILE z_fs_open(const char* filename, const char* mode)
973973

974974
file = (XFILE)XMALLOC(sizeof(*file), NULL, DYNAMIC_TYPE_FILE);
975975
if (file != NULL) {
976+
fs_file_t_init(file);
976977
if (fs_open(file, filename, flags) != 0) {
977978
XFREE(file, NULL, DYNAMIC_TYPE_FILE);
978979
file = NULL;

wolfssl/test.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
#elif defined(WOLFSSL_TIRTOS)
254254
#define WOLFSSL_SOCKET_INVALID ((SOCKET_T)-1)
255255
#else
256-
#define WOLFSSL_SOCKET_INVALID (SOCKET_T)(0)
256+
#define WOLFSSL_SOCKET_INVALID (SOCKET_T)(-1)
257257
#endif
258258
#endif /* WOLFSSL_SOCKET_INVALID */
259259

wolfssl/wolfcrypt/types.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -761,13 +761,6 @@ typedef struct w64wrapper {
761761
debugging is turned on */
762762
#ifndef USE_WINDOWS_API
763763
#ifndef XSNPRINTF
764-
#if defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) && \
765-
(defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \
766-
defined(WOLFSSL_CERT_EXT) || defined(HAVE_PKCS7))
767-
/* case where stdio is not included else where but is needed
768-
for snprintf */
769-
#include <stdio.h>
770-
#endif
771764
#if defined(WOLFSSL_ESPIDF) && \
772765
(!defined(NO_ASN_TIME) && defined(HAVE_PKCS7))
773766
#include<stdarg.h>
@@ -797,8 +790,10 @@ typedef struct w64wrapper {
797790
}
798791
#define XSNPRINTF _xsnprintf_
799792
#elif defined(WOLF_C89)
793+
#include <stdio.h>
800794
#define XSPRINTF sprintf
801795
#else
796+
#include <stdio.h>
802797
#define XSNPRINTF snprintf
803798
#endif
804799
#endif

zephyr/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,12 @@ if(CONFIG_WOLFSSL)
113113
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/port/st/stm32.c)
114114

115115
zephyr_library_link_libraries(wolfSSL)
116-
117-
add_definitions(-DWOLFSSL_USER_SETTINGS)
118-
add_definitions(-DWOLFSSL_ZEPHYR)
116+
117+
target_compile_definitions(wolfSSL INTERFACE WOLFSSL_ZEPHYR)
118+
target_compile_definitions(wolfSSL INTERFACE WOLFSSL_USER_SETTINGS)
119+
if(CONFIG_WOLFSSL_DEBUG)
120+
target_compile_definitions(wolfSSL INTERFACE DEBUG_WOLFSSL)
121+
endif()
119122
else()
120123
assert(CONFIG_WOLFSSL_LIBRARY "wolfSSL was enabled, but neither BUILTIN or LIBRARY was selected.")
121124

zephyr/samples/wolfssl_tls_sock/prj.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ CONFIG_NET_SOCKETS_POSIX_NAMES=y
2323

2424
CONFIG_NET_TEST=y
2525
CONFIG_NET_LOOPBACK=y
26-
CONFIG_DNS_RESOLVER=y
27-
CONFIG_DNS_SERVER_IP_ADDRESSES=y
28-
CONFIG_DNS_SERVER1="192.0.2.2"
2926

3027
# Network driver config
3128
CONFIG_TEST_RANDOM_GENERATOR=y

zephyr/user_settings-tls-generic.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
extern "C" {
2929
#endif
3030

31-
#undef WOLFSSL_ZEPHYR
32-
#define WOLFSSL_ZEPHYR
33-
3431
#if 0
3532
#undef SINGLE_THREADED
3633
#define SINGLE_THREADED
@@ -147,11 +144,6 @@ extern "C" {
147144
#define WOLFSSL_HAVE_SP_ECC
148145
#endif
149146

150-
#if defined(CONFIG_WOLFSSL_DEBUG)
151-
#undef DEBUG_WOLFSSL
152-
#define DEBUG_WOLFSSL
153-
#endif
154-
155147
#ifdef __cplusplus
156148
}
157149
#endif

zephyr/user_settings.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
extern "C" {
3434
#endif
3535

36-
#undef WOLFSSL_ZEPHYR
37-
#define WOLFSSL_ZEPHYR
38-
3936
#if 0
4037
#undef SINGLE_THREADED
4138
#define SINGLE_THREADED
@@ -140,11 +137,6 @@ extern "C" {
140137
#define WOLFSSL_HAVE_SP_ECC
141138
#endif
142139

143-
#if defined(CONFIG_WOLFSSL_DEBUG)
144-
#undef DEBUG_WOLFSSL
145-
#define DEBUG_WOLFSSL
146-
#endif
147-
148140
#ifdef __cplusplus
149141
}
150142
#endif

0 commit comments

Comments
 (0)