From 9d562a59bca78e4c7c68a00ad309f17d87c1aadb Mon Sep 17 00:00:00 2001 From: Maxime Vincent Date: Thu, 29 Jul 2021 11:11:20 +0200 Subject: [PATCH 1/6] wolfSSL as a Zephyr module --- IDE/zephyr/README.md | 41 ------ IDE/zephyr/lib/install_lib.sh | 67 --------- IDE/zephyr/lib/zephyr/module.yml | 3 - IDE/zephyr/module/CMakeLists.txt | 122 ---------------- IDE/zephyr/module/install_module.sh | 42 ------ IDE/zephyr/setup.sh | 23 --- IDE/zephyr/wolfssl_tls_thread/README | 12 -- zephyr/CMakeLists.txt | 123 ++++++++++++++++ {IDE/zephyr/module => zephyr}/Kconfig | 0 .../module => zephyr}/Kconfig.tls-generic | 0 zephyr/README.md | 136 ++++++++++++++++++ {IDE/zephyr => zephyr}/include.am | 1 + zephyr/module.yml | 3 + .../samples}/wolfssl_test/CMakeLists.txt | 3 +- .../samples/wolfssl_test}/README | 0 .../samples}/wolfssl_test/install_test.sh | 0 .../samples}/wolfssl_test/prj.conf | 0 .../samples}/wolfssl_test/sample.yaml | 0 .../samples}/wolfssl_tls_sock/CMakeLists.txt | 0 .../samples/wolfssl_tls_sock}/README | 0 .../wolfssl_tls_sock/install_sample.sh | 0 .../samples}/wolfssl_tls_sock/prj.conf | 0 .../samples}/wolfssl_tls_sock/sample.yaml | 0 .../samples}/wolfssl_tls_sock/src/tls_sock.c | 0 .../wolfssl_tls_thread/CMakeLists.txt | 0 .../samples/wolfssl_tls_thread}/README | 0 .../wolfssl_tls_thread/install_sample.sh | 0 .../samples}/wolfssl_tls_thread/prj.conf | 0 .../samples}/wolfssl_tls_thread/sample.yaml | 0 .../wolfssl_tls_thread/src/tls_threaded.c | 0 .../user_settings-tls-generic.h | 0 {IDE/zephyr/lib => zephyr}/user_settings.h | 0 zephyr/wolfssl/options.h | 0 {IDE/zephyr/module => zephyr}/zephyr_init.c | 0 34 files changed, 265 insertions(+), 311 deletions(-) delete mode 100644 IDE/zephyr/README.md delete mode 100755 IDE/zephyr/lib/install_lib.sh delete mode 100644 IDE/zephyr/lib/zephyr/module.yml delete mode 100644 IDE/zephyr/module/CMakeLists.txt delete mode 100755 IDE/zephyr/module/install_module.sh delete mode 100755 IDE/zephyr/setup.sh delete mode 100644 IDE/zephyr/wolfssl_tls_thread/README create mode 100644 zephyr/CMakeLists.txt rename {IDE/zephyr/module => zephyr}/Kconfig (100%) rename {IDE/zephyr/module => zephyr}/Kconfig.tls-generic (100%) create mode 100644 zephyr/README.md rename {IDE/zephyr => zephyr}/include.am (97%) create mode 100644 zephyr/module.yml rename {IDE/zephyr => zephyr/samples}/wolfssl_test/CMakeLists.txt (57%) rename {IDE/zephyr/lib => zephyr/samples/wolfssl_test}/README (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_test/install_test.sh (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_test/prj.conf (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_test/sample.yaml (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_tls_sock/CMakeLists.txt (100%) rename {IDE/zephyr/wolfssl_test => zephyr/samples/wolfssl_tls_sock}/README (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_tls_sock/install_sample.sh (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_tls_sock/prj.conf (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_tls_sock/sample.yaml (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_tls_sock/src/tls_sock.c (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_tls_thread/CMakeLists.txt (100%) rename {IDE/zephyr/wolfssl_tls_sock => zephyr/samples/wolfssl_tls_thread}/README (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_tls_thread/install_sample.sh (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_tls_thread/prj.conf (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_tls_thread/sample.yaml (100%) rename {IDE/zephyr => zephyr/samples}/wolfssl_tls_thread/src/tls_threaded.c (100%) rename {IDE/zephyr/lib/settings => zephyr}/user_settings-tls-generic.h (100%) rename {IDE/zephyr/lib => zephyr}/user_settings.h (100%) create mode 100644 zephyr/wolfssl/options.h rename {IDE/zephyr/module => zephyr}/zephyr_init.c (100%) diff --git a/IDE/zephyr/README.md b/IDE/zephyr/README.md deleted file mode 100644 index 0fb3f6cdd..000000000 --- a/IDE/zephyr/README.md +++ /dev/null @@ -1,41 +0,0 @@ -Zephyr Project Port -=================== - -## Overview - -This port is for Zephyr Project available [here](https://www.zephyrproject.org/). - -It provides the following zephyr code. - -- modules/crypto/wolfssl - - wolfssl library code -- zephyr/modules/crypto/wolfssl - - Configuration and make files for wolfSSL -- zephyr/samples/modules/wolfssl_test - - wolfcrypt unit test application -- zephyr/samples/modules/wolfssl_tls_sock - - socket based sample of TLS -- zephyr/samples/modules/wolfssl_tls_thread - - socket based sample of TLS using threads - -## How to setup - -### deploy wolfssl source to zephyr project -Specify the path of the zephyr project and execute `wolfssl/IDE/zephyr/setup.sh`. - -```bash -./IDE/zephyr/setup.sh /path/to/zephyrproject -``` - -This script will deploy wolfssl's library code, configuration and samples as described in the Overview to the zephyr project. - -## build & test - -build and execute wolfssl_test - -``` -cd [zephyrproject] -west build -p auto -b qemu_x86 zephyr/samples/modules/wolfssl_test -west build -t run -``` - diff --git a/IDE/zephyr/lib/install_lib.sh b/IDE/zephyr/lib/install_lib.sh deleted file mode 100755 index ae67f4249..000000000 --- a/IDE/zephyr/lib/install_lib.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/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_CRYPTO_DIR=$ZEPHYR_DIR/modules/crypto -if [ ! -d $ZEPHYR_CRYPTO_DIR ]; then - echo "Zephyr crypto directory does not exist: $ZEPHYR_CRYPTO_DIR" - exit 1 -fi -ZEPHYR_WOLFSSL_DIR=$ZEPHYR_CRYPTO_DIR/wolfssl -ZEPHYR_WOLFSSL_LIB_DIR=$ZEPHYR_CRYPTO_DIR/wolfssl/wolfssl - -echo "wolfSSL directory in Zephyr:" -echo " $ZEPHYR_WOLFSSL_DIR" -rm -rf $ZEPHYR_WOLFSSL_DIR -mkdir $ZEPHYR_WOLFSSL_DIR -mkdir $ZEPHYR_WOLFSSL_LIB_DIR - -echo "Copy in Build files ..." -cp -r * $ZEPHYR_WOLFSSL_LIB_DIR/ -rm $ZEPHYR_WOLFSSL_LIB_DIR/$0 -mv $ZEPHYR_WOLFSSL_LIB_DIR/zephyr $ZEPHYR_WOLFSSL_DIR/zephyr - -echo "Copy Source Code ..." -rm -rf $ZEPHYR_WOLFSSL_LIB_DIR/library -mkdir $ZEPHYR_WOLFSSL_LIB_DIR/library -mkdir $ZEPHYR_WOLFSSL_LIB_DIR/library/src -mkdir -p $ZEPHYR_WOLFSSL_LIB_DIR/library/wolfcrypt/src - -cp -rf ${WOLFSSL_SRC_DIR}/src/*.c $ZEPHYR_WOLFSSL_LIB_DIR/library/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_LIB_DIR/library/wolfcrypt/src/ -cp -rf ${WOLFSSL_SRC_DIR}/wolfcrypt/src/*.S $ZEPHYR_WOLFSSL_LIB_DIR/library/wolfcrypt/src/ - -echo "Copy Header Files ..." -rm -rf $ZEPHYR_WOLFSSL_LIB_DIR/include -mkdir $ZEPHYR_WOLFSSL_LIB_DIR/include - -cp $ZEPHYR_WOLFSSL_LIB_DIR/user_settings.h $ZEPHYR_WOLFSSL_LIB_DIR/include/ -cp -rf ${WOLFSSL_SRC_DIR}/wolfssl $ZEPHYR_WOLFSSL_LIB_DIR/include/ -rm -f $ZEPHYR_WOLFSSL_LIB_DIR/include/wolfssl/options.h -touch $ZEPHYR_WOLFSSL_LIB_DIR/include/wolfssl/options.h -rm -rf $ZEPHYR_WOLFSSL_LIB_DIR/include/wolfssl/wolfcrypt/port - - -echo "Done" - diff --git a/IDE/zephyr/lib/zephyr/module.yml b/IDE/zephyr/lib/zephyr/module.yml deleted file mode 100644 index ab1e2b0f6..000000000 --- a/IDE/zephyr/lib/zephyr/module.yml +++ /dev/null @@ -1,3 +0,0 @@ -build: - cmake-ext: True - kconfig-ext: True diff --git a/IDE/zephyr/module/CMakeLists.txt b/IDE/zephyr/module/CMakeLists.txt deleted file mode 100644 index 0f21e4ddf..000000000 --- a/IDE/zephyr/module/CMakeLists.txt +++ /dev/null @@ -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 - ${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) diff --git a/IDE/zephyr/module/install_module.sh b/IDE/zephyr/module/install_module.sh deleted file mode 100755 index 71380b5d5..000000000 --- a/IDE/zephyr/module/install_module.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/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" - diff --git a/IDE/zephyr/setup.sh b/IDE/zephyr/setup.sh deleted file mode 100755 index ffa03befb..000000000 --- a/IDE/zephyr/setup.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# Check for zephyr directory on command line -if [ $# -ne 1 ]; then - echo "Usage: $0 'zephyr project root directory path'" 1>&2 - exit 1 -fi -ZEPHYR_DIR=$1 - -# Check zephyr directory exists -if [ ! -d $ZEPHR_DIR ]; then - echo "Zephyr project directory does not exist: $ZEPHYR_DIR" - exit 1 -fi - -cd `dirname $0` - -(cd lib; ./install_lib.sh $ZEPHYR_DIR) -(cd module; ./install_module.sh $ZEPHYR_DIR) -(cd wolfssl_test; ./install_test.sh $ZEPHYR_DIR) -(cd wolfssl_tls_sock; ./install_sample.sh $ZEPHYR_DIR) -(cd wolfssl_tls_thread; ./install_sample.sh $ZEPHYR_DIR) - diff --git a/IDE/zephyr/wolfssl_tls_thread/README b/IDE/zephyr/wolfssl_tls_thread/README deleted file mode 100644 index 906a6c9ba..000000000 --- a/IDE/zephyr/wolfssl_tls_thread/README +++ /dev/null @@ -1,12 +0,0 @@ - -wolfSSL (formerly known as CyaSSL) and wolfCrypt are either licensed for use -under the GPLv2 or a standard commercial license. For our users who cannot use -wolfSSL under GPLv2, a commercial license to wolfSSL and wolfCrypt is available. -Please contact wolfSSL Inc. directly at: - -Email: licensing@wolfssl.com -Phone: +1 425 245-8247 - -More information can be found on the wolfSSL website at www.wolfssl.com. - - diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt new file mode 100644 index 000000000..f9aa604aa --- /dev/null +++ b/zephyr/CMakeLists.txt @@ -0,0 +1,123 @@ +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} + ${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl + ${ZEPHYR_CURRENT_MODULE_DIR}/zephyr + ) + + zephyr_library() + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/zephyr/zephyr_init.c) + + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/crl.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/internal.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/keys.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/ocsp.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/sniffer.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/ssl.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/tls13.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/tls.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/wolfio.c) + + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/aes.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/arc4.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/asm.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/asn.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/async.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/blake2b.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/camellia.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/chacha20_poly1305.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/chacha.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/cmac.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/coding.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/compress.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/cpuid.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/cryptocb.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/curve25519.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/des3.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/dh.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/dsa.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ecc.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ecc_fp.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ed25519.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/error.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fe_low_mem.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fe_operations.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fips.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fips_test.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ge_low_mem.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ge_operations.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/hash.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/hc128.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/hmac.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/idea.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/integer.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/logging.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/md2.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/md4.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/md5.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/memory.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/misc.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/pkcs12.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/pkcs7.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/poly1305.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/pwdbased.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/rabbit.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/random.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ripemd.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/rsa.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/selftest.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha256.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha3.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha512.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/signature.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_arm32.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_arm64.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_armthumb.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_c32.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_c64.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_cortexm.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_int.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_x86_64.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/srp.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/tfm.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wc_encrypt.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wc_pkcs11.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wc_port.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wolfcrypt_first.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wolfcrypt_last.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wolfevent.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/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") +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) diff --git a/IDE/zephyr/module/Kconfig b/zephyr/Kconfig similarity index 100% rename from IDE/zephyr/module/Kconfig rename to zephyr/Kconfig diff --git a/IDE/zephyr/module/Kconfig.tls-generic b/zephyr/Kconfig.tls-generic similarity index 100% rename from IDE/zephyr/module/Kconfig.tls-generic rename to zephyr/Kconfig.tls-generic diff --git a/zephyr/README.md b/zephyr/README.md new file mode 100644 index 000000000..6efbb36f8 --- /dev/null +++ b/zephyr/README.md @@ -0,0 +1,136 @@ +Zephyr Project Port +=================== + +## Overview + +This port is for Zephyr Project available [here](https://www.zephyrproject.org/). + +It provides the following zephyr code. + +- modules/crypto/wolfssl + - wolfssl library code +- zephyr/modules/crypto/wolfssl + - Configuration and make files for wolfSSL +- zephyr/samples/modules/wolfssl_test + - wolfcrypt unit test application +- zephyr/samples/modules/wolfssl_tls_sock + - socket based sample of TLS +- zephyr/samples/modules/wolfssl_tls_thread + - socket based sample of TLS using threads + +## How to setup - automated + +### deploy wolfssl source to zephyr project +Specify the path of the zephyr project and execute `wolfssl/IDE/zephyr/setup.sh`. + +```bash +./IDE/zephyr/setup.sh /path/to/zephyrproject +``` + +This script will deploy wolfssl's library code, configuration and samples as described in the Overview to the zephyr project. + +## build & test + +build and execute wolfssl_test + +``` +cd [zephyrproject] +west build -p auto -b qemu_x86 zephyr/samples/modules/wolfssl_test +west build -t run +``` + + +## How to setup - step by step + +export ZEPHYR_DIR= +export WOLFSSL_DIR= + +### Install wolfSSL library code + +``` +(cd lib; ./install_lib.sh $ZEPHYR_DIR) +``` + +or + +``` +mkdir -p $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/src +mkdir -p $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/wolfcrypt/src +mkdir -p $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/include + +cp -r lib/* $ZEPHYR_DIR/modules/crypto/wolfssl +mv $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/zephyr $ZEPHYR_DIR/modules/crypto/wolfssl/zephyr + +cp -rf $WOLFSSL_DIR/src/*.c $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/src/ +cp -rf $WOLFSSL_DIR/wolfcrypt/src/*.c $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/wolfcrypt/src/ +cp -rf $WOLFSSL_DIR/wolfcrypt/src/*.i $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/wolfcrypt/src/ +cp -rf $WOLFSSL_DIR/wolfcrypt/src/*.S $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/wolfcrypt/src/ + +cp lib/user_settings.h $ZEPHYR_DIR/modules/crypto/wolfssl/include +cp -rf $WOLFSSL_DIR/wolfssl $ZEPHYR_DIR/modules/crypto/wolfssl/include +rm -f $ZEPHYR_DIR/modules/crypto/wolfssl/include/wolfssl/options.h +touch $ZEPHYR_DIR/modules/crypto/wolfssl/include/wolfssl/options.h +rm -rf $ZEPHYR_DIR/modules/crypto/wolfssl/include/wolfssl/wolfcrypt/port +``` + +### Install wolfSSL mdule (build system hooks) + +``` +(cd module; ./install_module.sh $ZEPHYR_DIR) +``` + +or + +``` +mkdir $ZEPHYR_DIR/zephyr/modules/crypto/wolfssl; +cp module/* $ZEPHYR_DIR/zephyr/modules/crypto/wolfssl/ +``` + +### Add wolfSSL to west + +Add the following lines in 'projects' to: $ZEPHYR_DIR/zephyr/west.yml + +``` + - name: wolfssl + path: modules/crypto/wolfssl +``` + +### Install wolfSSL example wolfssl_test + +``` +(cd wolfssl_test; ./install_test.sh $ZEPHYR_DIR) +``` + +or + +``` +cp wolfssl_test $ZEPHYR_DIR/zephyr/samples/modules +mkdir $ZEPHYR_DIR/zephyr/samples/modules/src +cp $WOLFSSL_DIR/wolfcrypt/test/test.c $ZEPHYR_DIR/zephyr/samples/modules/src +cp $WOLFSSL_DIR/wolfcrypt/test/test.h $ZEPHYR_DIR/zephyr/samples/modules/src +``` + +### Install wolfSSL example wolfssl_tls_sock + +``` +(cd wolfssl_tls_sock; ./install_sample.sh $ZEPHYR_DIR) +``` + +or + +``` +cp wolfssl_tls_sock $ZEPHYR_DIR/zephyr/samples/modules +``` + +### Install wolfSSL example wolfssl_tls_thread + +``` +(cd wolfssl_tls_thread; ./install_sample.sh $ZEPHYR_DIR) +``` + +or + +``` +cp wolfssl_tls_thread $ZEPHYR_DIR/zephyr/samples/modules +``` + diff --git a/IDE/zephyr/include.am b/zephyr/include.am similarity index 97% rename from IDE/zephyr/include.am rename to zephyr/include.am index e69546f92..8b72fa0e1 100644 --- a/IDE/zephyr/include.am +++ b/zephyr/include.am @@ -31,3 +31,4 @@ 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 +EXTRA_DIST+= IDE/zephyr/wolfssl_zephyr.diff diff --git a/zephyr/module.yml b/zephyr/module.yml new file mode 100644 index 000000000..cbff6a1ae --- /dev/null +++ b/zephyr/module.yml @@ -0,0 +1,3 @@ +build: + cmake: zephyr + kconfig: zephyr/Kconfig diff --git a/IDE/zephyr/wolfssl_test/CMakeLists.txt b/zephyr/samples/wolfssl_test/CMakeLists.txt similarity index 57% rename from IDE/zephyr/wolfssl_test/CMakeLists.txt rename to zephyr/samples/wolfssl_test/CMakeLists.txt index edf423efc..1206b47dc 100644 --- a/IDE/zephyr/wolfssl_test/CMakeLists.txt +++ b/zephyr/samples/wolfssl_test/CMakeLists.txt @@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.13.1) include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) project(wolfssl_test) -FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${ZEPHYR_WOLFSSL_MODULE_DIR}/wolfcrypt/test/test.c) +target_include_directories(app PRIVATE ${ZEPHYR_WOLFSSL_MODULE_DIR}/wolfcrypt/test) target_sources(app PRIVATE ${app_sources}) add_definitions(-DWOLFSSL_USER_SETTINGS) diff --git a/IDE/zephyr/lib/README b/zephyr/samples/wolfssl_test/README similarity index 100% rename from IDE/zephyr/lib/README rename to zephyr/samples/wolfssl_test/README diff --git a/IDE/zephyr/wolfssl_test/install_test.sh b/zephyr/samples/wolfssl_test/install_test.sh similarity index 100% rename from IDE/zephyr/wolfssl_test/install_test.sh rename to zephyr/samples/wolfssl_test/install_test.sh diff --git a/IDE/zephyr/wolfssl_test/prj.conf b/zephyr/samples/wolfssl_test/prj.conf similarity index 100% rename from IDE/zephyr/wolfssl_test/prj.conf rename to zephyr/samples/wolfssl_test/prj.conf diff --git a/IDE/zephyr/wolfssl_test/sample.yaml b/zephyr/samples/wolfssl_test/sample.yaml similarity index 100% rename from IDE/zephyr/wolfssl_test/sample.yaml rename to zephyr/samples/wolfssl_test/sample.yaml diff --git a/IDE/zephyr/wolfssl_tls_sock/CMakeLists.txt b/zephyr/samples/wolfssl_tls_sock/CMakeLists.txt similarity index 100% rename from IDE/zephyr/wolfssl_tls_sock/CMakeLists.txt rename to zephyr/samples/wolfssl_tls_sock/CMakeLists.txt diff --git a/IDE/zephyr/wolfssl_test/README b/zephyr/samples/wolfssl_tls_sock/README similarity index 100% rename from IDE/zephyr/wolfssl_test/README rename to zephyr/samples/wolfssl_tls_sock/README diff --git a/IDE/zephyr/wolfssl_tls_sock/install_sample.sh b/zephyr/samples/wolfssl_tls_sock/install_sample.sh similarity index 100% rename from IDE/zephyr/wolfssl_tls_sock/install_sample.sh rename to zephyr/samples/wolfssl_tls_sock/install_sample.sh diff --git a/IDE/zephyr/wolfssl_tls_sock/prj.conf b/zephyr/samples/wolfssl_tls_sock/prj.conf similarity index 100% rename from IDE/zephyr/wolfssl_tls_sock/prj.conf rename to zephyr/samples/wolfssl_tls_sock/prj.conf diff --git a/IDE/zephyr/wolfssl_tls_sock/sample.yaml b/zephyr/samples/wolfssl_tls_sock/sample.yaml similarity index 100% rename from IDE/zephyr/wolfssl_tls_sock/sample.yaml rename to zephyr/samples/wolfssl_tls_sock/sample.yaml diff --git a/IDE/zephyr/wolfssl_tls_sock/src/tls_sock.c b/zephyr/samples/wolfssl_tls_sock/src/tls_sock.c similarity index 100% rename from IDE/zephyr/wolfssl_tls_sock/src/tls_sock.c rename to zephyr/samples/wolfssl_tls_sock/src/tls_sock.c diff --git a/IDE/zephyr/wolfssl_tls_thread/CMakeLists.txt b/zephyr/samples/wolfssl_tls_thread/CMakeLists.txt similarity index 100% rename from IDE/zephyr/wolfssl_tls_thread/CMakeLists.txt rename to zephyr/samples/wolfssl_tls_thread/CMakeLists.txt diff --git a/IDE/zephyr/wolfssl_tls_sock/README b/zephyr/samples/wolfssl_tls_thread/README similarity index 100% rename from IDE/zephyr/wolfssl_tls_sock/README rename to zephyr/samples/wolfssl_tls_thread/README diff --git a/IDE/zephyr/wolfssl_tls_thread/install_sample.sh b/zephyr/samples/wolfssl_tls_thread/install_sample.sh similarity index 100% rename from IDE/zephyr/wolfssl_tls_thread/install_sample.sh rename to zephyr/samples/wolfssl_tls_thread/install_sample.sh diff --git a/IDE/zephyr/wolfssl_tls_thread/prj.conf b/zephyr/samples/wolfssl_tls_thread/prj.conf similarity index 100% rename from IDE/zephyr/wolfssl_tls_thread/prj.conf rename to zephyr/samples/wolfssl_tls_thread/prj.conf diff --git a/IDE/zephyr/wolfssl_tls_thread/sample.yaml b/zephyr/samples/wolfssl_tls_thread/sample.yaml similarity index 100% rename from IDE/zephyr/wolfssl_tls_thread/sample.yaml rename to zephyr/samples/wolfssl_tls_thread/sample.yaml diff --git a/IDE/zephyr/wolfssl_tls_thread/src/tls_threaded.c b/zephyr/samples/wolfssl_tls_thread/src/tls_threaded.c similarity index 100% rename from IDE/zephyr/wolfssl_tls_thread/src/tls_threaded.c rename to zephyr/samples/wolfssl_tls_thread/src/tls_threaded.c diff --git a/IDE/zephyr/lib/settings/user_settings-tls-generic.h b/zephyr/user_settings-tls-generic.h similarity index 100% rename from IDE/zephyr/lib/settings/user_settings-tls-generic.h rename to zephyr/user_settings-tls-generic.h diff --git a/IDE/zephyr/lib/user_settings.h b/zephyr/user_settings.h similarity index 100% rename from IDE/zephyr/lib/user_settings.h rename to zephyr/user_settings.h diff --git a/zephyr/wolfssl/options.h b/zephyr/wolfssl/options.h new file mode 100644 index 000000000..e69de29bb diff --git a/IDE/zephyr/module/zephyr_init.c b/zephyr/zephyr_init.c similarity index 100% rename from IDE/zephyr/module/zephyr_init.c rename to zephyr/zephyr_init.c From 7532ac530a4f34ef89b4056ef773ab81684527ef Mon Sep 17 00:00:00 2001 From: Maxime Vincent Date: Thu, 29 Jul 2021 12:03:40 +0200 Subject: [PATCH 2/6] Remove IDE/zephyr/include.am from IDE/include.am for now --- IDE/include.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IDE/include.am b/IDE/include.am index 573a0f829..737d6dd3e 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -38,7 +38,7 @@ include IDE/XilinxSDK/include.am include IDE/VisualDSP/include.am include IDE/QNX/include.am include IDE/WINCE/include.am -include IDE/zephyr/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 EXTRA_DIST+= IDE/OPENSTM32/README.md From 3f802d19e487913aa0dd9362acdf732638e8c31f Mon Sep 17 00:00:00 2001 From: Maxime Vincent Date: Thu, 29 Jul 2021 12:16:05 +0200 Subject: [PATCH 3/6] Update zephyr/README.md --- zephyr/README.md | 140 +++++++++++++---------------------------------- 1 file changed, 39 insertions(+), 101 deletions(-) diff --git a/zephyr/README.md b/zephyr/README.md index 6efbb36f8..7aee5ddc1 100644 --- a/zephyr/README.md +++ b/zephyr/README.md @@ -3,134 +3,72 @@ Zephyr Project Port ## Overview -This port is for Zephyr Project available [here](https://www.zephyrproject.org/). +This port is for the Zephyr RTOS Project, available [here](https://www.zephyrproject.org/). It provides the following zephyr code. - modules/crypto/wolfssl - wolfssl library code -- zephyr/modules/crypto/wolfssl - - Configuration and make files for wolfSSL -- zephyr/samples/modules/wolfssl_test +- modules/crypto/wolfssl/zephyr/ + - Configuration and CMake files for wolfSSL as a Zephyr module +- modules/crypto/wolfssl/zephyr/samples/wolfssl_test - wolfcrypt unit test application -- zephyr/samples/modules/wolfssl_tls_sock +- modules/crypto/wolfssl/zephyr/samples/wolfssl_tls_sock - socket based sample of TLS -- zephyr/samples/modules/wolfssl_tls_thread +- modules/crypto/wolfssl/zephyr/samples/wolfssl_tls_thread - socket based sample of TLS using threads -## How to setup - automated +## How to setup as a Zephyr Module -### deploy wolfssl source to zephyr project -Specify the path of the zephyr project and execute `wolfssl/IDE/zephyr/setup.sh`. +### Modify your project's west manifest -```bash -./IDE/zephyr/setup.sh /path/to/zephyrproject +Add wolfssl as a project: +``` +manifest: + remotes: + # + - name: wolfssl + url-base: https://github.com/wolfssl + + projects: + # + - name: wolfssl + path: modules/crypto/wolfssl + revision: master + remote: wolfssl ``` -This script will deploy wolfssl's library code, configuration and samples as described in the Overview to the zephyr project. +Update west's modules: -## build & test +```bash +west update +``` + +Now west recognizes 'wolfssl' as a module, and will include it's Kconfig and CMakeFiles.txt in the build system. + +## Build & test build and execute wolfssl_test ``` cd [zephyrproject] -west build -p auto -b qemu_x86 zephyr/samples/modules/wolfssl_test +west build -p auto -b qemu_x86 modules/crypto/wolfssl/zephyr/samples/wolfssl_test west build -t run ``` - -## How to setup - step by step - -export ZEPHYR_DIR= -export WOLFSSL_DIR= - -### Install wolfSSL library code +### Run wolfSSL example wolfssl_tls_sock ``` -(cd lib; ./install_lib.sh $ZEPHYR_DIR) +cd [zephyrproject] +west build -p auto -b qemu_x86 modules/crypto/wolfssl/zephyr/samples/wolfssl_tls_sock +west build -t run ``` -or +### Run wolfSSL example wolfssl_tls_thread ``` -mkdir -p $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/src -mkdir -p $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/wolfcrypt/src -mkdir -p $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/include - -cp -r lib/* $ZEPHYR_DIR/modules/crypto/wolfssl -mv $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/zephyr $ZEPHYR_DIR/modules/crypto/wolfssl/zephyr - -cp -rf $WOLFSSL_DIR/src/*.c $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/src/ -cp -rf $WOLFSSL_DIR/wolfcrypt/src/*.c $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/wolfcrypt/src/ -cp -rf $WOLFSSL_DIR/wolfcrypt/src/*.i $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/wolfcrypt/src/ -cp -rf $WOLFSSL_DIR/wolfcrypt/src/*.S $ZEPHYR_DIR/modules/crypto/wolfssl/wolfssl/library/wolfcrypt/src/ - -cp lib/user_settings.h $ZEPHYR_DIR/modules/crypto/wolfssl/include -cp -rf $WOLFSSL_DIR/wolfssl $ZEPHYR_DIR/modules/crypto/wolfssl/include -rm -f $ZEPHYR_DIR/modules/crypto/wolfssl/include/wolfssl/options.h -touch $ZEPHYR_DIR/modules/crypto/wolfssl/include/wolfssl/options.h -rm -rf $ZEPHYR_DIR/modules/crypto/wolfssl/include/wolfssl/wolfcrypt/port -``` - -### Install wolfSSL mdule (build system hooks) - -``` -(cd module; ./install_module.sh $ZEPHYR_DIR) -``` - -or - -``` -mkdir $ZEPHYR_DIR/zephyr/modules/crypto/wolfssl; -cp module/* $ZEPHYR_DIR/zephyr/modules/crypto/wolfssl/ -``` - -### Add wolfSSL to west - -Add the following lines in 'projects' to: $ZEPHYR_DIR/zephyr/west.yml - -``` - - name: wolfssl - path: modules/crypto/wolfssl -``` - -### Install wolfSSL example wolfssl_test - -``` -(cd wolfssl_test; ./install_test.sh $ZEPHYR_DIR) -``` - -or - -``` -cp wolfssl_test $ZEPHYR_DIR/zephyr/samples/modules -mkdir $ZEPHYR_DIR/zephyr/samples/modules/src -cp $WOLFSSL_DIR/wolfcrypt/test/test.c $ZEPHYR_DIR/zephyr/samples/modules/src -cp $WOLFSSL_DIR/wolfcrypt/test/test.h $ZEPHYR_DIR/zephyr/samples/modules/src -``` - -### Install wolfSSL example wolfssl_tls_sock - -``` -(cd wolfssl_tls_sock; ./install_sample.sh $ZEPHYR_DIR) -``` - -or - -``` -cp wolfssl_tls_sock $ZEPHYR_DIR/zephyr/samples/modules -``` - -### Install wolfSSL example wolfssl_tls_thread - -``` -(cd wolfssl_tls_thread; ./install_sample.sh $ZEPHYR_DIR) -``` - -or - -``` -cp wolfssl_tls_thread $ZEPHYR_DIR/zephyr/samples/modules +cd [zephyrproject] +west build -p auto -b qemu_x86 modules/crypto/wolfssl/zephyr/samples/wolfssl_tls_thread +west build -t run ``` From 7acbf61e53d067e5e638eb95a23ba7ed405fbf4d Mon Sep 17 00:00:00 2001 From: Maxime Vincent Date: Thu, 29 Jul 2021 12:36:34 +0200 Subject: [PATCH 4/6] zephyr: fix CMakeLists.txt --- zephyr/CMakeLists.txt | 245 +++++++++++++++++++++--------------------- 1 file changed, 124 insertions(+), 121 deletions(-) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index f9aa604aa..e5f0b93ca 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -1,123 +1,126 @@ -zephyr_interface_library_named(wolfSSL) +if(CONFIG_WOLFSSL) + 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} + ${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl + ${ZEPHYR_CURRENT_MODULE_DIR}/zephyr + ) + + zephyr_library() + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/zephyr/zephyr_init.c) + + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/crl.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/internal.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/keys.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/ocsp.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/sniffer.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/ssl.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/tls13.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/tls.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/wolfio.c) + + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/aes.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/arc4.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/asm.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/asn.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/async.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/blake2b.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/camellia.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/chacha20_poly1305.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/chacha.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/cmac.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/coding.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/compress.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/cpuid.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/cryptocb.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/curve25519.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/des3.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/dh.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/dsa.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ecc.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ecc_fp.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ed25519.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/error.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fe_low_mem.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fe_operations.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fips.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fips_test.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ge_low_mem.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ge_operations.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/hash.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/hc128.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/hmac.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/idea.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/integer.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/logging.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/md2.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/md4.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/md5.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/memory.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/misc.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/pkcs12.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/pkcs7.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/poly1305.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/pwdbased.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/rabbit.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/random.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ripemd.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/rsa.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/selftest.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha256.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha3.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha512.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/signature.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_arm32.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_arm64.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_armthumb.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_c32.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_c64.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_cortexm.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_int.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_x86_64.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/srp.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/tfm.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wc_encrypt.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wc_pkcs11.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wc_port.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wolfcrypt_first.c) + #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wolfcrypt_last.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wolfevent.c) + zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/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") + 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) -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} - ${ZEPHYR_CURRENT_MODULE_DIR}/wolfssl - ${ZEPHYR_CURRENT_MODULE_DIR}/zephyr - ) - - zephyr_library() - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/zephyr/zephyr_init.c) - - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/crl.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/internal.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/keys.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/ocsp.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/sniffer.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/ssl.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/tls13.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/tls.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/wolfio.c) - - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/aes.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/arc4.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/asm.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/asn.c) - #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/async.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/blake2b.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/camellia.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/chacha20_poly1305.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/chacha.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/cmac.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/coding.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/compress.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/cpuid.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/cryptocb.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/curve25519.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/des3.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/dh.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/dsa.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ecc.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ecc_fp.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ed25519.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/error.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fe_low_mem.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fe_operations.c) - #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fips.c) - #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/fips_test.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ge_low_mem.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ge_operations.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/hash.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/hc128.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/hmac.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/idea.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/integer.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/logging.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/md2.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/md4.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/md5.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/memory.c) - #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/misc.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/pkcs12.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/pkcs7.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/poly1305.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/pwdbased.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/rabbit.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/random.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/ripemd.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/rsa.c) - #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/selftest.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha256.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha3.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha512.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sha.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/signature.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_arm32.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_arm64.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_armthumb.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_c32.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_c64.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_cortexm.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_int.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/sp_x86_64.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/srp.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/tfm.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wc_encrypt.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wc_pkcs11.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wc_port.c) - #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wolfcrypt_first.c) - #zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wolfcrypt_last.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/wolfcrypt/src/wolfevent.c) - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/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") -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) From f932736f234fbd3146300851bf0452d49342c338 Mon Sep 17 00:00:00 2001 From: Maxime Vincent Date: Mon, 2 Aug 2021 16:44:07 +0200 Subject: [PATCH 5/6] Fix include.am / EXTRA_DIST --- IDE/include.am | 2 +- zephyr/include.am | 58 +++++++++++++++++++++++------------------------ 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/IDE/include.am b/IDE/include.am index 737d6dd3e..b25e4f34d 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -38,7 +38,7 @@ include IDE/XilinxSDK/include.am include IDE/VisualDSP/include.am include IDE/QNX/include.am include IDE/WINCE/include.am -#include IDE/zephyr/include.am +include zephyr/include.am 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 diff --git a/zephyr/include.am b/zephyr/include.am index 8b72fa0e1..db4071490 100644 --- a/zephyr/include.am +++ b/zephyr/include.am @@ -2,33 +2,31 @@ # 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 -EXTRA_DIST+= IDE/zephyr/wolfssl_zephyr.diff +EXTRA_DIST+= zephyr/CMakeLists.txt +EXTRA_DIST+= zephyr/Kconfig +EXTRA_DIST+= zephyr/Kconfig.tls-generic +EXTRA_DIST+= zephyr/zephyr_init.c +EXTRA_DIST+= zephyr/module.yml +EXTRA_DIST+= zephyr/wolfssl/options.h +EXTRA_DIST+= zephyr/user_settings.h +EXTRA_DIST+= zephyr/user_settings-tls-generic.h +EXTRA_DIST+= zephyr/README.md +EXTRA_DIST+= zephyr/samples/wolfssl_test/CMakeLists.txt +EXTRA_DIST+= zephyr/samples/wolfssl_test/README +EXTRA_DIST+= zephyr/samples/wolfssl_test/install_test.sh +EXTRA_DIST+= zephyr/samples/wolfssl_test/prj.conf +EXTRA_DIST+= zephyr/samples/wolfssl_test/sample.yaml +EXTRA_DIST+= zephyr/samples/wolfssl_tls_sock/CMakeLists.txt +EXTRA_DIST+= zephyr/samples/wolfssl_tls_sock/README +EXTRA_DIST+= zephyr/samples/wolfssl_tls_sock/install_sample.sh +EXTRA_DIST+= zephyr/samples/wolfssl_tls_sock/prj.conf +EXTRA_DIST+= zephyr/samples/wolfssl_tls_sock/sample.yaml +EXTRA_DIST+= zephyr/samples/wolfssl_tls_sock/src +EXTRA_DIST+= zephyr/samples/wolfssl_tls_sock/src/tls_sock.c +EXTRA_DIST+= zephyr/samples/wolfssl_tls_thread/CMakeLists.txt +EXTRA_DIST+= zephyr/samples/wolfssl_tls_thread/README +EXTRA_DIST+= zephyr/samples/wolfssl_tls_thread/install_sample.sh +EXTRA_DIST+= zephyr/samples/wolfssl_tls_thread/prj.conf +EXTRA_DIST+= zephyr/samples/wolfssl_tls_thread/sample.yaml +EXTRA_DIST+= zephyr/samples/wolfssl_tls_thread/src +EXTRA_DIST+= zephyr/samples/wolfssl_tls_thread/src/tls_threaded.c From ea6f81cc547ace0f50fa50307988ca8f082a9b99 Mon Sep 17 00:00:00 2001 From: Maxime Vincent Date: Tue, 3 Aug 2021 09:43:03 +0200 Subject: [PATCH 6/6] Move zephyr/include.am to toplevel Makefile.am --- IDE/include.am | 1 - Makefile.am | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/IDE/include.am b/IDE/include.am index b25e4f34d..474ebf78c 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -38,7 +38,6 @@ include IDE/XilinxSDK/include.am include IDE/VisualDSP/include.am include IDE/QNX/include.am include IDE/WINCE/include.am -include zephyr/include.am 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 diff --git a/Makefile.am b/Makefile.am index 617e45c46..17a515f2f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -176,6 +176,7 @@ include tests/include.am include sslSniffer/sslSnifferTest/include.am include rpm/include.am include linuxkm/include.am +include zephyr/include.am # Exclude references to non-DFSG sources from build files if !BUILD_DISTRO