1

(3 replies, posted in wolfSSL)

Hi Ajmal,

I recommend to check the location of the zephyr kernel.h header file. The Zephyr header files were rearranged a bit over versions. For example:

In Zephyr 3.4:

$find zephyr/* -name "zephyr.h"
zephyr/include/zephyr/zephyr.h
$find zephyr/* -name "rand32.h"
zephyr/include/zephyr/random/rand32.h

In Zephyr 2.7.4:

$find zephyr/* -name "kernel.h"
zephyr/include/kernel.h
$find zephyr/* -name "rand32.h"
zephyr/include/random/rand32.h

You might need to update the wolfssl module include paths for zephyr header files.

For example I needed to make these changes for Zephyr 2.7.4:

diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c
index 5187334..9dcb8eb 100644
--- a/wolfcrypt/src/random.c
+++ b/wolfcrypt/src/random.c
@@ -3562,11 +3562,11 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
     #if KERNEL_VERSION_NUMBER >= 0x30500
         #include <zephyr/random/random.h>
     #else
-        #include <zephyr/random/rand32.h>
+        #include <random/rand32.h>
     #endif
 
     #ifndef _POSIX_C_SOURCE
-        #include <zephyr/posix/time.h>
+        #include <posix/time.h>
...

I didn't need to do this for the Zephyr v3.2-branch that I pulled, but maybe your version is different.

2

(3 replies, posted in wolfSSL)

Hi Ajmal,

In your wolfssl_test/prj.conf try replacing

COMMON_LIBC_MALLOC_ARENA_SIZE

with

MINIMAL_LIBC_MALLOC_ARENA_SIZE

The COMMON_LIBC_MALLOC parm is recent to Zephyr 3.4, but doesn't exist in older Zephyr versions. (our wolfSSL Zephyr samples were written for Zephyr 3.4).

After updating the parm all four of the examples worked for me with the Zephyr 3.2 branch. I attached a small patch to apply if that's handier.

Let me know if this helps!

Edit: the file didn't attach. Here is the git diff:

$git diff
diff --git a/zephyr/samples/wolfssl_benchmark/prj.conf b/zephyr/samples/wolfssl_benchmark/prj.conf
index b7e4eee..09af544 100644
--- a/zephyr/samples/wolfssl_benchmark/prj.conf
+++ b/zephyr/samples/wolfssl_benchmark/prj.conf
@@ -1,6 +1,6 @@
 # Configure stack and heap sizes
 CONFIG_MAIN_STACK_SIZE=32768
-CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192
+CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192
 
 # Pthreads
 CONFIG_PTHREAD_IPC=y
diff --git a/zephyr/samples/wolfssl_test/prj.conf b/zephyr/samples/wolfssl_test/prj.conf
index a989213..c2f9974 100644
--- a/zephyr/samples/wolfssl_test/prj.conf
+++ b/zephyr/samples/wolfssl_test/prj.conf
@@ -1,7 +1,7 @@
 
 # Configure stack and heap sizes
 CONFIG_MAIN_STACK_SIZE=32768
-CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=16384
+CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=16384
 
 # Pthreads
 CONFIG_PTHREAD_IPC=y
diff --git a/zephyr/samples/wolfssl_tls_sock/prj.conf b/zephyr/samples/wolfssl_tls_sock/prj.conf
index f8b0f29..b8ddf9e 100644
--- a/zephyr/samples/wolfssl_tls_sock/prj.conf
+++ b/zephyr/samples/wolfssl_tls_sock/prj.conf
@@ -2,7 +2,7 @@
 CONFIG_MAIN_STACK_SIZE=16384
 CONFIG_ENTROPY_GENERATOR=y
 CONFIG_INIT_STACKS=y
-CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192
+CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192
 
 # General config
 CONFIG_NEWLIB_LIBC=y
diff --git a/zephyr/samples/wolfssl_tls_thread/prj.conf b/zephyr/samples/wolfssl_tls_thread/prj.conf
index 4a1e290..e675b38 100644
--- a/zephyr/samples/wolfssl_tls_thread/prj.conf
+++ b/zephyr/samples/wolfssl_tls_thread/prj.conf
@@ -2,7 +2,7 @@
 CONFIG_MAIN_STACK_SIZE=16384
 CONFIG_ENTROPY_GENERATOR=y
 CONFIG_INIT_STACKS=y
-CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=65536
+CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=65536
 
 # Pthreads
 CONFIG_PTHREAD_IPC=y

Best,
Jordan