Skip to content

Commit e31fb09

Browse files
committed
Update some inclusion related items
1 parent ed64163 commit e31fb09

File tree

6 files changed

+32
-19
lines changed

6 files changed

+32
-19
lines changed

wolfssl/test.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,10 @@
209209
#endif
210210
#endif
211211
#define SOCKET_T int
212-
#define SOL_SOCKET 1
213212
#define WOLFSSL_USE_GETADDRINFO
214213

214+
#if !defined(CONFIG_POSIX_API)
215+
#define SOL_SOCKET 1
215216
static unsigned long inet_addr(const char *cp)
216217
{
217218
unsigned int a[4]; unsigned long ret;
@@ -227,6 +228,7 @@
227228
ret = ((a[3]<<24) + (a[2]<<16) + (a[1]<<8) + a[0]) ;
228229
return(ret) ;
229230
}
231+
#endif
230232
#elif defined(NETOS)
231233
#include <string.h>
232234
#include <sys/types.h>

wolfssl/wolfcrypt/wc_port.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,16 @@
294294
#endif
295295
#if KERNEL_VERSION_NUMBER >= 0x30100
296296
#include <zephyr/kernel.h>
297-
#include <zephyr/posix/posix_types.h>
298-
#include <zephyr/posix/pthread.h>
297+
#ifndef CONFIG_ARCH_POSIX
298+
#include <zephyr/posix/posix_types.h>
299+
#include <zephyr/posix/pthread.h>
300+
#endif
299301
#else
300302
#include <kernel.h>
301-
#include <posix/posix_types.h>
302-
#include <posix/pthread.h>
303+
#ifndef CONFIG_ARCH_POSIX
304+
#include <posix/posix_types.h>
305+
#include <posix/pthread.h>
306+
#endif
303307
#endif
304308
#endif
305309

zephyr/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,13 @@ if(CONFIG_WOLFSSL)
187187
target_compile_definitions(wolfSSL INTERFACE WOLFSSL_ZEPHYR)
188188
target_compile_definitions(wolfSSL INTERFACE WOLFSSL_USER_SETTINGS)
189189

190-
# Zephyr >= 4.1 provides min()/max() macros in sys/util.h that collide
191-
# with wolfSSL's static inline definitions in misc.c
192-
if(KERNEL_VERSION_MAJOR GREATER_EQUAL 5 OR
193-
(KERNEL_VERSION_MAJOR EQUAL 4 AND KERNEL_VERSION_MINOR GREATER_EQUAL 1))
194-
target_compile_definitions(wolfSSL INTERFACE WOLFSSL_HAVE_MIN_MAX)
190+
if(NOT CONFIG_WOLFSSL_NO_HAVE_MIN_MAX AND
191+
(KERNEL_VERSION_MAJOR GREATER_EQUAL 5 OR
192+
(KERNEL_VERSION_MAJOR EQUAL 4 AND
193+
KERNEL_VERSION_MINOR GREATER_EQUAL 3)))
194+
target_compile_definitions(wolfSSL INTERFACE
195+
WOLFSSL_HAVE_MIN
196+
WOLFSSL_HAVE_MAX)
195197
endif()
196198
if(CONFIG_WOLFSSL_DEBUG)
197199
target_compile_definitions(wolfSSL INTERFACE DEBUG_WOLFSSL)

zephyr/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ config WOLFCRYPT_INTELASM
112112
help
113113
wolfCrypt Intel Aassembly support (AVX/AVX2/AESNI)
114114

115+
config WOLFSSL_NO_HAVE_MIN_MAX
116+
bool "Force wolfSSL to use its own min/max"
117+
help
118+
Disable this if Zephyr min()/max() macros cause
119+
issues. By default wolfSSL defers to Zephyr's
120+
min/max on >= 4.3.
121+
115122
config WOLFSSL_DEBUG
116123
bool "wolfSSL debug activation"
117124
depends on WOLFSSL_BUILTIN

zephyr/samples/wolfssl_tls_sock/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ if(EXISTS $ENV{ZEPHYR_BASE}/VERSION)
99
set(ZEPHYR_VER_MINOR ${CMAKE_MATCH_1})
1010
endif()
1111

12-
if(ZEPHYR_VER_MAJOR GREATER_EQUAL 5)
13-
set(EXTRA_CONF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zephyr_v4.1.conf)
14-
elseif(ZEPHYR_VER_MAJOR EQUAL 4 AND ZEPHYR_VER_MINOR GREATER_EQUAL 1)
15-
set(EXTRA_CONF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zephyr_v4.1.conf)
12+
if(ZEPHYR_VER_MAJOR GREATER_EQUAL 4 OR
13+
(ZEPHYR_VER_MAJOR EQUAL 3 AND
14+
ZEPHYR_VER_MINOR GREATER 5))
15+
set(EXTRA_CONF_FILE
16+
${CMAKE_CURRENT_SOURCE_DIR}/zephyr_v4.1.conf)
1617
else()
17-
set(EXTRA_CONF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zephyr_legacy.conf)
18+
set(EXTRA_CONF_FILE
19+
${CMAKE_CURRENT_SOURCE_DIR}/zephyr_legacy.conf)
1820
endif()
1921

2022
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)

zephyr/user_settings.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ extern "C" {
4040
/* ------------------------------------------------------------------------- */
4141
/* Platform */
4242
/* ------------------------------------------------------------------------- */
43-
#ifdef WOLFSSL_HAVE_MIN_MAX
44-
#define WOLFSSL_HAVE_MIN /* Zephyr provides min() in sys/util.h */
45-
#define WOLFSSL_HAVE_MAX /* Zephyr provides max() in sys/util.h */
46-
#endif
4743
#define WOLFSSL_GENERAL_ALIGNMENT 4 /* platform requires 32-bit alignment on uint32_t */
4844
#define SIZEOF_LONG_LONG 8 /* long long is 8 bytes / 64-bit */
4945
//#define WOLFSSL_NO_ASM /* optionally disable inline assembly support */

0 commit comments

Comments
 (0)