Merge pull request #4174 from SparkiDev/zephyr_2_6_99

Zephyr Project: update port to work with latest
This commit is contained in:
JacobBarthelmeh
2021-07-02 03:23:10 +07:00
committed by GitHub
27 changed files with 361 additions and 255 deletions

View File

@@ -38,7 +38,8 @@ include IDE/XilinxSDK/include.am
include IDE/VisualDSP/include.am include IDE/VisualDSP/include.am
include IDE/QNX/include.am include IDE/QNX/include.am
include IDE/WINCE/include.am include IDE/WINCE/include.am
include IDE/zephyr/include.am
EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif IDE/zephyr EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif
EXTRA_DIST+= IDE/OPENSTM32/README.md EXTRA_DIST+= IDE/OPENSTM32/README.md
EXTRA_DIST+= IDE/Espressif/ESP-IDF/setup_win.bat EXTRA_DIST+= IDE/Espressif/ESP-IDF/setup_win.bat

View File

@@ -7,35 +7,35 @@ This port is for Zephyr Project available [here](https://www.zephyrproject.org/)
It provides the following zephyr code. It provides the following zephyr code.
- zephyr/ext/lib/crypto/wolfssl - modules/crypto/wolfssl
- wolfssl library - wolfssl library code
- zephyr/samples/crypto/wolfssl_test - zephyr/modules/crypto/wolfssl
- Configuration and make files for wolfSSL
- zephyr/samples/modules/wolfssl_test
- wolfcrypt unit test application - wolfcrypt unit test application
- zephyr/samples/crypto/wolfssl_tls_sock - zephyr/samples/modules/wolfssl_tls_sock
- socket based sample of TLS - socket based sample of TLS
- zephyr/samples/crypto/wolfssl_tls_thread - zephyr/samples/modules/wolfssl_tls_thread
- socket based sample of TLS using threads - socket based sample of TLS using threads
## How to setup ## How to setup
### delopy wolfssl source to zephyr project ### deploy wolfssl source to zephyr project
Specify the path of the zephyr project and execute `wolfssl/IDE/zephyr/setup.sh`. Specify the path of the zephyr project and execute `wolfssl/IDE/zephyr/setup.sh`.
```bash ```bash
./IDE/zephyr/setup.sh /path/to/zephyrproject ./IDE/zephyr/setup.sh /path/to/zephyrproject
``` ```
This script will deploy wolfssl's library code and samples as described in the Overview to the zephyr project. This script will deploy wolfssl's library code, configuration and samples as described in the Overview to the zephyr project.
## build & test ## build & test
build and execute wolfssl_test build and execute wolfssl_test
``` ```
cd [zephyrproject]/zephyr/samples/crypto/wolfssl_test cd [zephyrproject]
mkdir build && cd build west build -p auto -b qemu_x86 zephyr/samples/modules/wolfssl_test
cmake -GNinja -DBOARD=qemu_x86 .. west build -t run
ninja
ninja run
``` ```

33
IDE/zephyr/include.am Normal file
View File

@@ -0,0 +1,33 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root
EXTRA_DIST+= IDE/zephyr/lib/settings/user_settings-tls-generic.h
EXTRA_DIST+= IDE/zephyr/lib/zephyr/module.yml
EXTRA_DIST+= IDE/zephyr/lib/install_lib.sh
EXTRA_DIST+= IDE/zephyr/lib/README
EXTRA_DIST+= IDE/zephyr/lib/user_settings.h
EXTRA_DIST+= IDE/zephyr/module/CMakeLists.txt
EXTRA_DIST+= IDE/zephyr/module/install_module.sh
EXTRA_DIST+= IDE/zephyr/module/Kconfig
EXTRA_DIST+= IDE/zephyr/module/Kconfig.tls-generic
EXTRA_DIST+= IDE/zephyr/module/zephyr_init.c
EXTRA_DIST+= IDE/zephyr/wolfssl_test/CMakeLists.txt
EXTRA_DIST+= IDE/zephyr/wolfssl_test/install_test.sh
EXTRA_DIST+= IDE/zephyr/wolfssl_test/prj.conf
EXTRA_DIST+= IDE/zephyr/wolfssl_test/README
EXTRA_DIST+= IDE/zephyr/wolfssl_test/sample.yaml
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_sock/src/tls_sock.c
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_sock/CMakeLists.txt
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_sock/install_sample.sh
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_sock/prj.conf
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_sock/README
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_sock/sample.yaml
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_thread/src/tls_threaded.c
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_thread/CMakeLists.txt
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_thread/install_sample.sh
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_thread/prj.conf
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_thread/README
EXTRA_DIST+= IDE/zephyr/wolfssl_tls_thread/sample.yaml
EXTRA_DIST+= IDE/zephyr/README.md
EXTRA_DIST+= IDE/zephyr/setup.sh

View File

@@ -1,122 +0,0 @@
zephyr_interface_library_named(wolfSSL)
if(CONFIG_WOLFSSL_BUILTIN)
target_compile_definitions(wolfSSL INTERFACE
WOLFSSL_OPTIONS_FILE="${CONFIG_WOLFSSL_OPTIONS_FILE}"
)
target_include_directories(wolfSSL INTERFACE
include
settings
)
zephyr_library()
zephyr_library_sources(zephyr_init.c)
zephyr_library_sources(library/src/crl.c)
zephyr_library_sources(library/src/internal.c)
zephyr_library_sources(library/src/keys.c)
zephyr_library_sources(library/src/ocsp.c)
zephyr_library_sources(library/src/sniffer.c)
zephyr_library_sources(library/src/ssl.c)
zephyr_library_sources(library/src/tls13.c)
zephyr_library_sources(library/src/tls.c)
zephyr_library_sources(library/src/wolfio.c)
zephyr_library_sources(library/wolfcrypt/src/aes.c)
zephyr_library_sources(library/wolfcrypt/src/arc4.c)
zephyr_library_sources(library/wolfcrypt/src/asm.c)
zephyr_library_sources(library/wolfcrypt/src/asn.c)
zephyr_library_sources(library/wolfcrypt/src/async.c)
zephyr_library_sources(library/wolfcrypt/src/blake2b.c)
zephyr_library_sources(library/wolfcrypt/src/camellia.c)
zephyr_library_sources(library/wolfcrypt/src/chacha20_poly1305.c)
zephyr_library_sources(library/wolfcrypt/src/chacha.c)
zephyr_library_sources(library/wolfcrypt/src/cmac.c)
zephyr_library_sources(library/wolfcrypt/src/coding.c)
zephyr_library_sources(library/wolfcrypt/src/compress.c)
zephyr_library_sources(library/wolfcrypt/src/cpuid.c)
zephyr_library_sources(library/wolfcrypt/src/cryptocb.c)
zephyr_library_sources(library/wolfcrypt/src/curve25519.c)
zephyr_library_sources(library/wolfcrypt/src/des3.c)
zephyr_library_sources(library/wolfcrypt/src/dh.c)
zephyr_library_sources(library/wolfcrypt/src/dsa.c)
zephyr_library_sources(library/wolfcrypt/src/ecc.c)
zephyr_library_sources(library/wolfcrypt/src/ecc_fp.c)
zephyr_library_sources(library/wolfcrypt/src/ed25519.c)
zephyr_library_sources(library/wolfcrypt/src/error.c)
zephyr_library_sources(library/wolfcrypt/src/fe_low_mem.c)
zephyr_library_sources(library/wolfcrypt/src/fe_operations.c)
#zephyr_library_sources(library/wolfcrypt/src/fips.c)
#zephyr_library_sources(library/wolfcrypt/src/fips_test.c)
zephyr_library_sources(library/wolfcrypt/src/ge_low_mem.c)
zephyr_library_sources(library/wolfcrypt/src/ge_operations.c)
zephyr_library_sources(library/wolfcrypt/src/hash.c)
zephyr_library_sources(library/wolfcrypt/src/hc128.c)
zephyr_library_sources(library/wolfcrypt/src/hmac.c)
zephyr_library_sources(library/wolfcrypt/src/idea.c)
zephyr_library_sources(library/wolfcrypt/src/integer.c)
zephyr_library_sources(library/wolfcrypt/src/logging.c)
zephyr_library_sources(library/wolfcrypt/src/md2.c)
zephyr_library_sources(library/wolfcrypt/src/md4.c)
zephyr_library_sources(library/wolfcrypt/src/md5.c)
zephyr_library_sources(library/wolfcrypt/src/memory.c)
#zephyr_library_sources(library/wolfcrypt/src/misc.c)
zephyr_library_sources(library/wolfcrypt/src/pkcs12.c)
zephyr_library_sources(library/wolfcrypt/src/pkcs7.c)
zephyr_library_sources(library/wolfcrypt/src/poly1305.c)
zephyr_library_sources(library/wolfcrypt/src/pwdbased.c)
zephyr_library_sources(library/wolfcrypt/src/rabbit.c)
zephyr_library_sources(library/wolfcrypt/src/random.c)
zephyr_library_sources(library/wolfcrypt/src/ripemd.c)
zephyr_library_sources(library/wolfcrypt/src/rsa.c)
#zephyr_library_sources(library/wolfcrypt/src/selftest.c)
zephyr_library_sources(library/wolfcrypt/src/sha256.c)
zephyr_library_sources(library/wolfcrypt/src/sha3.c)
zephyr_library_sources(library/wolfcrypt/src/sha512.c)
zephyr_library_sources(library/wolfcrypt/src/sha.c)
zephyr_library_sources(library/wolfcrypt/src/signature.c)
zephyr_library_sources(library/wolfcrypt/src/sp_arm32.c)
zephyr_library_sources(library/wolfcrypt/src/sp_arm64.c)
zephyr_library_sources(library/wolfcrypt/src/sp_armthumb.c)
zephyr_library_sources(library/wolfcrypt/src/sp_c32.c)
zephyr_library_sources(library/wolfcrypt/src/sp_c64.c)
zephyr_library_sources(library/wolfcrypt/src/sp_cortexm.c)
zephyr_library_sources(library/wolfcrypt/src/sp_int.c)
zephyr_library_sources(library/wolfcrypt/src/sp_x86_64.c)
zephyr_library_sources(library/wolfcrypt/src/srp.c)
zephyr_library_sources(library/wolfcrypt/src/tfm.c)
zephyr_library_sources(library/wolfcrypt/src/wc_encrypt.c)
zephyr_library_sources(library/wolfcrypt/src/wc_pkcs11.c)
zephyr_library_sources(library/wolfcrypt/src/wc_port.c)
#zephyr_library_sources(library/wolfcrypt/src/wolfcrypt_first.c)
#zephyr_library_sources(library/wolfcrypt/src/wolfcrypt_last.c)
zephyr_library_sources(library/wolfcrypt/src/wolfevent.c)
zephyr_library_sources(library/wolfcrypt/src/wolfmath.c)
zephyr_library_link_libraries(wolfSSL)
add_definitions(-DWOLFSSL_USER_SETTINGS)
add_definitions(-DWOLFSSL_ZEPHYR)
include_directories("library")
else()
assert(CONFIG_WOLFSSL_LIBRARY "wolfSSL was enabled, but neither BUILTIN or LIBRARY was selected.")
# NB: CONFIG_WOLFSSL_LIBRARY is not regression tested and is
# therefore susceptible to bit rot
target_include_directories(wolfSSL INTERFACE
${CONFIG_WOLFSSL_INSTALL_PATH}
)
zephyr_link_libraries(
mbedtls_external
-L${CONFIG_WOLFSSL_INSTALL_PATH}
gcc
)
# Lib wolfssl depends on libgcc so to allow
# wolfssl to link with gcc we need to ensure it is placed
# after wolfssl_external on the linkers command line.
endif()
target_link_libraries(wolfSSL INTERFACE zephyr_interface)

View File

@@ -22,42 +22,45 @@ if [ ! -d $ZEPHR_DIR ]; then
echo "Zephyr project directory does not exist: $ZEPHYR_DIR" echo "Zephyr project directory does not exist: $ZEPHYR_DIR"
exit 1 exit 1
fi fi
ZEPHYR_CRYPTO_DIR=$ZEPHYR_DIR/zephyr/ext/lib/crypto ZEPHYR_CRYPTO_DIR=$ZEPHYR_DIR/modules/crypto
if [ ! -d $ZEPHYR_CRYPTO_DIR ]; then if [ ! -d $ZEPHYR_CRYPTO_DIR ]; then
echo "Zephyr crypto directory does not exist: $ZEPHYR_CRYPTO_DIR" echo "Zephyr crypto directory does not exist: $ZEPHYR_CRYPTO_DIR"
exit 1 exit 1
fi fi
ZEPHYR_WOLFSSL_DIR=$ZEPHYR_CRYPTO_DIR/wolfssl ZEPHYR_WOLFSSL_DIR=$ZEPHYR_CRYPTO_DIR/wolfssl
ZEPHYR_WOLFSSL_LIB_DIR=$ZEPHYR_CRYPTO_DIR/wolfssl/wolfssl
echo "wolfSSL directory in Zephyr:" echo "wolfSSL directory in Zephyr:"
echo " $ZEPHYR_WOLFSSL_DIR" echo " $ZEPHYR_WOLFSSL_DIR"
rm -rf $ZEPHYR_WOLFSSL_DIR rm -rf $ZEPHYR_WOLFSSL_DIR
mkdir $ZEPHYR_WOLFSSL_DIR mkdir $ZEPHYR_WOLFSSL_DIR
mkdir $ZEPHYR_WOLFSSL_LIB_DIR
echo "Copy in Build files ..." echo "Copy in Build files ..."
cp -r * $ZEPHYR_WOLFSSL_DIR/ cp -r * $ZEPHYR_WOLFSSL_LIB_DIR/
rm $ZEPHYR_WOLFSSL_DIR/$0 rm $ZEPHYR_WOLFSSL_LIB_DIR/$0
mv $ZEPHYR_WOLFSSL_LIB_DIR/zephyr $ZEPHYR_WOLFSSL_DIR/zephyr
echo "Copy Source Code ..." echo "Copy Source Code ..."
rm -rf $ZEPHYR_WOLFSSL_DIR/library rm -rf $ZEPHYR_WOLFSSL_LIB_DIR/library
mkdir $ZEPHYR_WOLFSSL_DIR/library mkdir $ZEPHYR_WOLFSSL_LIB_DIR/library
mkdir $ZEPHYR_WOLFSSL_DIR/library/src mkdir $ZEPHYR_WOLFSSL_LIB_DIR/library/src
mkdir -p $ZEPHYR_WOLFSSL_DIR/library/wolfcrypt/src mkdir -p $ZEPHYR_WOLFSSL_LIB_DIR/library/wolfcrypt/src
cp -rf ${WOLFSSL_SRC_DIR}/src/*.c $ZEPHYR_WOLFSSL_DIR/library/src/ cp -rf ${WOLFSSL_SRC_DIR}/src/*.c $ZEPHYR_WOLFSSL_LIB_DIR/library/src/
cp -rf ${WOLFSSL_SRC_DIR}/wolfcrypt/src/*.c $ZEPHYR_WOLFSSL_DIR/library/wolfcrypt/src/ cp -rf ${WOLFSSL_SRC_DIR}/wolfcrypt/src/*.c $ZEPHYR_WOLFSSL_LIB_DIR/library/wolfcrypt/src/
cp -rf ${WOLFSSL_SRC_DIR}/wolfcrypt/src/*.i $ZEPHYR_WOLFSSL_DIR/library/wolfcrypt/src/ cp -rf ${WOLFSSL_SRC_DIR}/wolfcrypt/src/*.i $ZEPHYR_WOLFSSL_LIB_DIR/library/wolfcrypt/src/
cp -rf ${WOLFSSL_SRC_DIR}/wolfcrypt/src/*.S $ZEPHYR_WOLFSSL_DIR/library/wolfcrypt/src/ cp -rf ${WOLFSSL_SRC_DIR}/wolfcrypt/src/*.S $ZEPHYR_WOLFSSL_LIB_DIR/library/wolfcrypt/src/
echo "Copy Header Files ..." echo "Copy Header Files ..."
rm -rf $ZEPHYR_WOLFSSL_DIR/include rm -rf $ZEPHYR_WOLFSSL_LIB_DIR/include
mkdir $ZEPHYR_WOLFSSL_DIR/include mkdir $ZEPHYR_WOLFSSL_LIB_DIR/include
cp $ZEPHYR_WOLFSSL_DIR/user_settings.h $ZEPHYR_WOLFSSL_DIR/include/ cp $ZEPHYR_WOLFSSL_LIB_DIR/user_settings.h $ZEPHYR_WOLFSSL_LIB_DIR/include/
cp -rf ${WOLFSSL_SRC_DIR}/wolfssl $ZEPHYR_WOLFSSL_DIR/include/ cp -rf ${WOLFSSL_SRC_DIR}/wolfssl $ZEPHYR_WOLFSSL_LIB_DIR/include/
rm -f $ZEPHYR_WOLFSSL_DIR/include/wolfssl/options.h rm -f $ZEPHYR_WOLFSSL_LIB_DIR/include/wolfssl/options.h
touch $ZEPHYR_WOLFSSL_DIR/include/wolfssl/options.h touch $ZEPHYR_WOLFSSL_LIB_DIR/include/wolfssl/options.h
rm -rf $ZEPHYR_WOLFSSL_DIR/include/wolfssl/wolfcrypt/port rm -rf $ZEPHYR_WOLFSSL_LIB_DIR/include/wolfssl/wolfcrypt/port
echo "Done" echo "Done"

View File

@@ -1,4 +1,4 @@
/* wolfssl options.h /* user_settings-tls-generic.h
* generated from configure options * generated from configure options
* *
* Copyright (C) 2006-2021 wolfSSL Inc. * Copyright (C) 2006-2021 wolfSSL Inc.
@@ -146,7 +146,7 @@ extern "C" {
#define WOLFSSL_HAVE_SP_ECC #define WOLFSSL_HAVE_SP_ECC
#endif #endif
#if 0 #if defined(CONFIG_WOLFSSL_DEBUG)
#undef DEBUG_WOLFSSL #undef DEBUG_WOLFSSL
#define DEBUG_WOLFSSL #define DEBUG_WOLFSSL
#endif #endif

View File

@@ -1,3 +1,23 @@
/* user_settings.h
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef USER_SETTINGS_H #ifndef USER_SETTINGS_H
#define USER_SETTINGS_H #define USER_SETTINGS_H
@@ -131,7 +151,7 @@ extern "C" {
#define WOLFSSL_HAVE_SP_ECC #define WOLFSSL_HAVE_SP_ECC
#endif #endif
#if 0 #if defined(CONFIG_WOLFSSL_DEBUG)
#undef DEBUG_WOLFSSL #undef DEBUG_WOLFSSL
#define DEBUG_WOLFSSL #define DEBUG_WOLFSSL
#endif #endif

View File

@@ -0,0 +1,3 @@
build:
cmake-ext: True
kconfig-ext: True

View File

@@ -1,19 +0,0 @@
/** @file
* @brief wolfSSL initialization
*
* Initialize the wolfSSL library.
*/
#include <init.h>
#include "user_settings.h"
#include "wolfssl/ssl.h"
static int _wolfssl_init(struct device *device)
{
ARG_UNUSED(device);
return 0;
}
SYS_INIT(_wolfssl_init, POST_KERNEL, 0);

View File

@@ -0,0 +1,122 @@
zephyr_interface_library_named(wolfSSL)
if(CONFIG_WOLFSSL_BUILTIN)
target_compile_definitions(wolfSSL INTERFACE
WOLFSSL_OPTIONS_FILE="${CONFIG_WOLFSSL_OPTIONS_FILE}"
)
target_include_directories(wolfSSL INTERFACE
${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/include
${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/settings
)
zephyr_library()
zephyr_library_sources(zephyr_init.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/src/crl.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/src/internal.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/src/keys.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/src/ocsp.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/src/sniffer.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/src/ssl.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/src/tls13.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/src/tls.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/src/wolfio.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/aes.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/arc4.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/asm.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/asn.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/async.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/blake2b.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/camellia.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/chacha20_poly1305.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/chacha.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/cmac.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/coding.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/compress.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/cpuid.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/cryptocb.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/curve25519.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/des3.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/dh.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/dsa.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/ecc.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/ecc_fp.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/ed25519.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/error.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/fe_low_mem.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/fe_operations.c)
#zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/fips.c)
#zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/fips_test.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/ge_low_mem.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/ge_operations.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/hash.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/hc128.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/hmac.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/idea.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/integer.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/logging.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/md2.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/md4.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/md5.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/memory.c)
#zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/misc.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/pkcs12.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/pkcs7.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/poly1305.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/pwdbased.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/rabbit.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/random.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/ripemd.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/rsa.c)
#zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/selftest.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sha256.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sha3.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sha512.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sha.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/signature.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sp_arm32.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sp_arm64.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sp_armthumb.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sp_c32.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sp_c64.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sp_cortexm.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sp_int.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/sp_x86_64.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/srp.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/tfm.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/wc_encrypt.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/wc_pkcs11.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/wc_port.c)
#zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/wolfcrypt_first.c)
#zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/wolfcrypt_last.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/wolfevent.c)
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library/wolfcrypt/src/wolfmath.c)
zephyr_library_link_libraries(wolfSSL)
add_definitions(-DWOLFSSL_USER_SETTINGS)
add_definitions(-DWOLFSSL_ZEPHYR)
include_directories("${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl/library")
else()
assert(CONFIG_WOLFSSL_LIBRARY "wolfSSL was enabled, but neither BUILTIN or LIBRARY was selected.")
# NB: CONFIG_WOLFSSL_LIBRARY is not regression tested and is
# therefore susceptible to bit rot
target_include_directories(wolfSSL INTERFACE
${CONFIG_WOLFSSL_INSTALL_PATH}
)
zephyr_link_libraries(
wolfssl_external
-L${CONFIG_WOLFSSL_INSTALL_PATH}
gcc
)
# Lib wolfssl depends on libgcc so to allow
# wolfssl to link with gcc we need to ensure it is placed
# after wolfssl_external on the linkers command line.
endif()
target_link_libraries(wolfSSL INTERFACE zephyr_interface)

View File

@@ -16,15 +16,25 @@
# limitations under the License. # limitations under the License.
# #
config ZEPHYR_WOLFSSL_MODULE
bool
config WOLFSSL_PROMPTLESS
bool
help
Symbol to disable the prompt for WOLFSSL selection.
This symbol may be used internally in a Kconfig tree to hide the
wolfSSL menu prompt and instead handle the selection of WOLFSSL from
dependent sub-configurations and thus preven stuck symbol behavior.
menuconfig WOLFSSL menuconfig WOLFSSL
bool "wolfSSL Support" bool "wolfSSL Support" if !WOLFSSL_PROMPTLESS
help help
This option enables the wolfSSL cryptography library. This option enables the wolfSSL cryptography library.
if WOLFSSL if WOLFSSL
choice choice WOLFSSL_IMPLEMENTATION
prompt "Select implementation" prompt "Select implementation"
default WOLFSSL_BUILTIN default WOLFSSL_BUILTIN
@@ -52,9 +62,7 @@ config WOLFSSL_SETTINGS_FILE
special TLS usage, use available Kconfig settings, or select an special TLS usage, use available Kconfig settings, or select an
alternative config. alternative config.
if WOLFSSL_BUILTIN && WOLFSSL_SETTINGS_FILE = "user_settings-tls-generic.h" rsource "Kconfig.tls-generic"
source "ext/lib/crypto/wolfssl/Kconfig.tls-generic"
endif
config WOLFSSL_DEBUG config WOLFSSL_DEBUG
bool "wolfSSL debug activation" bool "wolfSSL debug activation"
@@ -75,7 +83,6 @@ config WOLFSSL_INSTALL_PATH
config APP_LINK_WITH_WOLFSSL config APP_LINK_WITH_WOLFSSL
bool "Link 'app' with WOLFSSL" bool "Link 'app' with WOLFSSL"
default y default y
depends on WOLFSSL
help help
Add WOLFSSL header files to the 'app' include path. It may be Add WOLFSSL header files to the 'app' include path. It may be
disabled if the include paths for WOLFSSL are causing aliasing disabled if the include paths for WOLFSSL are causing aliasing

View File

@@ -0,0 +1,42 @@
#!/bin/sh
WOLFSSL_SRC_DIR=../../..
if [ ! -d $WOLFSSL_SRC_DIR ]; then
echo "Directory does not exist: $WOLFSSL_SRC_DIR"
exit 1
fi
if [ ! -f $WOLFSSL_SRC_DIR/wolfssl/ssl.h ]; then
echo "Missing header file: $WOLFSSL_SRC_DIR/wolfssl/ssl.h"
exit 1
fi
ZEPHYR_DIR=
if [ $# -ne 1 ]; then
echo "Need location of zephyr project as a command line argument"
exit 1
else
ZEPHYR_DIR=$1
fi
if [ ! -d $ZEPHR_DIR ]; then
echo "Zephyr project directory does not exist: $ZEPHYR_DIR"
exit 1
fi
ZEPHYR_MODULES_DIR=$ZEPHYR_DIR/zephyr/modules
if [ ! -d $ZEPHYR_MODULES_DIR ]; then
echo "Zephyr modules directory does not exist: $ZEPHYR_MODULES_DIR"
exit 1
fi
ZEPHYR_WOLFSSL_DIR=$ZEPHYR_MODULES_DIR/wolfssl
echo "wolfSSL directory in Zephyr:"
echo " $ZEPHYR_WOLFSSL_DIR"
rm -rf $ZEPHYR_WOLFSSL_DIR
mkdir $ZEPHYR_WOLFSSL_DIR
echo "Copy in Build files ..."
cp -r * $ZEPHYR_WOLFSSL_DIR/
rm $ZEPHYR_WOLFSSL_DIR/$0
echo "Done"

View File

@@ -0,0 +1,40 @@
/* zephyr_init.c
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
/** @file
* @brief wolfSSL initialization
*
* Initialize the wolfSSL library.
*/
#include <init.h>
#include "user_settings.h"
#include "wolfssl/ssl.h"
static int _wolfssl_init(const struct device *device)
{
ARG_UNUSED(device);
return 0;
}
SYS_INIT(_wolfssl_init, POST_KERNEL, 0);

View File

@@ -16,6 +16,7 @@ fi
cd `dirname $0` cd `dirname $0`
(cd lib; ./install_lib.sh $ZEPHYR_DIR) (cd lib; ./install_lib.sh $ZEPHYR_DIR)
(cd module; ./install_module.sh $ZEPHYR_DIR)
(cd wolfssl_test; ./install_test.sh $ZEPHYR_DIR) (cd wolfssl_test; ./install_test.sh $ZEPHYR_DIR)
(cd wolfssl_tls_sock; ./install_sample.sh $ZEPHYR_DIR) (cd wolfssl_tls_sock; ./install_sample.sh $ZEPHYR_DIR)
(cd wolfssl_tls_thread; ./install_sample.sh $ZEPHYR_DIR) (cd wolfssl_tls_thread; ./install_sample.sh $ZEPHYR_DIR)

View File

@@ -22,12 +22,12 @@ if [ ! -d $ZEPHR_DIR ]; then
echo "Zephyr project directory does not exist: $ZEPHYR_DIR" echo "Zephyr project directory does not exist: $ZEPHYR_DIR"
exit 1 exit 1
fi fi
ZEPHYR_CRYPTO_DIR=$ZEPHYR_DIR/zephyr/samples/crypto ZEPHYR_SAMPLES_DIR=$ZEPHYR_DIR/zephyr/samples/modules
if [ ! -d $ZEPHYR_CRYPTO_DIR ]; then if [ ! -d $ZEPHYR_SAMPLES_DIR ]; then
echo "Zephyr crypto directory does not exist: $ZEPHYR_CRYPTO_DIR" echo "Zephyr samples/modules directory does not exist: $ZEPHYR_SAMPLES_DIR"
exit 1 exit 1
fi fi
ZEPHYR_WOLFSSL_DIR=$ZEPHYR_CRYPTO_DIR/wolfssl_test ZEPHYR_WOLFSSL_DIR=$ZEPHYR_SAMPLES_DIR/wolfssl_test
echo "wolfSSL directory:" echo "wolfSSL directory:"
echo " $ZEPHYR_WOLFSSL_DIR" echo " $ZEPHYR_WOLFSSL_DIR"

View File

@@ -1,25 +1,16 @@
# Kernel options
CONFIG_MAIN_STACK_SIZE=32768 CONFIG_MAIN_STACK_SIZE=32768
CONFIG_ENTROPY_GENERATOR=y CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=16384
CONFIG_POSIX_API=y
CONFIG_INIT_STACKS=y
#CONFIG_FLOAT=y
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192
# Networking
CONFIG_NETWORKING=y
CONFIG_NET_TEST=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
CONFIG_NET_SOCKETS=y
CONFIG_DNS_RESOLVER=y
# Logging
CONFIG_PRINTK=y
CONFIG_WOLFSSL_DEBUG=y
# TLS configuration # TLS configuration
CONFIG_WOLFSSL=y CONFIG_WOLFSSL=y
CONFIG_WOLFSSL_BUILTIN=y CONFIG_WOLFSSL_BUILTIN=y
# Logging
CONFIG_PRINTK=y
CONFIG_WOLFSSL_DEBUG=y
# Entropy
CONFIG_ENTROPY_GENERATOR=y
CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR=y

View File

@@ -1,9 +1,7 @@
common: common:
harness: crypto min_flash: 65
tags: crypto min_ram: 36
sample: tags: crypto wolfssl userspace random
description: wolfSSL test application
name: wolfSSL Test
tests: tests:
test: crypto.wolfssl_test:
platform_whitelist: qemu_x86 platform_whitelist: qemu_x86

View File

@@ -11,12 +11,12 @@ if [ ! -d $ZEPHR_DIR ]; then
echo "Zephyr project directory does not exist: $ZEPHYR_DIR" echo "Zephyr project directory does not exist: $ZEPHYR_DIR"
exit 1 exit 1
fi fi
ZEPHYR_CRYPTO_DIR=$ZEPHYR_DIR/zephyr/samples/crypto ZEPHYR_SAMPLES_DIR=$ZEPHYR_DIR/zephyr/samples/modules
if [ ! -d $ZEPHYR_CRYPTO_DIR ]; then if [ ! -d $ZEPHYR_SAMPLES_DIR ]; then
echo "Zephyr crypto directory does not exist: $ZEPHYR_CRYPTO_DIR" echo "Zephyr samples/module directory does not exist: $ZEPHYR_SAMPLES_DIR"
exit 1 exit 1
fi fi
ZEPHYR_WOLFSSL_DIR=$ZEPHYR_CRYPTO_DIR/wolfssl_tls_sock ZEPHYR_WOLFSSL_DIR=$ZEPHYR_SAMPLES_DIR/wolfssl_tls_sock
echo "wolfSSL directory:" echo "wolfSSL directory:"
echo " $ZEPHYR_WOLFSSL_DIR" echo " $ZEPHYR_WOLFSSL_DIR"

View File

@@ -1,7 +1,6 @@
# Kernel options # Kernel options
CONFIG_MAIN_STACK_SIZE=12288 CONFIG_MAIN_STACK_SIZE=16384
CONFIG_ENTROPY_GENERATOR=y CONFIG_ENTROPY_GENERATOR=y
CONFIG_POSIX_API=y
CONFIG_INIT_STACKS=y CONFIG_INIT_STACKS=y
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192 CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192
@@ -40,7 +39,7 @@ CONFIG_NET_PKT_TX_COUNT=10
# Logging # Logging
CONFIG_PRINTK=y CONFIG_PRINTK=y
CONFIG_WOLFSSL_DEBUG=y #CONFIG_WOLFSSL_DEBUG=y
# TLS configuration # TLS configuration
CONFIG_WOLFSSL=y CONFIG_WOLFSSL=y

View File

@@ -98,9 +98,6 @@ static int wolfssl_client_new(WOLFSSL_CTX** ctx, WOLFSSL** ssl)
} }
if (ret == 0) { if (ret == 0) {
/* make wolfSSL object nonblocking */
wolfSSL_set_using_nonblock(client_ssl, 1);
/* Return newly created wolfSSL context and object */ /* Return newly created wolfSSL context and object */
*ctx = client_ctx; *ctx = client_ctx;
*ssl = client_ssl; *ssl = client_ssl;
@@ -174,9 +171,6 @@ static int wolfssl_server_new(WOLFSSL_CTX** ctx, WOLFSSL** ssl)
} }
if (ret == 0) { if (ret == 0) {
/* make wolfSSL object nonblocking */
wolfSSL_set_using_nonblock(server_ssl, 1);
/* Return newly created wolfSSL context and object */ /* Return newly created wolfSSL context and object */
*ctx = server_ctx; *ctx = server_ctx;
*ssl = server_ssl; *ssl = server_ssl;
@@ -358,7 +352,7 @@ void server_thread(void* arg1, void* arg2, void* arg3)
ret = wolfssl_server_accept_tcp(server_ssl, &sockfd, &clientfd); ret = wolfssl_server_accept_tcp(server_ssl, &sockfd, &clientfd);
while (ret == 0) { while (ret == 0) {
k_sleep(100); k_sleep(Z_TIMEOUT_TICKS(100));
ret = wolfssl_server_accept(server_ssl); ret = wolfssl_server_accept(server_ssl);
if (ret == 0 && wolfSSL_is_init_finished(server_ssl)) if (ret == 0 && wolfSSL_is_init_finished(server_ssl))
break; break;
@@ -451,7 +445,7 @@ void client_thread()
ret = wolfssl_client_connect_tcp(client_ssl, &sockfd); ret = wolfssl_client_connect_tcp(client_ssl, &sockfd);
while (ret == 0) { while (ret == 0) {
k_sleep(10); k_sleep(Z_TIMEOUT_TICKS(10));
ret = wolfssl_client_connect(client_ssl); ret = wolfssl_client_connect(client_ssl);
if (ret == 0 && wolfSSL_is_init_finished(client_ssl)) if (ret == 0 && wolfSSL_is_init_finished(client_ssl))
break; break;
@@ -465,7 +459,7 @@ void client_thread()
} }
/* Receive HTTP response */ /* Receive HTTP response */
while (ret == 0) { while (ret == 0) {
k_sleep(10); k_sleep(Z_TIMEOUT_TICKS(10));
ret = wolfssl_recv(client_ssl); ret = wolfssl_recv(client_ssl);
} }
if (ret == 1) if (ret == 1)
@@ -484,15 +478,17 @@ void client_thread()
int main() int main()
{ {
int ret = 0;
THREAD_TYPE serverThread; THREAD_TYPE serverThread;
wolfSSL_Init(); wolfSSL_Init();
#ifdef DEBUG_WOLFSSL
wolfSSL_Debugging_ON();
#endif
/* Start server */ /* Start server */
start_thread(server_thread, NULL, &serverThread); start_thread(server_thread, NULL, &serverThread);
k_sleep(100); k_sleep(Z_TIMEOUT_TICKS(100));
client_thread(); client_thread();
join_thread(serverThread); join_thread(serverThread);

View File

@@ -11,12 +11,12 @@ if [ ! -d $ZEPHR_DIR ]; then
echo "Zephyr project directory does not exist: $ZEPHYR_DIR" echo "Zephyr project directory does not exist: $ZEPHYR_DIR"
exit 1 exit 1
fi fi
ZEPHYR_CRYPTO_DIR=$ZEPHYR_DIR/zephyr/samples/crypto ZEPHYR_SAMPLES_DIR=$ZEPHYR_DIR/zephyr/samples/modules
if [ ! -d $ZEPHYR_CRYPTO_DIR ]; then if [ ! -d $ZEPHYR_SAMPLES_DIR ]; then
echo "Zephyr crypto directory does not exist: $ZEPHYR_CRYPTO_DIR" echo "Zephyr samples/modules directory does not exist: $ZEPHYR_SAMPLES_DIR"
exit 1 exit 1
fi fi
ZEPHYR_WOLFSSL_DIR=$ZEPHYR_CRYPTO_DIR/wolfssl_tls_thread ZEPHYR_WOLFSSL_DIR=$ZEPHYR_SAMPLES_DIR/wolfssl_tls_thread
echo "wolfSSL directory:" echo "wolfSSL directory:"
echo " $ZEPHYR_WOLFSSL_DIR" echo " $ZEPHYR_WOLFSSL_DIR"

View File

@@ -1,7 +1,6 @@
# Kernel options # Kernel options
CONFIG_MAIN_STACK_SIZE=12288 CONFIG_MAIN_STACK_SIZE=16384
CONFIG_ENTROPY_GENERATOR=y CONFIG_ENTROPY_GENERATOR=y
CONFIG_POSIX_API=y
CONFIG_INIT_STACKS=y CONFIG_INIT_STACKS=y
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192 CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192
@@ -16,7 +15,7 @@ CONFIG_DNS_RESOLVER=y
# Logging # Logging
CONFIG_PRINTK=y CONFIG_PRINTK=y
CONFIG_WOLFSSL_DEBUG=y #CONFIG_WOLFSSL_DEBUG=y
# TLS configuration # TLS configuration
CONFIG_WOLFSSL=y CONFIG_WOLFSSL=y

View File

@@ -436,6 +436,9 @@ int main()
THREAD_TYPE serverThread; THREAD_TYPE serverThread;
wolfSSL_Init(); wolfSSL_Init();
#ifdef DEBUG_WOLFSSL
wolfSSL_Debugging_ON();
#endif
wc_InitMutex(&client_mutex); wc_InitMutex(&client_mutex);
wc_InitMutex(&server_mutex); wc_InitMutex(&server_mutex);
@@ -462,7 +465,7 @@ int main()
ret = wolfssl_client_connect(client_ssl); ret = wolfssl_client_connect(client_ssl);
if (ret == 0 && wolfSSL_is_init_finished(client_ssl)) if (ret == 0 && wolfSSL_is_init_finished(client_ssl))
break; break;
k_sleep(10); k_sleep(Z_TIMEOUT_TICKS(10));
} }
if (ret == 0) { if (ret == 0) {
@@ -473,7 +476,7 @@ int main()
} }
/* Receive HTTP response */ /* Receive HTTP response */
while (ret == 0) { while (ret == 0) {
k_sleep(10); k_sleep(Z_TIMEOUT_TICKS(10));
ret = wolfssl_recv(client_ssl); ret = wolfssl_recv(client_ssl);
} }
if (ret == 1) if (ret == 1)

View File

@@ -2530,7 +2530,7 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
#elif defined(WOLFSSL_ZEPHYR) #elif defined(WOLFSSL_ZEPHYR)
#include <entropy.h> #include <random/rand32.h>
#ifndef _POSIX_C_SOURCE #ifndef _POSIX_C_SOURCE
#include <posix/time.h> #include <posix/time.h>
#else #else
@@ -2539,19 +2539,8 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{ {
int ret = 0; sys_rand_get(output, sz);
word32 rand; return 0;
while (sz > 0) {
word32 len = sizeof(rand);
if (sz < len)
len = sz;
rand = sys_rand32_get();
XMEMCPY(output, &rand, len);
output += len;
sz -= len;
}
return ret;
} }
#elif defined(WOLFSSL_TELIT_M2MB) #elif defined(WOLFSSL_TELIT_M2MB)

View File

@@ -118,7 +118,6 @@
#include <net/socket.h> #include <net/socket.h>
#define SOCKET_T int #define SOCKET_T int
#define SOL_SOCKET 1 #define SOL_SOCKET 1
#define SO_REUSEADDR 201
#define WOLFSSL_USE_GETADDRINFO #define WOLFSSL_USE_GETADDRINFO
static unsigned long inet_addr(const char *cp) static unsigned long inet_addr(const char *cp)

View File

@@ -1625,12 +1625,11 @@ extern void uITRON4_free(void *p) ;
#ifdef WOLFSSL_ZEPHYR #ifdef WOLFSSL_ZEPHYR
#include <zephyr.h> #include <zephyr.h>
#include <misc/printk.h> #include <sys/printk.h>
#include <misc/util.h> #include <sys/util.h>
#include <stdlib.h> #include <stdlib.h>
#define WOLFSSL_DH_CONST #define WOLFSSL_DH_CONST
#define WOLFSSL_HAVE_MIN
#define WOLFSSL_HAVE_MAX #define WOLFSSL_HAVE_MAX
#define NO_WRITEV #define NO_WRITEV
@@ -1642,7 +1641,9 @@ extern void uITRON4_free(void *p) ;
void *z_realloc(void *ptr, size_t size); void *z_realloc(void *ptr, size_t size);
#define realloc z_realloc #define realloc z_realloc
#ifndef CONFIG_NET_SOCKETS_POSIX_NAMES
#define CONFIG_NET_SOCKETS_POSIX_NAMES #define CONFIG_NET_SOCKETS_POSIX_NAMES
#endif
#endif #endif
#ifdef WOLFSSL_IMX6 #ifdef WOLFSSL_IMX6