diff --git a/.github/workflows/async.yml b/.github/workflows/async.yml index 3ad8e86860..07a2b5088c 100644 --- a/.github/workflows/async.yml +++ b/.github/workflows/async.yml @@ -24,7 +24,7 @@ jobs: ] name: make check if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 6 steps: diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index 328b1ffe62..e44572a20b 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -14,7 +14,7 @@ concurrency: jobs: codespell: if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/coverity-scan-fixes.yml b/.github/workflows/coverity-scan-fixes.yml index 6d63f3bf11..9a70e080b6 100644 --- a/.github/workflows/coverity-scan-fixes.yml +++ b/.github/workflows/coverity-scan-fixes.yml @@ -10,7 +10,7 @@ on: jobs: coverity: if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/curl.yml b/.github/workflows/curl.yml index b6fe4cc2d3..19d3dcd497 100644 --- a/.github/workflows/curl.yml +++ b/.github/workflows/curl.yml @@ -16,7 +16,7 @@ jobs: build_wolfssl: name: Build wolfSSL if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -40,7 +40,7 @@ jobs: test_curl: name: ${{ matrix.curl_ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 15 needs: build_wolfssl diff --git a/.github/workflows/cyrus-sasl.yml b/.github/workflows/cyrus-sasl.yml index 790d8886a7..910c871224 100644 --- a/.github/workflows/cyrus-sasl.yml +++ b/.github/workflows/cyrus-sasl.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL if: github.repository_owner == 'wolfssl' # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -48,7 +48,7 @@ jobs: ref: [ 2.1.28 ] name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 needs: build_wolfssl diff --git a/.github/workflows/hitch.yml b/.github/workflows/disabled/hitch.yml similarity index 100% rename from .github/workflows/hitch.yml rename to .github/workflows/disabled/hitch.yml diff --git a/.github/workflows/docker-Espressif.yml b/.github/workflows/docker-Espressif.yml index 184dced8d1..dda8e9c34a 100644 --- a/.github/workflows/docker-Espressif.yml +++ b/.github/workflows/docker-Espressif.yml @@ -15,7 +15,7 @@ jobs: espressif_latest: name: latest Docker container if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 12 container: @@ -23,24 +23,24 @@ jobs: steps: - uses: actions/checkout@v4 - name: Initialize Espressif IDE and build examples - run: . /opt/esp/idf/export.sh; IDE/Espressif/ESP-IDF/compileAllExamples.sh + run: cd /opt/esp/idf && . ./export.sh && cd $GITHUB_WORKSPACE; IDE/Espressif/ESP-IDF/compileAllExamples.sh espressif_v4_4: name: v4.4 Docker container if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 container: image: espressif/idf:release-v4.4 steps: - uses: actions/checkout@v4 - name: Initialize Espressif IDE and build examples - run: . /opt/esp/idf/export.sh; IDE/Espressif/ESP-IDF/compileAllExamples.sh + run: cd /opt/esp/idf && . ./export.sh && cd $GITHUB_WORKSPACE; IDE/Espressif/ESP-IDF/compileAllExamples.sh espressif_v5_0: name: v5.0 Docker container if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 container: image: espressif/idf:release-v5.0 steps: - uses: actions/checkout@v4 - name: Initialize Espressif IDE and build examples - run: . /opt/esp/idf/export.sh; IDE/Espressif/ESP-IDF/compileAllExamples.sh + run: cd /opt/esp/idf && . ./export.sh && cd $GITHUB_WORKSPACE; IDE/Espressif/ESP-IDF/compileAllExamples.sh diff --git a/.github/workflows/docker-OpenWrt.yml b/.github/workflows/docker-OpenWrt.yml index 0a3768d613..05890ffaed 100644 --- a/.github/workflows/docker-OpenWrt.yml +++ b/.github/workflows/docker-OpenWrt.yml @@ -18,7 +18,7 @@ jobs: build_library: name: Compile libwolfssl.so if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 container: @@ -42,7 +42,7 @@ jobs: compile_container: name: Compile container if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 2 needs: build_library diff --git a/.github/workflows/grpc.yml b/.github/workflows/grpc.yml index e8d549b7a4..2804756eb6 100644 --- a/.github/workflows/grpc.yml +++ b/.github/workflows/grpc.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL if: github.repository_owner == 'wolfssl' # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 10 steps: @@ -52,7 +52,7 @@ jobs: h2_ssl_cert_test h2_ssl_session_reuse_test name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 30 needs: build_wolfssl diff --git a/.github/workflows/hostap-vm.yml b/.github/workflows/hostap-vm.yml index 4c52175d46..859910c6af 100644 --- a/.github/workflows/hostap-vm.yml +++ b/.github/workflows/hostap-vm.yml @@ -13,7 +13,7 @@ concurrency: # END OF COMMON SECTION env: - LINUX_REF: v6.6 + LINUX_REF: v6.12 jobs: build_wolfssl: @@ -28,7 +28,7 @@ jobs: --enable-tlsv10 --enable-oldtls name: Build wolfSSL if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 10 steps: @@ -63,27 +63,47 @@ jobs: path: build-dir.tgz retention-days: 5 + checkout_hostap: + name: Checkout hostap repo + if: github.repository_owner == 'wolfssl' + runs-on: ubuntu-22.04 + # This should be a safe limit for the tests to run. + timeout-minutes: 10 + steps: + - name: Checking if we have hostap in cache + uses: actions/cache@v4 + id: cache + with: + path: hostap + key: hostap-repo + lookup-only: true + + - name: Checkout hostap + run: git clone git://w1.fi/hostap.git hostap + build_uml_linux: name: Build UML (UserMode Linux) if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 10 + needs: checkout_hostap steps: - name: Checking if we have kernel in cache uses: actions/cache@v4 id: cache with: path: linux/linux - key: ${{ env.LINUX_REF }} + key: hostap-linux-${{ env.LINUX_REF }} lookup-only: true - - name: Checkout hostap + - name: Checking if we have hostap in cache if: steps.cache.outputs.cache-hit != 'true' - uses: actions/checkout@v4 + uses: actions/cache/restore@v4 with: - repository: julek-wolfssl/hostap-mirror path: hostap + key: hostap-repo + fail-on-cache-miss: true - name: Checkout linux if: steps.cache.outputs.cache-hit != 'true' @@ -91,6 +111,7 @@ jobs: with: repository: torvalds/linux path: linux + ref: ${{ env.LINUX_REF }} - name: Compile linux if: steps.cache.outputs.cache-hit != 'true' @@ -141,19 +162,18 @@ jobs: build_id: hostap-vm-build2 } name: hwsim test - # For openssl 1.1 if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 45 - needs: [build_wolfssl, build_uml_linux] + needs: [build_wolfssl, build_uml_linux, checkout_hostap] steps: - name: Checking if we have kernel in cache uses: actions/cache/restore@v4 id: cache with: path: linux/linux - key: ${{ env.LINUX_REF }} + key: hostap-linux-${{ env.LINUX_REF }} fail-on-cache-miss: true - name: show file structure @@ -198,12 +218,16 @@ jobs: libnl-3-dev binutils-dev libssl-dev libiberty-dev libnl-genl-3-dev \ libnl-route-3-dev libdbus-1-dev bridge-utils tshark python3-pycryptodome - - name: Checkout hostap - uses: actions/checkout@v4 + - name: Checking if we have hostap in cache + uses: actions/cache/restore@v4 with: - repository: julek-wolfssl/hostap-mirror path: hostap - ref: ${{ matrix.config.hostap_ref }} + key: hostap-repo + fail-on-cache-miss: true + + - name: Checkout correct ref + working-directory: hostap + run: git checkout ${{ matrix.config.hostap_ref }} - name: Update certs working-directory: hostap/tests/hwsim/auth_serv diff --git a/.github/workflows/ipmitool.yml b/.github/workflows/ipmitool.yml index 1dc2c18e58..c23b407c52 100644 --- a/.github/workflows/ipmitool.yml +++ b/.github/workflows/ipmitool.yml @@ -17,7 +17,7 @@ jobs: build_wolfssl: name: Build wolfSSL # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.repository_owner == 'wolfssl' # This should be a safe limit for the tests to run. timeout-minutes: 4 @@ -48,7 +48,7 @@ jobs: git_ref: [ c3939dac2c060651361fc71516806f9ab8c38901 ] name: ${{ matrix.git_ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: build_wolfssl steps: - name: Install dependencies diff --git a/.github/workflows/jwt-cpp.yml b/.github/workflows/jwt-cpp.yml index 3b8348ad77..3dd89ad6ab 100644 --- a/.github/workflows/jwt-cpp.yml +++ b/.github/workflows/jwt-cpp.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL # Just to keep it the same as the testing target if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -47,7 +47,7 @@ jobs: matrix: config: - ref: 0.7.0 - runner: ubuntu-latest + runner: ubuntu-22.04 - ref: 0.6.0 runner: ubuntu-22.04 name: ${{ matrix.config.ref }} diff --git a/.github/workflows/krb5.yml b/.github/workflows/krb5.yml index 2b69761d2d..af6f9e7953 100644 --- a/.github/workflows/krb5.yml +++ b/.github/workflows/krb5.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL # Just to keep it the same as the testing target if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 5 steps: @@ -50,7 +50,7 @@ jobs: ref: [ 1.21.1 ] name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 8 needs: build_wolfssl diff --git a/.github/workflows/libspdm.yml b/.github/workflows/libspdm.yml new file mode 100644 index 0000000000..49cbf8c529 --- /dev/null +++ b/.github/workflows/libspdm.yml @@ -0,0 +1,91 @@ +name: libspdm Tests + +# START OF COMMON SECTION +on: + push: + branches: [ 'master', 'main', 'release/**' ] + pull_request: + branches: [ '*' ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +# END OF COMMON SECTION + +jobs: + build_wolfssl: + name: Build wolfSSL + if: github.repository_owner == 'wolfssl' + # Just to keep it the same as the testing target + runs-on: ubuntu-22.04 + # This should be a safe limit for the tests to run. + timeout-minutes: 4 + steps: + - name: Build wolfSSL + uses: wolfSSL/actions-build-autotools-project@v1 + with: + path: wolfssl + configure: --enable-all --enable-static CFLAGS='-DRSA_MIN_SIZE=512' + install: true + + - name: tar build-dir + run: tar -zcf build-dir.tgz build-dir + + - name: Upload built lib + uses: actions/upload-artifact@v4 + with: + name: wolf-install-libspdm + path: build-dir.tgz + retention-days: 5 + + libspdm_check: + strategy: + fail-fast: false + matrix: + # List of releases to test + ref: [ 3.3.0 ] + name: ${{ matrix.ref }} + if: github.repository_owner == 'wolfssl' + runs-on: ubuntu-22.04 + # This should be a safe limit for the tests to run. + timeout-minutes: 4 + needs: build_wolfssl + steps: + - name: Download lib + uses: actions/download-artifact@v4 + with: + name: wolf-install-libspdm + + - name: untar build-dir + run: tar -xf build-dir.tgz + + - name: Checkout OSP + uses: actions/checkout@v4 + with: + repository: wolfssl/osp + path: osp + + - name: Checkout libspdm + uses: actions/checkout@v4 + with: + repository: DMTF/libspdm + path: libspdm + ref: ${{ matrix.ref }} + + - name: Build and test libspdm + working-directory: libspdm + run: | + patch -p1 < ../osp/libspdm/${{ matrix.ref }}/libspdm-${{ matrix.ref }}.patch + git submodule update --init --recursive + # Silence cmake version warnings + find -name CMakeLists.txt -exec sed -i 's/cmake_minimum_required.*/cmake_minimum_required(VERSION 3.10)/g' {} \; + mkdir build + cd build + cmake -DARCH=x64 -DTOOLCHAIN=GCC -DTARGET=Debug -DCRYPTO=wolfssl -DENABLE_BINARY_BUILD=1 \ + -DCOMPILED_LIBWOLFSSL_PATH=$GITHUB_WORKSPACE/build-dir/lib/libwolfssl.a \ + -DWOLFSSL_INCDIR=$GITHUB_WORKSPACE/build-dir/include .. + make -j + cd ../unit_test/sample_key + ../../build/bin/test_crypt + ../../build/bin/test_spdm_secured_message + ../../build/bin/test_spdm_crypt diff --git a/.github/workflows/libssh2.yml b/.github/workflows/libssh2.yml index 121595954f..1658cbbbb8 100644 --- a/.github/workflows/libssh2.yml +++ b/.github/workflows/libssh2.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL # Just to keep it the same as the testing target if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -47,7 +47,7 @@ jobs: ref: [ 1.11.0 ] name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 8 needs: build_wolfssl diff --git a/.github/workflows/libvncserver.yml b/.github/workflows/libvncserver.yml index 942b7aa3ff..371ba2a56b 100644 --- a/.github/workflows/libvncserver.yml +++ b/.github/workflows/libvncserver.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL # Just to keep it the same as the testing target if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -47,7 +47,7 @@ jobs: ref: [ 0.9.13 ] name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: build_wolfssl steps: - name: Download lib diff --git a/.github/workflows/mbedtls.sh b/.github/workflows/mbedtls.sh new file mode 100644 index 0000000000..d199fd2e3d --- /dev/null +++ b/.github/workflows/mbedtls.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + +set -e +set -x + +# Basic TLS test +./mbedtls/build/programs/ssl/ssl_server2 > /tmp/server.log 2>&1 & +SERVER_PID=$! +sleep 0.1 +./mbedtls/build/programs/ssl/ssl_client2 # Confirm working with mbed +env -C wolfssl ./examples/client/client -p 4433 -g \ + -A ../mbedtls/framework/data_files/test-ca-sha256.crt \ + -c ../mbedtls/framework/data_files/cli-rsa-sha256.crt \ + -k ../mbedtls/framework/data_files/cli-rsa-sha256.key.pem +kill $SERVER_PID +sleep 0.1 +env -C wolfssl ./examples/server/server -p 4433 -i -g \ + -A ../mbedtls/framework/data_files/test-ca-sha256.crt \ + -c ../mbedtls/framework/data_files/server2-sha256.crt \ + -k ../mbedtls/framework/data_files/server2.key.pem > /tmp/server.log 2>&1 & +SERVER_PID=$! +sleep 0.1 +./mbedtls/build/programs/ssl/ssl_client2 +env -C wolfssl ./examples/client/client -p 4433 -g \ + -A ../mbedtls/framework/data_files/test-ca-sha256.crt \ + -c ../mbedtls/framework/data_files/cli-rsa-sha256.crt \ + -k ../mbedtls/framework/data_files/cli-rsa-sha256.key.pem +kill $SERVER_PID +sleep 0.1 + +# Basic DTLS test +./mbedtls/build/programs/ssl/ssl_server2 dtls=1 > /tmp/server.log 2>&1 & +SERVER_PID=$! +sleep 0.1 +./mbedtls/build/programs/ssl/ssl_client2 dtls=1 # Confirm working with mbed +env -C wolfssl ./examples/client/client -p 4433 -g -u \ + -A ../mbedtls/framework/data_files/test-ca-sha256.crt \ + -c ../mbedtls/framework/data_files/cli-rsa-sha256.crt \ + -k ../mbedtls/framework/data_files/cli-rsa-sha256.key.pem +kill $SERVER_PID +sleep 0.1 +env -C wolfssl ./examples/server/server -p 4433 -i -g -u \ + -A ../mbedtls/framework/data_files/test-ca-sha256.crt \ + -c ../mbedtls/framework/data_files/server2-sha256.crt \ + -k ../mbedtls/framework/data_files/server2.key.pem > /tmp/server.log 2>&1 & +SERVER_PID=$! +sleep 0.1 +env -C wolfssl ./examples/client/client -p 4433 -g -u \ + -A ../mbedtls/framework/data_files/test-ca-sha256.crt \ + -c ../mbedtls/framework/data_files/cli-rsa-sha256.crt \ + -k ../mbedtls/framework/data_files/cli-rsa-sha256.key.pem +./mbedtls/build/programs/ssl/ssl_client2 dtls=1 +kill $SERVER_PID +sleep 0.1 + +# DTLS 1.2 CID test +./mbedtls/build/programs/ssl/ssl_server2 dtls=1 cid=1 cid_val=121212 > /tmp/server.log 2>&1 & +SERVER_PID=$! +sleep 0.1 +./mbedtls/build/programs/ssl/ssl_client2 dtls=1 cid=1 cid_val=232323 # Confirm working with mbed +env -C wolfssl ./examples/client/client -p 4433 -g -u --cid 232323 \ + -A ../mbedtls/framework/data_files/test-ca-sha256.crt \ + -c ../mbedtls/framework/data_files/cli-rsa-sha256.crt \ + -k ../mbedtls/framework/data_files/cli-rsa-sha256.key.pem +kill $SERVER_PID +sleep 0.1 +env -C wolfssl ./examples/server/server -p 4433 -i -g -u --cid 121212 \ + -A ../mbedtls/framework/data_files/test-ca-sha256.crt \ + -c ../mbedtls/framework/data_files/server2-sha256.crt \ + -k ../mbedtls/framework/data_files/server2.key.pem > /tmp/server.log 2>&1 & +SERVER_PID=$! +sleep 0.1 +./mbedtls/build/programs/ssl/ssl_client2 dtls=1 cid_val=232323 +env -C wolfssl ./examples/client/client -p 4433 -g -u --cid 232323 \ + -A ../mbedtls/framework/data_files/test-ca-sha256.crt \ + -c ../mbedtls/framework/data_files/cli-rsa-sha256.crt \ + -k ../mbedtls/framework/data_files/cli-rsa-sha256.key.pem +kill $SERVER_PID +sleep 0.1 diff --git a/.github/workflows/mbedtls.yml b/.github/workflows/mbedtls.yml new file mode 100644 index 0000000000..f9830fcf6e --- /dev/null +++ b/.github/workflows/mbedtls.yml @@ -0,0 +1,86 @@ +name: mbedtls interop Tests + +# START OF COMMON SECTION +on: + push: + branches: [ 'master', 'main', 'release/**' ] + pull_request: + branches: [ '*' ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +# END OF COMMON SECTION + +env: + MBED_REF: v3.6.2 + +jobs: + build_mbedtls: + name: Build mbedtls + if: github.repository_owner == 'wolfssl' + runs-on: ubuntu-latest + # This should be a safe limit for the tests to run. + timeout-minutes: 10 + steps: + - name: Checking if we have mbed in cache + uses: actions/cache@v4 + id: cache + with: + path: mbedtls + key: mbedtls-${{ env.MBED_REF }} + lookup-only: true + + - name: Checkout mbedtls + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + repository: Mbed-TLS/mbedtls + ref: ${{ env.MBED_REF }} + path: mbedtls + + - name: Compile mbedtls + if: steps.cache.outputs.cache-hit != 'true' + working-directory: mbedtls + run: | + git submodule update --init + mkdir build + cd build + cmake .. + make -j + # convert key to pem format + openssl pkey -in framework/data_files/cli-rsa-sha256.key.der -text > framework/data_files/cli-rsa-sha256.key.pem + openssl pkey -in framework/data_files/server2.key.der -text > framework/data_files/server2.key.pem + + mbedtls_test: + name: Test interop with mbedtls + runs-on: ubuntu-latest + needs: build_mbedtls + timeout-minutes: 10 + if: github.repository_owner == 'wolfssl' + steps: + - name: Disable IPv6 (IMPORTANT, OTHERWISE DTLS MBEDTLS CLIENT WON'T CONNECT) + run: echo 1 | sudo tee /proc/sys/net/ipv6/conf/lo/disable_ipv6 + + - name: Checking if we have mbed in cache + uses: actions/cache/restore@v4 + id: cache + with: + path: mbedtls + key: mbedtls-${{ env.MBED_REF }} + fail-on-cache-miss: true + + - name: Build wolfSSL + uses: wolfSSL/actions-build-autotools-project@v1 + with: + path: wolfssl + configure: --enable-dtls --enable-dtlscid + install: false + check: false + + - name: Test interop + run: bash wolfssl/.github/workflows/mbedtls.sh + + - name: print server logs + if: ${{ failure() }} + run: cat /tmp/server.log diff --git a/.github/workflows/memcached.yml b/.github/workflows/memcached.yml index a111e30027..bdd0c0593e 100644 --- a/.github/workflows/memcached.yml +++ b/.github/workflows/memcached.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL # Just to keep it the same as the testing target if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Build wolfSSL uses: wolfSSL/actions-build-autotools-project@v1 @@ -48,7 +48,7 @@ jobs: - ref: 1.6.22 name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: build_wolfssl steps: - name: Download lib diff --git a/.github/workflows/mosquitto.yml b/.github/workflows/mosquitto.yml index 6d9961cc9e..5ba7e3a89f 100644 --- a/.github/workflows/mosquitto.yml +++ b/.github/workflows/mosquitto.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL # Just to keep it the same as the testing target if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -45,7 +45,7 @@ jobs: ref: [ 2.0.18 ] name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 needs: build_wolfssl diff --git a/.github/workflows/multi-arch.yml b/.github/workflows/multi-arch.yml index 33ea970ae5..729048a6cf 100644 --- a/.github/workflows/multi-arch.yml +++ b/.github/workflows/multi-arch.yml @@ -37,7 +37,7 @@ jobs: ARCH: armel EXTRA_OPTS: --enable-sp-asm if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 10 steps: diff --git a/.github/workflows/multi-compiler.yml b/.github/workflows/multi-compiler.yml index 0606833025..9f946796b1 100644 --- a/.github/workflows/multi-compiler.yml +++ b/.github/workflows/multi-compiler.yml @@ -21,16 +21,16 @@ jobs: include: - CC: gcc-9 CXX: g++-9 - OS: ubuntu-latest + OS: ubuntu-22.04 - CC: gcc-10 CXX: g++-10 - OS: ubuntu-latest + OS: ubuntu-22.04 - CC: gcc-11 CXX: g++-11 - OS: ubuntu-latest + OS: ubuntu-22.04 - CC: gcc-12 CXX: g++-12 - OS: ubuntu-latest + OS: ubuntu-22.04 - CC: clang-10 CXX: clang++-10 OS: ubuntu-20.04 @@ -42,10 +42,10 @@ jobs: OS: ubuntu-20.04 - CC: clang-13 CXX: clang++-13 - OS: ubuntu-latest + OS: ubuntu-22.04 - CC: clang-14 CXX: clang++-14 - OS: ubuntu-latest + OS: ubuntu-22.04 if: github.repository_owner == 'wolfssl' runs-on: ${{ matrix.OS }} # This should be a safe limit for the tests to run. diff --git a/.github/workflows/net-snmp.yml b/.github/workflows/net-snmp.yml index 0275e0f12c..7ce030b80c 100644 --- a/.github/workflows/net-snmp.yml +++ b/.github/workflows/net-snmp.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL if: github.repository_owner == 'wolfssl' # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -48,7 +48,7 @@ jobs: test_opts: -e 'agentxperl' name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 needs: build_wolfssl diff --git a/.github/workflows/nginx.yml b/.github/workflows/nginx.yml index e6729f11ea..868a02abaf 100644 --- a/.github/workflows/nginx.yml +++ b/.github/workflows/nginx.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL if: github.repository_owner == 'wolfssl' # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -107,7 +107,7 @@ jobs: stream_proxy_ssl_verify.t name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 6 needs: build_wolfssl diff --git a/.github/workflows/no-malloc.yml b/.github/workflows/no-malloc.yml index a5888caa47..25c9c82887 100644 --- a/.github/workflows/no-malloc.yml +++ b/.github/workflows/no-malloc.yml @@ -22,7 +22,7 @@ jobs: ] name: make check if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 6 steps: diff --git a/.github/workflows/nss.sh b/.github/workflows/nss.sh new file mode 100644 index 0000000000..8a78e0fd58 --- /dev/null +++ b/.github/workflows/nss.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -e +set -x + +# Setup nss cert db +mkdir nssdb +./dist/Debug/bin/certutil -d nssdb -N --empty-password +./dist/Debug/bin/certutil -d nssdb -A -a -i wolfssl/certs/test/server-localhost.pem \ + -t TCP -n 'wolf localhost' + +# App data for nss +echo Hello from nss > /tmp/in + +# TLS 1.3 test +env -C wolfssl ./examples/server/server -v 4 -p 4433 \ + -c certs/test/server-localhost.pem -d -w > /tmp/server.log 2>&1 & +sleep 0.1 +./dist/Debug/bin/tstclnt -V tls1.3: -h localhost -p 4433 -d nssdb -C -4 -A /tmp/in -v +sleep 0.1 + +# DTLS 1.3 test +env -C wolfssl ./examples/server/server -v 4 -p 4433 -u \ + -c certs/test/server-localhost.pem -d -w > /tmp/server.log 2>&1 & +sleep 0.1 +./dist/Debug/bin/tstclnt -V tls1.3: -P client -h localhost -p 4433 -d nssdb -C -4 -A /tmp/in -v +sleep 0.1 diff --git a/.github/workflows/nss.yml b/.github/workflows/nss.yml new file mode 100644 index 0000000000..e7d911bd15 --- /dev/null +++ b/.github/workflows/nss.yml @@ -0,0 +1,89 @@ +name: nss interop Tests + +### TODO uncomment stuff + +# START OF COMMON SECTION +on: + push: + branches: [ 'master', 'main', 'release/**' ] + pull_request: + branches: [ '*' ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +# END OF COMMON SECTION + +env: + NSS_REF: NSS_3_107_RTM + +jobs: + build_nss: + name: Build nss + if: github.repository_owner == 'wolfssl' + runs-on: ubuntu-22.04 + # This should be a safe limit for the tests to run. + timeout-minutes: 30 + steps: + - name: Checking if we have nss in cache + uses: actions/cache@v4 + id: cache + with: + path: dist + key: nss-${{ env.NSS_REF }} + lookup-only: true + + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: | + # Don't prompt for anything + export DEBIAN_FRONTEND=noninteractive + sudo apt-get update + # hostap dependencies + sudo apt-get install -y gyp ninja-build + + - name: Checkout nss + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + repository: nss-dev/nss + ref: ${{ env.NSS_REF }} + path: nss + + - name: Compile nss + if: steps.cache.outputs.cache-hit != 'true' + run: | + hg clone https://hg.mozilla.org/projects/nspr + cd nss + ./build.sh + + nss_test: + name: Test interop with nss + runs-on: ubuntu-22.04 + needs: build_nss + timeout-minutes: 10 + if: github.repository_owner == 'wolfssl' + steps: + - name: Checking if we have nss in cache + uses: actions/cache/restore@v4 + id: cache + with: + path: dist + key: nss-${{ env.NSS_REF }} + fail-on-cache-miss: true + + - name: Build wolfSSL + uses: wolfSSL/actions-build-autotools-project@v1 + with: + path: wolfssl + configure: --enable-dtls --enable-dtls13 + install: false + check: false + + - name: Test interop + run: bash wolfssl/.github/workflows/nss.sh + + - name: print server logs + if: ${{ failure() }} + run: | + cat /tmp/server.log diff --git a/.github/workflows/ntp.yml b/.github/workflows/ntp.yml index 89f330f9a9..56e405f089 100644 --- a/.github/workflows/ntp.yml +++ b/.github/workflows/ntp.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL if: github.repository_owner == 'wolfssl' # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -47,7 +47,7 @@ jobs: ref: [ 4.2.8p15 ] name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 10 needs: build_wolfssl diff --git a/.github/workflows/ocsp.yml b/.github/workflows/ocsp.yml index fab41650ab..b7c8f8ef5f 100644 --- a/.github/workflows/ocsp.yml +++ b/.github/workflows/ocsp.yml @@ -16,7 +16,7 @@ jobs: ocsp_stapling: name: ocsp stapling if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 10 steps: - name: Checkout wolfSSL diff --git a/.github/workflows/openldap.yml b/.github/workflows/openldap.yml index 950435b5cc..e20743118e 100644 --- a/.github/workflows/openldap.yml +++ b/.github/workflows/openldap.yml @@ -16,7 +16,7 @@ jobs: build_wolfssl: name: Build wolfSSL # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -47,7 +47,7 @@ jobs: - osp_ref: 2.5.13 git_ref: OPENLDAP_REL_ENG_2_5_13 name: ${{ matrix.osp_ref }} - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 20 needs: build_wolfssl diff --git a/.github/workflows/openssh.yml b/.github/workflows/openssh.yml index 586d21edfa..83b122773c 100644 --- a/.github/workflows/openssh.yml +++ b/.github/workflows/openssh.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL if: github.repository_owner == 'wolfssl' # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -49,7 +49,7 @@ jobs: osp_ver: '9.6' name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: build_wolfssl steps: - name: Download lib diff --git a/.github/workflows/openvpn.yml b/.github/workflows/openvpn.yml index b9ae65114e..9746301451 100644 --- a/.github/workflows/openvpn.yml +++ b/.github/workflows/openvpn.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL if: github.repository_owner == 'wolfssl' # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -46,7 +46,7 @@ jobs: ref: [ release/2.6, master ] name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 10 needs: build_wolfssl diff --git a/.github/workflows/os-check.yml b/.github/workflows/os-check.yml index d4c1a8bc22..223ac8c300 100644 --- a/.github/workflows/os-check.yml +++ b/.github/workflows/os-check.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-latest ] + os: [ ubuntu-22.04, macos-latest ] config: [ # Add new configs here '', @@ -57,7 +57,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-latest ] + os: [ ubuntu-22.04, macos-latest ] user-settings: [ # Add new user_settings.h here 'examples/configs/user_settings_all.h', @@ -79,7 +79,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-latest ] + os: [ ubuntu-22.04, macos-latest ] user-settings: [ # Add new user_settings.h here 'examples/configs/user_settings_min_ecc.h', @@ -109,7 +109,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-latest ] + os: [ ubuntu-22.04, macos-latest ] name: make user_setting.h (with sed) if: github.repository_owner == 'wolfssl' runs-on: ${{ matrix.os }} diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index 83eff907a7..e498e33af9 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -16,7 +16,7 @@ jobs: build_wolfssl: name: Package wolfSSL if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 10 steps: diff --git a/.github/workflows/pam-ipmi.yml b/.github/workflows/pam-ipmi.yml index ec254d6f3d..22da7d6b63 100644 --- a/.github/workflows/pam-ipmi.yml +++ b/.github/workflows/pam-ipmi.yml @@ -18,7 +18,7 @@ jobs: name: Build wolfSSL if: github.repository_owner == 'wolfssl' # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -48,7 +48,7 @@ jobs: git_ref: [ e4b13e6725abb178f62ee897fe1c0e81b06a9431 ] name: ${{ matrix.git_ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: build_wolfssl steps: - name: Install dependencies diff --git a/.github/workflows/rng-tools.yml b/.github/workflows/rng-tools.yml index 859c6e6bdd..44d3a20e20 100644 --- a/.github/workflows/rng-tools.yml +++ b/.github/workflows/rng-tools.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL if: github.repository_owner == 'wolfssl' # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -47,7 +47,7 @@ jobs: ref: [ 6.16 ] name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 needs: build_wolfssl diff --git a/.github/workflows/socat.yml b/.github/workflows/socat.yml index fe3da235b5..3d6d8fa58d 100644 --- a/.github/workflows/socat.yml +++ b/.github/workflows/socat.yml @@ -16,7 +16,7 @@ jobs: build_wolfssl: name: Build wolfSSL if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 4 steps: - name: Build wolfSSL @@ -39,7 +39,7 @@ jobs: socat_check: if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 30 needs: build_wolfssl diff --git a/.github/workflows/softhsm.yml b/.github/workflows/softhsm.yml index 1f30a7cff6..bb3824d174 100644 --- a/.github/workflows/softhsm.yml +++ b/.github/workflows/softhsm.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL if: github.repository_owner == 'wolfssl' # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 10 steps: @@ -47,7 +47,7 @@ jobs: ref: [ 2.6.1 ] name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 20 needs: build_wolfssl diff --git a/.github/workflows/sssd.yml b/.github/workflows/sssd.yml index 7ab859133a..4ef3a7968f 100644 --- a/.github/workflows/sssd.yml +++ b/.github/workflows/sssd.yml @@ -17,7 +17,7 @@ jobs: if: github.repository_owner == 'wolfssl' name: Build wolfSSL # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -47,7 +47,7 @@ jobs: # List of releases to test ref: [ 2.9.1 ] name: ${{ matrix.ref }} - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 container: image: quay.io/sssd/ci-client-devel:ubuntu-latest env: diff --git a/.github/workflows/stunnel.yml b/.github/workflows/stunnel.yml index 0bef67a8f6..701a4e51b0 100644 --- a/.github/workflows/stunnel.yml +++ b/.github/workflows/stunnel.yml @@ -17,7 +17,7 @@ jobs: name: Build wolfSSL if: github.repository_owner == 'wolfssl' # Just to keep it the same as the testing target - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 steps: @@ -46,7 +46,7 @@ jobs: ref: [ 5.67 ] name: ${{ matrix.ref }} if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 4 needs: build_wolfssl diff --git a/.github/workflows/zephyr.yml b/.github/workflows/zephyr.yml index 0582154c8f..3bd2978a5a 100644 --- a/.github/workflows/zephyr.yml +++ b/.github/workflows/zephyr.yml @@ -26,7 +26,7 @@ jobs: - zephyr-ref: v2.7.4 zephyr-sdk: 0.16.3 if: github.repository_owner == 'wolfssl' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # This should be a safe limit for the tests to run. timeout-minutes: 25 steps: diff --git a/.wolfssl_known_macro_extras b/.wolfssl_known_macro_extras index 7f39547e64..9c32e038da 100644 --- a/.wolfssl_known_macro_extras +++ b/.wolfssl_known_macro_extras @@ -216,8 +216,6 @@ HAVE_ECC512 HAVE_ECC_CDH_CAST HAVE_ECC_SM2 HAVE_ESP_CLK -HAVE_EX_DATA_CRYPTO -HAVE_EX_DATA_CLEANUP_HOOKS HAVE_FACON HAVE_FIPS_VERSION_PORT HAVE_FUZZER @@ -463,6 +461,7 @@ STM32L475xx STM32L4A6xx STM32L552xx STM32L562xx +STM32MP135Fxx STM32U575xx STM32U585xx STM32U5A9xx @@ -540,7 +539,6 @@ WC_RSA_NO_FERMAT_CHECK WC_SHA384 WC_SHA384_DIGEST_SIZE WC_SHA512 -WC_SHA512_DIGEST_SIZE WC_SSIZE_TYPE WC_STRICT_SIG WC_XMSS_FULL_HASH @@ -548,6 +546,7 @@ WOLFCRYPT_FIPS_CORE_DYNAMIC_HASH_VALUE WOLFSENTRY_H WOLFSENTRY_NO_JSON WOLFSSL_32BIT_MILLI_TIME +WOLFSSL_AARCH64_PRIVILEGE_MODE WOLFSSL_AESNI_BY4 WOLFSSL_AESNI_BY6 WOLFSSL_AFTER_DATE_CLOCK_SKEW @@ -598,6 +597,7 @@ WOLFSSL_CLANG_TIDY WOLFSSL_COMMERCIAL_LICENSE WOLFSSL_CONTIKI WOLFSSL_CRL_ALLOW_MISSING_CDP +WOLFSSL_CUSTOM_CONFIG WOLFSSL_DILITHIUM_ASSIGN_KEY WOLFSSL_DILITHIUM_MAKE_KEY_SMALL_MEM WOLFSSL_DILITHIUM_NO_ASN1 @@ -681,6 +681,7 @@ WOLFSSL_MULTICIRCULATE_ALTNAMELIST WOLFSSL_NONBLOCK_OCSP WOLFSSL_NOSHA3_384 WOLFSSL_NOT_WINDOWS_API +WOLFSSL_NO_AES_CFB_1_8 WOLFSSL_NO_BIO_ADDR_IN WOLFSSL_NO_CLIENT WOLFSSL_NO_CLIENT_CERT_ERROR @@ -722,6 +723,7 @@ WOLFSSL_NRF51_AES WOLFSSL_OLDTLS_AEAD_CIPHERSUITES WOLFSSL_OLDTLS_SHA2_CIPHERSUITES WOLFSSL_OLD_SET_CURVES_LIST +WOLFSSL_OLD_TIMINGPADVERIFY WOLFSSL_OLD_UNSUPPORTED_EXTENSION WOLFSSL_OPTIONS_IGNORE_SYS WOLFSSL_PASSTHRU_ERR @@ -747,7 +749,6 @@ WOLFSSL_RENESAS_RA6M3G WOLFSSL_RENESAS_RSIP WOLFSSL_RENESAS_RZN2L WOLFSSL_RENESAS_TLS -WOLFSSL_RENESAS_TSIP_CRYPTONLY WOLFSSL_RENESAS_TSIP_IAREWRX WOLFSSL_RSA_CHECK_D_ON_DECRYPT WOLFSSL_RSA_DECRYPT_TO_0_LEN @@ -814,7 +815,6 @@ WOLFSSL_XILINX_PATCH WOLFSSL_XIL_MSG_NO_SLEEP WOLFSSL_XMSS_LARGE_SECRET_KEY WOLFSSL_ZEPHYR -WOLFSS_SP_MATH_ALL WOLF_ALLOW_BUILTIN WOLF_CONF_IO WOLF_CONF_KYBER @@ -825,10 +825,8 @@ WOLF_CRYPTO_CB_CMD WOLF_CRYPTO_CB_FIND WOLF_CRYPTO_CB_ONLY_ECC WOLF_CRYPTO_CB_ONLY_RSA -WOLF_CRYPTO_CB_RSA_PAD WOLF_CRYPTO_DEV WOLF_NO_TRAILING_ENUM_COMMAS -WOLSSL_OLD_TIMINGPADVERIFY XGETPASSWD XMSS_CALL_PRF_KEYGEN XPAR_VERSAL_CIPS_0_PSPMC_0_PSV_CORTEXA72_0_TIMESTAMP_CLK_FREQ @@ -855,6 +853,7 @@ _UINTPTR_T_DECLARED _WIN32 _WIN32_WCE _WIN64 +_XOPEN_SOURCE_EXTENDED __32MZ2048ECH144__ __32MZ2048ECM144__ __32MZ2048EFM144__ @@ -869,6 +868,7 @@ __ARCH_STRNCPY_NO_REDIRECT __ARCH_STRSTR_NO_REDIRECT __ARM_ARCH_7M__ __ARM_FEATURE_CRYPTO +__ASSEMBLER__ __ATOMIC_RELAXED __AVR__ __BCPLUSPLUS__ @@ -905,6 +905,7 @@ __MINGW32__ __MINGW64_VERSION_MAJOR __MINGW64__ __MWERKS__ +__OpenBSD__ __PIE__ __POWERPC__ __PPC__ diff --git a/IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt index 54971360fc..e0591fce6a 100644 --- a/IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt @@ -3,10 +3,12 @@ # # The following lines of boilerplate have to be in your project's # CMakeLists in this exact order for cmake to work correctly +message(STATUS "Begin project ${CMAKE_PROJECT_NAME}") + cmake_minimum_required(VERSION 3.16) # Optional no watchdog typically used for test & benchmark -add_compile_options(-DWOLFSSL_ESP_NO_WATCHDOG=1) +add_compile_definitions(WOLFSSL_ESP_NO_WATCHDOG=1) # The wolfSSL CMake file should be able to find the source code. # Otherwise, assign an environment variable or set it here: @@ -25,34 +27,63 @@ add_compile_options(-DWOLFSSL_ESP_NO_WATCHDOG=1) if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() # End optional WOLFSSL_CMAKE_SYSTEM_NAME +# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. +# set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +string(REPLACE "\\" "/" PROTOCOL_EXAMPLES_DIR "$ENV{IDF_PATH}/examples/common_components/protocol_examples_common") + +if (EXISTS "${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR") +else() + message(STATUS "NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") +endif() + +# Find the user name to search for possible "wolfssl-username" +# Reminder: Windows is %USERNAME%, Linux is $USER +message(STATUS "USERNAME = $ENV{USERNAME}") +if( "$ENV{USER}" STREQUAL "" ) # the bash user + if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user + message(STATUS "could not find USER or USERNAME") + else() + # the bash user is not blank, so we'll use it. + set(THIS_USER "$ENV{USERNAME}") + endif() +else() + # the bash user is not blank, so we'll use it. + set(THIS_USER "$ENV{USER}") +endif() +message(STATUS "THIS_USER = ${THIS_USER}") + # Check that there are not conflicting wolfSSL components # The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl # The local component wolfSSL directory will be in ./components/wolfssl +message(STATUS "Checking for wolfSSL as Managed Component or not... ${CMAKE_HOME_DIRECTORY}") if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" ) # These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake' # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL) @@ -67,16 +98,46 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXI message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n" "If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove " "or rename the idf_component.yml file typically found in ./main/") -else() +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl") + # A standard project component (not a Managed Component) message(STATUS "No conflicting wolfSSL components found.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/components/wolfssl") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl") + # The official Managed Component called wolfssl from the wolfssl user. + message(STATUS "No conflicting wolfSSL components found as a Managed Component.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/gojimmypi__mywolfssl") + # There is a known gojimmypi staging component available for anyone: + message(STATUS "No conflicting wolfSSL components found as a gojimmypi staging Managed Component.") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/${THIS_USER}__mywolfssl") + # Other users with permissions might publish their own mywolfssl staging Managed Component + message(STATUS "No conflicting wolfSSL components found as a Managed Component.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/managed_components/${THIS_USER}__mywolfssl") +else() + message(STATUS "WARNING: wolfssl component directory not found.") endif() -# Ensure the this wolfSSL component directory is included -set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/components/wolfssl") -list(APPEND EXTRA_COMPONENT_DIRS ${WOLFSSL_PATH}) +# message(STATUS "EXTRA_COMPONENT_DIRS WOLFSSL_PATH: ${WOLFSSL_PATH}") +# list(APPEND EXTRA_COMPONENT_DIRS ${WOLFSSL_PATH}) # Not only is a project-level "set(COMPONENTS" not needed here, this will cause # an unintuitive error about Unknown CMake command "esptool_py_flash_project_args". + +message(STATUS "begin optional PROTOCOL_EXAMPLES_DIR include") +if(0) + # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. + set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) + + if (EXISTS "${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR") + else() + message(STATUS "NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + endif() +endif() include($ENV{IDF_PATH}/tools/cmake/project.cmake) +message(STATUS "end optional include") project(wolfssl_template) +message(STATUS "end project") diff --git a/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/CMakeLists.txt index 8b90966f9b..6869f4f881 100644 --- a/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/CMakeLists.txt @@ -102,28 +102,28 @@ if(VERBOSE_COMPONENT_MESSAGES) if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() endif() # End optional WOLFSSL_CMAKE_SYSTEM_NAME @@ -159,7 +159,8 @@ else() set(COMPONENT_REQUIRES lwip "${THIS_ESP_TLS}") # we typically don't need lwip directly in wolfssl component endif() -# find the user name to search for possible "wolfssl-username" +# Find the user name to search for possible "wolfssl-username" +# Reminder: Windows is %USERNAME%, Linux is $USER message(STATUS "USERNAME = $ENV{USERNAME}") if( "$ENV{USER}" STREQUAL "" ) # the bash user if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user @@ -524,7 +525,7 @@ else() set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl") string(REPLACE "/" "//" STR_WOLFSSL_PROJECT_DIR "${WOLFSSL_PROJECT_DIR}") - add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}/include/user_settings.h") + add_compile_definitions(WOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}/include/user_settings.h") message(STATUS "Added definition for user_settings.h: -DWOLFSSL_USER_SETTINGS_DIR=\"${STR_WOLFSSL_PROJECT_DIR}//include//user_settings.h\"") # Espressif may take several passes through this makefile. Check to see if we found IDF string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF) @@ -951,7 +952,7 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") # the interesting part is defining the VAR_OUPUT name a value to use in the app - add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + add_compile_definitions(${VAR_OUPUT}=\"${VAR_VALUE}\") else() # if we get here, check the execute_process command and parameters. message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") @@ -959,9 +960,16 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) endif() endfunction() # LIBWOLFSSL_SAVE_INFO +execute_process( + COMMAND ${git_cmd} "rev-parse" "--is-inside-work-tree" + OUTPUT_VARIABLE IS_GIT_REPO + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + # create some programmatic #define values that will be used by ShowExtendedSystemInfo(). # see wolfcrypt\src\port\Espressif\esp32_utl.c -if(NOT CMAKE_BUILD_EARLY_EXPANSION AND WOLFSSL_ROOT) +if(NOT CMAKE_BUILD_EARLY_EXPANSION AND WOLFSSL_ROOT AND (IS_GIT_REPO STREQUAL "true")) set (git_cmd "git") message(STATUS "Adding macro definitions:") diff --git a/IDE/Espressif/ESP-IDF/examples/template/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/template/main/CMakeLists.txt index 3d72464657..3a360077d4 100644 --- a/IDE/Espressif/ESP-IDF/examples/template/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/template/main/CMakeLists.txt @@ -3,33 +3,34 @@ # # wolfssl template # +message(STATUS "Begin wolfSSL main CMakeLists.txt") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() set (git_cmd "git") @@ -43,10 +44,20 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") endif() +# The wolfSL component name is named "mywolfssl" on the staging site for Managed Components. +if( NOT EXISTS "../components/wolfssl" AND ("$ENV{IDF_COMPONENT_REGISTRY_URL}" STREQUAL "https://components-staging.espressif.com") ) + message(STATUS "WARNING: Using a staging instance of wolfssl.") + set(MAIN_WOLFSSL_COMPONENT_NAME "mywolfssl") +else() + message(STATUS "Using release wolfssl component.") + set(MAIN_WOLFSSL_COMPONENT_NAME "wolfssl") +endif() + ## register_component() idf_component_register(SRCS main.c INCLUDE_DIRS "." - "./include") + "./include" + PRIV_REQUIRES driver "${MAIN_WOLFSSL_COMPONENT_NAME}") # # LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT) @@ -76,15 +87,24 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") # the interesting part is defining the VAR_OUPUT name a value to use in the app - add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + add_compile_definitions(${VAR_OUPUT}=\"${VAR_VALUE}\") else() # if we get here, check the execute_process command and parameters. - message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") + message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT.") + message(STATUS "Setting ${VAR_OUPUT} to \"Unknown\"") set(${VAR_OUPUT} "Unknown") endif() endfunction() # LIBWOLFSSL_SAVE_INFO -if(NOT CMAKE_BUILD_EARLY_EXPANSION) +execute_process( + COMMAND ${git_cmd} "rev-parse" "--is-inside-work-tree" + OUTPUT_VARIABLE IS_GIT_REPO + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + +# Save some project-specific details. Repo may be different than component, or may not even be a repo at all: +if(NOT CMAKE_BUILD_EARLY_EXPANSION AND (IS_GIT_REPO STREQUAL "true")) # LIBWOLFSSL_VERSION_GIT_HASH execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}") @@ -100,3 +120,4 @@ endif() message(STATUS "") +message(STATUS "End wolfSSL main CMakeLists.txt") diff --git a/IDE/Espressif/ESP-IDF/examples/template/sdkconfig.defaults b/IDE/Espressif/ESP-IDF/examples/template/sdkconfig.defaults index c3b5367a69..8b167b2d48 100644 --- a/IDE/Espressif/ESP-IDF/examples/template/sdkconfig.defaults +++ b/IDE/Espressif/ESP-IDF/examples/template/sdkconfig.defaults @@ -1,10 +1,13 @@ # Set the known example app config to template example (see user_settings.h) CONFIG_WOLFSSL_EXAMPLE_NAME_TEMPLATE=y +# CONFIG_EXAMPLE_WIFI_SSID="myssid" +# CONFIG_EXAMPLE_WIFI_PASSWORD="mypassword" # Some wolfSSL helpers CONFIG_USE_WOLFSSL_ESP_SDK_TIME=y - +# sdkconfig.defaults for ESP8266 + ESP32 +# See separate sdkconfig.defaults.esp8266 # FreeRTOS ticks at 1ms interval CONFIG_FREERTOS_UNICORE=y CONFIG_FREERTOS_HZ=1000 @@ -18,9 +21,10 @@ CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y # # For wolfSSL SMALL_STACK, 3072 bytes should be sufficient for benchmark app. # When using RSA, assign at least 10500 bytes, otherwise 5500 usually works for others -CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584 -# Legacy stack size for older ESP-IDF versions -CONFIG_MAIN_TASK_STACK_SIZE=3584 +# We set this to 28672 for use in the "test everything possible" in the wolfssl_test app. +CONFIG_ESP_MAIN_TASK_STACK_SIZE=10500 +# Legacy stack size name for older ESP-IDF versions +CONFIG_MAIN_TASK_STACK_SIZE=10500 # # Benchmark must not have CONFIG_NEWLIB_NANO_FORMAT enabled @@ -61,8 +65,8 @@ CONFIG_HEAP_DISABLE_IRAM=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y # Enable wolfSSL TLS in esp-tls -CONFIG_ESP_TLS_USING_WOLFSSL=y -CONFIG_TLS_STACK_WOLFSSL=y +# CONFIG_ESP_TLS_USING_WOLFSSL=y +# CONFIG_TLS_STACK_WOLFSSL=y # Bundles take up flash space and are disabled unless otherwise known to be needed CONFIG_WOLFSSL_CERTIFICATE_BUNDLE=n @@ -87,6 +91,13 @@ CONFIG_HEAP_DISABLE_IRAM=y # Performance # CONFIG_COMPILER_OPTIMIZATION_PERF=y +# Set max COU frequency (falls back as needed for lower maximum) +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y + +# FreeRTOS ticks at 1ms interval +CONFIG_FREERTOS_UNICORE=y +CONFIG_FREERTOS_HZ=1000 + # Ensure mbedTLS options are disabled # CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=n # CONFIG_MBEDTLS_TLS_CLIENT_ONLY=n diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/CMakeLists.txt index f11fcd13e2..aa794e0b4f 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/CMakeLists.txt @@ -3,10 +3,12 @@ # # The following lines of boilerplate have to be in your project's # CMakeLists in this exact order for cmake to work correctly +message(STATUS "Begin project ${CMAKE_PROJECT_NAME}") + cmake_minimum_required(VERSION 3.16) # Optional no watchdog typically used for test & benchmark -add_compile_options(-DWOLFSSL_ESP_NO_WATCHDOG=1) +add_compile_definitions(WOLFSSL_ESP_NO_WATCHDOG=1) # The wolfSSL CMake file should be able to find the source code. # Otherwise, assign an environment variable or set it here: @@ -25,34 +27,35 @@ add_compile_options(-DWOLFSSL_ESP_NO_WATCHDOG=1) if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() # End optional WOLFSSL_CMAKE_SYSTEM_NAME # Check that there are not conflicting wolfSSL components # The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl # The local component wolfSSL directory will be in ./components/wolfssl +message(STATUS "Checking for wolfSSL as Managed Component or not... ${CMAKE_HOME_DIRECTORY}") if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" ) # These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake' # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL) @@ -67,16 +70,46 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXI message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n" "If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove " "or rename the idf_component.yml file typically found in ./main/") -else() +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl") + # A standard project component (not a Managed Component) message(STATUS "No conflicting wolfSSL components found.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/components/wolfssl") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl") + # The official Managed Component called wolfssl from the wolfssl user. + message(STATUS "No conflicting wolfSSL components found as a Managed Component.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/gojimmypi__mywolfssl") + # There is a known gojimmypi staging component available for anyone: + message(STATUS "No conflicting wolfSSL components found as a gojimmypi staging Managed Component.") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/${THIS_USER}__mywolfssl") + # Other users with permissions might publish their own mywolfssl staging Managed Component + message(STATUS "No conflicting wolfSSL components found as a Managed Component.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/managed_components/${THIS_USER}__mywolfssl") +else() + message(STATUS "WARNING: wolfssl component directory not found.") endif() -# Ensure the this wolfSSL component directory is included -set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/components/wolfssl") -list(APPEND EXTRA_COMPONENT_DIRS ${WOLFSSL_PATH}) +# message(STATUS "EXTRA_COMPONENT_DIRS WOLFSSL_PATH: ${WOLFSSL_PATH}") +# list(APPEND EXTRA_COMPONENT_DIRS ${WOLFSSL_PATH}) # Not only is a project-level "set(COMPONENTS" not needed here, this will cause # an unintuitive error about Unknown CMake command "esptool_py_flash_project_args". + +message(STATUS "begin optional PROTOCOL_EXAMPLES_DIR include") +if(0) + # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. + set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) + + if (EXISTS "${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR") + else() + message(STATUS "NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + endif() +endif() include($ENV{IDF_PATH}/tools/cmake/project.cmake) +message(STATUS "end optional include") project(wolfssl_benchmark) +message(STATUS "end project") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt index 8b90966f9b..83c7f93ef5 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt @@ -102,28 +102,28 @@ if(VERBOSE_COMPONENT_MESSAGES) if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() endif() # End optional WOLFSSL_CMAKE_SYSTEM_NAME @@ -524,7 +524,7 @@ else() set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl") string(REPLACE "/" "//" STR_WOLFSSL_PROJECT_DIR "${WOLFSSL_PROJECT_DIR}") - add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}/include/user_settings.h") + add_compile_definitions(WOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}/include/user_settings.h") message(STATUS "Added definition for user_settings.h: -DWOLFSSL_USER_SETTINGS_DIR=\"${STR_WOLFSSL_PROJECT_DIR}//include//user_settings.h\"") # Espressif may take several passes through this makefile. Check to see if we found IDF string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF) @@ -951,7 +951,7 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") # the interesting part is defining the VAR_OUPUT name a value to use in the app - add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + add_compile_definitions(${VAR_OUPUT}=\"${VAR_VALUE}\") else() # if we get here, check the execute_process command and parameters. message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") @@ -959,9 +959,16 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) endif() endfunction() # LIBWOLFSSL_SAVE_INFO +execute_process( + COMMAND ${git_cmd} "rev-parse" "--is-inside-work-tree" + OUTPUT_VARIABLE IS_GIT_REPO + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + # create some programmatic #define values that will be used by ShowExtendedSystemInfo(). # see wolfcrypt\src\port\Espressif\esp32_utl.c -if(NOT CMAKE_BUILD_EARLY_EXPANSION AND WOLFSSL_ROOT) +if(NOT CMAKE_BUILD_EARLY_EXPANSION AND WOLFSSL_ROOT AND (IS_GIT_REPO STREQUAL "true")) set (git_cmd "git") message(STATUS "Adding macro definitions:") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt index bb71f4b282..7160bec7f9 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt @@ -8,6 +8,32 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") set(COMPONENT_SRCS "main.c") set(COMPONENT_ADD_INCLUDEDIRS ".") +if(WIN32) + # Windows-specific configuration here + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") + message(STATUS "Detected Windows") +endif() +if(CMAKE_HOST_UNIX) + message(STATUS "Detected UNIX") +endif() +if(APPLE) + message(STATUS "Detected APPLE") +endif() +if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") + # Windows-specific configuration here + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") + message(STATUS "Detected WSL") +endif() +if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) + # Windows-specific configuration here + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") + message(STATUS "Detected Linux") +endif() +if(APPLE) + # Windows-specific configuration here + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") + message(STATUS "Detected Apple") +endif() set (git_cmd "git") if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) @@ -20,9 +46,20 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") endif() +# The wolfSL component name is named "mywolfssl" on the staging site for Managed Components. +if( NOT EXISTS "../components/wolfssl" AND ("$ENV{IDF_COMPONENT_REGISTRY_URL}" STREQUAL "https://components-staging.espressif.com") ) + message(STATUS "WARNING: Using a staging instance of wolfssl.") + set(MAIN_WOLFSSL_COMPONENT_NAME "mywolfssl") +else() + message(STATUS "Using release wolfssl component.") + set(MAIN_WOLFSSL_COMPONENT_NAME "wolfssl") +endif() + +## register_component() idf_component_register(SRCS main.c INCLUDE_DIRS "." - "./include") + "./include" + PRIV_REQUIRES driver "${MAIN_WOLFSSL_COMPONENT_NAME}") # # LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT) @@ -52,15 +89,24 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") # the interesting part is defining the VAR_OUPUT name a value to use in the app - add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + add_compile_definitions(${VAR_OUPUT}=\"${VAR_VALUE}\") else() # if we get here, check the execute_process command and parameters. - message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") + message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT.") + message(STATUS "Setting ${VAR_OUPUT} to \"Unknown\"") set(${VAR_OUPUT} "Unknown") endif() endfunction() # LIBWOLFSSL_SAVE_INFO -if(NOT CMAKE_BUILD_EARLY_EXPANSION) +execute_process( + COMMAND ${git_cmd} "rev-parse" "--is-inside-work-tree" + OUTPUT_VARIABLE IS_GIT_REPO + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + +# Save some project-specific details. Repo may be different than component, or may not even be a repo at all: +if(NOT CMAKE_BUILD_EARLY_EXPANSION AND (IS_GIT_REPO STREQUAL "true")) # LIBWOLFSSL_VERSION_GIT_HASH execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}") @@ -76,3 +122,4 @@ endif() message(STATUS "") +message(STATUS "End wolfSSL main CMakeLists.txt") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/sdkconfig.defaults b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/sdkconfig.defaults index 5dd65ae9d4..cd3798c80f 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/sdkconfig.defaults +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/sdkconfig.defaults @@ -1,12 +1,13 @@ # Set the known example app config to template example (see user_settings.h) CONFIG_WOLFSSL_EXAMPLE_NAME_WOLFSSL_BENCHMARK=y +# CONFIG_EXAMPLE_WIFI_SSID="myssid" +# CONFIG_EXAMPLE_WIFI_PASSWORD="mypassword" # Some wolfSSL helpers CONFIG_USE_WOLFSSL_ESP_SDK_TIME=y # sdkconfig.defaults for ESP8266 + ESP32 # Note that during the build process, settings from sdkconfig.defaults will not override those already in sdkconfig. -# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#custom-sdkconfig-defaults CONFIG_BENCH_ARGV="-lng 0" # FreeRTOS ticks at 1ms interval CONFIG_FREERTOS_UNICORE=y @@ -24,7 +25,7 @@ CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y # We set this to 28672 for use in the "test everything possible" in the wolfssl_test app. CONFIG_ESP_MAIN_TASK_STACK_SIZE=28672 -# Legacy stack size for older ESP-IDF versions +# Legacy stack size name for older ESP-IDF versions CONFIG_MAIN_TASK_STACK_SIZE=28672 # @@ -66,8 +67,8 @@ CONFIG_HEAP_DISABLE_IRAM=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y # Enable wolfSSL TLS in esp-tls -CONFIG_ESP_TLS_USING_WOLFSSL=y -CONFIG_TLS_STACK_WOLFSSL=y +# CONFIG_ESP_TLS_USING_WOLFSSL=y +# CONFIG_TLS_STACK_WOLFSSL=y # Bundles take up flash space and are disabled unless otherwise known to be needed CONFIG_WOLFSSL_CERTIFICATE_BUNDLE=n @@ -99,6 +100,26 @@ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_FREERTOS_UNICORE=y CONFIG_FREERTOS_HZ=1000 +# Ensure mbedTLS options are disabled +# CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=n +# CONFIG_MBEDTLS_TLS_CLIENT_ONLY=n +# CONFIG_MBEDTLS_TLS_SERVER=n +# CONFIG_MBEDTLS_TLS_CLIENT=n +# CONFIG_MBEDTLS_HARDWARE_AES=n +# CONFIG_MBEDTLS_HARDWARE_MPI=n +# CONFIG_MBEDTLS_HARDWARE_SHA=n +# CONFIG_MBEDTLS_ROM_MD5=n +# CONFIG_MBEDTLS_SSL_RENEGOTIATION=n +# CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=n +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1=n +# CONFIG_MBEDTLS_SSL_ALPN=n +# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=n +# CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=n + +# The same-name config is used for both WiFi and client/server TLS, so we cannot disable: +# CONFIG_MBEDTLS_TLS_ENABLED=n +# CONFIG_MBEDTLS_TLS_DISABLED=y + # # Compiler options # diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/CMakeLists.txt index 0518aedc2e..c6c17911ec 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/CMakeLists.txt @@ -1,5 +1,5 @@ # wolfSSL Espressif Example Project CMakeLists.txt -# v1.0 +# v1.3 # # The following lines of boilerplate have to be in your project's # CMakeLists in this exact order for cmake to work correctly @@ -7,6 +7,9 @@ message(STATUS "Begin project ${CMAKE_PROJECT_NAME}") cmake_minimum_required(VERSION 3.16) +# Optional no watchdog typically used for test & benchmark +add_compile_definitions(WOLFSSL_ESP_NO_WATCHDOG=1) + # The wolfSSL CMake file should be able to find the source code. # Otherwise, assign an environment variable or set it here: # @@ -24,28 +27,28 @@ cmake_minimum_required(VERSION 3.16) if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() # End optional WOLFSSL_CMAKE_SYSTEM_NAME @@ -54,16 +57,33 @@ endif() string(REPLACE "\\" "/" PROTOCOL_EXAMPLES_DIR "$ENV{IDF_PATH}/examples/common_components/protocol_examples_common") if (EXISTS "${PROTOCOL_EXAMPLES_DIR}") - message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR") else() - message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") +endif() + +# Find the user name to search for possible "wolfssl-username" +# Reminder: Windows is %USERNAME%, Linux is $USER +message(STATUS "USERNAME = $ENV{USERNAME}") +if( "$ENV{USER}" STREQUAL "" ) # the bash user + if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user + message(STATUS "could not find USER or USERNAME") + else() + # the bash user is not blank, so we'll use it. + set(THIS_USER "$ENV{USERNAME}") + endif() +else() + # the bash user is not blank, so we'll use it. + set(THIS_USER "$ENV{USER}") endif() +message(STATUS "THIS_USER = ${THIS_USER}") # Check that there are not conflicting wolfSSL components # The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl # The local component wolfSSL directory will be in ./components/wolfssl +message(STATUS "Checking for wolfSSL as Managed Component or not... ${CMAKE_HOME_DIRECTORY}") if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" ) # These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake' # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL) @@ -78,25 +98,46 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXI message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n" "If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove " "or rename the idf_component.yml file typically found in ./main/") -else() +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl") + # A standard project component (not a Managed Component) message(STATUS "No conflicting wolfSSL components found.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/components/wolfssl") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl") + # The official Managed Component called wolfssl from the wolfssl user. + message(STATUS "No conflicting wolfSSL components found as a Managed Component.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/gojimmypi__mywolfssl") + # There is a known gojimmypi staging component available for anyone: + message(STATUS "No conflicting wolfSSL components found as a gojimmypi staging Managed Component.") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/${THIS_USER}__mywolfssl") + # Other users with permissions might publish their own mywolfssl staging Managed Component + message(STATUS "No conflicting wolfSSL components found as a Managed Component.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/managed_components/${THIS_USER}__mywolfssl") +else() + message(STATUS "WARNING: wolfssl component directory not found.") endif() +# message(STATUS "EXTRA_COMPONENT_DIRS WOLFSSL_PATH: ${WOLFSSL_PATH}") +# list(APPEND EXTRA_COMPONENT_DIRS ${WOLFSSL_PATH}) + +# Not only is a project-level "set(COMPONENTS" not needed here, this will cause +# an unintuitive error about Unknown CMake command "esptool_py_flash_project_args". -message(STATUS "begin include") if(0) + message(STATUS "begin optional PROTOCOL_EXAMPLES_DIR include") # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) if (EXISTS "${PROTOCOL_EXAMPLES_DIR}") - message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR") else() - message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") endif() + message(STATUS "end optional include") endif() include($ENV{IDF_PATH}/tools/cmake/project.cmake) -message(STATUS "end include") + project(wolfssl_client) message(STATUS "end project") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt index 8b90966f9b..83c7f93ef5 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt @@ -102,28 +102,28 @@ if(VERBOSE_COMPONENT_MESSAGES) if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() endif() # End optional WOLFSSL_CMAKE_SYSTEM_NAME @@ -524,7 +524,7 @@ else() set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl") string(REPLACE "/" "//" STR_WOLFSSL_PROJECT_DIR "${WOLFSSL_PROJECT_DIR}") - add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}/include/user_settings.h") + add_compile_definitions(WOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}/include/user_settings.h") message(STATUS "Added definition for user_settings.h: -DWOLFSSL_USER_SETTINGS_DIR=\"${STR_WOLFSSL_PROJECT_DIR}//include//user_settings.h\"") # Espressif may take several passes through this makefile. Check to see if we found IDF string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF) @@ -951,7 +951,7 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") # the interesting part is defining the VAR_OUPUT name a value to use in the app - add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + add_compile_definitions(${VAR_OUPUT}=\"${VAR_VALUE}\") else() # if we get here, check the execute_process command and parameters. message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") @@ -959,9 +959,16 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) endif() endfunction() # LIBWOLFSSL_SAVE_INFO +execute_process( + COMMAND ${git_cmd} "rev-parse" "--is-inside-work-tree" + OUTPUT_VARIABLE IS_GIT_REPO + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + # create some programmatic #define values that will be used by ShowExtendedSystemInfo(). # see wolfcrypt\src\port\Espressif\esp32_utl.c -if(NOT CMAKE_BUILD_EARLY_EXPANSION AND WOLFSSL_ROOT) +if(NOT CMAKE_BUILD_EARLY_EXPANSION AND WOLFSSL_ROOT AND (IS_GIT_REPO STREQUAL "true")) set (git_cmd "git") message(STATUS "Adding macro definitions:") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt index e339d25093..76b01c65b5 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt @@ -1,36 +1,36 @@ # wolfSSL Espressif Example Project/main CMakeLists.txt -# v1.0 +# v1.1 # # wolfssl client test # -message("Begin wolfSSL main CMakeLists.txt") +message(STATUS "Begin wolfSSL main CMakeLists.txt") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() set (git_cmd "git") @@ -44,14 +44,26 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") endif() +# The wolfSL component name is named "mywolfssl" on the staging site for Managed Components. +if( NOT EXISTS "../components/wolfssl" AND ("$ENV{IDF_COMPONENT_REGISTRY_URL}" STREQUAL "https://components-staging.espressif.com") ) + message(STATUS "WARNING: Using a staging instance of wolfssl.") + set(MAIN_WOLFSSL_COMPONENT_NAME "mywolfssl") +else() + message(STATUS "Using release wolfssl component.") + set(MAIN_WOLFSSL_COMPONENT_NAME "wolfssl") +endif() + ## register_component() idf_component_register(SRCS main.c wifi_connect.c time_helper.c client-tls.c INCLUDE_DIRS "." - "./include") -# + "./include" + PRIV_REQUIRES "${MAIN_WOLFSSL_COMPONENT_NAME}" + driver + nvs_flash + protocol_examples_common) # # LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT) @@ -81,7 +93,7 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") # the interesting part is defining the VAR_OUPUT name a value to use in the app - add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + add_compile_definitions(${VAR_OUPUT}=\"${VAR_VALUE}\") else() # if we get here, check the execute_process command and parameters. message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT.") @@ -90,21 +102,28 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) endif() endfunction() # LIBWOLFSSL_SAVE_INFO +execute_process( + COMMAND ${git_cmd} "rev-parse" "--is-inside-work-tree" + OUTPUT_VARIABLE IS_GIT_REPO + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + # Save some project-specific details. Repo may be different than component, or may not even be a repo at all: -if(NOT CMAKE_BUILD_EARLY_EXPANSION) - # WOLFSSL_EXAMPLE_VERSION_GIT_HASH +if(NOT CMAKE_BUILD_EARLY_EXPANSION AND (IS_GIT_REPO STREQUAL "true")) + # LIBWOLFSSL_VERSION_GIT_HASH execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) - LIBWOLFSSL_SAVE_INFO(WOLFSSL_EXAMPLE_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}") + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}") - # WOLFSSL_EXAMPLE_VERSION_GIT_SHORT_HASH + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH execute_process(COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) - LIBWOLFSSL_SAVE_INFO(WOLFSSL_EXAMPLE_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}") + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}") - # WOLFSSL_EXAMPLE_VERSION_GIT_HASH_DATE + # LIBWOLFSSL_VERSION_GIT_HASH_DATE execute_process(COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ) - LIBWOLFSSL_SAVE_INFO(WOLFSSL_EXAMPLE_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}") + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}") endif() message(STATUS "") -message("End wolfSSL main CMakeLists.txt") +message(STATUS "End wolfSSL main CMakeLists.txt") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c index 2883f2f25d..9eeb7bd8c0 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c @@ -307,11 +307,11 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args) /* no peer check */ if (doPeerCheck == 0) { - ESP_LOGW(TAG, "doPeerCheck == 0"); + ESP_LOGW(TAG, "doPeerCheck == 0; WOLFSSL_VERIFY_NONE"); wolfSSL_CTX_set_verify(ctx, WOLFSSL_VERIFY_NONE, 0); } else { - ESP_LOGW(TAG, "doPeerCheck != 0"); + ESP_LOGI(TAG, "doPeerCheck != 0"); WOLFSSL_MSG("Loading... our cert"); /* load our certificate */ ret_i = wolfSSL_CTX_use_certificate_chain_buffer_format(ctx, diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/client-tls.h b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/client-tls.h index b4144242eb..d104eb30ac 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/client-tls.h +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/client-tls.h @@ -59,7 +59,7 @@ #define TLS_SMP_CLIENT_TASK_BYTES (12 * 1024) #else /* Minimum ESP32 stack size = 8K without Kyber */ - #define TLS_SMP_CLIENT_TASK_BYTES (8 * 1024) + #define TLS_SMP_CLIENT_TASK_BYTES (10 * 1024) #endif #endif diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/main.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/main.c index 376c853fc2..2281b9bb75 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/main.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/main.c @@ -149,7 +149,7 @@ void app_main(void) #if !defined(CONFIG_WOLFSSL_EXAMPLE_NAME_TLS_CLIENT) ESP_LOGW(TAG, "Warning: Example wolfSSL misconfigured? Check menuconfig."); #endif -#ifdef ESP_SDK_MEM_LIB_VERSION +#if defined(ESP_SDK_MEM_LIB_VERSION) && defined(DEBUG_WOLFSSL) sdk_init_meminfo(); #endif #ifdef ESP_TASK_MAIN_STACK diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/sdkconfig.defaults b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/sdkconfig.defaults index 146dabf0f1..fc854cbc35 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/sdkconfig.defaults +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/sdkconfig.defaults @@ -6,22 +6,25 @@ CONFIG_WOLFSSL_EXAMPLE_NAME_TLS_CLIENT=y # Some wolfSSL helpers CONFIG_USE_WOLFSSL_ESP_SDK_TIME=y +# sdkconfig.defaults for ESP8266 + ESP32 + # FreeRTOS ticks at 1ms interval CONFIG_FREERTOS_UNICORE=y CONFIG_FREERTOS_HZ=1000 CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y # -# Default main stack size +# Default main stack size. See user_settings.h # # This is typically bigger than needed for stack size. # Units are words, not bytes. See user_settings.h # # For wolfSSL SMALL_STACK, 3072 bytes should be sufficient for benchmark app. # When using RSA, assign at least 10500 bytes, otherwise 5500 usually works for others +# We set this to 28672 for use in the "test everything possible" in the wolfssl_test app. CONFIG_ESP_MAIN_TASK_STACK_SIZE=10500 -# Legacy stack size for older ESP-IDF versions +# Legacy stack size name for older ESP-IDF versions CONFIG_MAIN_TASK_STACK_SIZE=10500 # @@ -63,8 +66,8 @@ CONFIG_HEAP_DISABLE_IRAM=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y # Enable wolfSSL TLS in esp-tls -CONFIG_ESP_TLS_USING_WOLFSSL=y -CONFIG_TLS_STACK_WOLFSSL=y +# CONFIG_ESP_TLS_USING_WOLFSSL=y +# CONFIG_TLS_STACK_WOLFSSL=y # Bundles take up flash space and are disabled unless otherwise known to be needed CONFIG_WOLFSSL_CERTIFICATE_BUNDLE=n @@ -76,6 +79,25 @@ CONFIG_WOLFSSL_CERTIFICATE_BUNDLE=n CONFIG_ESP_TLS_USING_MBEDTLS=n CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n +# Some wolfSSL helpers +CONFIG_USE_WOLFSSL_ESP_SDK_TIME=n + +# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set +CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=n + +# ESP8266 Memory +CONFIG_FREERTOS_GLOBAL_DATA_LINK_IRAM=y +CONFIG_HEAP_DISABLE_IRAM=y + +# Performance +# CONFIG_COMPILER_OPTIMIZATION_PERF=y + +# Set max COU frequency (falls back as needed for lower maximum) +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y + +# FreeRTOS ticks at 1ms interval +CONFIG_FREERTOS_UNICORE=y +CONFIG_FREERTOS_HZ=1000 # Ensure mbedTLS options are disabled # CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=n diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/CMakeLists.txt index e4ce3d8a0d..245a3dc2e4 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/CMakeLists.txt @@ -1,5 +1,5 @@ # wolfSSL Espressif Example Project CMakeLists.txt -# v1.0 +# v1.3 # # The following lines of boilerplate have to be in your project's # CMakeLists in this exact order for cmake to work correctly @@ -7,6 +7,9 @@ message(STATUS "Begin project ${CMAKE_PROJECT_NAME}") cmake_minimum_required(VERSION 3.16) +# Optional no watchdog typically used for test & benchmark +add_compile_definitions(WOLFSSL_ESP_NO_WATCHDOG=1) + # The wolfSSL CMake file should be able to find the source code. # Otherwise, assign an environment variable or set it here: # @@ -24,28 +27,28 @@ cmake_minimum_required(VERSION 3.16) if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() # End optional WOLFSSL_CMAKE_SYSTEM_NAME @@ -54,16 +57,33 @@ endif() string(REPLACE "\\" "/" PROTOCOL_EXAMPLES_DIR "$ENV{IDF_PATH}/examples/common_components/protocol_examples_common") if (EXISTS "${PROTOCOL_EXAMPLES_DIR}") - message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR") else() - message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") +endif() + +# Find the user name to search for possible "wolfssl-username" +# Reminder: Windows is %USERNAME%, Linux is $USER +message(STATUS "USERNAME = $ENV{USERNAME}") +if( "$ENV{USER}" STREQUAL "" ) # the bash user + if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user + message(STATUS "could not find USER or USERNAME") + else() + # the bash user is not blank, so we'll use it. + set(THIS_USER "$ENV{USERNAME}") + endif() +else() + # the bash user is not blank, so we'll use it. + set(THIS_USER "$ENV{USER}") endif() +message(STATUS "THIS_USER = ${THIS_USER}") # Check that there are not conflicting wolfSSL components # The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl # The local component wolfSSL directory will be in ./components/wolfssl +message(STATUS "Checking for wolfSSL as Managed Component or not... ${CMAKE_HOME_DIRECTORY}") if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" ) # These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake' # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL) @@ -78,25 +98,46 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXI message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n" "If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove " "or rename the idf_component.yml file typically found in ./main/") -else() +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl") + # A standard project component (not a Managed Component) message(STATUS "No conflicting wolfSSL components found.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/components/wolfssl") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl") + # The official Managed Component called wolfssl from the wolfssl user. + message(STATUS "No conflicting wolfSSL components found as a Managed Component.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/gojimmypi__mywolfssl") + # There is a known gojimmypi staging component available for anyone: + message(STATUS "No conflicting wolfSSL components found as a gojimmypi staging Managed Component.") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/${THIS_USER}__mywolfssl") + # Other users with permissions might publish their own mywolfssl staging Managed Component + message(STATUS "No conflicting wolfSSL components found as a Managed Component.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/managed_components/${THIS_USER}__mywolfssl") +else() + message(STATUS "WARNING: wolfssl component directory not found.") endif() +# message(STATUS "EXTRA_COMPONENT_DIRS WOLFSSL_PATH: ${WOLFSSL_PATH}") +# list(APPEND EXTRA_COMPONENT_DIRS ${WOLFSSL_PATH}) -message(STATUS "begin include") +# Not only is a project-level "set(COMPONENTS" not needed here, this will cause +# an unintuitive error about Unknown CMake command "esptool_py_flash_project_args". + +message(STATUS "begin optional PROTOCOL_EXAMPLES_DIR include") if(0) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) if (EXISTS "${PROTOCOL_EXAMPLES_DIR}") - message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR") else() - message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") endif() endif() include($ENV{IDF_PATH}/tools/cmake/project.cmake) message(STATUS "end include") + project(wolfssl_server) message(STATUS "end project") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt index 8b90966f9b..83c7f93ef5 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt @@ -102,28 +102,28 @@ if(VERBOSE_COMPONENT_MESSAGES) if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() endif() # End optional WOLFSSL_CMAKE_SYSTEM_NAME @@ -524,7 +524,7 @@ else() set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl") string(REPLACE "/" "//" STR_WOLFSSL_PROJECT_DIR "${WOLFSSL_PROJECT_DIR}") - add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}/include/user_settings.h") + add_compile_definitions(WOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}/include/user_settings.h") message(STATUS "Added definition for user_settings.h: -DWOLFSSL_USER_SETTINGS_DIR=\"${STR_WOLFSSL_PROJECT_DIR}//include//user_settings.h\"") # Espressif may take several passes through this makefile. Check to see if we found IDF string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF) @@ -951,7 +951,7 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") # the interesting part is defining the VAR_OUPUT name a value to use in the app - add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + add_compile_definitions(${VAR_OUPUT}=\"${VAR_VALUE}\") else() # if we get here, check the execute_process command and parameters. message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") @@ -959,9 +959,16 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) endif() endfunction() # LIBWOLFSSL_SAVE_INFO +execute_process( + COMMAND ${git_cmd} "rev-parse" "--is-inside-work-tree" + OUTPUT_VARIABLE IS_GIT_REPO + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + # create some programmatic #define values that will be used by ShowExtendedSystemInfo(). # see wolfcrypt\src\port\Espressif\esp32_utl.c -if(NOT CMAKE_BUILD_EARLY_EXPANSION AND WOLFSSL_ROOT) +if(NOT CMAKE_BUILD_EARLY_EXPANSION AND WOLFSSL_ROOT AND (IS_GIT_REPO STREQUAL "true")) set (git_cmd "git") message(STATUS "Adding macro definitions:") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt index 9b1e29369c..0f991d909c 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt @@ -1,36 +1,36 @@ # wolfSSL Espressif Example Project/main CMakeLists.txt -# v1.0 +# v1.1 # # wolfssl server test # -message("Begin wolfSSL main CMakeLists.txt") +message(STATUS "Begin wolfSSL main CMakeLists.txt") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() set (git_cmd "git") @@ -44,14 +44,26 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") endif() +# The wolfSL component name is named "mywolfssl" on the staging site for Managed Components. +if( NOT EXISTS "../components/wolfssl" AND ("$ENV{IDF_COMPONENT_REGISTRY_URL}" STREQUAL "https://components-staging.espressif.com") ) + message(STATUS "WARNING: Using a staging instance of wolfssl.") + set(MAIN_WOLFSSL_COMPONENT_NAME "mywolfssl") +else() + message(STATUS "Using release wolfssl component.") + set(MAIN_WOLFSSL_COMPONENT_NAME "wolfssl") +endif() + ## register_component() idf_component_register(SRCS main.c wifi_connect.c time_helper.c server-tls.c INCLUDE_DIRS "." - "./include") -# + "./include" + PRIV_REQUIRES "${MAIN_WOLFSSL_COMPONENT_NAME}" + driver + nvs_flash + protocol_examples_common) # # LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT) @@ -81,7 +93,7 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") # the interesting part is defining the VAR_OUPUT name a value to use in the app - add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + add_compile_definitions(${VAR_OUPUT}=\"${VAR_VALUE}\") else() # if we get here, check the execute_process command and parameters. message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT.") @@ -90,21 +102,28 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) endif() endfunction() # LIBWOLFSSL_SAVE_INFO +execute_process( + COMMAND ${git_cmd} "rev-parse" "--is-inside-work-tree" + OUTPUT_VARIABLE IS_GIT_REPO + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + # Save some project-specific details. Repo may be different than component, or may not even be a repo at all: -if(NOT CMAKE_BUILD_EARLY_EXPANSION) - # WOLFSSL_EXAMPLE_VERSION_GIT_HASH +if(NOT CMAKE_BUILD_EARLY_EXPANSION AND (IS_GIT_REPO STREQUAL "true")) + # LIBWOLFSSL_VERSION_GIT_HASH execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) LIBWOLFSSL_SAVE_INFO(WOLFSSL_EXAMPLE_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}") - # WOLFSSL_EXAMPLE_VERSION_GIT_SHORT_HASH + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH execute_process(COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) - LIBWOLFSSL_SAVE_INFO(WOLFSSL_EXAMPLE_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}") + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}") - # WOLFSSL_EXAMPLE_VERSION_GIT_HASH_DATE + # LIBWOLFSSL_VERSION_GIT_HASH_DATE execute_process(COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ) - LIBWOLFSSL_SAVE_INFO(WOLFSSL_EXAMPLE_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}") + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}") endif() message(STATUS "") -message("End wolfSSL main CMakeLists.txt") +message(STATUS "End wolfSSL main CMakeLists.txt") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/main.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/main.c index e8195416f4..769829e86f 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/main.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/main.c @@ -131,9 +131,13 @@ void my_atmel_free(int slotId) /* Entry for FreeRTOS */ void app_main(void) { - int stack_start = 0; - int this_heap = 0; esp_err_t ret = 0; +#ifndef SINGLE_THREADED + int this_heap = 0; + #ifdef INCLUDE_uxTaskGetStackHighWaterMark + int stack_start = 0; + #endif +#endif ESP_LOGI(TAG, "---------------- wolfSSL TLS Server Example ------------"); ESP_LOGI(TAG, "--------------------------------------------------------"); ESP_LOGI(TAG, "--------------------------------------------------------"); @@ -143,7 +147,7 @@ void app_main(void) #if !defined(CONFIG_WOLFSSL_EXAMPLE_NAME_TLS_SERVER) ESP_LOGW(TAG, "Warning: Example wolfSSL misconfigured? Check menuconfig."); #endif -#ifdef ESP_SDK_MEM_LIB_VERSION +#if defined(ESP_SDK_MEM_LIB_VERSION) && defined(DEBUG_WOLFSSL) sdk_init_meminfo(); #endif #ifdef ESP_TASK_MAIN_STACK diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/sdkconfig.defaults b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/sdkconfig.defaults index 2734899437..ca304079c3 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/sdkconfig.defaults +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/sdkconfig.defaults @@ -7,21 +7,23 @@ CONFIG_WOLFSSL_EXAMPLE_NAME_TLS_SERVER=y # Some wolfSSL helpers CONFIG_USE_WOLFSSL_ESP_SDK_TIME=y +# sdkconfig.defaults for ESP8266 + ESP32 +# See separate sdkconfig.defaults.esp8266 # FreeRTOS ticks at 1ms interval CONFIG_FREERTOS_UNICORE=y CONFIG_FREERTOS_HZ=1000 CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y # -# Default main stack size +# Default main stack size. See user_settings.h # # This is typically bigger than needed for stack size. # Units are words, not bytes. See user_settings.h # # For wolfSSL SMALL_STACK, 3072 bytes should be sufficient for benchmark app. # When using RSA, assign at least 10500 bytes, otherwise 5500 usually works for others +# We set this to 28672 for use in the "test everything possible" in the wolfssl_test app. CONFIG_ESP_MAIN_TASK_STACK_SIZE=10500 - # Legacy stack size for older ESP-IDF versions CONFIG_MAIN_TASK_STACK_SIZE=10500 @@ -64,8 +66,8 @@ CONFIG_HEAP_DISABLE_IRAM=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y # Enable wolfSSL TLS in esp-tls -CONFIG_ESP_TLS_USING_WOLFSSL=y -CONFIG_TLS_STACK_WOLFSSL=y +# CONFIG_ESP_TLS_USING_WOLFSSL=y +# CONFIG_TLS_STACK_WOLFSSL=y # Bundles take up flash space and are disabled unless otherwise known to be needed CONFIG_WOLFSSL_CERTIFICATE_BUNDLE=n @@ -77,6 +79,25 @@ CONFIG_WOLFSSL_CERTIFICATE_BUNDLE=n CONFIG_ESP_TLS_USING_MBEDTLS=n CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n +# Some wolfSSL helpers +CONFIG_USE_WOLFSSL_ESP_SDK_TIME=n + +# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set +CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=n + +# ESP8266 Memory +CONFIG_FREERTOS_GLOBAL_DATA_LINK_IRAM=y +CONFIG_HEAP_DISABLE_IRAM=y + +# Performance +# CONFIG_COMPILER_OPTIMIZATION_PERF=y + +# Set max COU frequency (falls back as needed for lower maximum) +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y + +# FreeRTOS ticks at 1ms interval +CONFIG_FREERTOS_UNICORE=y +CONFIG_FREERTOS_HZ=1000 # Ensure mbedTLS options are disabled # CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=n diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/CMakeLists.txt index 4260db5ca3..49fea24750 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/CMakeLists.txt @@ -3,10 +3,12 @@ # # The following lines of boilerplate have to be in your project's # CMakeLists in this exact order for cmake to work correctly +message(STATUS "Begin project ${CMAKE_PROJECT_NAME}") + cmake_minimum_required(VERSION 3.16) # Optional no watchdog typically used for test & benchmark -add_compile_options(-DWOLFSSL_ESP_NO_WATCHDOG=1) +add_compile_definitions(WOLFSSL_ESP_NO_WATCHDOG=1) # The wolfSSL CMake file should be able to find the source code. # Otherwise, assign an environment variable or set it here: @@ -25,34 +27,63 @@ add_compile_options(-DWOLFSSL_ESP_NO_WATCHDOG=1) if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() # End optional WOLFSSL_CMAKE_SYSTEM_NAME +# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. +# set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +string(REPLACE "\\" "/" PROTOCOL_EXAMPLES_DIR "$ENV{IDF_PATH}/examples/common_components/protocol_examples_common") + +if (EXISTS "${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR") +else() + message(STATUS "NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") +endif() + +# Find the user name to search for possible "wolfssl-username" +# Reminder: Windows is %USERNAME%, Linux is $USER +message(STATUS "USERNAME = $ENV{USERNAME}") +if( "$ENV{USER}" STREQUAL "" ) # the bash user + if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user + message(STATUS "could not find USER or USERNAME") + else() + # the bash user is not blank, so we'll use it. + set(THIS_USER "$ENV{USERNAME}") + endif() +else() + # the bash user is not blank, so we'll use it. + set(THIS_USER "$ENV{USER}") +endif() +message(STATUS "THIS_USER = ${THIS_USER}") + # Check that there are not conflicting wolfSSL components # The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl # The local component wolfSSL directory will be in ./components/wolfssl +message(STATUS "Checking for wolfSSL as Managed Component or not... ${CMAKE_HOME_DIRECTORY}") if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" ) # These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake' # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL) @@ -67,16 +98,46 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXI message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n" "If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove " "or rename the idf_component.yml file typically found in ./main/") -else() +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl") + # A standard project component (not a Managed Component) message(STATUS "No conflicting wolfSSL components found.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/components/wolfssl") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl") + # The official Managed Component called wolfssl from the wolfssl user. + message(STATUS "No conflicting wolfSSL components found as a Managed Component.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/gojimmypi__mywolfssl") + # There is a known gojimmypi staging component available for anyone: + message(STATUS "No conflicting wolfSSL components found as a gojimmypi staging Managed Component.") +elseif(EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/${THIS_USER}__mywolfssl") + # Other users with permissions might publish their own mywolfssl staging Managed Component + message(STATUS "No conflicting wolfSSL components found as a Managed Component.") + set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/managed_components/${THIS_USER}__mywolfssl") +else() + message(STATUS "WARNING: wolfssl component directory not found.") endif() -# Ensure the this wolfSSL component directory is included -set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/components/wolfssl") -list(APPEND EXTRA_COMPONENT_DIRS ${WOLFSSL_PATH}) +# message(STATUS "EXTRA_COMPONENT_DIRS WOLFSSL_PATH: ${WOLFSSL_PATH}") +# list(APPEND EXTRA_COMPONENT_DIRS ${WOLFSSL_PATH}) # Not only is a project-level "set(COMPONENTS" not needed here, this will cause # an unintuitive error about Unknown CMake command "esptool_py_flash_project_args". + +message(STATUS "begin optional PROTOCOL_EXAMPLES_DIR include") +if(0) + # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. + set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) + + if (EXISTS "${PROTOCOL_EXAMPLES_DIR}") + message(STATUS "Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR") + else() + message(STATUS "NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}") + endif() +endif() include($ENV{IDF_PATH}/tools/cmake/project.cmake) +message(STATUS "end optional include") project(wolfssl_test) +message(STATUS "end project") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt index 8b90966f9b..83c7f93ef5 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt @@ -102,28 +102,28 @@ if(VERBOSE_COMPONENT_MESSAGES) if(WIN32) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") - message("Detected Windows") + message(STATUS "Detected Windows") endif() if(CMAKE_HOST_UNIX) - message("Detected UNIX") + message(STATUS "Detected UNIX") endif() if(APPLE) - message("Detected APPLE") + message(STATUS "Detected APPLE") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") - message("Detected WSL") + message(STATUS "Detected WSL") endif() if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") - message("Detected Linux") + message(STATUS "Detected Linux") endif() if(APPLE) # Windows-specific configuration here set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") - message("Detected Apple") + message(STATUS "Detected Apple") endif() endif() # End optional WOLFSSL_CMAKE_SYSTEM_NAME @@ -524,7 +524,7 @@ else() set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl") string(REPLACE "/" "//" STR_WOLFSSL_PROJECT_DIR "${WOLFSSL_PROJECT_DIR}") - add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}/include/user_settings.h") + add_compile_definitions(WOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}/include/user_settings.h") message(STATUS "Added definition for user_settings.h: -DWOLFSSL_USER_SETTINGS_DIR=\"${STR_WOLFSSL_PROJECT_DIR}//include//user_settings.h\"") # Espressif may take several passes through this makefile. Check to see if we found IDF string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF) @@ -951,7 +951,7 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") # the interesting part is defining the VAR_OUPUT name a value to use in the app - add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + add_compile_definitions(${VAR_OUPUT}=\"${VAR_VALUE}\") else() # if we get here, check the execute_process command and parameters. message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") @@ -959,9 +959,16 @@ function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) endif() endfunction() # LIBWOLFSSL_SAVE_INFO +execute_process( + COMMAND ${git_cmd} "rev-parse" "--is-inside-work-tree" + OUTPUT_VARIABLE IS_GIT_REPO + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + # create some programmatic #define values that will be used by ShowExtendedSystemInfo(). # see wolfcrypt\src\port\Espressif\esp32_utl.c -if(NOT CMAKE_BUILD_EARLY_EXPANSION AND WOLFSSL_ROOT) +if(NOT CMAKE_BUILD_EARLY_EXPANSION AND WOLFSSL_ROOT AND (IS_GIT_REPO STREQUAL "true")) set (git_cmd "git") message(STATUS "Adding macro definitions:") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/component.mk index 0811ea2b02..9678bc6b55 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/component.mk +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/component.mk @@ -291,5 +291,5 @@ COMPONENT_SRCDIRS += $(WOLFSSL_ROOT)/wolfcrypt/test ## wolfcrypt ## # COMPONENT_PRIV_INCLUDEDIRS += $(PROJECT_PATH)/components/wolfssl/include -COMPONENT_SRCDIRS += $(WOLFSSL_ROOT)wolfcrypt/src +COMPONENT_SRCDIRS += $(WOLFSSL_ROOT)/wolfcrypt/src $(info ********** end wolfssl component **********) diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt index 3690d140f4..07b8ff3cf7 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt @@ -3,9 +3,121 @@ # # wolfssl crypt test # +message(STATUS "Begin wolfSSL main CMakeLists.txt") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") -idf_component_register(SRCS - "main.c" - INCLUDE_DIRS - ".") +if(WIN32) + # Windows-specific configuration here + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") + message(STATUS "Detected Windows") +endif() +if(CMAKE_HOST_UNIX) + message(STATUS "Detected UNIX") +endif() +if(APPLE) + message(STATUS "Detected APPLE") +endif() +if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") + # Windows-specific configuration here + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") + message(STATUS "Detected WSL") +endif() +if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) + # Windows-specific configuration here + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") + message(STATUS "Detected Linux") +endif() +if(APPLE) + # Windows-specific configuration here + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") + message(STATUS "Detected Apple") +endif() +set (git_cmd "git") + +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user + # + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") +endif() + +# The wolfSL component name is named "mywolfssl" on the staging site for Managed Components. +if( NOT EXISTS "../components/wolfssl" AND ("$ENV{IDF_COMPONENT_REGISTRY_URL}" STREQUAL "https://components-staging.espressif.com") ) + message(STATUS "WARNING: Using a staging instance of wolfssl.") + set(MAIN_WOLFSSL_COMPONENT_NAME "mywolfssl") +else() + message(STATUS "Using release wolfssl component.") + set(MAIN_WOLFSSL_COMPONENT_NAME "wolfssl") +endif() + +## register_component() +idf_component_register(SRCS main.c + INCLUDE_DIRS "." + "./include" + PRIV_REQUIRES driver "${MAIN_WOLFSSL_COMPONENT_NAME}") + +# +# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT) +# +# Save the THIS_VAR as a string in a macro called VAR_OUPUT +# +# VAR_OUPUT: the name of the macro to define +# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process() +# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful. +# +function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) + # is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true. + string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE) + + # if we had a successful operation, save the THIS_VAR in VAR_OUPUT + if(${IS_VALID_VALUE}) + # strip newline chars in THIS_VAR parameter and save in VAR_VALUE + string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR}) + + # we'll could percolate the value to the parent for possible later use + # set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE) + + # but we're only using it here in this function + set(${VAR_OUPUT} ${VAR_VALUE}) + + # we'll print what we found to the console + message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") + + # the interesting part is defining the VAR_OUPUT name a value to use in the app + add_compile_definitions(${VAR_OUPUT}=\"${VAR_VALUE}\") + else() + # if we get here, check the execute_process command and parameters. + message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT.") + message(STATUS "Setting ${VAR_OUPUT} to \"Unknown\"") + set(${VAR_OUPUT} "Unknown") + endif() +endfunction() # LIBWOLFSSL_SAVE_INFO + +execute_process( + COMMAND ${git_cmd} "rev-parse" "--is-inside-work-tree" + OUTPUT_VARIABLE IS_GIT_REPO + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + +# Save some project-specific details. Repo may be different than component, or may not even be a repo at all: +if(NOT CMAKE_BUILD_EARLY_EXPANSION AND (IS_GIT_REPO STREQUAL "true")) + # LIBWOLFSSL_VERSION_GIT_HASH + execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}") + + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH + execute_process(COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}") + + # LIBWOLFSSL_VERSION_GIT_HASH_DATE + execute_process(COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}") +endif() + +message(STATUS "") + +message(STATUS "End wolfSSL main CMakeLists.txt") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/sdkconfig.defaults b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/sdkconfig.defaults index 6f5dcdb8f1..c84e962476 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/sdkconfig.defaults +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/sdkconfig.defaults @@ -1,13 +1,14 @@ # Set the known example app config to template example (see user_settings.h) CONFIG_WOLFSSL_EXAMPLE_NAME_WOLFSSL_TEST=y +# CONFIG_EXAMPLE_WIFI_SSID="myssid" +# CONFIG_EXAMPLE_WIFI_PASSWORD="mypassword" # Some wolfSSL helpers CONFIG_USE_WOLFSSL_ESP_SDK_TIME=y -# sdkconfig.defaults for ESP32. +# sdkconfig.defaults for ESP8266 + ESP32 # See separate sdkconfig.defaults.esp8266 # Note that during the build process, settings from sdkconfig.defaults will not override those already in sdkconfig. -# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#custom-sdkconfig-defaults CONFIG_BENCH_ARGV="-lng 0" # FreeRTOS ticks at 1ms interval CONFIG_FREERTOS_UNICORE=y @@ -24,8 +25,7 @@ CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y # When using RSA, assign at least 10500 bytes, otherwise 5500 usually works for others # We set this to 28672 for use in the "test everything possible" in the wolfssl_test app. CONFIG_ESP_MAIN_TASK_STACK_SIZE=28672 - -# Legacy stack size for older ESP-IDF versions +# Legacy stack size name for older ESP-IDF versions CONFIG_MAIN_TASK_STACK_SIZE=28672 # @@ -67,8 +67,8 @@ CONFIG_HEAP_DISABLE_IRAM=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y # Enable wolfSSL TLS in esp-tls -CONFIG_ESP_TLS_USING_WOLFSSL=y -CONFIG_TLS_STACK_WOLFSSL=y +# CONFIG_ESP_TLS_USING_WOLFSSL=y +# CONFIG_TLS_STACK_WOLFSSL=y # Bundles take up flash space and are disabled unless otherwise known to be needed CONFIG_WOLFSSL_CERTIFICATE_BUNDLE=n @@ -100,6 +100,26 @@ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_FREERTOS_UNICORE=y CONFIG_FREERTOS_HZ=1000 +# Ensure mbedTLS options are disabled +# CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=n +# CONFIG_MBEDTLS_TLS_CLIENT_ONLY=n +# CONFIG_MBEDTLS_TLS_SERVER=n +# CONFIG_MBEDTLS_TLS_CLIENT=n +# CONFIG_MBEDTLS_HARDWARE_AES=n +# CONFIG_MBEDTLS_HARDWARE_MPI=n +# CONFIG_MBEDTLS_HARDWARE_SHA=n +# CONFIG_MBEDTLS_ROM_MD5=n +# CONFIG_MBEDTLS_SSL_RENEGOTIATION=n +# CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=n +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1=n +# CONFIG_MBEDTLS_SSL_ALPN=n +# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=n +# CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=n + +# The same-name config is used for both WiFi and client/server TLS, so we cannot disable: +# CONFIG_MBEDTLS_TLS_ENABLED=n +# CONFIG_MBEDTLS_TLS_DISABLED=y + # # Compiler options # diff --git a/IDE/GCC-ARM/Source/benchmark_main.c b/IDE/GCC-ARM/Source/benchmark_main.c index 1151bbc32c..44acc6967a 100644 --- a/IDE/GCC-ARM/Source/benchmark_main.c +++ b/IDE/GCC-ARM/Source/benchmark_main.c @@ -39,16 +39,16 @@ int main(void) { int ret; #ifndef NO_CRYPT_BENCHMARK - wolfCrypt_Init(); + wolfCrypt_Init(); - printf("\nBenchmark Test\n"); - benchmark_test(&args); + printf("\nBenchmark Test\n"); + benchmark_test(&args); ret = args.return_code; - printf("Benchmark Test: Return code %d\n", ret); + printf("Benchmark Test: Return code %d\n", ret); - wolfCrypt_Cleanup(); + wolfCrypt_Cleanup(); #else ret = NOT_COMPILED_IN; #endif - return ret; + return ret; } diff --git a/IDE/GCC-ARM/Source/test_main.c b/IDE/GCC-ARM/Source/test_main.c index c63246368b..2e6236d89a 100644 --- a/IDE/GCC-ARM/Source/test_main.c +++ b/IDE/GCC-ARM/Source/test_main.c @@ -40,16 +40,16 @@ int main(void) { int ret; #ifndef NO_CRYPT_TEST - wolfCrypt_Init(); + wolfCrypt_Init(); - printf("\nCrypt Test\n"); - wolfcrypt_test(&args); + printf("\nCrypt Test\n"); + wolfcrypt_test(&args); ret = args.return_code; - printf("Crypt Test: Return code %d\n", ret); + printf("Crypt Test: Return code %d\n", ret); - wolfCrypt_Cleanup(); + wolfCrypt_Cleanup(); #else ret = NOT_COMPILED_IN; #endif - return ret; + return ret; } diff --git a/IDE/Renesas/e2studio/RA6M4/test/.cproject b/IDE/Renesas/e2studio/RA6M4/test/.cproject index e7bb1ceb95..11ea166457 100644 --- a/IDE/Renesas/e2studio/RA6M4/test/.cproject +++ b/IDE/Renesas/e2studio/RA6M4/test/.cproject @@ -105,6 +105,9 @@ + + +