diff --git a/.github/workflows/async.yml b/.github/workflows/async.yml index e1699c1c54..d2c4d0c846 100644 --- a/.github/workflows/async.yml +++ b/.github/workflows/async.yml @@ -36,7 +36,7 @@ jobs: ./configure ${{ matrix.config }} make check - - name: Print errors + - name: Print errors if: ${{ failure() }} run: | if [ -f test-suite.log ] ; then diff --git a/.github/workflows/curl.yml b/.github/workflows/curl.yml index d1ffb6f666..ba3ff3ff70 100644 --- a/.github/workflows/curl.yml +++ b/.github/workflows/curl.yml @@ -26,11 +26,14 @@ jobs: configure: --enable-curl 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-curl - path: build-dir + path: build-dir.tgz retention-days: 5 test_curl: @@ -54,7 +57,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-curl - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Build curl uses: wolfSSL/actions-build-autotools-project@v1 @@ -67,4 +72,4 @@ jobs: - name: Test curl working-directory: curl - run: make -j test-ci + run: make -j $(nproc) test-ci diff --git a/.github/workflows/cyrus-sasl.yml b/.github/workflows/cyrus-sasl.yml index 9cd572aea0..9f2aab72c2 100644 --- a/.github/workflows/cyrus-sasl.yml +++ b/.github/workflows/cyrus-sasl.yml @@ -29,11 +29,14 @@ jobs: # Don't run tests as this config is tested in many other places check: false + - 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-sasl - path: build-dir + path: build-dir.tgz retention-days: 5 sasl_check: @@ -60,7 +63,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-sasl - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Checkout OSP uses: actions/checkout@v4 @@ -88,4 +93,11 @@ jobs: working-directory: sasl run: | make -j -C utils testsuite saslpasswd2 - $GITHUB_WORKSPACE/osp/cyrus-sasl/${{ matrix.ref }}/run-tests.sh + # Retry up to five times + for i in {1..5}; do + TEST_RES=0 + $GITHUB_WORKSPACE/osp/cyrus-sasl/${{ matrix.ref }}/run-tests.sh || TEST_RES=$? + if [ "$TEST_RES" -eq "0" ]; then + break + fi + done diff --git a/.github/workflows/disabled/haproxy.yml b/.github/workflows/disabled/haproxy.yml index 43e197fd59..1943a6269a 100644 --- a/.github/workflows/disabled/haproxy.yml +++ b/.github/workflows/disabled/haproxy.yml @@ -57,4 +57,3 @@ jobs: - name: Test HaProxy working-directory: haproxy run: make reg-tests reg-tests/ssl VTEST_PROGRAM=$GITHUB_WORKSPACE/VTest/vtest - diff --git a/.github/workflows/disabled/hostap.yml b/.github/workflows/disabled/hostap.yml index aad37cad30..97a03ce327 100644 --- a/.github/workflows/disabled/hostap.yml +++ b/.github/workflows/disabled/hostap.yml @@ -181,7 +181,7 @@ jobs: - name: Checkout hostap uses: actions/checkout@v4 with: - repository: julek-wolfssl/hostap-mirror + repository: julek-wolfssl/hostap-mirror path: hostap ref: ${{ matrix.config.hostap_ref }} # necessary for cherry pick step @@ -210,7 +210,7 @@ jobs: done - if: ${{ matrix.hostapd }} - name: Setup hostapd config file + name: Setup hostapd config file run: | cp wolfssl/.github/workflows/hostap-files/configs/${{ matrix.config.hostap_ref }}/hostapd.config \ hostap/hostapd/.config @@ -220,7 +220,7 @@ jobs: EOF - if: ${{ matrix.wpa_supplicant }} - name: Setup wpa_supplicant config file + name: Setup wpa_supplicant config file run: | cp wolfssl/.github/workflows/hostap-files/configs/${{ matrix.config.hostap_ref }}/wpa_supplicant.config \ hostap/wpa_supplicant/.config diff --git a/.github/workflows/docker-OpenWrt.yml b/.github/workflows/docker-OpenWrt.yml index c71b500a67..283e3b92e2 100644 --- a/.github/workflows/docker-OpenWrt.yml +++ b/.github/workflows/docker-OpenWrt.yml @@ -28,11 +28,15 @@ jobs: - uses: actions/checkout@v4 - name: Compile libwolfssl.so run: ./autogen.sh && ./configure --enable-all && make + # 2024-08-05 - Something broke in the actions. They are no longer following links. + - name: tar libwolfssl.so + working-directory: src/.libs + run: tar -zcf libwolfssl.tgz libwolfssl.so* - name: Upload libwolfssl.so uses: actions/upload-artifact@v4 with: name: openwrt-libwolfssl.so - path: src/.libs/libwolfssl.so + path: src/.libs/libwolfssl.tgz retention-days: 5 compile_container: name: Compile container @@ -50,7 +54,9 @@ jobs: - uses: actions/download-artifact@v4 with: name: openwrt-libwolfssl.so - path: Docker/OpenWrt/. + path: . + - name: untar libwolfssl.so + run: tar -xf libwolfssl.tgz -C Docker/OpenWrt - name: Build but dont push uses: docker/build-push-action@v5 with: diff --git a/.github/workflows/grpc.yml b/.github/workflows/grpc.yml index d2f0a8317c..4e145cc6c8 100644 --- a/.github/workflows/grpc.yml +++ b/.github/workflows/grpc.yml @@ -27,11 +27,14 @@ jobs: configure: --enable-all 'CPPFLAGS=-DWOLFSSL_RSA_KEY_CHECK -DHAVE_EX_DATA_CLEANUP_HOOKS' 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-grpc - path: build-dir + path: build-dir.tgz retention-days: 5 grpc_check: @@ -65,7 +68,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-grpc - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Checkout OSP uses: actions/checkout@v4 diff --git a/.github/workflows/hitch.yml b/.github/workflows/hitch.yml index 4f11a79f04..60ee38dba2 100644 --- a/.github/workflows/hitch.yml +++ b/.github/workflows/hitch.yml @@ -27,11 +27,14 @@ jobs: configure: --enable-hitch 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-hitch - path: build-dir + path: build-dir.tgz retention-days: 5 hitch_check: @@ -53,7 +56,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-hitch - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Checkout OSP uses: actions/checkout@v4 @@ -100,4 +105,4 @@ jobs: working-directory: ./hitch run: | export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH - make check \ No newline at end of file + make check diff --git a/.github/workflows/hostap-vm.yml b/.github/workflows/hostap-vm.yml index aa983ac03e..22a073ce65 100644 --- a/.github/workflows/hostap-vm.yml +++ b/.github/workflows/hostap-vm.yml @@ -24,7 +24,7 @@ jobs: wolf_extra_config: --disable-tls13 - build_id: hostap-vm-build2 wolf_extra_config: >- - --enable-wpas-dpp --enable-brainpool --with-eccminsz=192 + --enable-wpas-dpp --enable-brainpool --with-eccminsz=192 --enable-tlsv10 --enable-oldtls name: Build wolfSSL runs-on: ubuntu-latest @@ -52,11 +52,14 @@ jobs: ${{ env.wolf_debug_flags }} ${{ matrix.wolf_extra_config }} 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: ${{ matrix.build_id }} - path: build-dir + path: build-dir.tgz retention-days: 5 build_uml_linux: @@ -84,7 +87,7 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' uses: actions/checkout@v4 with: - repository: torvalds/linux + repository: torvalds/linux path: linux - name: Compile linux @@ -178,7 +181,9 @@ jobs: uses: actions/download-artifact@v4 with: name: ${{ matrix.config.build_id }} - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Install dependencies run: | @@ -194,7 +199,7 @@ jobs: - name: Checkout hostap uses: actions/checkout@v4 with: - repository: julek-wolfssl/hostap-mirror + repository: julek-wolfssl/hostap-mirror path: hostap ref: ${{ matrix.config.hostap_ref }} @@ -228,7 +233,7 @@ jobs: fi - if: ${{ matrix.hostapd }} - name: Setup hostapd config file + name: Setup hostapd config file run: | cp wolfssl/.github/workflows/hostap-files/configs/${{ matrix.config.hostap_ref }}/hostapd.config \ hostap/hostapd/.config @@ -238,7 +243,7 @@ jobs: EOF - if: ${{ matrix.wpa_supplicant }} - name: Setup wpa_supplicant config file + name: Setup wpa_supplicant config file run: | cp wolfssl/.github/workflows/hostap-files/configs/${{ matrix.config.hostap_ref }}/wpa_supplicant.config \ hostap/wpa_supplicant/.config diff --git a/.github/workflows/ipmitool.yml b/.github/workflows/ipmitool.yml index 83117a9001..2fb6403d71 100644 --- a/.github/workflows/ipmitool.yml +++ b/.github/workflows/ipmitool.yml @@ -30,11 +30,14 @@ jobs: # Don't run tests as this config is tested in many other places check: false + - 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-ipmitool - path: build-dir + path: build-dir.tgz retention-days: 5 build_ipmitool: @@ -50,7 +53,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-ipmitool - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Checkout OSP uses: actions/checkout@v4 @@ -74,4 +79,3 @@ jobs: run: | ldd src/ipmitool | grep wolfssl ldd src/ipmievd | grep wolfssl - \ No newline at end of file diff --git a/.github/workflows/jwt-cpp.yml b/.github/workflows/jwt-cpp.yml index a76d8a1050..13569574fa 100644 --- a/.github/workflows/jwt-cpp.yml +++ b/.github/workflows/jwt-cpp.yml @@ -29,11 +29,14 @@ jobs: # Don't run tests as this config is tested in many other places check: false + - 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-jwt-cpp - path: build-dir + path: build-dir.tgz retention-days: 5 build_pam-ipmi: @@ -56,7 +59,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-jwt-cpp - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Checkout OSP uses: actions/checkout@v4 diff --git a/.github/workflows/krb5.yml b/.github/workflows/krb5.yml index 87f89dba1c..ce96479ce0 100644 --- a/.github/workflows/krb5.yml +++ b/.github/workflows/krb5.yml @@ -31,11 +31,14 @@ jobs: configure: --enable-krb CC='gcc -fsanitize=address' 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-krb5 - path: build-dir + path: build-dir.tgz retention-days: 5 krb5_check: @@ -54,7 +57,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-krb5 - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Checkout OSP uses: actions/checkout@v4 diff --git a/.github/workflows/libssh2.yml b/.github/workflows/libssh2.yml index a66d1c5697..0f5f241008 100644 --- a/.github/workflows/libssh2.yml +++ b/.github/workflows/libssh2.yml @@ -28,11 +28,14 @@ jobs: check: false # config is already tested in many other PRB's 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-libssh2 - path: build-dir + path: build-dir.tgz retention-days: 5 libssh2_check: @@ -51,7 +54,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-libssh2 - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Build and test libssh2 uses: wolfSSL/actions-build-autotools-project@v1 diff --git a/.github/workflows/libvncserver.yml b/.github/workflows/libvncserver.yml index 348eb56eb6..cdef79dde5 100644 --- a/.github/workflows/libvncserver.yml +++ b/.github/workflows/libvncserver.yml @@ -29,11 +29,14 @@ jobs: # Don't run tests as this config is tested in many other places check: false + - 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-libvncserver - path: build-dir + path: build-dir.tgz retention-days: 5 build_libvncserver: @@ -49,7 +52,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-libvncserver - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Checkout OSP uses: actions/checkout@v4 diff --git a/.github/workflows/memcached.yml b/.github/workflows/memcached.yml index 9bcedc149e..e1cbb37847 100644 --- a/.github/workflows/memcached.yml +++ b/.github/workflows/memcached.yml @@ -28,11 +28,14 @@ jobs: - name: Bundle Docker entry point run: cp wolfssl/.github/workflows/memcached.sh build-dir/bin + - 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-memcached - path: build-dir + path: build-dir.tgz retention-days: 5 memcached_check: @@ -50,7 +53,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-memcached - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Checkout OSP uses: actions/checkout@v4 diff --git a/.github/workflows/mosquitto.yml b/.github/workflows/mosquitto.yml new file mode 100644 index 0000000000..8ba0477797 --- /dev/null +++ b/.github/workflows/mosquitto.yml @@ -0,0 +1,98 @@ +name: mosquitto 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 + # Just to keep it the same as the testing target + runs-on: ubuntu-latest + # 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-mosquitto CFLAGS="-DALLOW_INVALID_CERTSIGN" + 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-mosquitto + path: build-dir.tgz + retention-days: 5 + + mosquitto_check: + strategy: + fail-fast: false + matrix: + ref: [ 2.0.18 ] + name: ${{ matrix.ref }} + runs-on: ubuntu-latest + # 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-mosquitto + + - name: untar build-dir + run: tar -xf build-dir.tgz + + - name: Checkout OSP + uses: actions/checkout@v4 + with: + repository: wolfssl/osp + path: osp + + - name: Install dependencies + run: | + export DEBIAN_FRONTEND=noninteractive + sudo apt-get update + sudo apt-get install -y build-essential libev-dev libssl-dev automake python3-docutils libcunit1 libcunit1-doc libcunit1-dev pkg-config make + sudo pip install --upgrade psutil + + - name: Checkout mosquitto + uses: actions/checkout@v4 + with: + repository: eclipse/mosquitto + ref: v${{ matrix.ref }} + path: mosquitto + + - name: Configure and build mosquitto + run: | + cd $GITHUB_WORKSPACE/mosquitto/ + patch -p1 < $GITHUB_WORKSPACE/osp/mosquitto/${{ matrix.ref }}.patch + make WITH_TLS=wolfssl WITH_CJSON=no WITH_DOCS=no WOLFSSLDIR=$GITHUB_WORKSPACE/build-dir + + - name: Run mosquitto tests + working-directory: ./mosquitto + run: | + # Retry up to five times + for i in {1..5}; do + TEST_RES=0 + make WITH_TLS=wolfssl WITH_CJSON=no WITH_DOCS=no WOLFSSLDIR=$GITHUB_WORKSPACE/build-dir ptest || TEST_RES=$? + if [ "$TEST_RES" -eq "0" ]; then + break + fi + done + if [ "$TEST_RES" -ne "0" ]; then + exit $TEST_RES + fi diff --git a/.github/workflows/multi-arch.yml b/.github/workflows/multi-arch.yml index f296464f9f..c8f2270193 100644 --- a/.github/workflows/multi-arch.yml +++ b/.github/workflows/multi-arch.yml @@ -51,7 +51,7 @@ jobs: CFLAGS: ${{ matrix.CFLAGS }} QEMU_LD_PREFIX: /usr/${{ matrix.HOST }} run: ./autogen.sh && ./configure --host=${{ matrix.HOST }} --enable-all --disable-examples ${{ matrix.EXTRA_OPTS }} && make - - name: Print errors + - name: Print errors if: ${{ failure() }} run: | if [ -f config.log ] ; then diff --git a/.github/workflows/net-snmp.yml b/.github/workflows/net-snmp.yml index c121709f39..709b59f5e1 100644 --- a/.github/workflows/net-snmp.yml +++ b/.github/workflows/net-snmp.yml @@ -27,11 +27,14 @@ jobs: configure: --enable-net-snmp 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-net-snmp - path: build-dir + path: build-dir.tgz retention-days: 5 net-snmp_check: @@ -52,8 +55,10 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-net-snmp - path: build-dir - + + - name: untar build-dir + run: tar -xf build-dir.tgz + - name: Checkout OSP uses: actions/checkout@v4 with: diff --git a/.github/workflows/nginx.yml b/.github/workflows/nginx.yml index 97e57a1eea..0d4f1448e4 100644 --- a/.github/workflows/nginx.yml +++ b/.github/workflows/nginx.yml @@ -33,11 +33,14 @@ jobs: configure: --enable-nginx ${{ env.wolf_debug_flags }} 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-nginx - path: build-dir + path: build-dir.tgz retention-days: 5 nginx_check: @@ -93,7 +96,7 @@ jobs: stream_ssl_preread.t stream_ssl_realip.t stream_ssl_session_reuse.t stream_ssl.t stream_ssl_variables.t stream_ssl_verify_client.t stream_upstream_zone_ssl.t upstream_zone_ssl.t uwsgi_ssl_certificate.t uwsgi_ssl_certificate_vars.t - uwsgi_ssl.t uwsgi_ssl_verify.t + uwsgi_ssl.t uwsgi_ssl_verify.t # Following tests do not pass with sanitizer on (with OpenSSL too) sanitize-not-ok: >- grpc_ssl.t h2_proxy_request_buffering_ssl.t h2_proxy_ssl.t @@ -111,7 +114,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-nginx - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Install dependencies run: | @@ -216,4 +221,4 @@ jobs: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib \ TMPDIR=$GITHUB_WORKSPACE TEST_NGINX_BINARY=../nginx/objs/nginx \ prove ${{ matrix.sanitize-ok }} - + diff --git a/.github/workflows/no-malloc.yml b/.github/workflows/no-malloc.yml index 88e5eedd70..d3ba9b2d27 100644 --- a/.github/workflows/no-malloc.yml +++ b/.github/workflows/no-malloc.yml @@ -18,7 +18,7 @@ jobs: matrix: config: [ # Add new configs here - '--enable-rsa --enable-keygen --disable-dh CFLAGS="-DWOLFSSL_NO_MALLOC"', + '--enable-rsa --enable-keygen --disable-dh CFLAGS="-DWOLFSSL_NO_MALLOC -DRSA_MIN_SIZE=1024"', ] name: make check runs-on: ubuntu-latest @@ -35,7 +35,7 @@ jobs: make ./wolfcrypt/test/testwolfcrypt - - name: Print errors + - name: Print errors if: ${{ failure() }} run: | if [ -f test-suite.log ] ; then diff --git a/.github/workflows/ntp.yml b/.github/workflows/ntp.yml new file mode 100644 index 0000000000..fcc0843243 --- /dev/null +++ b/.github/workflows/ntp.yml @@ -0,0 +1,91 @@ +name: ntp 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 + # Just to keep it the same as the testing target + runs-on: ubuntu-latest + # 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 + install: true + check: false + + - 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-ntp + path: build-dir.tgz + retention-days: 5 + + ntp_check: + strategy: + fail-fast: false + matrix: + # List of releases to test + ref: [ 4.2.8p15 ] + name: ${{ matrix.ref }} + runs-on: ubuntu-latest + # This should be a safe limit for the tests to run. + timeout-minutes: 10 + needs: build_wolfssl + steps: + - name: Download lib + uses: actions/download-artifact@v4 + with: + name: wolf-install-ntp + + - name: untar build-dir + run: tar -xf build-dir.tgz + + - name: Checkout OSP + uses: actions/checkout@v4 + with: + repository: wolfssl/osp + path: osp + + # Avoid DoS'ing ntp site so cache the tar.gz + - name: Check if we have ntp + uses: actions/cache@v4 + id: cache + with: + path: ntp-${{ matrix.ref }}.tar.gz + key: ntp-${{ matrix.ref }}.tar.gz + + - name: Download ntp + if: steps.cache.outputs.cache-hit != 'true' + run: | + wget https://downloads.nwtime.org/ntp/4.2.8/ntp-${{ matrix.ref }}.tar.gz + + - name: Extract ntp + run: | + tar -xf ntp-${{ matrix.ref }}.tar.gz + + - name: Build and test ntp + working-directory: ntp-${{ matrix.ref }} + run: | + patch -p1 < $GITHUB_WORKSPACE/osp/ntp/${{ matrix.ref }}/ntp-${{ matrix.ref }}.patch + ./bootstrap + ./configure --with-wolfssl=$GITHUB_WORKSPACE/build-dir + make -j + make -j check diff --git a/.github/workflows/openldap.yml b/.github/workflows/openldap.yml new file mode 100644 index 0000000000..950435b5cc --- /dev/null +++ b/.github/workflows/openldap.yml @@ -0,0 +1,89 @@ +name: openldap 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 + # Just to keep it the same as the testing target + runs-on: ubuntu-latest + # 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-openldap CPPFLAGS=-DWOLFSSL_NO_ASN_STRICT + install: true + check: 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-openldap + path: build-dir.tgz + retention-days: 5 + + openldap_check: + strategy: + fail-fast: false + matrix: + include: + # List of releases to test + - osp_ref: 2.5.13 + git_ref: OPENLDAP_REL_ENG_2_5_13 + name: ${{ matrix.osp_ref }} + runs-on: ubuntu-latest + # This should be a safe limit for the tests to run. + timeout-minutes: 20 + needs: build_wolfssl + steps: + - name: Download lib + uses: actions/download-artifact@v4 + with: + name: wolf-install-openldap + + - 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 openldap + uses: actions/checkout@v4 + with: + repository: openldap/openldap + path: openldap + ref: ${{ matrix.git_ref }} + + - name: Build and test OpenLDAP + working-directory: openldap + run: | + export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH + patch -p1 < $GITHUB_WORKSPACE/osp/openldap/${{ matrix.osp_ref }}/openldap-${{ matrix.osp_ref }}.patch + rm aclocal.m4 + autoreconf -ivf + ./configure --with-tls=wolfssl --disable-bdb --disable-hdb \ + CFLAGS="-I$GITHUB_WORKSPACE/build-dir/include \ + -I$GITHUB_WORKSPACE/build-dir/include/wolfssl \ + -L$GITHUB_WORKSPACE/build-dir/lib" + make -j depend + make -j + make -j check diff --git a/.github/workflows/openssh.yml b/.github/workflows/openssh.yml index 040ae74648..3e717af012 100644 --- a/.github/workflows/openssh.yml +++ b/.github/workflows/openssh.yml @@ -26,14 +26,17 @@ jobs: path: wolfssl configure: >- --enable-openssh --enable-dsa --with-max-rsa-bits=8192 - --enable-intelasm --enable-sp-asm + --enable-intelasm --enable-sp-asm CFLAGS="-DRSA_MIN_SIZE=1024" 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-openssh - path: build-dir + path: build-dir.tgz retention-days: 5 openssh_check: @@ -51,7 +54,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-openssh - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Checkout OSP uses: actions/checkout@v4 @@ -69,7 +74,7 @@ jobs: configure: --with-wolfssl=$GITHUB_WORKSPACE/build-dir --with-rpath=-Wl,-rpath= check: false - # make tests take >20 minutes. Consider limiting? + # make tests take >20 minutes. Consider limiting? - name: Run tests working-directory: ./openssh run: | diff --git a/.github/workflows/openvpn.yml b/.github/workflows/openvpn.yml index 97243cb9ea..a547e8d8f4 100644 --- a/.github/workflows/openvpn.yml +++ b/.github/workflows/openvpn.yml @@ -27,11 +27,14 @@ jobs: configure: --enable-openvpn 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-openvpn - path: build-dir + path: build-dir.tgz retention-days: 5 openvpn_check: @@ -50,7 +53,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-openvpn - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Install dependencies run: | diff --git a/.github/workflows/os-check.yml b/.github/workflows/os-check.yml index 68557a31ab..8b337c1f0b 100644 --- a/.github/workflows/os-check.yml +++ b/.github/workflows/os-check.yml @@ -25,14 +25,19 @@ jobs: '--enable-all --enable-asn=original', '--enable-harden-tls', '--enable-tls13 --enable-session-ticket --enable-dtls --enable-dtls13 - --enable-opensslextra --enable-sessioncerts - CPPFLAGS=''-DWOLFSSL_DTLS_NO_HVR_ON_RESUME -DHAVE_EXT_CACHE + --enable-opensslextra --enable-sessioncerts + CPPFLAGS=''-DWOLFSSL_DTLS_NO_HVR_ON_RESUME -DHAVE_EXT_CACHE -DWOLFSSL_TICKET_HAVE_ID -DHAVE_EX_DATA -DSESSION_CACHE_DYNAMIC_MEM'' ', '--enable-all --enable-secure-renegotiation', '--enable-all --enable-haproxy --enable-quic', - '--enable-dtls --enable-dtls13 --enable-earlydata - --enable-session-ticket --enable-psk + '--enable-dtls --enable-dtls13 --enable-earlydata + --enable-session-ticket --enable-psk CPPFLAGS=''-DWOLFSSL_DTLS13_NO_HRR_ON_RESUME'' ', + '--enable-experimental --enable-kyber --enable-dtls --enable-dtls13 + --enable-dtls-frag-ch', + '--enable-all --enable-dtls13 --enable-dtls-frag-ch', + '--enable-dtls --enable-dtls13 --enable-dtls-frag-ch + --enable-dtls-mtu', ] name: make check runs-on: ${{ matrix.os }} diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index b4657110c5..b9d3378ff7 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -37,8 +37,9 @@ jobs: - name: Build wolfSSL .deb run: make deb-docker - - name: Build wolfSSL .rpm - run: make rpm-docker +# disabled 20240919 -- broken target. +# - name: Build wolfSSL .rpm +# run: make rpm-docker - name: Confirm packages built run: | @@ -47,8 +48,9 @@ jobs: echo Did not find exactly two deb packages!!! exit 1 fi - RPM_COUNT=$(find -name 'wolfssl*.rpm' | wc -l) - if [ "$RPM_COUNT" != "4" ]; then - echo Did not find exactly four rpm packages!!! - exit 1 - fi +# disabled 20240919 -- broken target. +# RPM_COUNT=$(find -name 'wolfssl*.rpm' | wc -l) +# if [ "$RPM_COUNT" != "4" ]; then +# echo Did not find exactly four rpm packages!!! +# exit 1 +# fi diff --git a/.github/workflows/pam-ipmi.yml b/.github/workflows/pam-ipmi.yml index e6a2a4ae55..dda3200644 100644 --- a/.github/workflows/pam-ipmi.yml +++ b/.github/workflows/pam-ipmi.yml @@ -30,11 +30,14 @@ jobs: # Don't run tests as this config is tested in many other places check: false + - 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-pam-ipmi - path: build-dir + path: build-dir.tgz retention-days: 5 build_pam-ipmi: @@ -58,7 +61,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-pam-ipmi - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Checkout OSP uses: actions/checkout@v4 diff --git a/.github/workflows/rng-tools.yml b/.github/workflows/rng-tools.yml new file mode 100644 index 0000000000..98a4280070 --- /dev/null +++ b/.github/workflows/rng-tools.yml @@ -0,0 +1,114 @@ +name: rng-tools 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 + # Just to keep it the same as the testing target + runs-on: ubuntu-latest + # 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 + install: true + check: false + + - 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-rng-tools + path: build-dir.tgz + retention-days: 5 + + rng-tools_check: + strategy: + fail-fast: false + matrix: + # List of releases to test + ref: [ 6.16 ] + name: ${{ matrix.ref }} + runs-on: ubuntu-latest + # This should be a safe limit for the tests to run. + timeout-minutes: 4 + needs: build_wolfssl + steps: + - name: Install dependencies + run: | + # Don't prompt for anything + export DEBIAN_FRONTEND=noninteractive + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev libjansson-dev libp11-dev librtlsdr-dev libcap-dev + + - name: Download lib + uses: actions/download-artifact@v4 + with: + name: wolf-install-rng-tools + + - 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 jitterentropy-library + uses: actions/checkout@v4 + with: + repository: smuellerDD/jitterentropy-library + path: jitterentropy-library + ref: v3.5.0 + + - name: Build jitterentropy-library + working-directory: jitterentropy-library + run: make -j + + - name: Build rng-tools + uses: wolfSSL/actions-build-autotools-project@v1 + with: + repository: nhorman/rng-tools + ref: v${{ matrix.ref }} + path: rng-tools + patch-file: $GITHUB_WORKSPACE/osp/rng-tools/${{ matrix.ref }}.patch + configure: --without-pkcs11 --enable-jitterentropy=$GITHUB_WORKSPACE/jitterentropy-library --with-wolfssl=$GITHUB_WORKSPACE/build-dir + check: false + + - name: Testing rng-tools + id: testing + working-directory: rng-tools + run: | + # Retry up to five times + for i in {1..5}; do + TEST_RES=0 + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib make check || TEST_RES=$? + if [ "$TEST_RES" -eq "0" ]; then + break + fi + done + if [ "$TEST_RES" -ne "0" ]; then + exit $TEST_RES + fi + + - name: Print logs + if: ${{ failure() && steps.testing.outcome == 'failure' }} + working-directory: rng-tools/tests + run: cat test-suite.log diff --git a/.github/workflows/socat.yml b/.github/workflows/socat.yml index 98c612d840..fe2c8252ac 100644 --- a/.github/workflows/socat.yml +++ b/.github/workflows/socat.yml @@ -25,12 +25,15 @@ jobs: configure: --enable-maxfragment --enable-opensslall --enable-opensslextra --enable-dtls --enable-oldtls --enable-tlsv10 --enable-ipv6 'CPPFLAGS=-DWOLFSSL_NO_DTLS_SIZE_CHECK -DOPENSSL_COMPATIBLE_DEFAULTS' 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-socat - path: build-dir - retention-days: 3 + path: build-dir.tgz + retention-days: 5 socat_check: @@ -49,7 +52,9 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-socat - path: build-dir + + - name: untar build-dir + run: tar -xf build-dir.tgz - name: Download socat run: curl -O http://www.dest-unreach.org/socat/download/socat-1.8.0.0.tar.gz && tar xvf socat-1.8.0.0.tar.gz diff --git a/.github/workflows/sssd.yml b/.github/workflows/sssd.yml new file mode 100644 index 0000000000..31011e1874 --- /dev/null +++ b/.github/workflows/sssd.yml @@ -0,0 +1,97 @@ +name: sssd 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 + # Just to keep it the same as the testing target + runs-on: ubuntu-latest + # 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 CFLAGS=-DWOLFSSL_NO_ASN_STRICT + install: true + check: false + + - 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-sssd + path: build-dir.tgz + retention-days: 5 + + sssd_check: + strategy: + fail-fast: false + matrix: + # List of releases to test + ref: [ 2.9.1 ] + name: ${{ matrix.ref }} + runs-on: ubuntu-latest + container: + image: quay.io/sssd/ci-client-devel:ubuntu-latest + env: + LD_LIBRARY_PATH: /usr/local/lib + # This should be a safe limit for the tests to run. + timeout-minutes: 20 + needs: build_wolfssl + steps: + - name: Install dependencies + run: | + # Don't prompt for anything + export DEBIAN_FRONTEND=noninteractive + sudo apt-get update + sudo apt-get install -y build-essential autoconf libldb-dev libldb2 python3-ldb bc + + - name: Setup env + run: | + ln -s samba-4.0/ldb.h /usr/include/ldb.h + ln -s samba-4.0/ldb_errors.h /usr/include/ldb_errors.h + ln -s samba-4.0/ldb_handlers.h /usr/include/ldb_handlers.h + ln -s samba-4.0/ldb_module.h /usr/include/ldb_module.h + ln -s samba-4.0/ldb_version.h /usr/include/ldb_version.h + + - name: Download lib + uses: actions/download-artifact@v4 + with: + name: wolf-install-sssd + + - name: untar build-dir + run: tar -xf build-dir.tgz + + - name: Checkout OSP + uses: actions/checkout@v4 + with: + repository: wolfssl/osp + path: osp + + - name: Build and test sssd + uses: wolfSSL/actions-build-autotools-project@v1 + with: + repository: SSSD/sssd + ref: ${{ matrix.ref }} + path: sssd + patch-file: $GITHUB_WORKSPACE/osp/sssd/${{ matrix.ref }}.patch + configure: >- + --without-samba --without-nfsv4-idmapd-plugin --with-oidc-child=no + --without-manpages WOLFSSL_INSTALL_DIR=$GITHUB_WORKSPACE/build-dir + check: true + diff --git a/.github/workflows/stunnel.yml b/.github/workflows/stunnel.yml index 5e1b6b325f..fdb6623f43 100644 --- a/.github/workflows/stunnel.yml +++ b/.github/workflows/stunnel.yml @@ -27,11 +27,14 @@ jobs: configure: --enable-stunnel 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-stunnel - path: build-dir + path: build-dir.tgz retention-days: 5 stunnel_check: @@ -50,8 +53,10 @@ jobs: uses: actions/download-artifact@v4 with: name: wolf-install-stunnel - path: build-dir - + + - name: untar build-dir + run: tar -xf build-dir.tgz + - name: Checkout OSP uses: actions/checkout@v4 with: diff --git a/.gitignore b/.gitignore index 833b664af3..c542ec121b 100644 --- a/.gitignore +++ b/.gitignore @@ -413,6 +413,14 @@ user_settings_asm.h /IDE/Espressif/**/sdkconfig /IDE/Espressif/**/sdkconfig.old +# ESP8266 RTOS SDK has a slightly different sdkconfig filename to exclude: +/IDE/Espressif/**/sdkconfig.debug +/IDE/Espressif/**/sdkconfig.release + +# Always include Espressif makefiles (typically only used for ESP8266) +!/IDE/Espressif/**/Makefile +!/IDE/Espressif/**/component.mk + # MPLAB /IDE/MPLABX16/wolfssl.X/dist/default/ /IDE/MPLABX16/wolfssl.X/.generated_files @@ -434,6 +442,12 @@ debian/changelog debian/control *.deb +# Ada/Alire files +wrapper/Ada/alire/ +wrapper/Ada/config/ +wrapper/Ada/lib/ +wrapper/Ada/obj/ + # PlatformIO /**/.pio /**/.vscode/.browse.c_cpp.db* diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e6f05fc68..d5dd2796e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -945,13 +945,29 @@ if(WOLFSSL_ECC) endif() endif() -# TODO: - ECC custom curves -# - Compressed key +# TODO: - Compressed key # - FP ECC, fixed point cache ECC # - ECC encrypt # - PSK # - Single PSK identity +# ECC custom curves +add_option("WOLFSSL_ECCCUSTCURVES" + "Enable ECC Custom Curves (default: disabled)" + "no" "yes;no;all") + +if(WOLFSSL_ECCCUSTCURVES) + if("${WOLFSSL_ECCCUSTCURVES}" STREQUAL "all") + list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_ECC_SECPR2") + list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_ECC_SECPR3") + list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_ECC_BRAINPOOL") + list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_ECC_KOBLITZ") + list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_ECC_CDH") + endif() + + list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_CUSTOM_CURVES") +endif() + # CURVE25519 set(WOLFSSL_CURVE25519_SMALL "no") add_option("WOLFSSL_CURVE25519" @@ -1877,6 +1893,10 @@ add_option("WOLFSSL_CRYPTOCB" "Enable crypto callbacks (default: disabled)" "no" "yes;no") +add_option("WOLFSSL_CRYPTOCB_NO_SW_TEST" + "Disable crypto callback SW testing (default: disabled)" + "no" "yes;no") + add_option("WOLFSSL_PKCALLBACKS" "Enable public key callbacks (default: disabled)" "no" "yes;no") @@ -2080,6 +2100,10 @@ if(WOLFSSL_CRYPTOCB) list(APPEND WOLFSSL_DEFINITIONS "-DWOLF_CRYPTO_CB") endif() +if(WOLFSSL_CRYPTOCB_NO_SW_TEST) + list(APPEND WOLFSSL_DEFINITIONS "-DWC_TEST_NO_CRYPTOCB_SW_TEST") +endif() + # Public Key Callbacks if(WOLFSSL_PKCALLBACKS) list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_PK_CALLBACKS") @@ -2335,7 +2359,7 @@ endif() foreach(DEF IN LISTS WOLFSSL_DEFINITIONS) string(REGEX MATCH "^(-D)?([^=]+)(=(.*))?$" DEF_MATCH ${DEF}) - if (DEFINED CMAKE_MATCH_4) + if (NOT "${CMAKE_MATCH_4}" STREQUAL "") set(${CMAKE_MATCH_2} ${CMAKE_MATCH_4}) # message("set(${CMAKE_MATCH_2} ${CMAKE_MATCH_4})") else() diff --git a/ChangeLog.md b/ChangeLog.md index 0939a65940..bee6e614ee 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -220,7 +220,7 @@ fixed this omission in several PRs for this release. * [Low] CVE-2023-6936: A potential heap overflow read is possible in servers connecting over TLS 1.3 when the optional `WOLFSSL_CALLBACKS` has been defined. The out of bounds read can occur when a server receives a malicious malformed ClientHello. Users should either discontinue use of `WOLFSSL_CALLBACKS` on the server side or update versions of wolfSSL to 5.6.6. Thanks to the tlspuffin fuzzer team for the report which was designed and developed by; Lucca Hirschi (Inria, LORIA), Steve Kremer (Inria, LORIA), and Max Ammann (Trail of Bits). The fix for this issue is located in the following GitHub Pull Request: https://github.com/wolfSSL/wolfssl/pull/6949. -* [Low] A side channel vulnerability with AES T-Tables is possible in a very controlled environment where precision sub-cache-line inspection can happen, such as inside an Intel SGX enclave. This can lead to recovery of the AES key. To prevent this type of attack, wolfSSL added an AES bitsliced implementation which can be enabled with the “`--enable-aes-bitsliced`” configure option. Thanks to Florian Sieck, Zhiyuan Zhang, Sebastian Berndt, Chitchanok Chuengsatiansup, Thomas Eisenbarth, and Yuval Yarom for the report (Universities of Lübeck, Melbourne, Adelaide and Bochum). The fix for this issue is located in the following GitHub Pull Request: https://github.com/wolfSSL/wolfssl/pull/6854. +* [Low] CVE-2024-1543: A side channel vulnerability with AES T-Tables is possible in a very controlled environment where precision sub-cache-line inspection can happen, such as inside an Intel SGX enclave. This can lead to recovery of the AES key. To prevent this type of attack, wolfSSL added an AES bitsliced implementation which can be enabled with the “`--enable-aes-bitsliced`” configure option. Thanks to Florian Sieck, Zhiyuan Zhang, Sebastian Berndt, Chitchanok Chuengsatiansup, Thomas Eisenbarth, and Yuval Yarom for the report (Universities of Lübeck, Melbourne, Adelaide and Bochum). The fix for this issue is located in the following GitHub Pull Request: https://github.com/wolfSSL/wolfssl/pull/6854. * [Low] CVE-2023-6937: wolfSSL prior to 5.6.6 did not check that messages in a single (D)TLS record do not span key boundaries. As a result, it was possible to combine (D)TLS messages using different keys into one (D)TLS record. The most extreme edge case is that, in (D)TLS 1.3, it was possible that an unencrypted (D)TLS 1.3 record from the server containing first a ServerHello message and then the rest of the first server flight would be accepted by a wolfSSL client. In (D)TLS 1.3 the handshake is encrypted after the ServerHello but a wolfSSL client would accept an unencrypted flight from the server. This does not compromise key negotiation and authentication so it is assigned a low severity rating. Thanks to Johannes Wilson for the report (Sectra Communications and Linköping University). The fix for this issue is located in the following GitHub Pull Request: https://github.com/wolfSSL/wolfssl/pull/7029. @@ -874,9 +874,9 @@ Release 5.5.1 of wolfSSL embedded TLS has bug fixes and new features including: ## Enhancements * DTLSv1.3: Do HRR Cookie exchange by default -* Add wolfSSL_EVP_PKEY_new_CMAC_key to OpenSSL compatible API -* Update ide win10 build files to add missing sp source files -* Improve Workbench docs +* Add wolfSSL_EVP_PKEY_new_CMAC_key to OpenSSL compatible API +* Update ide win10 build files to add missing sp source files +* Improve Workbench docs * Improve EVP support for CHACHA20_POLY1305 * Improve `wc_SetCustomExtension` documentation * RSA-PSS with OCSP and add simple OCSP response DER verify test case @@ -884,23 +884,23 @@ Release 5.5.1 of wolfSSL embedded TLS has bug fixes and new features including: * Don't over-allocate memory for DTLS fragments * Add WOLFSSL_ATECC_TFLXTLS for Atmel port * SHA-3 performance improvements with x86_64 assembly -* Add code to fallback to S/W if TSIP cannot handle +* Add code to fallback to S/W if TSIP cannot handle * Improves entropy with VxWorks * Make time in milliseconds 64-bits for longer session ticket lives * Support for setting cipher list with bytes * wolfSSL_set1_curves_list(), wolfSSL_CTX_set1_curves_list() improvements * Add to RSAES-OAEP key parsing for pkcs7 * Add missing DN nid to work with PrintName() -* SP int: default to 16 bit word size when NO_64BIT defined +* SP int: default to 16 bit word size when NO_64BIT defined * Limit the amount of fragments we store per a DTLS connection and error out when max limit is reached * Detect when certificate's RSA public key size is too big and fail on loading of certificate ## Fixes * Fix for async with OCSP non-blocking in `ProcessPeerCerts` * Fixes for building with 32-bit and socket size sign/unsigned mismatch -* Fix Windows CMakeList compiler options -* TLS 1.3 Middle-Box compat: fix missing brace -* Configuration consistency fixes for RSA keys and way to force disable of private keys +* Fix Windows CMakeList compiler options +* TLS 1.3 Middle-Box compat: fix missing brace +* Configuration consistency fixes for RSA keys and way to force disable of private keys * Fix for Aarch64 Mac M1 SP use * Fix build errors and warnings for MSVC with DTLS 1.3 * Fix HMAC compat layer function for SHA-1 @@ -908,9 +908,9 @@ Release 5.5.1 of wolfSSL embedded TLS has bug fixes and new features including: * Check return from call to wc_Time * SP math: fix build configuration with opensslall * Fix for async session tickets -* SP int mp_init_size fixes when SP_WORD_SIZE == 8 +* SP int mp_init_size fixes when SP_WORD_SIZE == 8 * Ed. function to make public key now checks for if the private key flag is set -* Fix HashRaw WC_SHA256_DIGEST_SIZE for wc_Sha256GetHash +* Fix HashRaw WC_SHA256_DIGEST_SIZE for wc_Sha256GetHash * Fix for building with PSK only * Set correct types in wolfSSL_sk_*_new functions * Sanity check that size passed to mp_init_size() is no more than SP_INT_DIGITS @@ -1024,7 +1024,7 @@ CVE-2020-12966 https://www.amd.com/en/corporate/product-security/bulletin/amd-sb * Update SP math all to not use sp_int_word when SQR_MUL_ASM is available ### SP Math Fixes * Fixes for constant time with div function -* Fix casting warnings for Windows builds and assembly changes to support XMM6-15 being non-volatile +* Fix casting warnings for Windows builds and assembly changes to support XMM6-15 being non-volatile * Fix for div_word when not using div function * Fixes for user settings with SP ASM and ED/Curve25519 small * Additional Wycheproof tests ran and fixes @@ -1204,7 +1204,7 @@ Release 5.3.0 of wolfSSL embedded TLS has bug fixes and new features including: ### Math Library Fixes * Sanity check with SP math that ECC points ordinates are not greater than modulus length * Additional sanity checks that _sp_add_d does not error due to overflow -* Wycheproof fixes, testing integration, and fixes for AVX / AArch64 ASM edge case tests +* Wycheproof fixes, testing integration, and fixes for AVX / AArch64 ASM edge case tests * TFM fp_div_2_ct rework to avoid potential overflow ### Misc. @@ -1445,7 +1445,7 @@ Release 5.1.0 of wolfSSL embedded TLS has bug fixes and new features including: ###### PORT Fixes * Building with Android wpa_supplicant and KeyStore * Setting initial value of CA certificate with TSIP enabled -* Cryptocell ECC build fix and fix with RSA disabled +* Cryptocell ECC build fix and fix with RSA disabled * IoT-SAFE improvement for Key/File slot ID size, fix for C++ compile, and fixes for retrieving the public key after key generation ###### Math Library Fixes @@ -1584,7 +1584,7 @@ Release 5.0.0 of wolfSSL embedded TLS has bug fixes and new features including: - SSL_SESSION_has_ticket() - SSL_SESSION_get_ticket_lifetime_hint() - DIST_POINT_new - - DIST_POINT_free + - DIST_POINT_free - DIST_POINTS_free - CRL_DIST_POINTS_free - sk_DIST_POINT_push @@ -1747,7 +1747,7 @@ Release 4.8.0 of wolfSSL embedded TLS has bug fixes and new features including: ### Vulnerabilities * [Low] CVE-2021-37155: OCSP request/response verification issue. In the case that the serial number in the OCSP request differs from the serial number in the OCSP response the error from the comparison was not resulting in a failed verification. We recommend users that have wolfSSL version 4.6.0 and 4.7.0 with OCSP enabled update their version of wolfSSL. Version 4.5.0 and earlier are not affected by this report. Thanks to Rainer Mueller-Amersdorffer, Roee Yankelevsky, Barak Gutman, Hila Cohen and Shoshi Berko (from CYMOTIVE Technologies and CARIAD) for the report. -* [Low] CVE-2021-24116: Side-Channel cache look up vulnerability in base64 PEM decoding for versions of wolfSSL 4.5.0 and earlier. Versions 4.6.0 and up contain a fix and do not need to be updated for this report. If decoding a PEM format private key using version 4.5.0 and older of wolfSSL then we recommend updating the version of wolfSSL used. Thanks to Florian Sieck, Jan Wichelmann, Sebastian Berndt and Thomas Eisenbarth for the report. +* [Low] CVE-2021-24116: Side-Channel cache look up vulnerability in base64 PEM decoding for versions of wolfSSL 4.5.0 and earlier. Versions 4.6.0 and up contain a fix and do not need to be updated for this report. If decoding a PEM format private key using version 4.5.0 and older of wolfSSL then we recommend updating the version of wolfSSL used. Thanks to Florian Sieck, Jan Wichelmann, Sebastian Berndt and Thomas Eisenbarth for the report. ### New Feature Additions ###### New Product diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 32b10900ce..e6c3cd35d3 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -40,10 +40,12 @@ RUN cd /opt/sources && git clone --single-branch https://github.com/cisco/hash-s # Install pkixssh to /opt/pkixssh for X509 interop testing with wolfSSH RUN mkdir /var/empty -RUN cd /opt/sources && wget -q -O- https://roumenpetrov.info/secsh/src/pkixssh-14.1.1.tar.gz | tar xzf - && cd pkixssh-14.1.1 && ./configure --prefix=/opt/pkixssh/ --exec-prefix=/opt/pkixssh/ && make install +RUN cd /opt/sources && wget -q -O- https://roumenpetrov.info/secsh/src/pkixssh-15.1.tar.gz | tar xzf - && cd pkixssh-15.1 && ./configure --prefix=/opt/pkixssh/ --exec-prefix=/opt/pkixssh/ && make install # Install udp/tcp-proxy RUN cd /opt/sources && git clone --depth=1 --single-branch --branch=main http://github.com/wolfssl/udp-proxy && cd udp-proxy && make && cp tcp_proxy udp_proxy /bin/. +# Install libbacktrace +RUN cd /opt/sources && git clone --depth=1 --single-branch https://github.com/ianlancetaylor/libbacktrace.git && cd libbacktrace && mkdir build && cd build && ../configure && make && make install # Allow non-root to use tcpdump (will need NET_RAW and NET_ADMIN capability when running the container) RUN setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/tcpdump diff --git a/Docker/buildAndPush.sh b/Docker/buildAndPush.sh index d66e2c8486..444edaca09 100755 --- a/Docker/buildAndPush.sh +++ b/Docker/buildAndPush.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Assume we're in wolfssl/Docker WOLFSSL_DIR=$(builtin cd ${BASH_SOURCE%/*}/..; pwd) @@ -18,18 +18,37 @@ docker build -t wolfssl/wolfssl-builder:${CUR_DATE} ${DOCKER_BUILD_OPTIONS} "${W docker tag wolfssl/testing-cross-compiler:${CUR_DATE} wolfssl/testing-cross-compiler:latest if [ $? -eq 0 ]; then - echo "Pushing containers to DockerHub" - docker push wolfssl/wolfssl-builder:${CUR_DATE} && docker push wolfssl/wolfssl-builder:latest && \ - docker push wolfssl/testing-cross-compiler:${CUR_DATE} && docker push wolfssl/testing-cross-compiler:latest + echo "Push containers to DockerHub [y/N]? " + read val + if [ "$val" = "y" ]; then + docker push wolfssl/wolfssl-builder:${CUR_DATE} && docker push wolfssl/wolfssl-builder:latest && \ + docker push wolfssl/testing-cross-compiler:${CUR_DATE} && docker push wolfssl/testing-cross-compiler:latest + if [ $? -ne 0 ]; then + echo "Warning: push failed. Continuing" + ((NUM_FAILURES++)) + fi + fi else echo "Warning: Build wolfssl/wolfssl-builder failed. Continuing" ((NUM_FAILURES++)) fi echo "Building wolfssl/wolfCLU:${CUR_DATE}" -docker buildx build --pull --push --build-arg DUMMY=${CUR_DATE} -t wolfssl/wolfclu:${CUR_DATE} --platform=linux/amd64,linux/arm64,linux/arm/v7 "${WOLFSSL_DIR}/Docker/wolfCLU" && \ -docker buildx build --pull --push --build-arg DUMMY=${CUR_DATE} -t wolfssl/wolfclu:latest --platform=linux/amd64,linux/arm64,linux/arm/v7 "${WOLFSSL_DIR}/Docker/wolfCLU" -if [ $? -ne 0 ]; then +DOCKER_ARGS="--pull --build-arg DUMMY=${CUR_DATE} --platform=linux/amd64,linux/arm64,linux/arm/v7 ${WOLFSSL_DIR}/Docker/wolfCLU" +docker buildx build -t wolfssl/wolfclu:${CUR_DATE} ${DOCKER_ARGS} && \ + docker buildx build -t wolfssl/wolfclu:latest ${DOCKER_ARGS} +if [ $? -eq 0 ]; then + echo "Push containers to DockerHub [y/N]? " + read val + if [ "$val" = "y" ]; then + docker buildx build ${DOCKER_ARGS} --push -t wolfssl/wolfclu:${CUR_DATE} && \ + docker buildx build ${DOCKER_ARGS} --push -t wolfssl/wolfclu:latest + if [ $? -ne 0 ]; then + echo "Warning: push failed. Continuing" + ((NUM_FAILURES++)) + fi + fi +else echo "Warning: Build wolfssl/wolfclu failed. Continuing" ((NUM_FAILURES++)) fi diff --git a/Docker/run.sh b/Docker/run.sh index 3820425bb3..880e1e44f6 100755 --- a/Docker/run.sh +++ b/Docker/run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash echo "Running with \"${*}\"..." diff --git a/Docker/wolfCLU/Dockerfile b/Docker/wolfCLU/Dockerfile index 03b6a6fee3..da10d73dd6 100644 --- a/Docker/wolfCLU/Dockerfile +++ b/Docker/wolfCLU/Dockerfile @@ -3,7 +3,7 @@ FROM ubuntu as BUILDER ARG DEPS_WOLFSSL="build-essential autoconf libtool zlib1g-dev libuv1-dev libpam0g-dev git libpcap-dev libcurl4-openssl-dev bsdmainutils netcat-traditional iputils-ping bubblewrap" RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y apt-utils \ - && apt install -y ${DEPS_WOLFSSL} ${DEPS_LIBOQS} \ + && apt install -y ${DEPS_WOLFSSL} \ && apt clean -y && rm -rf /var/lib/apt/lists/* ARG NUM_CPU=16 diff --git a/Docker/wolfCLU/README.md b/Docker/wolfCLU/README.md index 1fc7bc6de8..2c271d5569 100644 --- a/Docker/wolfCLU/README.md +++ b/Docker/wolfCLU/README.md @@ -1,6 +1,6 @@ This is a small container that has wolfCLU installed for quick access. To build your own run the following: ``` -docker build --pull --build-arg DUMMY=$(date +%s) -t wolfclu . +docker build --pull --build-arg DUMMY=$(date +%s) -t wolfclu . ``` To run the container, you can use: diff --git a/Docker/yocto/buildAndPush.sh b/Docker/yocto/buildAndPush.sh index 8c749502c6..87558eb769 100755 --- a/Docker/yocto/buildAndPush.sh +++ b/Docker/yocto/buildAndPush.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Assume we're in wolfssl/Docker/yocto WOLFSSL_DIR=$(builtin cd ${BASH_SOURCE%/*}/../..; pwd) diff --git a/IDE/ARDUINO/Arduino_README_prepend.md b/IDE/ARDUINO/Arduino_README_prepend.md index 594a067847..c11b35dbb9 100644 --- a/IDE/ARDUINO/Arduino_README_prepend.md +++ b/IDE/ARDUINO/Arduino_README_prepend.md @@ -10,4 +10,6 @@ See the [Arduino-wolfSSL logs](https://downloads.arduino.cc/libraries/logs/githu The first Official wolfSSL Arduino Library is `5.6.6-Arduino.1`: a slightly modified, post [release 5.6.6](https://github.com/wolfSSL/wolfssl/releases/tag/v5.6.6-stable) version update. +The next Official wolfSSL Arduino Library is [5.7.0](https://github.com/wolfSSL/wolfssl/releases/tag/v5.7.0-stable) + See other [wolfSSL releases versions](https://github.com/wolfSSL/wolfssl/releases). The `./wolfssl-arduino.sh INSTALL` [script](https://github.com/wolfSSL/wolfssl/tree/master/IDE/ARDUINO) can be used to install specific GitHub versions as needed. diff --git a/IDE/ARDUINO/README.md b/IDE/ARDUINO/README.md index 75c25a20ad..f8b1ad60f1 100644 --- a/IDE/ARDUINO/README.md +++ b/IDE/ARDUINO/README.md @@ -27,7 +27,7 @@ This option will allow wolfSSL to be installed directly using the native Arduino ## Manually Reformatting wolfSSL as a Compatible Arduino Library -Use [this](./wolfssl-arduino.sh) shell script that will re-organize the wolfSSL library to be +Use [this](./wolfssl-arduino.sh) shell script that will re-organize the wolfSSL library to be compatible with [Arduino Library Specification](https://arduino.github.io/arduino-cli/0.35/library-specification/) for projects that use Arduino IDE 1.5.0 or newer. @@ -55,8 +55,8 @@ from within the `wolfssl/IDE/ARDUINO` directory: 3. `./wolfssl-arduino.sh INSTALL /path/to/repository` (Used to update [arduino-wolfSSL](https://github.com/wolfSSL/arduino-wolfSSL)) - Creates an Arduino Library in `wolfSSL` directory - Copies that directory contents to the specified `/path/to/repository` - - Adds the [default](../../examples/configs/user_settings_arduino.h) as `user_settings.h`. - + - Adds the [default](../../examples/configs/user_settings_arduino.h) as `user_settings.h`. + 4. `./wolfssl-arduino.sh INSTALL /path/to/any/other/directory` - Creates an Arduino Library in `wolfSSL` directory - Copies that directory contents to the specified `/path/to/any/other/directory` diff --git a/IDE/ARDUINO/sketches/wolfssl_client/wolfssl_client.ino b/IDE/ARDUINO/sketches/wolfssl_client/wolfssl_client.ino index 21a84deb00..e4727dce1a 100644 --- a/IDE/ARDUINO/sketches/wolfssl_client/wolfssl_client.ino +++ b/IDE/ARDUINO/sketches/wolfssl_client/wolfssl_client.ino @@ -1,6 +1,6 @@ /* wolfssl_client.ino * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ARDUINO/sketches/wolfssl_server/README.md b/IDE/ARDUINO/sketches/wolfssl_server/README.md index 523eb08729..a7073573b5 100644 --- a/IDE/ARDUINO/sketches/wolfssl_server/README.md +++ b/IDE/ARDUINO/sketches/wolfssl_server/README.md @@ -13,7 +13,7 @@ Additional examples can be found on [wolfSSL/wolfssl-examples](https://github.co ## Connect with an Arduino Sketch -See the companion [Arduino Sketch Client](../wolfssl_client/wolfssl_client.ino). +See the companion [Arduino Sketch Client](../wolfssl_client/wolfssl_client.ino). ## Connect with Linux Client @@ -35,7 +35,7 @@ press the reset button or power cycle the Arduino before making a connection. Here's one possible script to test the server from a command-line client: ```bash -#!/bin/bash +#!/usr/bin/env bash echo "client log " > client_log.txt counter=1 THIS_ERR=0 diff --git a/IDE/ARDUINO/sketches/wolfssl_server/wolfssl_server.ino b/IDE/ARDUINO/sketches/wolfssl_server/wolfssl_server.ino index 3a894323e4..387052ca6b 100644 --- a/IDE/ARDUINO/sketches/wolfssl_server/wolfssl_server.ino +++ b/IDE/ARDUINO/sketches/wolfssl_server/wolfssl_server.ino @@ -1,6 +1,6 @@ /* wolfssl_server.ino * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ARDUINO/wolfssl-arduino.sh b/IDE/ARDUINO/wolfssl-arduino.sh index d48b416626..e8a175a9f4 100755 --- a/IDE/ARDUINO/wolfssl-arduino.sh +++ b/IDE/ARDUINO/wolfssl-arduino.sh @@ -20,7 +20,7 @@ # Reminder there's typically no $USER for GitHub actions, but: # ROOT_DIR="/mnt/c/Users/$USER/Documents/Arduino/libraries" # -# The company name is "wolfSSL Inc."; There’s a space, no comma, and a period after "Inc." +# The company name is "wolfSSL Inc."; There's a space, no comma, and a period after "Inc." # The Arduino library name is "wolfssl" (all lower case) # The Arduino library directory name is "wolfssl" (all lower case) # The Arduino library include file is "wolfssl.h" (all lower case) @@ -29,7 +29,7 @@ ROOT_DIR="/wolfssl" # The Arduino Version will initially have a suffix appended during fine tuning stage. -WOLFSSL_VERSION_ARUINO_SUFFIX="-Arduino.3" +WOLFSSL_VERSION_ARUINO_SUFFIX="" # For verbose copy, set CP_CMD="-v", otherwise clear it: CP_CMD="cp" # Do not set to empty string, as copy will fail with this: CP_CMD="" @@ -65,6 +65,11 @@ if ! [ "$CP_CMD" = "cp " ]; then fi fi +if [ "$ROOT_DIR" = "" ]; then + echo "ERROR: ROOT_DIR cannot be blank" + exit 1 +fi + # Check environment if [ -n "$WSL_DISTRO_NAME" ]; then # we found a non-blank WSL environment distro name @@ -84,6 +89,11 @@ if [ $# -gt 0 ]; then if [ "$THIS_OPERATION" = "INSTALL" ]; then THIS_INSTALL_DIR=$2 + if [ "$THIS_INSTALL_DIR" = "/" ]; then + echo "ERROR: THIS_INSTALL_DIR cannot be /" + exit 1 + fi + echo "Install is active." if [ "$THIS_INSTALL_DIR" = "" ]; then @@ -300,20 +310,22 @@ echo "" # Note we should have exited above if a problem was encountered, # as we'll never want to install a bad library. if [ "$THIS_OPERATION" = "INSTALL" ]; then + echo "Config:" + echo "cp ../../examples/configs/user_settings_arduino.h ".${ROOT_SRC_DIR}"/user_settings.h" + # Nearly an ordinary copy, but we remove any lines with ">>" (typically edit with caution warning in comments) + grep -v '>>' ../../examples/configs/user_settings_arduino.h > ".${ROOT_SRC_DIR}"/user_settings.h || exit 1 + + # Show the user_settings.h revision string: + grep "WOLFSSL_USER_SETTINGS_ID" ."${ROOT_SRC_DIR}/user_settings.h" + echo "" + if [ "$THIS_INSTALL_IS_GITHUB" = "true" ]; then echo "Installing to GitHub directory: $THIS_INSTALL_DIR" cp -r ."$ROOT_DIR"/* "$THIS_INSTALL_DIR" || exit 1 + echo "Removing workspace library directory: .$ROOT_DIR" + rm -rf ".$ROOT_DIR" else - echo "Config:" - echo "cp ../../examples/configs/user_settings_arduino.h ".${ROOT_SRC_DIR}"/user_settings.h" - # Nearly an ordinary copy, but we remove any lines with ">>" (typically edit with caution warning in comments) - grep -v '>>' ../../examples/configs/user_settings_arduino.h > ".${ROOT_SRC_DIR}"/user_settings.h || exit 1 - - # Show the user_settings.h revision string: - grep "WOLFSSL_USER_SETTINGS_ID" ."${ROOT_SRC_DIR}/user_settings.h" - echo "" - - echo "Install:" + echo "Installing to local directory:" echo "mv .$ROOT_DIR $ARDUINO_ROOT" mv ."$ROOT_DIR" "$ARDUINO_ROOT" || exit 1 diff --git a/IDE/AURIX/Cpu0_Main.c b/IDE/AURIX/Cpu0_Main.c index 536ddbb10c..c1667202f6 100644 --- a/IDE/AURIX/Cpu0_Main.c +++ b/IDE/AURIX/Cpu0_Main.c @@ -1,6 +1,6 @@ /* Cpu0_Main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -63,7 +63,7 @@ int fputc(int ch, FILE *f) if (ch == (int)'\n') { int chcr = (int)'\r'; count = 1; - IfxAsclin_Asc_write(&g_asc, &chcr, &count, TIME_INFINITE); + IfxAsclin_Asc_write(&g_asc, &chcr, &count, TIME_INFINITE); } count = 1; IfxAsclin_Asc_write(&g_asc, &ch, &count, TIME_INFINITE); diff --git a/IDE/AURIX/README.md b/IDE/AURIX/README.md index 11f884db38..fdcb171d56 100644 --- a/IDE/AURIX/README.md +++ b/IDE/AURIX/README.md @@ -9,7 +9,7 @@ Tested Platform: ## Running wolfCrypt on TriCore -1) Add the wolfSSL source and headers to `Libraries/wolfssl`. +1) Add the wolfSSL source and headers to `Libraries/wolfssl`. - Only the following folders are required: `src`, `wolfcrypt` and `wolfssl`. - See script to help with producing bundle here: https://github.com/wolfSSL/wolfssl/blob/master/scripts/makedistsmall.sh 2) Add `WOLFSSL_USER_SETTINGS` to the Preprocessing symbols list. C/C++ Build -> Settings -> TASKING C/C++ Compiler -> Preprocessing. diff --git a/IDE/AURIX/user_settings.h b/IDE/AURIX/user_settings.h index 4b41446b9e..d041a99862 100644 --- a/IDE/AURIX/user_settings.h +++ b/IDE/AURIX/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/AURIX/wolf_main.c b/IDE/AURIX/wolf_main.c index 9f90038985..f88140339b 100644 --- a/IDE/AURIX/wolf_main.c +++ b/IDE/AURIX/wolf_main.c @@ -1,6 +1,6 @@ /* wolf_main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/CRYPTOCELL/main.c b/IDE/CRYPTOCELL/main.c index 7938d0dfae..c1ed8a0b13 100644 --- a/IDE/CRYPTOCELL/main.c +++ b/IDE/CRYPTOCELL/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -18,8 +18,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ - - + + #include #include #include @@ -63,4 +63,3 @@ int main(void) return 0; } - diff --git a/IDE/CRYPTOCELL/user_settings.h b/IDE/CRYPTOCELL/user_settings.h index dc9822f5cf..b6ffe4c781 100644 --- a/IDE/CRYPTOCELL/user_settings.h +++ b/IDE/CRYPTOCELL/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -401,6 +401,7 @@ extern "C" { /* prototypes for user heap override functions */ /* Note: Realloc only required for normal math */ + /* Note2: XFREE(NULL) must be properly handled */ #include /* for size_t */ extern void *myMalloc(size_t n, void* heap, int type); extern void myFree(void *p, void* heap, int type); diff --git a/IDE/ECLIPSE/DEOS/deos_malloc.c b/IDE/ECLIPSE/DEOS/deos_malloc.c index b944e3bf05..9dcc7a473d 100644 --- a/IDE/ECLIPSE/DEOS/deos_malloc.c +++ b/IDE/ECLIPSE/DEOS/deos_malloc.c @@ -1,6 +1,6 @@ /* deos_malloc.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/DEOS/tls_wolfssl.c b/IDE/ECLIPSE/DEOS/tls_wolfssl.c index 41149aa442..d74cc436ed 100644 --- a/IDE/ECLIPSE/DEOS/tls_wolfssl.c +++ b/IDE/ECLIPSE/DEOS/tls_wolfssl.c @@ -1,6 +1,6 @@ /* tls_wolfssl.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/DEOS/tls_wolfssl.h b/IDE/ECLIPSE/DEOS/tls_wolfssl.h index 02a0e53161..427eef6388 100644 --- a/IDE/ECLIPSE/DEOS/tls_wolfssl.h +++ b/IDE/ECLIPSE/DEOS/tls_wolfssl.h @@ -1,6 +1,6 @@ /* tls_wolfssl.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/DEOS/user_settings.h b/IDE/ECLIPSE/DEOS/user_settings.h index ca68a2a909..16dc09ee74 100644 --- a/IDE/ECLIPSE/DEOS/user_settings.h +++ b/IDE/ECLIPSE/DEOS/user_settings.h @@ -1,6 +1,6 @@ /* user_setting.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/client_wolfssl.c b/IDE/ECLIPSE/MICRIUM/client_wolfssl.c index 43d2e9be86..2c9b296417 100644 --- a/IDE/ECLIPSE/MICRIUM/client_wolfssl.c +++ b/IDE/ECLIPSE/MICRIUM/client_wolfssl.c @@ -1,6 +1,6 @@ /* client_wolfssl.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/client_wolfssl.h b/IDE/ECLIPSE/MICRIUM/client_wolfssl.h index f86cc98d51..edf6559f84 100644 --- a/IDE/ECLIPSE/MICRIUM/client_wolfssl.h +++ b/IDE/ECLIPSE/MICRIUM/client_wolfssl.h @@ -1,6 +1,6 @@ /* client_wolfssl.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/server_wolfssl.c b/IDE/ECLIPSE/MICRIUM/server_wolfssl.c index 225aaa2eef..e31f4ca615 100644 --- a/IDE/ECLIPSE/MICRIUM/server_wolfssl.c +++ b/IDE/ECLIPSE/MICRIUM/server_wolfssl.c @@ -1,6 +1,6 @@ /* server_wolfssl.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/server_wolfssl.h b/IDE/ECLIPSE/MICRIUM/server_wolfssl.h index 715e17b07c..b94e1fe6e2 100644 --- a/IDE/ECLIPSE/MICRIUM/server_wolfssl.h +++ b/IDE/ECLIPSE/MICRIUM/server_wolfssl.h @@ -1,6 +1,6 @@ /* server_wolfssl.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/user_settings.h b/IDE/ECLIPSE/MICRIUM/user_settings.h index b6b93fce84..27f8e08e25 100644 --- a/IDE/ECLIPSE/MICRIUM/user_settings.h +++ b/IDE/ECLIPSE/MICRIUM/user_settings.h @@ -1,6 +1,6 @@ /* user_setting.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/wolfsslRunTests.c b/IDE/ECLIPSE/MICRIUM/wolfsslRunTests.c index 99a9212e42..e7553c3d77 100644 --- a/IDE/ECLIPSE/MICRIUM/wolfsslRunTests.c +++ b/IDE/ECLIPSE/MICRIUM/wolfsslRunTests.c @@ -1,6 +1,6 @@ /* wolfsslRunTests.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/RTTHREAD/user_settings.h b/IDE/ECLIPSE/RTTHREAD/user_settings.h index 28157c2026..5e5ec18b43 100644 --- a/IDE/ECLIPSE/RTTHREAD/user_settings.h +++ b/IDE/ECLIPSE/RTTHREAD/user_settings.h @@ -1,6 +1,6 @@ /* user_setting.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/RTTHREAD/wolfssl_test.c b/IDE/ECLIPSE/RTTHREAD/wolfssl_test.c index 84d7f460a3..511801209c 100644 --- a/IDE/ECLIPSE/RTTHREAD/wolfssl_test.c +++ b/IDE/ECLIPSE/RTTHREAD/wolfssl_test.c @@ -1,6 +1,6 @@ /* wolfsslRunTests.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/SIFIVE/README.md b/IDE/ECLIPSE/SIFIVE/README.md index 030e140496..206793e9c8 100644 --- a/IDE/ECLIPSE/SIFIVE/README.md +++ b/IDE/ECLIPSE/SIFIVE/README.md @@ -1 +1 @@ -This folder has moved to `IDE/RISCV/SIFIVE-HIFIVE1`. \ No newline at end of file +This folder has moved to `IDE/RISCV/SIFIVE-HIFIVE1`. diff --git a/IDE/Espressif/ESP-IDF/README.md b/IDE/Espressif/ESP-IDF/README.md index 2075bde353..cc1a1d661d 100644 --- a/IDE/Espressif/ESP-IDF/README.md +++ b/IDE/Espressif/ESP-IDF/README.md @@ -1,6 +1,6 @@ # ESP-IDF Port -These Espressif examples have been created and tested with the latest stable release branch of +These Espressif examples have been created and tested with the latest stable release branch of [ESP-IDF V5.2](https://docs.espressif.com/projects/esp-idf/en/release-v5.2/esp32/get-started/index.html). The prior version 4.4 ESP-IDF is still supported, however version 5.2 or greater is recommended. Espressif has [a list of all ESP-IDF versions](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/versions.html). @@ -140,7 +140,7 @@ See the specific examples for additional details. This is an alternate method for installation. It is recommended to use the new `CMakeLists.txt` to point to wolfSSL source code. - 1. Run `setup.sh` at _/path/to_`/wolfssl/IDE/Espressif/ESP-IDF/` to deploy files into ESP-IDF tree + 1. Run `setup.sh` at _/path/to_`/wolfssl/IDE/Espressif/ESP-IDF/` to deploy files into ESP-IDF tree 2. Find Wolfssl files at _/path/to/esp_`/esp-idf/components/wolfssl/` 3. Find [Example Programs](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples) under _/path/to/esp_`/esp-idf/examples/protocols/wolfssl_xxx` (where xxx is the project name) @@ -169,7 +169,7 @@ C:\SysGCC\esp32\esp-idf>git clone -b v5.0.2 --recursive https://github.com/espre ## Configuration - 1. The `user_settings.h` can be found in `[project]/components/wolfssl/include/user_settings.h`. + 1. The `user_settings.h` can be found in `[project]/components/wolfssl/include/user_settings.h`. ## Configuration (Legacy IDF install) @@ -183,7 +183,7 @@ C:\SysGCC\esp32\esp-idf>git clone -b v5.0.2 --recursive https://github.com/espre For question please email [support@wolfssl.com] - Note: This is tested with : + Note: This is tested with : - OS: Ubuntu 20.04.3 LTS - Microsoft Windows 10 Pro 10.0.19041 / Windows 11 Pro 22H2 22621.2715 - Visual Studio 2022 17.7.6 with VisualGDB 5.6R9 (build 4777) diff --git a/IDE/Espressif/ESP-IDF/compileAllExamples.sh b/IDE/Espressif/ESP-IDF/compileAllExamples.sh index 536dc295c1..95a85d9068 100755 --- a/IDE/Espressif/ESP-IDF/compileAllExamples.sh +++ b/IDE/Espressif/ESP-IDF/compileAllExamples.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # testing script: compileAllExamples # diff --git a/IDE/Espressif/ESP-IDF/dummy_config_h b/IDE/Espressif/ESP-IDF/dummy_config_h index 9d13eb2844..258ffd3f3d 100644 --- a/IDE/Espressif/ESP-IDF/dummy_config_h +++ b/IDE/Espressif/ESP-IDF/dummy_config_h @@ -1,6 +1,6 @@ /* config.h - dummy * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Espressif/ESP-IDF/examples/README.md b/IDE/Espressif/ESP-IDF/examples/README.md index 1cd6696f7b..d4a0ad696a 100644 --- a/IDE/Espressif/ESP-IDF/examples/README.md +++ b/IDE/Espressif/ESP-IDF/examples/README.md @@ -12,7 +12,7 @@ These are the core examples for wolfSSL: - [TLS Client](./wolfssl_client/README.md). See also [CLI Client](https://github.com/wolfSSL/wolfssl/tree/master/examples/client) and [more TLS examples](https://github.com/wolfSSL/wolfssl-examples/tree/master/tls). -- [TLS Server](./wolfssl_server/README.md). See also [CLI Server](https://github.com/wolfSSL/wolfssl/tree/master/examples/server) +- [TLS Server](./wolfssl_server/README.md). See also [CLI Server](https://github.com/wolfSSL/wolfssl/tree/master/examples/server) ## Other Espressif wolfSSL Examples @@ -44,7 +44,7 @@ TLS1.3 Linux Client to Linux Server: `TLS_AES_128_GCM_SHA256` (default) ./examples/client/client -v 4 -h 127.0.0.1 -p 11111 -A ./certs/ca-cert.pem ``` -TLS1.2 Linux Server +TLS1.2 Linux Server ``` ./examples/server/server -v 3 -b -d -p 11111 -c ./certs/server-cert.pem -k ./certs/server-key.pem ``` @@ -71,11 +71,11 @@ There's an additional example that uses wolfSSL installed as a component to the ## Installing wolfSSL for Espressif projects -[Core examples](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples) -have a local `components/wolfssl` directory with a special CMakeFile.txt that does not require +[Core examples](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples) +have a local `components/wolfssl` directory with a special CMakeFile.txt that does not require wolfSSL to be installed. -If you want to install wolfSSL, see the setup for [wolfSSL](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF#setup-for-linux) +If you want to install wolfSSL, see the setup for [wolfSSL](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF#setup-for-linux) and [wolfSSH](https://github.com/wolfSSL/wolfssh/tree/master/ide/Espressif#setup-for-linux). The [Espressif Managed Component for wolfSSL](https://components.espressif.com/components/wolfssl/wolfssl) diff --git a/IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt index 649a736630..2f3e1630a3 100644 --- a/IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt @@ -1,10 +1,13 @@ # wolfSSL Espressif Example Project CMakeLists.txt -# v1.0 +# v1.2 # # The following lines of boilerplate have to be in your project's # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.16) +# Optional no watchdog typically used for test & benchmark +# add_compile_options(-DWOLFSSL_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: # @@ -68,6 +71,8 @@ else() message(STATUS "No conflicting wolfSSL components found.") endif() +# 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". include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(wolfssl_template) diff --git a/IDE/Espressif/ESP-IDF/examples/template/README.md b/IDE/Espressif/ESP-IDF/examples/template/README.md index 274e22dea5..8d9ebbe49a 100644 --- a/IDE/Espressif/ESP-IDF/examples/template/README.md +++ b/IDE/Espressif/ESP-IDF/examples/template/README.md @@ -11,7 +11,7 @@ It is assumed the [ESP-IDF environment](https://docs.espressif.com/projects/esp- ### Files Included -- [main.c](./main/main.c) with a simple call to an Espressif library (`ESP_LOGI`) and a call to a wolfSSL library (`esp_ShowExtendedSystemInfo`) . +- [main.c](./main/main.c) with a simple call to an Espressif library (`ESP_LOGI`) and a call to a wolfSSL library (`esp_ShowExtendedSystemInfo`) . - See [components/wolfssl/include](./components/wolfssl/include/user_settings.h) directory to edit the wolfSSL `user_settings.h`. 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 1aea2577f8..8c678fbf3b 100644 --- a/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/CMakeLists.txt @@ -1,34 +1,160 @@ # -# Copyright (C) 2006-2024 wolfSSL Inc. +# Copyright (C) 2006-2024 wolfSSL Inc. # -# This file is part of wolfSSL. +# This file is part of wolfSSL. # -# wolfSSL is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# wolfSSL is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA # # cmake for wolfssl Espressif projects # -# Version 5.6.0.011 for detect test/benchmark +# Version 5.7.2 Espressif ESP-IDF integration # # See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html # - +message(STATUS "Begin wolfssl ${CONFIG_CUSTOM_SETTING_WOLFSSL_ROOT}") cmake_minimum_required(VERSION 3.16) + +set(VERBOSE_COMPONENT_MESSAGES 1) + + +# function: IS_ESP_IDF_COMPONENT +# output: RESULT = 1 (true) if this component is located in the ESP-IDF components +# otherwise 0 (false) +function( IS_ESP_IDF_COMPONENT RESULT ) + # NOTE: Component location is based on the location of the CMakeList.txt + # and *not* the location of the wolfSSL source code. (which may be anywhere) + + # Normalize the paths to remove any trailing slashes + get_filename_component(NORMALIZED_IDF_PATH "${IDF_PATH}" REALPATH) + get_filename_component(NORMALIZED_TEST_PATH "${COMPONENT_DIR}" REALPATH) + + # Check if the test path starts with the IDF_PATH + string(FIND "${NORMALIZED_TEST_PATH}" "${NORMALIZED_IDF_PATH}" pos) + + if(${pos} EQUAL 0) + message(STATUS "${COMPONENT_DIR} is within IDF_PATH.") + set(${RESULT} 1 PARENT_SCOPE) + else() + message(STATUS "${COMPONENT_DIR} is not within IDF_PATH.") + set(${RESULT} 0 PARENT_SCOPE) + endif() +endfunction() + +# Determine if this cmake file is located in the ESP-IDF component directory or not, +# and if so, if it is being ignored (allowing the use of a local project one, instead). +IS_ESP_IDF_COMPONENT( IS_WOLSSL_ESP_IDF_COMPONENT ) +if( IS_WOLSSL_ESP_IDF_COMPONENT ) + message(STATUS "This wolfSSL is a component in ESP-IDF.") + if ( CONFIG_IGNORE_ESP_IDF_WOLFSSL_COMPONENT ) + idf_component_register() + message(STATUS "Warning: wolfSSL component in ESP-IDF is being ignored.") + return() + endif() +endif() + + +if( "${CONFIG_CUSTOM_SETTING_WOLFSSL_ROOT}" STREQUAL "" ) + # nothing to do +else() + # Only forward slashes, or double backslashes are supported. + # By the time we get here the sdkconfig file has a value for wolfSSL source code root. + string(REPLACE "\\" "/" CONFIG_CUSTOM_SETTING_WOLFSSL_ROOT ${CONFIG_CUSTOM_SETTING_WOLFSSL_ROOT}) + message(STATUS "Cleaned wolfssl path: ${CONFIG_CUSTOM_SETTING_WOLFSSL_ROOT}") +endif() + +# The scope of this CMAKE_C_FLAGS is just this component: set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWOLFSSL_USER_SETTINGS") + set(CMAKE_CURRENT_SOURCE_DIR ".") -set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component -set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" ) +# set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component + +# Optionally set your source to wolfSSL in your project CMakeLists.txt like this: +# set(WOLFSSL_ROOT "c:/test/my_wolfssl" ) + +if ( "${WOLFSSL_ROOT}" STREQUAL "") + set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" ) +endif() + +if( "$ENV{IDF_PATH}" STREQUAL "" ) + message(FATAL_ERROR "IDF_PATH Environment variable not set!") +else() + string(REPLACE "\\" "/" THIS_IDF_PATH "$ENV{IDF_PATH}") +endif() + +# Optional compiler definitions to help with system name detection (typically printed by app diagnostics) +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") + endif() + if(CMAKE_HOST_UNIX) + message("Detected UNIX") + endif() + if(APPLE) + message("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") + 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") + endif() + if(APPLE) + # Windows-specific configuration here + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") + message("Detected Apple") + endif() +endif() # End optional WOLFSSL_CMAKE_SYSTEM_NAME + +message(STATUS "CONFIG_TARGET_PLATFORM = ${CONFIG_TARGET_PLATFORM}") + +# 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 +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) + # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl/include" EXCLUDE_FROM_ALL) + # So we'll error out and let the user decide how to proceed: + message(WARNING "\nFound wolfSSL components in\n" + "./managed_components/wolfssl__wolfssl\n" + "and\n" + "./components/wolfssl\n" + "in project directory: \n" + "${CMAKE_HOME_DIRECTORY}") + 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() + message(STATUS "No conflicting wolfSSL components found.") +endif() + + +# Don't include lwip requirement for benchmark and test apps. +if( ("${CMAKE_PROJECT_NAME}" STREQUAL "wolfssl_benchmark") OR ("${CMAKE_PROJECT_NAME}" STREQUAL "wolfssl_test") ) + message(STATUS "Not including lwip for ${CMAKE_PROJECT_NAME}") +else() + # benchmark and test do not need wifi, everything else probably does: + set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component +endif() # find the user name to search for possible "wolfssl-username" message(STATUS "USERNAME = $ENV{USERNAME}") @@ -51,6 +177,25 @@ else() string(REPLACE "\\" "/" THIS_IDF_PATH "$ENV{IDF_PATH}") endif() +# ENVIRONMENT_VAR_TO_MACRO +# Check environment variable name EVARPARAM as [name] +# If defined, and has a value of EVARVALUE as [value], +# then assign a compiler definition "-D[name]=[value]" +function(ENVIRONMENT_VAR_TO_MACRO EVARPARAM EVARVALUE) + # If the EVARPARAM environment variable name is set to EVARVALUE, + # set the compiler flag definition to enable CSV output. + if ( "$ENV{${EVARPARAM}}" STREQUAL "${EVARVALUE}") + message(STATUS "Appending compile definition: -D${EVARPARAM}=${EVARVALUE}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D${EVARPARAM}=${EVARVALUE}") + else() + if(DEFINED ENV{${EVARPARAM}}) + message(STATUS "Environment variable ${EVARPARAM} detected but set to $ENV{${EVARPARAM}}, not appending compile definition.") + else() + message(STATUS "Environment variable ${EVARPARAM} not detected, not appending compile definition.") + endif() + endif() +endfunction() + # COMPONENT_NAME = wolfssl # The component name is the directory name. "No feature to change this". # See https://github.com/espressif/esp-idf/issues/8978#issuecomment-1129892685 @@ -68,7 +213,8 @@ endif() # function: IS_WOLFSSL_SOURCE # parameter: DIRECTORY_PARAMETER - the directory to test # output: RESULT = contains contents of DIRECTORY_PARAMETER for wolfssl directory, otherwise blank. -function(IS_WOLFSSL_SOURCE DIRECTORY_PARAMETER RESULT) +function( IS_WOLFSSL_SOURCE DIRECTORY_PARAMETER + RESULT ) if (EXISTS "${DIRECTORY_PARAMETER}/wolfcrypt/src") set(${RESULT} "${DIRECTORY_PARAMETER}" PARENT_SCOPE) else() @@ -76,27 +222,71 @@ function(IS_WOLFSSL_SOURCE DIRECTORY_PARAMETER RESULT) endif() endfunction() +# ********************************************************************************************* # function: FIND_WOLFSSL_DIRECTORY # parameter: OUTPUT_FOUND_WOLFSSL_DIRECTORY contains root of source code, otherwise blank # +# Example usage: +# FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT) +# ********************************************************************************************* function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY) - message(STATUS "Starting FIND_WOLFSSL_DIRECTORY") - set(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}") + message(STATUS "Starting FIND_WOLFSSL_DIRECTORY: ${${OUTPUT_FOUND_WOLFSSL_DIRECTORY}}") + + if ( "${${OUTPUT_FOUND_WOLFSSL_DIRECTORY}}" STREQUAL "" ) + # The parameter is empty, so we certainly need to search. + # First, see if there's an environment variable. This takes highest priority (unless already found as hard-coded, above) + set(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}") + if( "${CURRENT_SEARCH_DIR}" STREQUAL "" ) + message(STATUS "The WOLFSSL_ROOT environment variable is not set. Searching...") + # Next, if not found, see if wolfSSL was selected for ESP-TLS Kconfig + if(CONFIG_CUSTOM_SETTING_WOLFSSL_ROOT) + set(CURRENT_SEARCH_DIR ${CONFIG_CUSTOM_SETTING_WOLFSSL_ROOT}) + get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" ABSOLUTE) + message(STATUS "WOLFSSL_ROOT found in sdkconfig/KConfig: ${CONFIG_CUSTOM_SETTING_WOLFSSL_ROOT}") + else() + message(STATUS "wolfSSL not defined in [Component Config] [wolfssl]. Continuing search...") + # If not specified as a search hint in OUTPUT_FOUND_WOLFSSL_DIRECTORY: + # This wolfSSL component CMakeLists.txt may be found EITHER in: + # 1) local project component + # 2) ESP-IDF share components + # We'll start in the CMAKE_CURRENT_SOURCE_DIR, typically [something]/projectname/components/wolfssl + # That option might find wolfSSL source code as a copy in the component directory (e.g. Managed Components) + # Unless cmake is in the ESP-IDF, in which case it is unlikely to find wolfSSL source in any parent. + message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}") + get_filename_component(CURRENT_SEARCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE) + message(STATUS "CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}") + string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH) + endif() # CONFIG_CUSTOM_SETTING_WOLFSSL_ROOT + endif() # check environment var blank + else() + message(STATUS "Parameter found for FIND_WOLFSSL_DIRECTORY") + message(STATUS "Setting wolfSSL search directory to: ${${OUTPUT_FOUND_WOLFSSL_DIRECTORY}}") + set(CURRENT_SEARCH_DIR "${${OUTPUT_FOUND_WOLFSSL_DIRECTORY}}") + endif() # parameter empty + + # Check to see if we found a path in environment or config settings, above. if( "${CURRENT_SEARCH_DIR}" STREQUAL "" ) - message(STATUS "The WOLFSSL_ROOT environment variable is not set. Searching...") + message(STATUS "Source for wolfSSL not specified in path nor config settings.") + # We'll continue the search by recursing up the directory tree, below. else() - get_filename_component(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}" ABSOLUTE) + # Setting found! Does it contain a valid path? + string(REPLACE "\\" "/" CURRENT_SEARCH_DIR ${CURRENT_SEARCH_DIR}) + get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" ABSOLUTE) IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL) if( FOUND_WOLFSSL ) - message(STATUS "Found WOLFSSL_ROOT via Environment Variable: ${CURRENT_SEARCH_DIR}") + message(STATUS "Found wolfSSL source code via setting: ${CURRENT_SEARCH_DIR}") set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE) return() else() - message(FATAL_ERROR "WOLFSSL_ROOT Environment Variable defined, but path not found:") - message(STATUS "$ENV{WOLFSSL_ROOT}") + if(WIN32) + message(STATUS "When specifying a path for Windows, use forward slahes, or double backslashes.") + endif() + message(STATUS "CONFIG_CUSTOM_SETTING_WOLFSSL_ROOT sdkconfig setting = ${CONFIG_CUSTOM_SETTING_WOLFSSL_ROOT}") + message(STATUS "WOLFSSL_ROOT Variable defined, but source code not found: ${CURRENT_SEARCH_DIR}") endif() endif() + # we'll start in the CMAKE_CURRENT_SOURCE_DIR, typically [something]/projectname/components/wolfssl message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}") get_filename_component(CURRENT_SEARCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE) @@ -114,16 +304,47 @@ function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY) return() endif() + # Maintain CURRENT_SEARCH_DIR, but check various suffixes with CURRENT_SEARCH_DIR_ALT if( THIS_USER ) # Check for "wolfssl-[username]" subdirectory as we recurse up the directory tree set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-${THIS_USER}) - message(STATUS "Looking in ${CURRENT_SEARCH_DIR}") + message(STATUS "Looking in ${CURRENT_SEARCH_DIR_ALT}") + + IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL ) + if ( FOUND_WOLFSSL ) + message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}") + set(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR_ALT}") + set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE) + return() + endif() + endif() + + if ( FOUND_WOLFSSL ) + # if we already found the source, skip attempt of "wolfssl-master" + else() + set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-master) + message(STATUS "Looking in ${CURRENT_SEARCH_DIR_ALT}") - #if(EXISTS ${CURRENT_SEARCH_DIR_ALT} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR_ALT} AND EXISTS "${CURRENT_SEARCH_DIR_ALT}/wolfcrypt/src") IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL ) if ( FOUND_WOLFSSL ) - message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}") - set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR_ALT} PARENT_SCOPE) + message(STATUS "Found wolfssl in master-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}") + set(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR_ALT}") + set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE) + return() + endif() + endif() + + if ( FOUND_WOLFSSL ) + # if we already found the source, skip attempt of "wolfssl" + else() + set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl) + message(STATUS "Looking in ${CURRENT_SEARCH_DIR_ALT}") + + IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL ) + if ( FOUND_WOLFSSL ) + message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}") + set(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR_ALT}") + set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE) return() endif() endif() @@ -143,7 +364,8 @@ function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY) get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY) message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}") if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" ) - # when the search directory is empty, we'll give up + # When the parent is current directory, cannot go any further. We didn't find wolfssl. + # When the search directory is empty, we'll give up. set(CURRENT_SEARCH_DIR "") endif() endwhile() @@ -154,17 +376,52 @@ endfunction() # Example usage: +# +# Simply find the WOLFSSL_DIRECTORY by searching parent directories: +# FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT) +# +message(STATUS "CONFIG_TARGET_PLATFORM = ${CONFIG_TARGET_PLATFORM}") +# Check for environment variable that may be assigned to macros +ENVIRONMENT_VAR_TO_MACRO("GENERATE_MACHINE_PARSEABLE_REPORT" "1") +ENVIRONMENT_VAR_TO_MACRO("WOLFSSL_BENCHMARK_FIXED_CSV" "1") + +# Optional variable inspection +if (0) + get_cmake_property(_variableNames VARIABLES) + list (SORT _variableNames) + message(STATUS "") + message(STATUS "ALL VARIABLES BEGIN") + message(STATUS "") + foreach (_variableName ${_variableNames}) + message(STATUS "${_variableName}=${${_variableName}}") + endforeach() + message(STATUS "") + message(STATUS "ALL VARIABLES END") + message(STATUS "") +endif() +if ( ("${CONFIG_TARGET_PLATFORM}" STREQUAL "esp8266") OR ("${IDF_TARGET}" STREQUAL "esp8266") ) + # There's no esp_timer, no driver components for the ESP8266 + message(STATUS "Early expansion EXCLUDES esp_timer: ${THIS_INCLUDE_TIMER}") + message(STATUS "Early expansion EXCLUDES driver: ${THIS_INCLUDE_DRIVER}") + set(THIS_INCLUDE_TIMER "") + set(THIS_INCLUDE_DRIVER "") +else() + message(STATUS "Early expansion includes esp_timer: ${THIS_INCLUDE_TIMER}") + message(STATUS "Early expansion includes driver: ${THIS_INCLUDE_DRIVER}") + set(THIS_INCLUDE_TIMER "esp_timer") + set(THIS_INCLUDE_DRIVER "driver") +endif() if(CMAKE_BUILD_EARLY_EXPANSION) message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:") idf_component_register( REQUIRES "${COMPONENT_REQUIRES}" PRIV_REQUIRES # esp_hw_support - # esp_timer - # driver # this will typically only be needed for wolfSSL benchmark + "${THIS_INCLUDE_TIMER}" + "${THIS_INCLUDE_DRIVER}" # this will typically only be needed for wolfSSL benchmark ) else() @@ -173,48 +430,99 @@ else() message(STATUS "wolfssl component config:") message(STATUS "************************************************************************************************") + if ( "${CONFIG_TARGET_PLATFORM}" STREQUAL "esp8266") + # There's no esp_timer, no driver components for the ESP8266 + set(THIS_INCLUDE_TIMER "") + set(THIS_INCLUDE_DRIVER "") + else() + set(THIS_INCLUDE_TIMER "esp_timer") + set(THIS_INCLUDE_DRIVER "driver") + endif() + # search for wolfSSL FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT) if(WOLFSSL_ROOT) - message(STATUS "NEW Found wolfssl directory at: ${WOLFSSL_ROOT}") + IS_WOLFSSL_SOURCE("${WOLFSSL_ROOT}" FOUND_WOLFSSL) + if(FOUND_WOLFSSL) + message(STATUS "Found WOLFSSL_ROOT via CMake specification.") + else() + # WOLFSSL_ROOT Path specified in CMakeLists.txt is not a valid path + message(FATAL_ERROR "WOLFSSL_ROOT CMake Variable defined, but path not found: ${WOLFSSL_ROOT}\n" + "Try correcting WOLFSSL_ROOT in your project CMakeFile.txt or setting environment variable.") + # Abort CMake after fatal error. + endif() else() - message(STATUS "NEW wolfssl directory not found.") + message(STATUS "Source code for wolfSSL still not found.") + message(STATUS "Searching from project home: ${CMAKE_HOME_DIRECTORY} ...") + set(WOLFSSL_ROOT "${CMAKE_HOME_DIRECTORY}") + FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT) + endif() + + + if(WOLFSSL_ROOT) + message(STATUS "Confirmed wolfssl directory at: ${WOLFSSL_ROOT}") + else() + # Try to allow a more intuitive error that the source code was not found in cmake: + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_WARNING_SOURCE_NOT_FOUND") + + message(STATUS "Failed: wolfssl source code directory not found.") # Abort. We need wolfssl _somewhere_. - message(FATAL_ERROR "Could not find wolfssl in ${WOLFSSL_ROOT}.\n" - "Try setting WOLFSSL_ROOT environment variable or git clone.") + message(STATUS "") + message(STATUS "") + message(STATUS "Could not find wolfssl in any parent directory named wolfssl-${THIS_USER}, wolfssl-master, or wolfssl.\n" + "Try setting WOLFSSL_ROOT environment variable, cmake variable in project, copy source, or use managed components.") + message(STATUS "") + message(STATUS "") + # Abort CMake after fatal error. (or not?) endif() set(INCLUDE_PATH ${WOLFSSL_ROOT}) set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/src/") - if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_benchmark" ) - set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/benchmark") - endif() + # During regression tests, optionally copy source locally and use: set(USE_LOCAL_TEST_BENCH 1) + set(USE_LOCAL_TEST_BENCH 0) + if(NOT USE_LOCAL_TEST_BENCH) + if( "${CMAKE_PROJECT_NAME}" STREQUAL "hello-world" ) + message(STATUS "Include ${WOLFSSL_ROOT}/wolfcrypt/benchmark") + set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/benchmark") + endif() - if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_test" ) - set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/test") + if( "${CMAKE_PROJECT_NAME}" STREQUAL "wolfssl_benchmark" ) + message(STATUS "Include ${WOLFSSL_ROOT}/wolfcrypt/benchmark") + set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/benchmark") + endif() + + if( "${CMAKE_PROJECT_NAME}" STREQUAL "wolfssl_test" ) + message(STATUS "Include ${WOLFSSL_ROOT}/wolfcrypt/test") + set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/test") + endif() endif() + message(STATUS "WOLFSSL_EXTRA_PROJECT_DIR = ${WOLFSSL_EXTRA_PROJECT_DIR}") set(COMPONENT_SRCDIRS "\"${WOLFSSL_ROOT}/src/\"" "\"${WOLFSSL_ROOT}/wolfcrypt/src\"" "\"${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif\"" + "\"${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif/esp_crt_bundle\"" "\"${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel\"" "\"${WOLFSSL_EXTRA_PROJECT_DIR}\"" ) # COMPONENT_SRCDIRS message(STATUS "This COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}") + # wolfSSL user_settings.h may be in the local project. + # TODO check if exists and possibly set to ESP-IDF set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl") - add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${WOLFSSL_PROJECT_DIR}/include/user_settings.h") - + string(REPLACE "/" "//" STR_WOLFSSL_PROJECT_DIR "${WOLFSSL_PROJECT_DIR}") + add_definitions(-DWOLFSSL_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) # get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa file(GLOB EXCLUDE_ASM *.S) - file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S") + file(GLOB EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S") message(STATUS "IDF_PATH = $ENV{IDF_PATH}") message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}") @@ -237,11 +545,12 @@ else() message(STATUS "Remove either the local project component: ${WOLFSSL_PROJECT_DIR} ") message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ") message(STATUS "") - message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.") message(STATUS "") message(STATUS "**************************************************************************************") message(STATUS "") + message(STATUS "Please use wolfSSL in either local project or Espressif components, but not both.") + # Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition: set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") @@ -291,6 +600,7 @@ else() message(FATAL_ERROR "Found stray wolfSSL user_settings.h in " "${WOLFSSL_ROOT}/include/user_settings.h " " (please move it to ${WOLFSSL_PROJECT_DIR}/include/user_settings.h )") + # Abort CMake after fatal error. else() # we won't overwrite an existing user settings file, just note that we already have one: if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/user_settings.h" ) @@ -347,7 +657,9 @@ else() # depending on the environment, we may need to swap backslashes with forward slashes string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos") - string(REPLACE "\\" "/" WOLFSSL_ROOT ${WOLFSSL_ROOT}) + if(WOLFSSL_ROOT) + string(REPLACE "\\" "/" WOLFSSL_ROOT ${WOLFSSL_ROOT}) + endif() if(IS_DIRECTORY "${RTOS_IDF_PATH}") message(STATUS "Found current RTOS path: ${RTOS_IDF_PATH}") @@ -360,13 +672,14 @@ else() message(STATUS "Could not find RTOS path") endif() endif() - - + message(STATUS "THIS_IDF_PATH = $THIS_IDF_PATH") + # wolfSSL-specific include directories set(COMPONENT_ADD_INCLUDEDIRS - "./include" # this is the location of wolfssl user_settings.h + "./include" # this is the location of local project wolfssl user_settings.h "\"${WOLFSSL_ROOT}/\"" "\"${WOLFSSL_ROOT}/wolfssl/\"" "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\"" + "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/port/Espressif\"" "\"${RTOS_IDF_PATH}/\"" # wolfSSL release after v5.7 includes WiFi, time, and mem/debug helpers "${THIS_IDF_PATH}/components/esp_event/include" @@ -374,7 +687,7 @@ else() "${THIS_IDF_PATH}/components/esp_wifi/include" ) - + # Optionally include cryptoauthlib if present if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib) list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib") endif() @@ -383,7 +696,7 @@ else() list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\"") - + # Some files are known to be included elsewhere, or not used for Espressif set(COMPONENT_SRCEXCLUDE "\"${WOLFSSL_ROOT}/src/bio.c\"" "\"${WOLFSSL_ROOT}/src/conf.c\"" @@ -399,6 +712,8 @@ else() "\"${WOLFSSL_ROOT}/src/ssl_sess.c\"" # included by ssl.c "\"${WOLFSSL_ROOT}/src/x509.c\"" "\"${WOLFSSL_ROOT}/src/x509_str.c\"" + "\"${WOLFSSL_ROOT}/wolfcrypt/src/ext_kyber.c\"" # external non-wolfssl Kyber disabled by default + "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/ext_kyber.h\"" # external non-wolfssl Kyber disabled by default "\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\"" "\"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c\"" "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm32.c\"" @@ -409,6 +724,7 @@ else() "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_cortexm.c\"" "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64.c\"" "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64_asm.S\"" + "\"${WOLFSSL_ROOT}/examples\"" # Examples are distributed in Managed Components, but not part of a project. "\"${EXCLUDE_ASM}\"" ) @@ -430,22 +746,140 @@ else() # see https://docs.espressif.com/projects/esp-idf/en/stable/esp32/migration-guides/release-5.x/build-system.html?highlight=space%20path # set(EXTRA_COMPONENT_DIRS "${COMPONENT_SRCDIRS}") - idf_component_register( - SRC_DIRS "${COMPONENT_SRCDIRS}" - INCLUDE_DIRS "${COMPONENT_ADD_INCLUDEDIRS}" - REQUIRES "${COMPONENT_REQUIRES}" - EXCLUDE_SRCS "${COMPONENT_SRCEXCLUDE}" - PRIV_REQUIRES esp_timer driver # this will typically only be needed for wolfSSL benchmark - ) - # some optional diagnostics - if (1) + + if(WOLFSSL_ROOT) + # Only register the component if we found wolfSSL source. + # This is important to allow Cmake to finish to completion, otherwise the UI + # may not be able to display the Kconfig settings to fix a bad or missing source. + idf_component_register( + SRC_DIRS "${COMPONENT_SRCDIRS}" + INCLUDE_DIRS "${COMPONENT_ADD_INCLUDEDIRS}" + REQUIRES "${COMPONENT_REQUIRES}" + EXCLUDE_SRCS "${COMPONENT_SRCEXCLUDE}" + PRIV_REQUIRES + "${THIS_INCLUDE_TIMER}" + "${THIS_INCLUDE_DRIVER}" # this will typically only be needed for wolfSSL benchmark + ) + else() + # Register the component simply to allow CMake to complete, but there's no wolfSSL source. + # Expect many other errors, but the project should at least be loadable and UI can edit Kconfig settings. + idf_component_register() + message(STATUS "Warning: wolfSSL component not registered as no source code found (WOLFSSL_ROOT is blank)") + endif() + +# function(WOLFSSL_INIT_CERT_BUNDLE) +if(CONFIG_WOLFSSL_CERTIFICATE_BUNDLE AND NOT CONFIG_WOLFSSL_CERTIFICATE_BUNDLE_DEFAULT_NONE) + if (CMAKE_BUILD_EARLY_EXPANSION) + message(ERROR "Bundle Cert initialization must occur during CMAKE_BUILD_EARLY_EXPANSION") + endif() + # reminder: we need a value for wolfSSL root first! + if( "${WOLFSSL_ROOT}" STREQUAL "" ) + message(ERROR "Certificate bundles need a value for WOLFSSL_ROOT") + endif() + set(WOLFSSL_ESP_CRT_BUNDLE_DIR ${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif/esp_crt_bundle) + message(STATUS "WOLFSSL_ESP_CRT_BUNDLE_DIR=${WOLFSSL_ESP_CRT_BUNDLE_DIR}") + if(EXISTS "${WOLFSSL_ESP_CRT_BUNDLE_DIR}") + set(bundle_name "x509_crt_bundle_wolfssl") + + # For now the certs are in the same directory + set(DEFAULT_CRT_DIR "${WOLFSSL_ESP_CRT_BUNDLE_DIR}") + + # Generate custom certificate bundle using the generate_cert_bundle utility + set(GENERATE_CERT_BUNDLEPY ${python} ${WOLFSSL_ESP_CRT_BUNDLE_DIR}/gen_crt_bundle.py) + + if(CONFIG_WOLFSSL_CERTIFICATE_BUNDLE_DEFAULT_FULL) + list(APPEND crt_paths ${DEFAULT_CRT_DIR}/cacrt_all.pem ${DEFAULT_CRT_DIR}/cacrt_local.pem) + elseif(CONFIG_WOLFSSL_CERTIFICATE_BUNDLE_DEFAULT_CMN) + list(APPEND crt_paths ${DEFAULT_CRT_DIR}/cacrt_all.pem ${DEFAULT_CRT_DIR}/cacrt_local.pem) + list(APPEND args --filter ${DEFAULT_CRT_DIR}/cmn_crt_authorities.csv) + endif() + + # Add deprecated root certs if enabled. This config is not visible if the default cert + # bundle is not selected + if(CONFIG_WOLFSSL_CERTIFICATE_BUNDLE_DEPRECATED_LIST) + list(APPEND crt_paths ${DEFAULT_CRT_DIR}/cacrt_deprecated.pem) + endif() + + if(CONFIG_WOLFSSL_CUSTOM_CERTIFICATE_BUNDLE) + get_filename_component(custom_bundle_path + ${CONFIG_WOLFSSL_CUSTOM_CERTIFICATE_BUNDLE_PATH} ABSOLUTE BASE_DIR "${project_dir}") + list(APPEND crt_paths ${custom_bundle_path}) + message(STATUS "Using a custom wolfSSL bundle path: ${custom_bundle_path}") + else() + message(STATUS "Not using a custom wolfSSL bundle path.") + endif() + list(APPEND args --input ${crt_paths} -q) + + message(STATUS "CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}") + get_filename_component(crt_bundle + ${bundle_name} + ABSOLUTE BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}") + + message(STATUS "Setting up bundle generate: ${GENERATE_CERT_BUNDLEPY} ${args}") + message(STATUS "Depends on custom bundle path: ${custom_bundle_path}") + message(STATUS "crt_bundle ${crt_bundle}") + message(STATUS "COMPONENT_LIB ${COMPONENT_LIB}") + message(STATUS "GENERATE_CERT_BUNDLEPY ${GENERATE_CERT_BUNDLEPY}") + message(STATUS "args ${args}") + message(STATUS "cert_bundle ${cert_bundle}") + + # Generate bundle according to config + # File is generated at build time, not cmake load + add_custom_command(OUTPUT ${crt_bundle} + COMMAND ${GENERATE_CERT_BUNDLEPY} ARGS ${args} + DEPENDS ${custom_bundle_path} + VERBATIM) + + if(EXISTS "${crt_bundle}") + message(STATUS "Bundle file exists from prior build: ${crt_bundle}") + else() + message(STATUS "Bundle file expected during next build: ${crt_bundle}") + endif() + + # Reminder the file is generated at build time, not cmake load time. + message(STATUS "wolfSSL Cert Bundle File to be created at build time in: ${crt_bundle}") + + add_custom_target(custom_wolfssl_bundle DEPENDS ${cert_bundle}) + + # the wolfSSL crtificate bundle is baked into wolfSSL + add_dependencies(${COMPONENT_LIB} custom_wolfssl_bundle) + + # COMPONENT_LIB may vary: __idf_wolfssl, __idf_esp_wolfssl, etc + # target_add_binary_data(__idf_wolfssl ${crt_bundle} BINARY) + target_add_binary_data(${COMPONENT_LIB} ${crt_bundle} BINARY) + set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + APPEND PROPERTY ADDITIONAL_CLEAN_FILES + "${crt_bundle}") + else() + message(STATUS "WARNING: CONFIG_WOLFSSL_CERTIFICATE_BUNDLE enabled but directory not found: ${WOLFSSL_ESP_CRT_BUNDLE_DIR}") + endif() +endif() + +# endfunction() # WOLFSSL_INIT_CERT_BUNDLE + + # Some optional diagnostics. Verbose ones are truncated. + if (VERBOSE_COMPONENT_MESSAGES) get_cmake_property(_variableNames VARIABLES) list (SORT _variableNames) message(STATUS "") message(STATUS "ALL VARIABLES BEGIN") message(STATUS "") foreach (_variableName ${_variableNames}) - message(STATUS "${_variableName}=${${_variableName}}") + if ( ("${_variableName}" STREQUAL "bootloader_binary_files") + OR ("${_variableName}" STREQUAL "Component paths") + OR ("${_variableName}" STREQUAL "component_targets") + OR ("${_variableName}" STREQUAL "__COMPONENT_TARGETS") + OR ("${_variableName}" STREQUAL "CONFIGS_LIST") + OR ("${_variableName}" STREQUAL "__CONFIG_VARIABLES") + OR ("${_variableName}" STREQUAL "val") + OR ("${_variableName}" MATCHES "^__idf_") + ) + # Truncate the displayed value: + string(SUBSTRING "${${_variableName}}" 0 70 truncatedValue) + message(STATUS "${_variableName} = ${truncatedValue} ... (truncated)") + else() + message(STATUS "${_variableName}=${${_variableName}}") + endif() endforeach() message(STATUS "") message(STATUS "ALL VARIABLES END") @@ -453,6 +887,12 @@ else() endif() # target_sources(wolfssl PRIVATE "\"${WOLFSSL_ROOT}/wolfssl/\"" "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt\"") + message(STATUS "DETECTED_PROJECT_NAME=${CMAKE_PROJECT_NAME}") + message(STATUS "COMPONENT_TARGET=${COMPONENT_TARGET}") + target_compile_definitions(${COMPONENT_TARGET} PRIVATE DETECTED_PROJECT_NAME="${CMAKE_PROJECT_NAME}") + if( "${CMAKE_PROJECT_NAME}" STREQUAL "esp_http_client_example" ) + target_compile_definitions(${COMPONENT_TARGET} PRIVATE APP_ESP_HTTP_CLIENT_EXAMPLE="y") + endif() endif() # CMAKE_BUILD_EARLY_EXPANSION @@ -508,31 +948,77 @@ endfunction() # LIBWOLFSSL_SAVE_INFO # 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) +if(NOT CMAKE_BUILD_EARLY_EXPANSION AND WOLFSSL_ROOT) set (git_cmd "git") message(STATUS "Adding macro definitions:") # LIBWOLFSSL_VERSION_GIT_ORIGIN: git config --get remote.origin.url - execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "config" "--get" "remote.origin.url" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "config" "--get" "remote.origin.url" + OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_ORIGIN "${TMP_OUT}" "${TMP_RES}") # LIBWOLFSSL_VERSION_GIT_BRANCH: git rev-parse --abbrev-ref HEAD - execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--abbrev-ref" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--abbrev-ref" "HEAD" + OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_BRANCH "${TMP_OUT}" "${TMP_RES}") # LIBWOLFSSL_VERSION_GIT_HASH: git rev-parse HEAD - execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} 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: git rev-parse --short HEAD - execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} 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 git show --no-patch --no-notes --pretty=\'\%cd\' - execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ) + execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} 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}") - message(STATUS "************************************************************************************************") - message(STATUS "wolfssl component config complete!") - message(STATUS "************************************************************************************************") + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_WOLFSSL_ROOT "${WOLFSSL_ROOT}" "${TMP_RES}") + endif() + +# Ensure flag "-DWOLFSSL_ESPIDF" is already in CMAKE_C_FLAGS if not yet found from project +string(FIND "${CMAKE_C_FLAGS}" "-DWOLFSSL_ESPIDF" FLAG_ALRREADY_FOUND_WOLFSSL_ESPIDF) + +if(FLAG_ALRREADY_FOUND_WOLFSSL_ESPIDF EQUAL -1) + # Flag not found, append it + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_ESPIDF") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") +endif() + +if(WOLFSSL_ROOT) + message(STATUS "Using wolfSSL in ${WOLFSSL_ROOT}") + + # PlatformIO does not process script from from the Espressif cmake process. + # We need to know where wolfSSL source code was found, so save it in the + # PIO_WOLFSSL_ROOT environment variable to later be read by extra_script.py + + set(ENV{PIO_WOLFSSL_ROOT} "${WOLFSSL_ROOT}") + message(STATUS "PIO_WOLFSSL_ROOT = $ENV{PIO_WOLFSSL_ROOT}") + message(STATUS "PLATFORMIO_BUILD_DIR = $ENV{PLATFORMIO_BUILD_DIR}") + file(WRITE "tada.txt" "${WOLFSSL_ROOT}\n") + # See esp-tls Kconfig; menu "ESP-TLS", ESP_TLS_LIBRARY_CHOOSE + if(CONFIG_ESP_TLS_USING_WOLFSSL) + message(STATUS "wolfSSL will be used for ESP-TLS") + else() + message(STATUS "WARNING: wolfSSL NOT selected for ESP-TLS. Features and performance will be limited.") + endif() +else() + message(STATUS "") + message(STATUS "Consider setting WOLFSSL_ROOT environment variable, use Kconfig setting, or set manually in this cmake file, above.") + message(STATUS "") + message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") + message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") + message(STATUS "ERROR: Could not find wolfSSL Source Code") + message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") + message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") +endif() + +message(STATUS "************************************************************************************************") +message(STATUS "wolfSSL component config complete!") +message(STATUS "************************************************************************************************") diff --git a/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/Kconfig b/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/Kconfig new file mode 100644 index 0000000000..5e21683b32 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/Kconfig @@ -0,0 +1,498 @@ +# Kconfig template +# +# Copyright (C) 2006-2024 wolfSSL Inc. All rights reserved. +# +# This file is part of wolfSSL. +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# + +# Kconfig File Version 5.7.2.001 for esp-idf integration + +# Kconfig Format Rules +# +# See: +# https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/kconfig.html +# +# Format rules for Kconfig files are as follows: +# +# Option names in any menus should have consistent prefixes. The prefix +# currently should have at least 3 characters. +# +# The unit of indentation should be 4 spaces. All sub-items belonging to a +# parent item are indented by one level deeper. For example, menu is indented +# by 0 spaces, config menu by 4 spaces, help in config by 8 spaces, and the +# text under help by 12 spaces. +# +# No trailing spaces are allowed at the end of the lines. +# +# The maximum length of options is NOT 50 characters as documented. +# kconfcheck will complain that options should be 40 at most. +# +# Fix option lengths first. Superflous errors on other lines may occur. +# +# The maximum length of lines is 120 characters. +# +# python -m kconfcheck +# +# --------------------------------------------------------------------------------------------------------------------- +# Begin main wolfSSL configuration menu +# --------------------------------------------------------------------------------------------------------------------- +# See ESP-IDF esp-tls component for config TLS_STACK_WOLFSSL + +menu "wolfSSL" + + menu "Hardening" + config ESP_WOLFSSL_WC_NO_HARDEN + bool "Disable wolfSSL hardening" + default n + help + Sets WC_NO_HARDEN + + config ESP_WOLFSSL_TFM_TIMING_RESISTANT + bool "Enable TFM Timing Resistant Code" + default n + help + Sets TFM_TIMING_RESISTANT. + + endmenu # Hardening + + config ESP_WOLFSSL_ENABLE_BENCHMARK + bool "Enable wolfSSL Benchmark Library" + default n + help + Enables wolfcrypt/benchmark/benchmark.c code for benchmark metrics. Disables NO_CRYPT_BENCHMARK. + + + menu "Benchmark Debug" + config ESP_DEBUG_WOLFSSL_BENCHMARK_TIMING + bool "Enable benchmark timing debug" + depends on ESP_WOLFSSL_ENABLE_BENCHMARK + default n + help + Enable wolfssl debug for benchmark metric timing (CPU Cycles, RTOS ticks, etc). + + config ESP_WOLFSSL_BENCHMARK_TIMER_DEBUG + bool "Enable benchmark timer debug" + depends on ESP_WOLFSSL_ENABLE_BENCHMARK + default n + help + Turn on timer debugging (used when CPU cycles not available) + + endmenu # Benchmark Debug + + # ----------------------------------------------------------------------------------------------------------------- + # wolfCrypt Test + # ----------------------------------------------------------------------------------------------------------------- + config ESP_WOLFSSL_ENABLE_TEST + bool "Enable wolfCrypt Test Library" + default n + help + Enables wolfcrypt/test/test.c code for testing. Disables NO_CRYPT_TEST. + + menu "wolfCrypt tests" + config WOLFSSL_HAVE_WOLFCRYPT_TEST_OPTIONS + bool "Enable wolfCrypt Test Options" + depends on ESP_WOLFSSL_ENABLE_TEST + default n + help + Enables HAVE_WOLFCRYPT_TEST_OPTIONS + + config TEST_ESPIDF_ALL_WOLFSSL + bool "Enable all features to use in tests" + depends on ESP_WOLFSSL_ENABLE_TEST + default n + help + Enables TEST_ESPIDF_ALL_WOLFSSL + + endmenu # wolfCrypt tests + + # ----------------------------------------------------------------------------------------------------------------- + # Apple HomeKit Options + # ----------------------------------------------------------------------------------------------------------------- + menu "Apple HomeKit" + config WOLFSSL_APPLE_HOMEKIT + bool "Enable Apple HomeKit options" + default n + help + Enables FP_MAX_BITS (8192 * 2), SRP, ChaCha, Poly1305, Base64 encoding needed for Apple HomeKit. + endmenu # Apple HomeKit + # ----------------------------------------------------------------------------------------------------------------- + + config ESP_WOLFSSL_DISABLE_MY_ECC + bool "Disable ECC in my project" + default "n" + help + ECC is enabled by default. Select this option to disable. + + config ESP_WOLFSSL_ENABLE_MY_USE_RSA + bool "Enable RSA in my project" + default "n" + help + RSA is disabled by default. Select this option to enable. + + config ESP_WOLFSSL_BENCHMARK + bool "Enable wolfSSL Benchmark" + default n + help + Enables user settings relevant to benchmark code + + config ESP_TLS_USING_WOLFSSL_SPECIFIED + bool "Use the specified wolfssl for ESP-TLS" + default Y + help + Includes wolfSSL from specified directory (not using esp-wolfssl). + + config ESP_WOLFSSL_NO_USE_FAST_MATH + bool "Disable FAST_MATH library and all ESP32 Hardware Acceleration" + select ESP_WOLFSSL_NO_HW + select ESP_WOLFSSL_NO_HW_AES + select ESP_WOLFSSL_NO_HW_HASH + select ESP_WOLFSSL_NO_HW_RSA_PRI + select ESP_WOLFSSL_NO_HW_RSA_PRI_MP_MUL + select ESP_WOLFSSL_NO_HW_RSA_PRI_MULMOD + select ESP_WOLFSSL_NO_HW_RSA_PRI_EXPTMOD + default n + help + When disabling all hardware acceleration for smaller memory footprint, + disabling TFM fast math provides faster wolfSSL software algorithms in an + even smaller flash memory footprint. + + menu "Protocol Config" + config WOLFSSL_HAVE_ALPN + bool "Enable ALPN (Application Layer Protocol Negotiation) in wolfSSL" + default y + + config WOLFSSL_ALLOW_TLS13 + bool "Allow TLS 1.3" + default y + help + Allow TLS to fallback to TLS1.2. Memory footprint will likely be larger for TLS1.2. + When disabled HTTPS and MQTT over TLS connections will fail if TLS1.3 not accepted. + + config WOLFSSL_ALLOW_TLS12 + bool "Allow TLS 1.2" + default n + help + Allow TLS to fallback to TLS1.2. Memory footprint will likely be larger for TLS1.2. + When disabled HTTPS and MQTT over TLS connections will fail if TLS1.3 not accepted. + + config WOLFSSL_HAVE_TLS_EXTENSIONS + bool "Enable TLS Extensions" + default y + help + Sets HAVE_TLS_EXTENSIONS which is needed for TLS 1.3, SNI, ALPN, and more. + + config WOLFSSL_ALT_CERT_CHAINS + bool "Enable Alternate Certificate Chains" + default n + help + The option relaxes the default strict wolfSSL certificate chain processing. This + will typically need to be enabled when loading only a CA file. Typically solves + the -188 ASN_NO_SIGNER_E error. Use with caution. + + config WOLFSSL_HAVE_OCSP + bool "Enable OCSP (Online Certificate Status Protocol) in wolfSSL" + default n + help + Sets HAVE_OCSP + + endmenu # Protocol Config + # ----------------------------------------------------------------------------------------------------------------- + + # ----------------------------------------------------------------------------------------------------------------- + config TLS_STACK_WOLFSSL + # Invisible option that locks TLS_STACK_WOLFSSL to ESP_TLS_USING_WOLFSSL + bool + default n + select FREERTOS_ENABLE_BACKWARD_COMPATIBILITY + help + Includes wolfSSL in ESP-TLS so that it can be compiled with wolfSSL as its SSL/TLS library. + Enabled when wolfSSL is selected in ESP_TLS_LIBRARY_CHOOSE. + + menu "wolfSSL ESP-TLS" + depends on ESP_TLS_USING_WOLFSSL + + menu "Certificate Bundle" + depends on ESP_TLS_USING_WOLFSSL + + config WOLFSSL_CERTIFICATE_BUNDLE + bool "Enable trusted root certificate bundle" + default y if ESP_TLS_USING_WOLFSSL + default n + depends on ESP_TLS_USING_WOLFSSL + help + Enable support for large number of default root certificates + + When enabled this option allows user to store default as well + as customer specific root certificates in compressed format rather + than storing full certificate. For the root certificates the public key and the subject name + will be stored. + + config WOLFSSL_NO_ASN_STRICT + bool "Relax Certificate ASN Strict Checks" + default n + depends on ESP_TLS_USING_WOLFSSL + help + Allows sub-optimal certificate ASN checks. Unless using a bundle with known issues, + it is recommended to NOT enable this. + + config WOLFSSL_ASN_ALLOW_0_SERIAL + bool "Allow cert missing an ASN Serial Number" + default y + depends on ESP_TLS_USING_WOLFSSL + help + Although not recommended, there may be certificates in the bundle that are missing + a serial number. This option allows the missing value without having to fully + disable strict ASN checking with WOLFSSL_NO_ASN_STRICT. + + choice WOLFSSL_DEFAULT_CERTIFICATE_BUNDLE + bool "Default certificate bundle options" + depends on WOLFSSL_CERTIFICATE_BUNDLE && ESP_TLS_USING_WOLFSSL + default WOLFSSL_CERTIFICATE_BUNDLE_DEFAULT_FULL + + config WOLFSSL_CERTIFICATE_BUNDLE_DEFAULT_FULL + bool "Use the full default certificate bundle" + config WOLFSSL_CERTIFICATE_BUNDLE_DEFAULT_CMN + bool "Use only the most common certificates from the default bundles" + help + Use only the most common certificates from the default bundles, reducing the size with 50%, + while still having around 99% coverage. + config WOLFSSL_CERTIFICATE_BUNDLE_DEFAULT_NONE + bool "Do not use the default certificate bundle" + endchoice + + config WOLFSSL_CUSTOM_CERTIFICATE_BUNDLE + depends on WOLFSSL_CERTIFICATE_BUNDLE && ESP_TLS_USING_WOLFSSL + default n + bool "Add custom certificates to the default bundle" + config WOLFSSL_CUSTOM_CERTIFICATE_BUNDLE_PATH + depends on WOLFSSL_CUSTOM_CERTIFICATE_BUNDLE && ESP_TLS_USING_WOLFSSL + string "Custom certificate bundle path" + help + Name of the custom certificate directory or file. This path is evaluated + relative to the project root directory. + + config WOLFSSL_CERTIFICATE_BUNDLE_DEPRECATED_LIST + bool "Add deprecated root certificates" + depends on WOLFSSL_CERTIFICATE_BUNDLE && ESP_TLS_USING_WOLFSSL && !WOLFSSL_CERTIFICATE_BUNDLE_DEFAULT_NONE + help + Include the deprecated list of root certificates in the bundle. + This list gets updated when a certificate is removed from the Mozilla's + NSS root certificate store. This config can be enabled if you would like + to ensure that none of the certificates that were deployed in the product + are affected because of the update to bundle. In turn, enabling this + config keeps expired, retracted certificates in the bundle and it may + pose a security risk. + + - Deprecated cert list may grow based based on sync with upstream bundle + - Deprecated certs would be be removed in ESP-IDF (next) major release + + config WOLFSSL_CERTIFICATE_BUNDLE_MAX_CERTS + int "Maximum no of certificates allowed in certificate bundle" + default 200 + depends on WOLFSSL_CERTIFICATE_BUNDLE && ESP_TLS_USING_WOLFSSL + + endmenu + endmenu # wolfSSL ESP-TLS + # ----------------------------------------------------------------------------------------------------------------- + + # ----------------------------------------------------------------------------------------------------------------- + config ESP_WOLFSSL_ALT_HARDWARE_ACCELERATION + bool "Modify default hardware acceleration settings" + default n + help + When disabling all hardware acceleration for smaller memory footprint, + disabling TFM fast math provides faster wolfSSL software algorithms in an + even smaller flash memory footprint. + Typically used for debugging, analysis, or optimizations. The default + hardware acceleration features can be each manually adjusted. + + menu "wolfSSL Hardware Acceleration" + + config ESP_WOLFSSL_NO_ESP32_CRYPT + bool "Disable all ESP32 Hardware Acceleration" + depends on ESP_WOLFSSL_ALT_HARDWARE_ACCELERATION + default n + select ESP_WOLFSSL_NO_HW_AES + select ESP_WOLFSSL_NO_HW_HASH + select ESP_WOLFSSL_NO_HW_RSA_PRI + select ESP_WOLFSSL_NO_HW_RSA_PRI_MP_MUL + select ESP_WOLFSSL_NO_HW_RSA_PRI_MULMOD + select ESP_WOLFSSL_NO_HW_RSA_PRI_EXPTMOD + help + Hardware acceleration enabled by default. When selected defines: NO_ESP32_CRYPT. + Consider disabling FASTMATH (other libraries are faster in software and smaller) + + config ESP_WOLFSSL_NO_HW_AES + bool "Disable all ESP32 AES Hardware Acceleration" + depends on ESP_WOLFSSL_ALT_HARDWARE_ACCELERATION + default n + help + Hardware acceleration enabled by default.When selected defines: NO_HW_AES + + config ESP_WOLFSSL_NO_HW_HASH + bool "Disable all ESP32 SHA Hash Hardware Acceleration" + depends on ESP_WOLFSSL_ALT_HARDWARE_ACCELERATION + default n + help + Hardware acceleration enabled by default. When selected defines: NO_HW_HASH + + config ESP_WOLFSSL_NO_HW_RSA_PRI + bool "Disable all ESP32 RSA Hardware Acceleration" + depends on ESP_WOLFSSL_ALT_HARDWARE_ACCELERATION + default n + select ESP_WOLFSSL_NO_HW_PRI_MP_MUL + select ESP_WOLFSSL_NO_HW_RSA_PRI_MULMOD + select ESP_WOLFSSL_NO_HW_RSA_PRI_EXPTMOD + help + Hardware acceleration enabled by default. When selected defines: NO_HW_RSA_PRI + + config ESP_WOLFSSL_NO_HW_RSA_PRI_MP_MUL + bool "Disable all ESP32 Multiplication Hardware Acceleration" + depends on ESP_WOLFSSL_ALT_HARDWARE_ACCELERATION + default n + help + Hardware acceleration enabled by default. When selected defines: NO_HW_RSA_PRI_MP_MUL + + config ESP_WOLFSSL_NO_HW_RSA_PRI_MULMOD + bool "Disable all ESP32 Modular Multiplication Hardware Acceleration" + depends on ESP_WOLFSSL_ALT_HARDWARE_ACCELERATION + default n + help + Hardware acceleration enabled by default. When selected defines: NO_HW_RSA_PRI_MULMOD + + config ESP_WOLFSSL_NO_HW_RSA_PRI_EXPTMOD + bool "Disable all ESP32 RSA Exponential Math Hardware Acceleration" + depends on ESP_WOLFSSL_ALT_HARDWARE_ACCELERATION + default n + help + Hardware acceleration enabled by default. + Select this option to force disable: NO_HW_RSA_PRI_EXPTMOD + + endmenu # wolfSSL Hardware Acceleration + # ----------------------------------------------------------------------------------------------------------------- + + # ----------------------------------------------------------------------------------------------------------------- + menu "wolfSSL Experimental Options" + + config ESP_WOLFSSL_EXPERIMENTAL_SETTINGS + bool "Enable wolfSSL Experimental Settings" + default n + help + Enables experimental settings for wolfSSL. See documentation. + + config ESP_WOLFSSL_ENABLE_KYBER + bool "Enable wolfSSL Kyber" + default n + help + Enable debugging messages for wolfSSL. See user_settings.h for additional debug options. + + endmenu # wolfSSL Experimental Options + # ----------------------------------------------------------------------------------------------------------------- + + # ----------------------------------------------------------------------------------------------------------------- + menu "wolfSSL Debug Options" + config ESP_WOLFSSL_DEBUG_WOLFSSL + bool "Enable wolfSSL Debugging" + default n + help + Enable debugging messages for wolfSSL. See user_settings.h for additional debug options. + endmenu # wolfSSL Debug Options + # ----------------------------------------------------------------------------------------------------------------- + + # ----------------------------------------------------------------------------------------------------------------- + menu "wolfSSL Customization" + config CUSTOM_SETTING_WOLFSSL_ROOT + string "Enter a path for wolfSSL source code" + default "~/workspace/wolfssl" + help + This option lets you specify a directory for the wolfSSL source code (typically a git clone). + Enter the path using forward slashes (e.g., C:/myfolder/mysubfolder) or double backslashes + (e.g., C:\\myfolder\\mysubfolder). + + endmenu # wolfSSL Customization + # ----------------------------------------------------------------------------------------------------------------- + + # ----------------------------------------------------------------------------------------------------------------- + menu "Component Config" + config IGNORE_ESP_IDF_WOLFSSL_COMPONENT + bool "Ignore the ESP-IDF component of wolfSSL (if present)" + default n + help + Ignores wolfSSL present in the esp-idf/components directory. Requires wolfssl as a local component. + + config IGNORE_LOCAL_WOLFSSL_COMPONENT + bool "Ignore the local component of wolfSSL (if present)" + default n + help + Ignores wolfSSL present in the local project components directory. + Requires wolfssl as a ESP-IDF component. + + endmenu # Component Config + # ----------------------------------------------------------------------------------------------------------------- + + # ----------------------------------------------------------------------------------------------------------------- + menu "Utility Config" + config USE_WOLFSSL_ESP_SDK_TIME + bool "Enable wolfSSL time helper functions" + default n + help + Enables use of various time and date setting functions found in the esp-sdk-lib.h file. + + config USE_WOLFSSL_ESP_SDK_WIFI + bool "Enable wolfSSL WiFi helper functions" + default n + help + Enables use of various time and date setting functions found in the esp-sdk-lib.h file. + + endmenu # Utility Config +endmenu # wolfSSL +# --------------------------------------------------------------------------------------------------------------------- + + +# --------------------------------------------------------------------------------------------------------------------- +menu "wolfSSH" + config ESP_ENABLE_WOLFSSH + bool "Enable wolfSSH options" + default n + help + Enables WOLFSSH_TERM, WOLFSSL_KEY_GEN, WOLFSSL_PTHREADS, WOLFSSH_TEST_SERVER, WOLFSSH_TEST_THREADING + + config ESP_WOLFSSL_DEBUG_WOLFSSH + bool "Enable wolfSSH debugging" + default n + help + Enable wolfSSH debugging macro. See user_settings.h + +endmenu # wolfSSH +# --------------------------------------------------------------------------------------------------------------------- + +# --------------------------------------------------------------------------------------------------------------------- +menu "wolfMQTT" + config ESP_ENABLE_WOLFMQTT + bool "Enable wolfMQTT options" + default n + help + Enables WOLFMQTT + + config ESP_WOLFSSL_DEBUG_WOLFMQTT + bool "Enable wolfMQTT debugging" + default n + help + Enable wolfMQTT debugging macro. See user_settings.h + +endmenu # wolfMQTT +# --------------------------------------------------------------------------------------------------------------------- diff --git a/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/include/user_settings.h b/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/include/user_settings.h index e0e0d61495..3939302b98 100644 --- a/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/include/user_settings.h +++ b/IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/include/user_settings.h @@ -1,4 +1,4 @@ -/* user_settings.h +/* wolfssl-component include/user_settings.h * * Copyright (C) 2006-2024 wolfSSL Inc. * @@ -18,19 +18,52 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ +#define WOLFSSL_ESPIDF_COMPONENT_VERSION 0x01 + +/* The Espressif project config file. See also sdkconfig.defaults */ +#include "sdkconfig.h" /* This user_settings.h is for Espressif ESP-IDF * * Standardized wolfSSL Espressif ESP32 + ESP8266 user_settings.h V5.7.0-1 * - * Do not include any wolfssl headers here + * Do not include any wolfssl headers here. * * When editing this file: - * ensure wolfssl_test and wolfssl_benchmark settings match. + * ensure all examples match. The template example is the reference. */ -/* The Espressif project config file. See also sdkconfig.defaults */ -#include "sdkconfig.h" +/* Naming convention: (see also esp32-crypt.h for the reference source). + * + * CONFIG_ + * This prefix indicates the setting came from the sdkconfig / Kconfig. + * + * May or may not be related to wolfSSL. + * + * The name after this prefix must exactly match that in the Kconfig file. + * + * WOLFSSL_ + * Typical of many, but not all wolfSSL macro names. + * + * Applies to all wolfSSL products such as wolfSSH, wolfMQTT, etc. + * + * May or may not have a corresponding sdkconfig / Kconfig control. + * + * ESP_WOLFSSL_ + * These are NOT valid wolfSSL macro names. These are names only used in + * the ESP-IDF Kconfig files. When parsed, they will have a "CONFIG_" + * suffix added. See next section. + * + * CONFIG_ESP_WOLFSSL_ + * This is a wolfSSL-specific macro that has been defined in the ESP-IDF + * via the sdkconfig / menuconfig. Any text after this prefix should + * exactly match an existing wolfSSL macro name. + * + * Applies to all wolfSSL products such as wolfSSH, wolfMQTT, etc. + * + * These macros may also be specific to only the project or environment, + * and possibly not used anywhere else in the wolfSSL libraries. + */ /* The Espressif sdkconfig will have chipset info. ** @@ -46,33 +79,228 @@ #undef WOLFSSL_ESPIDF #define WOLFSSL_ESPIDF -/* We don't use WiFi, so don't compile in the esp-sdk-lib WiFi helpers: */ -#define NO_ESP_SDK_WIFI +/* Test various user_settings between applications by selecting example apps + * in `idf.py menuconfig` for Example wolfSSL Configuration settings: */ + +/* Turn on messages that are useful to see only in examples. */ +#define WOLFSSL_EXAMPLE_VERBOSITY + +/* wolfSSL Examples: set macros used in example applications. + * + * These Settings NOT available in ESP-IDF (e.g. esp-tls) + * + * Any settings needed by ESP-IDF components should be explicitly set, + * and not by these example-specific settings via CONFIG_WOLFSSL_EXAMPLE_n + * + * ESP-IDF settings should be Kconfig "CONFIG_[name]" values when possible. */ +#if defined(CONFIG_WOLFSSL_EXAMPLE_NAME_TEMPLATE) + /* See https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/template */ + /* We don't use WiFi, so don't compile in the esp-sdk-lib WiFi helpers: */ + /* #define USE_WOLFSSL_ESP_SDK_WIFI */ +#elif defined(CONFIG_WOLFSSL_EXAMPLE_NAME_TEST) + /* See https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/wolfssl_test */ + /* We don't use WiFi, so don't compile in the esp-sdk-lib WiFi helpers: */ + /* #define USE_WOLFSSL_ESP_SDK_WIFI */ + #define TEST_ESPIDF_ALL_WOLFSSL + +#elif defined(CONFIG_WOLFSSL_EXAMPLE_NAME_BENCHMARK) + /* See https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark */ + /* We don't use WiFi, so don't compile in the esp-sdk-lib WiFi helpers: */ + /* #define USE_WOLFSSL_ESP_SDK_WIFI */ + #define WOLFSSL_BENCHMARK_FIXED_UNITS_KB +#elif defined(CONFIG_WOLFSSL_EXAMPLE_NAME_TLS_CLIENT) + /* See https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/wolfssl_client */ + #define USE_WOLFSSL_ESP_SDK_WIFI +#elif defined(CONFIG_WOLFSSL_EXAMPLE_NAME_TLS_SERVER) + /* See https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/wolfssl_server */ + #define USE_WOLFSSL_ESP_SDK_WIFI + +/* wolfSSH Examples */ +#elif defined(CONFIG_WOLFSSL_EXAMPLE_NAME_WOLFSSH_TEMPLATE) + /* See https://github.com/wolfSSL/wolfssh/tree/master/ide/Espressif/ESP-IDF/examples/wolfssh_template */ + #define USE_WOLFSSL_ESP_SDK_WIFI +#elif defined(CONFIG_WOLFSSL_EXAMPLE_NAME_WOLFSSH_ECHOSERVER) + /* See https://github.com/wolfSSL/wolfssh/tree/master/ide/Espressif/ESP-IDF/examples/wolfssh_echoserver */ + #define USE_WOLFSSL_ESP_SDK_WIFI +#elif defined(CONFIG_WOLFSSL_EXAMPLE_NAME_ESP32_SSH_SERVER) + /* See https://github.com/wolfSSL/wolfssh-examples/tree/main/Espressif/ESP32/ESP32-SSH-Server */ + #define USE_WOLFSSL_ESP_SDK_WIFI +#elif defined(CONFIG_WOLFSSL_EXAMPLE_NAME_ESP8266_SSH_SERVER) + /* See https://github.com/wolfSSL/wolfssh-examples/tree/main/Espressif/ESP8266/ESP8266-SSH-Server */ + #define USE_WOLFSSL_ESP_SDK_WIFI + +/* wolfMQTT Examples */ +#elif defined(CONFIG_WOLFSSL_EXAMPLE_NAME_WOLFMQTT_TEMPLATE) + /* See https://github.com/wolfSSL/wolfMQTT/tree/master/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template */ + #define USE_WOLFSSL_ESP_SDK_WIFI +#elif defined(CONFIG_WOLFSSL_EXAMPLE_NAME_WOLFMQTT_AWS_IOT_MQTT) + /* See https://github.com/wolfSSL/wolfMQTT/tree/master/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT */ + #define USE_WOLFSSL_ESP_SDK_WIFI + +/* wolfTPM Examples */ +#elif defined(CONFIG_WOLFTPM_EXAMPLE_NAME_ESPRESSIF) + /* See https://github.com/wolfSSL/wolfTPM/tree/master/IDE/Espressif */ + #define USE_WOLFSSL_ESP_SDK_WIFI + +/* Apple HomeKit Examples */ +#elif defined(CONFIG_WOLFSSL_APPLE_HOMEKIT) + /* See https://github.com/AchimPieters/esp32-homekit-demo */ + +/* no example selected */ +#elif defined(CONFIG_WOLFSSL_EXAMPLE_NAME_NONE) + /* We'll assume the app needs to use wolfSSL sdk lib function */ + #define USE_WOLFSSL_ESP_SDK_WIFI + +/* Other applications detected by cmake */ +#elif defined(APP_ESP_HTTP_CLIENT_EXAMPLE) + /* The wolfSSL Version */ + #define FP_MAX_BITS (8192 * 2) + #define HAVE_ALPN + #define HAVE_SNI + #define OPENSSL_EXTRA_X509_SMALL + #define HAVE_TLS_EXTENSIONS + #define HAVE_SUPPORTED_CURVES + #define OPENSSL_EXTRA + #ifndef WOLFSSL_ALWAYS_VERIFY_CB + #define WOLFSSL_ALWAYS_VERIFY_CB + #endif + #ifndef WOLFSSL_VERIFY_CB_ALL_CERTS + #define WOLFSSL_VERIFY_CB_ALL_CERTS + #endif + #ifndef KEEP_PEER_CERT + #define KEEP_PEER_CERT + #endif + +#elif defined(APP_ESP_HTTP_CLIENT) + /* The ESP-IDF Version */ + #define FP_MAX_BITS (8192 * 2) + #define HAVE_ALPN + #define HAVE_SNI + #define OPENSSL_EXTRA_X509_SMALL + #define HAVE_TLS_EXTENSIONS + #define HAVE_SUPPORTED_CURVES + #define OPENSSL_EXTRA + #ifndef WOLFSSL_ALWAYS_VERIFY_CB + #define WOLFSSL_ALWAYS_VERIFY_CB + #endif + #ifndef WOLFSSL_VERIFY_CB_ALL_CERTS + #define WOLFSSL_VERIFY_CB_ALL_CERTS + #endif + #ifndef KEEP_PEER_CERT + #define KEEP_PEER_CERT + #endif +#else + #ifdef WOLFSSL_ESPIDF + /* #warning "App config undetected" */ + #endif + /* the code is older or does not have application name defined. */ +#endif /* Example wolfSSL Configuration app settings */ /* Experimental Kyber */ -#if 0 +#ifdef CONFIG_WOLFSSL_ENABLE_KYBER /* Kyber typically needs a minimum 10K stack */ #define WOLFSSL_EXPERIMENTAL_SETTINGS #define WOLFSSL_HAVE_KYBER #define WOLFSSL_WC_KYBER #define WOLFSSL_SHA3 + #if defined(CONFIG_IDF_TARGET_ESP8266) + /* With limited RAM, we'll disable some of the Kyber sizes: */ + #define WOLFSSL_NO_KYBER1024 + #define WOLFSSL_NO_KYBER768 + #define NO_SESSION_CACHE + #endif #endif +/* Pick a cert buffer size: */ +/* #define USE_CERT_BUFFERS_2048 */ +/* #define USE_CERT_BUFFERS_1024 */ +#define USE_CERT_BUFFERS_2048 + +/* The Espressif sdkconfig will have chipset info. +** +** Some possible values: +** +** CONFIG_IDF_TARGET_ESP32 +** CONFIG_IDF_TARGET_ESP32S2 +** CONFIG_IDF_TARGET_ESP32S3 +** CONFIG_IDF_TARGET_ESP32C3 +** CONFIG_IDF_TARGET_ESP32C6 +*/ + +/* Optionally enable Apple HomeKit from compiler directive or Kconfig setting */ +#if defined(WOLFSSL_APPLE_HOMEKIT) || defined(CONFIG_WOLFSSL_APPLE_HOMEKIT) + /* SRP is known to need 8K; slow on some devices */ + #define FP_MAX_BITS (8192 * 2) + #define WOLFCRYPT_HAVE_SRP + #define HAVE_CHACHA + #define HAVE_POLY1305 + #define WOLFSSL_BASE64_ENCODE + #endif /* Apple HomeKit settings */ + +/* Used by ESP-IDF components: */ +#if defined(CONFIG_ESP_TLS_USING_WOLFSSL) + /* The ESP-TLS */ + #define FP_MAX_BITS (8192 * 2) + #define HAVE_ALPN + #define HAVE_SNI + #define OPENSSL_EXTRA_X509_SMALL + + #define HAVE_TLS_EXTENSIONS + #define HAVE_SUPPORTED_CURVES +#endif + +/* Optionally enable some wolfSSH settings */ +#if defined(ESP_ENABLE_WOLFSSH) || defined(CONFIG_ESP_ENABLE_WOLFSSH) + /* The default SSH Windows size is massive for an embedded target. + * Limit it: */ + #define DEFAULT_WINDOW_SZ 2000 + + /* These may be defined in cmake for other examples: */ + #undef WOLFSSH_TERM + #define WOLFSSH_TERM + + /* optional debug */ + /* #undef DEBUG_WOLFSSH */ + /* #define DEBUG_WOLFSSH */ + + #undef WOLFSSL_KEY_GEN + #define WOLFSSL_KEY_GEN + + #undef WOLFSSL_PTHREADS + #define WOLFSSL_PTHREADS + + #define WOLFSSH_TEST_SERVER + #define WOLFSSH_TEST_THREADING +#endif /* ESP_ENABLE_WOLFSSH */ + + +/* Not yet using WiFi lib, so don't compile in the esp-sdk-lib WiFi helpers: */ +/* #define USE_WOLFSSL_ESP_SDK_WIFI */ + /* * ONE of these Espressif chip families will be detected from sdkconfig: * * WOLFSSL_ESP32 + * WOLFSSL_ESPWROOM32SE * WOLFSSL_ESP8266 + * + * following ifdef detection only for syntax highlighting: */ -#undef WOLFSSL_ESPWROOM32SE -#undef WOLFSSL_ESP8266 -#undef WOLFSSL_ESP32 +#ifdef WOLFSSL_ESPWROOM32SE + #undef WOLFSSL_ESPWROOM32SE +#endif +#ifdef WOLFSSL_ESP8266 + #undef WOLFSSL_ESP8266 +#endif +#ifdef WOLFSSL_ESP32 + #undef WOLFSSL_ESP32 +#endif /* See below for chipset detection from sdkconfig.h */ /* when you want to use SINGLE THREAD. Note Default ESP-IDF is FreeRTOS */ -/* #define SINGLE_THREADED */ +#define SINGLE_THREADED -/* SMALL_SESSION_CACHE saves a lot of RAM for ClientCache and SessionCache. +/* Small session cache saves a lot of RAM for ClientCache and SessionCache. * Memory requirement is about 5KB, otherwise 20K is needed when not specified. * If extra small footprint is needed, try MICRO_SESSION_CACHE (< 1K) * When really desperate or no TLS used, try NO_SESSION_CACHE. */ @@ -92,9 +320,6 @@ /* RSA_LOW_MEM: Half as much memory but twice as slow. */ #define RSA_LOW_MEM - - - /* optionally turn off SHA512/224 SHA512/256 */ /* #define WOLFSSL_NOSHA512_224 */ /* #define WOLFSSL_NOSHA512_256 */ @@ -109,14 +334,33 @@ #define BENCH_EMBEDDED /* TLS 1.3 */ -#define WOLFSSL_TLS13 -#define HAVE_TLS_EXTENSIONS -#define WC_RSA_PSS -#define HAVE_HKDF -#define HAVE_AEAD -#define HAVE_SUPPORTED_CURVES +#ifdef CONFIG_WOLFSSL_ALLOW_TLS13 + #define WOLFSSL_TLS13 + #define HAVE_TLS_EXTENSIONS + #define HAVE_HKDF + + /* May be required */ + #ifndef HAVE_AEAD + #endif + + /* Required for ECC */ + #define HAVE_SUPPORTED_CURVES + + /* Required for RSA */ + #define WC_RSA_PSS + + /* TLS 1.3 normally requires HAVE_FFDHE. For now just syntax highlight: */ + #if defined(HAVE_FFDHE_2048) || \ + defined(HAVE_FFDHE_3072) || \ + defined(HAVE_FFDHE_4096) || \ + defined(HAVE_FFDHE_6144) || \ + defined(HAVE_FFDHE_8192) + #else + /* #error "TLS 1.3 requires HAVE_FFDHE_[nnnn]" */ + #endif +#endif + -#define WOLFSSL_BENCHMARK_FIXED_UNITS_KB #define NO_FILESYSTEM @@ -133,29 +377,64 @@ /* when you want to use SHA384 */ #define WOLFSSL_SHA384 -/* when you want to use SHA512 */ -#define WOLFSSL_SHA512 - -/* when you want to use SHA3 */ -#define WOLFSSL_SHA3 - - /* ED25519 requires SHA512 */ -#define HAVE_ED25519 - /* Some features not enabled for ESP8266: */ #if defined(CONFIG_IDF_TARGET_ESP8266) || \ defined(CONFIG_IDF_TARGET_ESP32C2) + /* Some known low-memory devices have features not enabled by default. */ /* TODO determine low memory configuration for ECC. */ #else - #define HAVE_ECC - #define HAVE_CURVE25519 - #define CURVE25519_SMALL + /* when you want to use SHA512 */ + #define WOLFSSL_SHA512 + + /* when you want to use SHA3 */ + /* #define WOLFSSL_SHA3 */ + + /* ED25519 requires SHA512 */ + #define HAVE_ED25519 +#endif + +#if defined(CONFIG_IDF_TARGET_ESP8266) || defined(CONFIG_IDF_TARGET_ESP32C2) + #define MY_USE_ECC 0 + #define MY_USE_RSA 1 +#else + #define MY_USE_ECC 1 + #define MY_USE_RSA 0 #endif -#define HAVE_ED25519 +/* We can use either or both ECC and RSA, but must use at least one. */ +#if MY_USE_ECC || MY_USE_RSA + #if MY_USE_ECC + /* ---- ECDSA / ECC ---- */ + #define HAVE_ECC + #define HAVE_CURVE25519 + #define HAVE_ED25519 + #define WOLFSSL_SHA512 + /* + #define HAVE_ECC384 + #define CURVE25519_SMALL + */ + #else + #define WOLFSSH_NO_ECC + /* WOLFSSH_NO_ECDSA is typically defined automatically, + * here for clarity: */ + #define WOLFSSH_NO_ECDSA + #endif + + #if MY_USE_RSA + /* ---- RSA ----- */ + /* #define RSA_LOW_MEM */ + + /* DH disabled by default, needed if ECDSA/ECC also turned off */ + #define HAVE_DH + #else + #define WOLFSSH_NO_RSA + #endif +#else + #error "Either RSA or ECC must be enabled" +#endif -/* Optional OPENSSL compatibility */ -#define OPENSSL_EXTRA +/* Optional OpenSSL compatibility */ +/* #define OPENSSL_EXTRA */ /* #Optional HAVE_PKCS7 */ /* #define HAVE_PKCS7 */ @@ -208,7 +487,7 @@ #define USE_FAST_MATH /***** Use SP_MATH *****/ -/* #undef USE_FAST_MATH */ +/* #undef USE_FAST_MATH */ /* #define SP_MATH */ /* #define WOLFSSL_SP_MATH_ALL */ /* #define WOLFSSL_SP_RISCV32 */ @@ -217,6 +496,14 @@ /* #undef USE_FAST_MATH */ /* #define USE_INTEGER_HEAP_MATH */ +/* Just syntax highlighting to check math libraries: */ +#if defined(SP_MATH) || \ + defined(USE_INTEGER_HEAP_MATH) || \ + defined(USE_INTEGER_HEAP_MATH) || \ + defined(USE_FAST_MATH) || \ + defined(WOLFSSL_SP_MATH_ALL) || \ + defined(WOLFSSL_SP_RISCV32) +#endif #define WOLFSSL_SMALL_STACK @@ -224,18 +511,32 @@ #define HAVE_VERSION_EXTENDED_INFO /* #define HAVE_WC_INTROSPECTION */ -#define HAVE_SESSION_TICKET +#ifndef NO_SESSION_CACHE + #define HAVE_SESSION_TICKET +#endif /* #define HAVE_HASHDRBG */ +#if 0 +/* Example for additional cert functions */ #define WOLFSSL_KEY_GEN -#define WOLFSSL_CERT_REQ -#define WOLFSSL_CERT_GEN -#define WOLFSSL_CERT_EXT -#define WOLFSSL_SYS_CA_CERTS + #define WOLFSSL_CERT_REQ + #define WOLFSSL_CERT_GEN + #define WOLFSSL_CERT_EXT + #define WOLFSSL_SYS_CA_CERTS + + #define WOLFSSL_CERT_TEXT -#define WOLFSSL_CERT_TEXT + /* command-line options + --enable-keygen + --enable-certgen + --enable-certreq + --enable-certext + --enable-asn-template + */ + +#endif #define WOLFSSL_ASN_TEMPLATE @@ -255,10 +556,62 @@ --enable-asn-template */ +/* optional SM4 Ciphers. See https://github.com/wolfSSL/wolfsm */ +/* +#define WOLFSSL_SM2 +#define WOLFSSL_SM3 +#define WOLFSSL_SM4 +*/ + +#if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4) + /* SM settings, possible cipher suites: + + TLS13-AES128-GCM-SHA256 + TLS13-CHACHA20-POLY1305-SHA256 + TLS13-SM4-GCM-SM3 + TLS13-SM4-CCM-SM3 + + #define WOLFSSL_ESP32_CIPHER_SUITE "TLS13-SM4-GCM-SM3" + #define WOLFSSL_ESP32_CIPHER_SUITE "TLS13-SM4-CCM-SM3" + #define WOLFSSL_ESP32_CIPHER_SUITE "ECDHE-ECDSA-SM4-CBC-SM3" + #define WOLFSSL_ESP32_CIPHER_SUITE "ECDHE-ECDSA-SM4-GCM-SM3" + #define WOLFSSL_ESP32_CIPHER_SUITE "ECDHE-ECDSA-SM4-CCM-SM3" + #define WOLFSSL_ESP32_CIPHER_SUITE "TLS13-SM4-GCM-SM3:" \ + "TLS13-SM4-CCM-SM3:" + */ + + #undef WOLFSSL_BASE16 + #define WOLFSSL_BASE16 /* required for WOLFSSL_SM2 */ + + #undef WOLFSSL_SM4_ECB + #define WOLFSSL_SM4_ECB + + #undef WOLFSSL_SM4_CBC + #define WOLFSSL_SM4_CBC + + #undef WOLFSSL_SM4_CTR + #define WOLFSSL_SM4_CTR + + #undef WOLFSSL_SM4_GCM + #define WOLFSSL_SM4_GCM + + #undef WOLFSSL_SM4_CCM + #define WOLFSSL_SM4_CCM + + #define HAVE_POLY1305 + #define HAVE_CHACHA + + #undef HAVE_AESGCM + #define HAVE_AESGCM +#else + /* default settings */ + #define USE_CERT_BUFFERS_2048 +#endif + /* Chipset detection from sdkconfig.h * Default is HW enabled unless turned off. * Uncomment lines to force SW instead of HW acceleration */ -#if defined(CONFIG_IDF_TARGET_ESP32) +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(WOLFSSL_ESPWROOM32SE) #define WOLFSSL_ESP32 /* Alternatively, if there's an ECC Secure Element present: */ /* #define WOLFSSL_ESPWROOM32SE */ @@ -435,18 +788,30 @@ /* Debug options: See wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h for details on debug options +optionally increase error message size for very long paths. +#define WOLFSSL_MAX_ERROR_SZ 500 + +Turn debugging on/off: + wolfSSL_Debugging_ON(); + wolfSSL_Debugging_OFF(); + #define ESP_VERIFY_MEMBLOCK #define DEBUG_WOLFSSL #define DEBUG_WOLFSSL_VERBOSE #define DEBUG_WOLFSSL_SHA_MUTEX +#define WOLFSSL_DEBUG_IGNORE_ASN_TIME +#define WOLFSSL_DEBUG_CERT_BUNDLE #define WOLFSSL_ESP32_CRYPT_DEBUG #define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG #define NO_RECOVER_SOFTWARE_CALC #define WOLFSSL_TEST_STRAY 1 #define USE_ESP_DPORT_ACCESS_READ_BUFFER #define WOLFSSL_ESP32_HW_LOCK_DEBUG +#define WOLFSSL_DEBUG_MUTEX #define WOLFSSL_DEBUG_ESP_RSA_MULM_BITS #define ESP_DISABLE_HW_TASK_LOCK +#define ESP_MONITOR_HW_TASK_LOCK +#define USE_ESP_DPORT_ACCESS_READ_BUFFER See wolfcrypt/benchmark/benchmark.c for debug and other settings: @@ -458,7 +823,8 @@ Turn on timer debugging (used when CPU cycles not available) */ /* Pause in a loop rather than exit. */ -#define WOLFSSL_ESPIDF_ERROR_PAUSE +/* #define WOLFSSL_ESPIDF_ERROR_PAUSE */ +/* #define WOLFSSL_ESP32_HW_LOCK_DEBUG */ #define WOLFSSL_HW_METRICS @@ -507,6 +873,12 @@ Turn on timer debugging (used when CPU cycles not available) * There are various certificate examples in this header file: * https://github.com/wolfSSL/wolfssl/blob/master/wolfssl/certs_test.h * + * To use the sample certificates in code (not recommended for production!): + * + * #if defined(USE_CERT_BUFFERS_2048) || defined(USE_CERT_BUFFERS_1024) + * #include + * #endif + * * To use the sets of macros below, define *one* of these: * * USE_CERT_BUFFERS_1024 - ECC 1024 bit encoded ASN1 @@ -584,7 +956,8 @@ Turn on timer debugging (used when CPU cycles not available) #define WOLFSSL_BASE16 #else #if defined(USE_CERT_BUFFERS_2048) - /* Be sure to include in app when using example certs: */ + #define USE_CERT_BUFFERS_256 + /* Be sure to include in app when using example certs: */ /* #include */ #define CTX_CA_CERT ca_cert_der_2048 #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048 @@ -605,7 +978,8 @@ Turn on timer debugging (used when CPU cycles not available) #define CTX_CLIENT_KEY_TYPE WOLFSSL_FILETYPE_ASN1 #elif defined(USE_CERT_BUFFERS_1024) - /* Be sure to include in app when using example certs: */ + #define USE_CERT_BUFFERS_256 + /* Be sure to include in app when using example certs: */ /* #include */ #define CTX_CA_CERT ca_cert_der_1024 #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_1024 @@ -629,3 +1003,34 @@ Turn on timer debugging (used when CPU cycles not available) #error "Must define USE_CERT_BUFFERS_2048 or USE_CERT_BUFFERS_1024" #endif #endif /* Conditional key and cert constant names */ + +/****************************************************************************** +** Sanity Checks +******************************************************************************/ +#if defined(CONFIG_ESP_MAIN_TASK_STACK_SIZE) + #if defined(WOLFCRYPT_HAVE_SRP) + #if defined(FP_MAX_BITS) + #if FP_MAX_BITS < (8192 * 2) + #define ESP_SRP_MINIMUM_STACK_8K (24 * 1024) + #else + #define ESP_SRP_MINIMUM_STACK_8K (28 * 1024) + #endif + #else + #error "Please define FP_MAX_BITS when using WOLFCRYPT_HAVE_SRP." + #endif + + #if (CONFIG_ESP_MAIN_TASK_STACK_SIZE < ESP_SRP_MINIMUM_STACK) + #warning "WOLFCRYPT_HAVE_SRP enabled with small stack size" + #endif + #endif +#else + #warning "CONFIG_ESP_MAIN_TASK_STACK_SIZE not defined!" +#endif +/* See settings.h for some of the possible hardening options: + * + * #define NO_ESPIDF_DEFAULT + * #define WC_NO_CACHE_RESISTANT + * #define WC_AES_BITSLICED + * #define HAVE_AES_ECB + * #define HAVE_AES_DIRECT + */ diff --git a/IDE/Espressif/ESP-IDF/examples/template/main/Kconfig.projbuild b/IDE/Espressif/ESP-IDF/examples/template/main/Kconfig.projbuild new file mode 100644 index 0000000000..b43b62cb47 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/template/main/Kconfig.projbuild @@ -0,0 +1,123 @@ +# Kconfig main +# +# Copyright (C) 2006-2024 wolfSSL Inc. All rights reserved. +# +# This file is part of wolfSSL. +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# + +# Kconfig File Version 5.7.2.001 for wolfssl_template + +menu "Example wolfSSL Configuration" + +choice WOLFSSL_EXAMPLE_CHOOSE + prompt "Choose Example (See wolfssl/include/user_settings.h)" + default WOLFSSL_EXAMPLE_NAME_NONE + help + The user settings file can be adjusted to specific wolfSSL examples. + + config WOLFSSL_EXAMPLE_NAME_TEMPLATE + bool "wolfSSL Template" + help + The sample template app compiles in wolfSSL and prints the current wolfSSL Version. Nothing more. + + config WOLFSSL_EXAMPLE_NAME_TEST + bool "wolfSSL Test" + help + This app tests all cryptographic functions currently enabled. See also Benchmark performance app. + + config WOLFSSL_EXAMPLE_NAME_BENCHMARK + bool "wolfSSL Benchmark" + help + Benchmark performance app. See also cryptographic test. + + config WOLFSSL_EXAMPLE_NAME_TLS_CLIENT + bool "TLS Client" + help + TLS Client Example app. Needs WiFi and a listening server on port 11111. + + config WOLFSSL_EXAMPLE_NAME_TLS_SERVER + bool "TLS Server" + help + TLS Server Example app. Needs WiFi. More interesting with a TLS client using port 11111. + + config WOLFSSL_EXAMPLE_NAME_WOLFSSH_TEMPLATE + bool "SSH Template App" + help + Bare-bones Hellow World app that only compiles in wolfSSL and wolfSSH. + See wolfSSL/wolfssh on GitHub. + + config WOLFSSL_EXAMPLE_NAME_WOLFSSH_ECHOSERVER + bool "SSH Echo Server" + help + See wolfSSL/wolfssh on GitHub. + + config WOLFSSL_EXAMPLE_NAME_WOLFSSH_ECHOSERVER + bool "SSH Echo Server" + help + See wolfSSL/wolfssh on GitHub. + + config WOLFSSL_EXAMPLE_NAME_ESP32_SSH_SERVER + bool "SSH to UART Server for the ESP32" + help + See wolfSSL/wolfssh-examples on GitHub. + + config WOLFSSL_EXAMPLE_NAME_ESP8266_SSH_SERVER + bool "SSH to UART Server for the ESP8266" + help + See wolfSSL/wolfssh-examples on GitHub. + + config WOLFSSL_EXAMPLE_NAME_WOLFMQTT_TEMPLATE + bool "MQTT Template" + help + See wolfSSL/wolfmqtt on GitHub. + + config WOLFSSL_EXAMPLE_NAME_WOLFMQTT_AWS_IOT_MQTT + bool "MQTT AWS IoT" + help + See wolfSSL/wolfmqtt on GitHub. + + config WOLFTPM_EXAMPLE_NAME_ESPRESSIF + bool "TPM Test Example for the ESP32" + help + See wolfSSL/wolfTPM on GitHub. + + config WOLFSSL_APPLE_HOMEKIT + bool "Apple HomeKit for the ESP32" + help + See AchimPieters/esp32-homekit-demo on GitHub. + + + config WOLFSSL_EXAMPLE_NAME_NONE + bool "Other" + help + A specific example app is not defined. + +endchoice + +config WOLFSSL_TARGET_HOST + string "Target host" + default "127.0.0.1" + help + host address for the example to connect + +config WOLFSSL_TARGET_PORT + int "Target port" + default 11111 + help + host port for the example to connect + +endmenu diff --git a/IDE/Espressif/ESP-IDF/examples/template/main/main.c b/IDE/Espressif/ESP-IDF/examples/template/main/main.c index f2f69bcb28..6b3abe13f6 100644 --- a/IDE/Espressif/ESP-IDF/examples/template/main/main.c +++ b/IDE/Espressif/ESP-IDF/examples/template/main/main.c @@ -50,6 +50,11 @@ void app_main(void) #ifdef WOLFSSL_ESPIDF_VERBOSE_EXIT_MESSAGE int ret = 0; #endif + +#if !defined(CONFIG_WOLFSSL_EXAMPLE_NAME_TEMPLATE) + ESP_LOGW(TAG, "Warning: Example wolfSSL misconfigured? Check menuconfig."); +#endif + ESP_LOGI(TAG, "Hello wolfSSL!"); #ifdef HAVE_VERSION_EXTENDED_INFO diff --git a/IDE/Espressif/ESP-IDF/examples/template/sdkconfig.defaults b/IDE/Espressif/ESP-IDF/examples/template/sdkconfig.defaults index 88f1e113e9..d14a51ee0c 100644 --- a/IDE/Espressif/ESP-IDF/examples/template/sdkconfig.defaults +++ b/IDE/Espressif/ESP-IDF/examples/template/sdkconfig.defaults @@ -1,6 +1,11 @@ +# Set the known example app config to template example (see user_settings.h) +CONFIG_WOLFSSL_EXAMPLE_NAME_TEMPLATE=y + CONFIG_FREERTOS_HZ=1000 CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y +# Set the known example app config to TLS Client (see user_settings.h) +CONFIG_WOLFSSL_EXAMPLE_NAME_TEMPLATE=y # # Default main stack size # diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md index 7b3a4f255b..143a6a6991 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md @@ -62,10 +62,10 @@ See the [feature request](https://sysprogs.com/w/forums/topic/feature-request-sh ## ESP-IDF Commandline -1. `idf.py menuconfig` to configure the program. +1. `idf.py menuconfig` to configure the program. 1-1. Example Configuration -> - BENCH_ARG : argument that you want to use. Default is "-lng 0" + BENCH_ARG : argument that you want to use. Default is "-lng 0" The list of argument can be find in help. When you want to run the benchmark program @@ -110,9 +110,9 @@ idf.py build flash -p /dev/ttyS20 -b 115200 monitor ## Example Output -Note the default wolfSSL `user_settings.h` is configured by default to be the most +Note the default wolfSSL `user_settings.h` is configured by default to be the most compatible across the widest ranges of targets. Contact wolfSSL at support@wolfssl.com -for help in optimizing for your particular application, or see the +for help in optimizing for your particular application, or see the [docs](https://www.wolfssl.com/documentation/manuals/wolfssl/index.html). Compiled and flashed with `idf.py build flash -p /dev/ttyS7 -b 115200 monitor`: 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 29f679b78f..f0bef7fc31 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 @@ -1,21 +1,21 @@ # -# Copyright (C) 2006-2024 wolfSSL Inc. +# Copyright (C) 2006-2024 wolfSSL Inc. # -# This file is part of wolfSSL. +# This file is part of wolfSSL. # -# wolfSSL is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# wolfSSL is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA # # cmake for wolfssl Espressif projects # diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/include/user_settings.h b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/include/user_settings.h index 5862894ee4..1c30597da9 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/include/user_settings.h +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/include/user_settings.h @@ -705,7 +705,7 @@ Turn on timer debugging (used when CPU cycles not available) #define WOLFSSL_BASE16 #else #if defined(USE_CERT_BUFFERS_2048) - /* Be sure to include in app when using example certs: */ + /* Be sure to include in app when using example certs: */ /* #include */ #define CTX_CA_CERT ca_cert_der_2048 #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048 @@ -726,7 +726,7 @@ Turn on timer debugging (used when CPU cycles not available) #define CTX_CLIENT_KEY_TYPE WOLFSSL_FILETYPE_ASN1 #elif defined(USE_CERT_BUFFERS_1024) - /* Be sure to include in app when using example certs: */ + /* Be sure to include in app when using example certs: */ /* #include */ #define CTX_CA_CERT ca_cert_der_1024 #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_1024 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 e37c4d5f62..6614af4fcc 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt @@ -19,7 +19,7 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA endif() idf_component_register(SRCS main.c - INCLUDE_DIRS "." + INCLUDE_DIRS "." "./include") # diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/Makefile b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/Makefile index 45d4b1d264..cedefce722 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/Makefile +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/Makefile @@ -39,6 +39,10 @@ # PROJECT_NAME := wolfssl_client +# Optionally include component source when print path (needs work to then properly build) +# +# include components/wolfssl/component.mk + MY_PRIVATE_CONFIG ?= n USE_MY_PRIVATE_WSL_CONFIG ?= n USE_MY_PRIVATE_MAC_CONFIG ?= n @@ -52,76 +56,76 @@ USE_MY_PRIVATE_WINDOWS_CONFIG ?= n $(info ************* wolfssl_client *************) ifeq ($(MY_PRIVATE_CONFIG),y) - CFLAGS += -DMY_PRIVATE_CONFIG - $(info Enabled MY_PRIVATE_CONFIG") + CFLAGS += -DMY_PRIVATE_CONFIG + $(info Enabled MY_PRIVATE_CONFIG") endif # Check for Windows environment variable: USE_MY_PRIVATE_WINDOWS_CONFIG ifeq ($(USE_MY_PRIVATE_WINDOWS_CONFIG),y) - # This hard coded MY_CONFIG_FILE value must match that in the header file. - MY_CONFIG_FILE := /workspace/my_private_config.h - ifeq ($(wildcard $(MY_CONFIG_FILE)),) - $(info File does not exist: $(MY_CONFIG_FILE)) - else - CFLAGS += -DUSE_MY_PRIVATE_WINDOWS_CONFIG - $(info Using private config file for: Windows) - endif + # This hard coded MY_CONFIG_FILE value must match that in the header file. + MY_CONFIG_FILE := /workspace/my_private_config.h + ifeq ($(wildcard $(MY_CONFIG_FILE)),) + $(info File does not exist: $(MY_CONFIG_FILE)) + else + CFLAGS += -DUSE_MY_PRIVATE_WINDOWS_CONFIG + $(info Using private config file for: Windows) + endif endif # Check for WSL environment variable: USE_MY_PRIVATE_WSL_CONFIG ifeq ($(USE_MY_PRIVATE_WSL_CONFIG),y) - # This hard coded MY_CONFIG_FILE value must match that in the header file. - MY_CONFIG_FILE := /mnt/c/workspace/my_private_config.h - ifeq ($(wildcard $(MY_CONFIG_FILE)),) - $(info File does not exist: $(MY_CONFIG_FILE)) - else - CFLAGS += -DUSE_MY_PRIVATE_WSL_CONFIG - $(info Using private config file for: WSL) - endif + # This hard coded MY_CONFIG_FILE value must match that in the header file. + MY_CONFIG_FILE := /mnt/c/workspace/my_private_config.h + ifeq ($(wildcard $(MY_CONFIG_FILE)),) + $(info File does not exist: $(MY_CONFIG_FILE)) + else + CFLAGS += -DUSE_MY_PRIVATE_WSL_CONFIG + $(info Using private config file for: WSL) + endif endif # Check for Linux environment variable: USE_MY_PRIVATE_LINUX_CONFIG ifeq ($(USE_MY_PRIVATE_LINUX_CONFIG),y) - # This hard coded MY_CONFIG_FILE value must match that in the header file. - MY_CONFIG_FILE := ~/workspace/my_private_config.h - ifeq ($(wildcard $(MY_CONFIG_FILE)),) - $(info File does not exist: $(MY_CONFIG_FILE)) - else - CFLAGS += -DUSE_MY_PRIVATE_LINUX_CONFIG - $(info Using private config file for: Linux) - endif + # This hard coded MY_CONFIG_FILE value must match that in the header file. + MY_CONFIG_FILE := ~/workspace/my_private_config.h + ifeq ($(wildcard $(MY_CONFIG_FILE)),) + $(info File does not exist: $(MY_CONFIG_FILE)) + else + CFLAGS += -DUSE_MY_PRIVATE_LINUX_CONFIG + $(info Using private config file for: Linux) + endif endif # Check for Mac environment variable: USE_MY_PRIVATE_MAC_CONFIG ifeq ($(USE_MY_PRIVATE_MAC_CONFIG),y) - # This hard coded MY_CONFIG_FILE value must match that in the header file. - MY_CONFIG_FILE := ~/Documents/my_private_config.h - ifeq ($(wildcard $(MY_CONFIG_FILE)),) - $(info File does not exist: $(MY_CONFIG_FILE)) - else - CFLAGS += -DUSE_MY_PRIVATE_MAC_CONFIG - $(info Using private config file for: Mac) - endif + # This hard coded MY_CONFIG_FILE value must match that in the header file. + MY_CONFIG_FILE := ~/Documents/my_private_config.h + ifeq ($(wildcard $(MY_CONFIG_FILE)),) + $(info File does not exist: $(MY_CONFIG_FILE)) + else + CFLAGS += -DUSE_MY_PRIVATE_MAC_CONFIG + $(info Using private config file for: Mac) + endif endif ifneq ($(OS),MY_PRIVATE_CONFIG) - CFLAGS += -DMY_PRIVATE_CONFIG="$(MY_PRIVATE_CONFIG)" + CFLAGS += -DMY_PRIVATE_CONFIG="$(MY_PRIVATE_CONFIG)" else - ifeq ($(OS),Linux) - CFLAGS += -DOS_LINUX - endif - ifeq ($(OS),Windows_NT) - CFLAGS += -DWOLFSSL_MAKE_SYSTEM_NAME_WINDOWS - endif - ifeq ($(OS),Darwin) - CFLAGS += -DWOLFSSL_MAKE_SYSTEM_NAME_APPLE - endif - ifneq (,$(findstring MINGW,$(OS))) - CFLAGS += -DWOLFSSL_MAKE_SYSTEM_NAME_MINGW - endif - ifneq (,$(findstring CYGWIN,$(OS))) - CFLAGS += -DWOLFSSL_MAKE_SYSTEM_NAME_CYGWIN - endif + ifeq ($(OS),Linux) + CFLAGS += -DOS_LINUX + endif + ifeq ($(OS),Windows_NT) + CFLAGS += -DWOLFSSL_MAKE_SYSTEM_NAME_WINDOWS + endif + ifeq ($(OS),Darwin) + CFLAGS += -DWOLFSSL_MAKE_SYSTEM_NAME_APPLE + endif + ifneq (,$(findstring MINGW,$(OS))) + CFLAGS += -DWOLFSSL_MAKE_SYSTEM_NAME_MINGW + endif + ifneq (,$(findstring CYGWIN,$(OS))) + CFLAGS += -DWOLFSSL_MAKE_SYSTEM_NAME_CYGWIN + endif endif # It is essential that the build process sees the WOLFSSL_USER_SETTINGS @@ -132,3 +136,4 @@ EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_ # The Standard Espressif IDF include: include $(IDF_PATH)/make/project.mk + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md index d8ed28c051..43961ec9be 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md @@ -56,23 +56,23 @@ Difficulty flashing: 1. `idf.py menuconfig` to config the project - 1-1. Example Configuration -> + 1-1. Example Configuration -> Target host ip address : the host that you want to connect to.(default is 127.0.0.1) 1-2. Example Connection Configuration -> - - WIFI SSID: your own WIFI, which is connected to the Internet.(default is "myssid") + + WIFI SSID: your own WIFI, which is connected to the Internet.(default is "myssid") WIFI Password: WIFI password, and default is "mypassword" - - - Note: the example program uses 11111 port. If you want to use different port + + + Note: the example program uses 11111 port. If you want to use different port , you need to modify DEFAULT_PORT definition in the code. When you want to test the wolfSSL client -1. `idf.py -p flash` and then `idf.py monitor` to load the firmware and see the context -2. You can use /examples/server/server program for test. +1. `idf.py -p flash` and then `idf.py monitor` to load the firmware and see the context +2. You can use /examples/server/server program for test. e.g. Launch ./examples/server/server -v 4 -b -i -d @@ -83,11 +83,75 @@ Reminder that we build with `make` and not `cmake` in VisualGDB. Build files will be created in `[project directory]\build` -## ESP-IDF make Commandline (version 3.5 or earlier for the ESP8266) +See notes below if building a project in a directory other than the examples. + +Problems? + +- Try deleting any existing `sdkconfig` file and/or `./build` directory to start fresh. +- Be sure the RTOS SDK is installed and properly configured. + +## ESP-IDF `make` Commandline (version 3.5 or earlier for the ESP8266) + +In-place example build: +```bash +export IDF_PATH=~/esp/ESP8266_RTOS_SDK +export PATH="$PATH:$HOME/esp/xtensa-lx106-elf/bin" +cd /mnt/c/workspace/wolfssl-master/IDE/Espressif/ESP-IDF/examples/wolfssl_client +make clean +make ``` + +When building a in a *different directory*, for example assuming the `wolfssl_client` in the wolfssl examples +directory is copied to the `C:\test\demo` directory in Windows. (aka ` /mnt/c/test/demo` in WSL), +with a clone of wolfSSL `master` branch in `C:\workspace\wolfssl-master`: + +```bash +cp -r /mnt/c/workspace/wolfssl-master/IDE/Espressif/ESP-IDF/examples/wolfssl_client/* /mnt/c/test/demo +``` + +Modify the project `./components/wolfssl/component.mk` file. Adjust `WOLFSSL_ROOT` setting, in this case to a value of: + +`WOLFSSL_ROOT := ../../../../workspace/wolfssl-master` + +Ensure the path is *relative* to the project `component.mk` file location and *not* absolute. + +Note the location of the component makefile in this case is `c:\test\demo\components\wolfssl\component.mk`. +Thus we need to navigate up 4 parents to the root of `C:\` to find `/mnt/c` in WSL. + +Proceed to run `make` from the project directory as usual: + +```bash +# setup environment as needed export IDF_PATH=~/esp/ESP8266_RTOS_SDK +export PATH="$PATH:$HOME/esp/xtensa-lx106-elf/bin" + +# copy and navigate to project directory +mkdir -p /mnt/c/test/demo +cp -r /mnt/c/workspace/wolfssl-master/IDE/Espressif/ESP-IDF/examples/wolfssl_client/* /mnt/c/test/demo +cd /mnt/c/test/demo +# Clean +rm -rf ./build +rm sdkconfig +make clean + +# Edit ./components/wolfssl/component.mk and set WOLFSSL_ROOT value +# WOLFSSL_ROOT := ../../../../workspace/wolfssl-master + +# build the example project +make +``` + +When using `make` there should be details in the build log to indicate +the assigned path, and the equivalent, fully-qualified path of `WOLFSSL_ROOT`. + +``` +************* wolfssl_client ************* +*********** wolfssl component ************ +WOLFSSL_ROOT defined: ../../../../workspace/wolfssl-master +WOLFSSL_ROOT actual: /mnt/c/workspace/wolfssl-master +********** end wolfssl component ********** ``` @@ -158,7 +222,7 @@ Command: ``` cd /mnt/c/workspace/wolfssl-$USER/IDE/Espressif/ESP-IDF/examples/wolfssl_server -. /mnt/c/SysGCC/esp32/esp-idf/v5.1/export.sh +. /mnt/c/SysGCC/esp32/esp-idf/v5.2/export.sh idf.py flash -p /dev/ttyS19 -b 115200 monitor ``` diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README_server_sm.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README_server_sm.md index 01dd6baf8a..71ab1b6c11 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README_server_sm.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README_server_sm.md @@ -49,7 +49,7 @@ make clean && make ### Others... ``` -# Success: Linux Client to ESP32 Server TLS1.2 +# Success: Linux Client to ESP32 Server TLS1.2 ./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C ./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-GCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C ./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-CCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C @@ -81,7 +81,7 @@ be the same as the Linux server files. | Usage | Certificate | Key | Certificate Authority file, default ./certs/client-cert.pem | | ----- | ---------------------------------- | ----------------------------------- | --------------------------------- | -| server | -c ./certs/sm2/server-sm2.pem | -k ./certs/sm2/server-sm2-priv.pem | -A ./certs/sm2/client-sm2.pem -V | +| server | -c ./certs/sm2/server-sm2.pem | -k ./certs/sm2/server-sm2-priv.pem | -A ./certs/sm2/client-sm2.pem -V | | client | -c ./certs/sm2/client-sm2.pem | -k ./certs/sm2/client-sm2-priv.pem | -A ./certs/sm2/root-sm2.pem -C | | emdedded: | server | wolfSSL_CTX_use_certificate_buffer
server_sm2 | wolfSSL_CTX_use_PrivateKey_buffer
server_sm2_priv | wolfSSL_CTX_load_verify_buffer
client-sm2 | @@ -156,7 +156,7 @@ I (622) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM I (628) heap_init: At 40094DC8 len 0000B238 (44 KiB): IRAM I (636) spi_flash: detected chip: generic I (639) spi_flash: flash io: dio -W (643) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the +W (643) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. I (657) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. @@ -358,12 +358,12 @@ I (14715) internal.c: GrowOutputBuffer ok I (14715) wolfssl: wolfSSL Entering wolfSSL_get_options I (14725) wolfssl: Point Formats extension to write W (14735) wolfio: ssl->wflags = 0 -I (14735) wolfio: 16 03 03 00 52 02 00 00 4e 03 03 af 87 e2 58 57 -I (14735) wolfio: 73 c3 c1 35 1a 59 39 b2 03 9d 14 03 e0 b8 fb e8 -I (14745) wolfio: 9d 5b 9c 44 4f 57 4e 47 52 44 01 20 85 77 75 20 -I (14755) wolfio: 95 dd 00 e2 91 f8 42 33 f8 61 3f 1f de 81 15 58 -I (14755) wolfio: 23 0c e7 1e 71 e6 10 e5 67 23 e0 40 e0 11 00 00 -I (14765) wolfio: 06 00 0b 00 02 01 00 +I (14735) wolfio: 16 03 03 00 52 02 00 00 4e 03 03 af 87 e2 58 57 +I (14735) wolfio: 73 c3 c1 35 1a 59 39 b2 03 9d 14 03 e0 b8 fb e8 +I (14745) wolfio: 9d 5b 9c 44 4f 57 4e 47 52 44 01 20 85 77 75 20 +I (14755) wolfio: 95 dd 00 e2 91 f8 42 33 f8 61 3f 1f de 81 15 58 +I (14755) wolfio: 23 0c e7 1e 71 e6 10 e5 67 23 e0 40 e0 11 00 00 +I (14765) wolfio: 06 00 0b 00 02 01 00 W (14775) wolfio: sz = 87 I (14775) wolfssl: Shrinking output buffer I (14775) wolfssl: wolfSSL Leaving SendServerHello, return 0 @@ -372,53 +372,53 @@ I (14795) wolfssl: wolfSSL Entering SendCertificate I (14795) wolfssl: growing output buffer I (14805) internal.c: GrowOutputBuffer ok W (14815) wolfio: ssl->wflags = 0 -I (14815) wolfio: 16 03 03 02 e6 0b 00 02 e2 00 02 df 00 02 dc 30 -I (14815) wolfio: 82 02 d8 30 82 02 7e a0 03 02 01 02 02 01 01 30 -I (14825) wolfio: 0a 06 08 2a 81 1c cf 55 01 83 75 30 81 ac 31 0b -I (14835) wolfio: 30 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06 -I (14835) wolfio: 03 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30 -I (14845) wolfio: 0e 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31 -I (14855) wolfio: 14 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53 -I (14855) wolfio: 4c 5f 73 6d 32 31 0f 30 0d 06 03 55 04 0b 0c 06 -I (14865) wolfio: 43 41 2d 73 6d 32 31 18 30 16 06 03 55 04 03 0c -I (14875) wolfio: 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e 63 6f 6d -I (14875) wolfio: 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01 09 01 16 -I (14885) wolfio: 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c 2e 63 6f -I (14895) wolfio: 6d 31 17 30 15 06 0a 09 92 26 89 93 f2 2c 64 01 -I (14895) wolfio: 01 0c 07 77 6f 6c 66 53 53 4c 30 1e 17 0d 32 33 -I (14905) wolfio: 30 32 31 35 30 36 32 33 30 37 5a 17 0d 32 35 31 -I (14915) wolfio: 31 31 31 30 36 32 33 30 37 5a 30 81 b0 31 0b 30 -I (14915) wolfio: 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06 03 -I (14925) wolfio: 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30 0e -I (14935) wolfio: 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31 14 -I (14945) wolfio: 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53 4c -I (14945) wolfio: 5f 73 6d 32 31 13 30 11 06 03 55 04 0b 0c 0a 53 -I (14955) wolfio: 65 72 76 65 72 2d 73 6d 32 31 18 30 16 06 03 55 -I (14965) wolfio: 04 03 0c 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e -I (14965) wolfio: 63 6f 6d 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01 -I (14975) wolfio: 09 01 16 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c -I (14985) wolfio: 2e 63 6f 6d 31 17 30 15 06 0a 09 92 26 89 93 f2 -I (14985) wolfio: 2c 64 01 01 0c 07 77 6f 6c 66 53 53 4c 30 5a 30 -I (14995) wolfio: 14 06 08 2a 81 1c cf 55 01 82 2d 06 08 2a 81 1c -I (15005) wolfio: cf 55 01 82 2d 03 42 00 04 94 70 2b 46 e4 5e 0f -I (15005) wolfio: 41 fb 8f 2d 34 0a 41 40 19 5e fb d4 1d 11 ac fa -I (15015) wolfio: f5 93 37 c6 fa 87 08 f7 16 1f 2c ce 30 40 9d 4f -I (15025) wolfio: a6 2a 0a a1 d6 95 33 c3 a6 03 98 e6 8d 05 34 b0 -I (15025) wolfio: 97 0c de a4 c7 cf 53 8f d1 a3 81 89 30 81 86 30 -I (15035) wolfio: 1d 06 03 55 1d 0e 04 16 04 14 67 ae 60 ff 7e 1b -I (15045) wolfio: 0f 95 ae 1f 82 59 f2 6c 56 2d 93 ef 17 32 30 1f -I (15045) wolfio: 06 03 55 1d 23 04 18 30 16 80 14 47 0a 48 7e bb -I (15055) wolfio: 02 a8 5a 26 57 2b 19 a9 7b 61 8b 7f 5d 99 6e 30 -I (15065) wolfio: 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0e 06 -I (15075) wolfio: 03 55 1d 0f 01 01 ff 04 04 03 02 03 a8 30 13 06 -I (15075) wolfio: 03 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 -I (15085) wolfio: 03 01 30 11 06 09 60 86 48 01 86 f8 42 01 01 04 -I (15095) wolfio: 04 03 02 06 40 30 0a 06 08 2a 81 1c cf 55 01 83 -I (15095) wolfio: 75 03 48 00 30 45 02 20 1b ca 94 28 7f f6 b2 0d -I (15105) wolfio: 31 43 50 e1 d5 34 17 dd af 3a de 81 06 67 9a b3 -I (15115) wolfio: 06 22 7e 64 ec fd 0e b9 02 21 00 a1 48 a8 32 d1 -I (15115) wolfio: 05 09 6b 1c eb 89 12 66 d8 38 a1 c4 5c 89 09 0f -I (15125) wolfio: fd e9 c0 3b 1d fb cd b5 4c 31 68 +I (14815) wolfio: 16 03 03 02 e6 0b 00 02 e2 00 02 df 00 02 dc 30 +I (14815) wolfio: 82 02 d8 30 82 02 7e a0 03 02 01 02 02 01 01 30 +I (14825) wolfio: 0a 06 08 2a 81 1c cf 55 01 83 75 30 81 ac 31 0b +I (14835) wolfio: 30 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06 +I (14835) wolfio: 03 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30 +I (14845) wolfio: 0e 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31 +I (14855) wolfio: 14 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53 +I (14855) wolfio: 4c 5f 73 6d 32 31 0f 30 0d 06 03 55 04 0b 0c 06 +I (14865) wolfio: 43 41 2d 73 6d 32 31 18 30 16 06 03 55 04 03 0c +I (14875) wolfio: 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e 63 6f 6d +I (14875) wolfio: 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01 09 01 16 +I (14885) wolfio: 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c 2e 63 6f +I (14895) wolfio: 6d 31 17 30 15 06 0a 09 92 26 89 93 f2 2c 64 01 +I (14895) wolfio: 01 0c 07 77 6f 6c 66 53 53 4c 30 1e 17 0d 32 33 +I (14905) wolfio: 30 32 31 35 30 36 32 33 30 37 5a 17 0d 32 35 31 +I (14915) wolfio: 31 31 31 30 36 32 33 30 37 5a 30 81 b0 31 0b 30 +I (14915) wolfio: 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06 03 +I (14925) wolfio: 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30 0e +I (14935) wolfio: 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31 14 +I (14945) wolfio: 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53 4c +I (14945) wolfio: 5f 73 6d 32 31 13 30 11 06 03 55 04 0b 0c 0a 53 +I (14955) wolfio: 65 72 76 65 72 2d 73 6d 32 31 18 30 16 06 03 55 +I (14965) wolfio: 04 03 0c 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e +I (14965) wolfio: 63 6f 6d 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01 +I (14975) wolfio: 09 01 16 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c +I (14985) wolfio: 2e 63 6f 6d 31 17 30 15 06 0a 09 92 26 89 93 f2 +I (14985) wolfio: 2c 64 01 01 0c 07 77 6f 6c 66 53 53 4c 30 5a 30 +I (14995) wolfio: 14 06 08 2a 81 1c cf 55 01 82 2d 06 08 2a 81 1c +I (15005) wolfio: cf 55 01 82 2d 03 42 00 04 94 70 2b 46 e4 5e 0f +I (15005) wolfio: 41 fb 8f 2d 34 0a 41 40 19 5e fb d4 1d 11 ac fa +I (15015) wolfio: f5 93 37 c6 fa 87 08 f7 16 1f 2c ce 30 40 9d 4f +I (15025) wolfio: a6 2a 0a a1 d6 95 33 c3 a6 03 98 e6 8d 05 34 b0 +I (15025) wolfio: 97 0c de a4 c7 cf 53 8f d1 a3 81 89 30 81 86 30 +I (15035) wolfio: 1d 06 03 55 1d 0e 04 16 04 14 67 ae 60 ff 7e 1b +I (15045) wolfio: 0f 95 ae 1f 82 59 f2 6c 56 2d 93 ef 17 32 30 1f +I (15045) wolfio: 06 03 55 1d 23 04 18 30 16 80 14 47 0a 48 7e bb +I (15055) wolfio: 02 a8 5a 26 57 2b 19 a9 7b 61 8b 7f 5d 99 6e 30 +I (15065) wolfio: 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0e 06 +I (15075) wolfio: 03 55 1d 0f 01 01 ff 04 04 03 02 03 a8 30 13 06 +I (15075) wolfio: 03 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 +I (15085) wolfio: 03 01 30 11 06 09 60 86 48 01 86 f8 42 01 01 04 +I (15095) wolfio: 04 03 02 06 40 30 0a 06 08 2a 81 1c cf 55 01 83 +I (15095) wolfio: 75 03 48 00 30 45 02 20 1b ca 94 28 7f f6 b2 0d +I (15105) wolfio: 31 43 50 e1 d5 34 17 dd af 3a de 81 06 67 9a b3 +I (15115) wolfio: 06 22 7e 64 ec fd 0e b9 02 21 00 a1 48 a8 32 d1 +I (15115) wolfio: 05 09 6b 1c eb 89 12 66 d8 38 a1 c4 5c 89 09 0f +I (15125) wolfio: fd e9 c0 3b 1d fb cd b5 4c 31 68 W (15135) wolfio: sz = 747 I (15135) wolfssl: Shrinking output buffer I (15135) wolfssl: wolfSSL Leaving SendCertificate, return 0 @@ -440,16 +440,16 @@ I (15915) wolfssl: wolfSSL Entering SendHandshakeMsg I (15925) wolfssl: growing output buffer I (15925) internal.c: GrowOutputBuffer ok W (15925) wolfio: ssl->wflags = 0 -I (15935) wolfio: 16 03 03 00 95 0c 00 00 91 03 00 29 41 04 fd f5 -I (15935) wolfio: 5e 74 15 30 1d f3 84 ae a5 69 96 a9 5b dd 27 b3 -I (15945) wolfio: 00 7d 40 3a 59 93 93 6f 4d 1f 62 dc 60 48 34 1f -I (15955) wolfio: a8 1d 34 b8 76 8f 8b 27 4a 1b 77 64 8e 2e d5 27 -I (15955) wolfio: 03 95 8b 9d a5 ed a4 a6 b9 40 1b ea aa 10 07 08 -I (15965) wolfio: 00 48 30 46 02 21 00 cb 89 61 e9 21 f9 c6 4d ad -I (15975) wolfio: aa e7 f1 3f 6f 27 46 f0 35 ec 45 4e 8a ae f3 ac -I (15985) wolfio: 7c c0 cf 68 11 44 e2 02 21 00 f6 40 5c bc 66 5a -I (15985) wolfio: 74 1e 92 5d 9a 03 75 e7 7f 16 c2 b3 c8 fe 8d 5c -I (15995) wolfio: 63 35 36 da 61 38 76 dc 4e d6 +I (15935) wolfio: 16 03 03 00 95 0c 00 00 91 03 00 29 41 04 fd f5 +I (15935) wolfio: 5e 74 15 30 1d f3 84 ae a5 69 96 a9 5b dd 27 b3 +I (15945) wolfio: 00 7d 40 3a 59 93 93 6f 4d 1f 62 dc 60 48 34 1f +I (15955) wolfio: a8 1d 34 b8 76 8f 8b 27 4a 1b 77 64 8e 2e d5 27 +I (15955) wolfio: 03 95 8b 9d a5 ed a4 a6 b9 40 1b ea aa 10 07 08 +I (15965) wolfio: 00 48 30 46 02 21 00 cb 89 61 e9 21 f9 c6 4d ad +I (15975) wolfio: aa e7 f1 3f 6f 27 46 f0 35 ec 45 4e 8a ae f3 ac +I (15985) wolfio: 7c c0 cf 68 11 44 e2 02 21 00 f6 40 5c bc 66 5a +I (15985) wolfio: 74 1e 92 5d 9a 03 75 e7 7f 16 c2 b3 c8 fe 8d 5c +I (15995) wolfio: 63 35 36 da 61 38 76 dc 4e d6 W (15995) wolfio: sz = 154 I (16005) wolfssl: Shrinking output buffer I (16005) wolfssl: wolfSSL Leaving SendServerKeyExchange, return 0 @@ -459,7 +459,7 @@ I (16025) wolfssl: wolfSSL Entering SendServerHelloDone I (16035) wolfssl: growing output buffer I (16035) internal.c: GrowOutputBuffer ok W (16045) wolfio: ssl->wflags = 0 -I (16045) wolfio: 16 03 03 00 04 0e 00 00 00 +I (16045) wolfio: 16 03 03 00 04 0e 00 00 00 W (16045) wolfio: sz = 9 I (16055) wolfssl: Embed Send error I (16055) wolfssl: Connection reset @@ -479,14 +479,14 @@ I (16125) wolfssl: User calling wolfSSL_read in error state, not allowed I (16135) wolfssl: wolfSSL Leaving wolfSSL_read_internal, return -308 E (16145) tls_server: ERROR: failed to read I (16145) wolfssl: Client sends: -I (16145) wolfssl: +I (16145) wolfssl: I (16155) wolfssl: wolfSSL Entering wolfSSL_write I (16155) wolfssl: handshake not complete, trying to finish I (16165) wolfssl: wolfSSL Entering wolfSSL_negotiate I (16165) wolfssl: wolfSSL Entering wolfSSL_accept I (16175) wolfssl: wolfSSL Entering ReinitSSL W (16185) wolfio: ssl->wflags = 0 -I (16185) wolfio: 16 03 03 00 04 0e 00 00 00 +I (16185) wolfio: 16 03 03 00 04 0e 00 00 00 W (16185) wolfio: sz = 9 I (16195) wolfssl: Embed Send error I (16195) wolfssl: General error 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 35b5cf88a8..c3c09ca532 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 @@ -1,21 +1,21 @@ # -# Copyright (C) 2006-2024 wolfSSL Inc. +# Copyright (C) 2006-2024 wolfSSL Inc. # -# This file is part of wolfSSL. +# This file is part of wolfSSL. # -# wolfSSL is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# wolfSSL is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA # # cmake for wolfssl Espressif projects # diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/component.mk index c1087504a5..1008e04afe 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/component.mk +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/component.mk @@ -18,7 +18,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA # -# +$(info *********** wolfssl component ************) + + # # Component Makefile # # @@ -48,14 +50,57 @@ # define it here: CFLAGS +=-DWOLFSSL_USER_SETTINGS +# Note that 4 source files created by autogen are excluded here. +# +# See these files commented out, below. Adjust as needed for your application: +# +# COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/async.o +# COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/selftest.o +# COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wolfcrypt_first.o +# COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wolfcrypt_last.o + + # NOTICE: the WOLFSSL_ROOT setting MUST be relative! # See https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/api-guides/build-system.html?highlight=must+relative#optional-component-specific-variables # In the wolfSSL GitHub examples for Espressif: # https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples # When this wolfssl component.mk makefile is in [project]/components/wolfssl -# The root is 7 directories up from here: +# The root is 7 directories up from here (the location of of this component.mk): WOLFSSL_ROOT := ../../../../../../.. +# To set the location of a different location, it is best to use relative paths. +# +# Set WOLFSSL_ROOT to a relative path from the current component directory. +# For example, if the wolfssl_client is copied from the examples to test: +# +# cp -r /IDE/Espressif/ESP-IDF/examples/wolfssl_client/* /mnt/c/test/demo +# +# we run make in /mnt/c/test/demo +# component is in /mnt/c/test/demo/components/wolfssl +# wolfssl is in /mnt/c/workspace/wolfssl-master +# +# "/mnt/c" is 4 directories up: +# 2 for `./test/demo` from where we run `make`, plus +# 2 more from the location of `component.mk` located +# in `[currect directory]/components/wolfssl`. +# +# Thus we need 4 parent reference to find the relative path to wolfSSL: +# WOLFSSL_ROOT := ../../../../workspace/wolfssl-master + +# Optional CFLAGS (make works without these; for reference only) +# CFLAGS += -I$(WOLFSSL_ROOT)/wolfssl +# CFLAGS += -I$(WOLFSSL_ROOT)/wolfssl/wolfcrypt +# CFLAGS += -I$(WOLFSSL_ROOT)/wolfssl/wolfcrypt/port/Espressif + +abs_WOLFSSL_ROOT := $(shell realpath $(WOLFSSL_ROOT)) + +# print-wolfssl-path-value: +# @echo "WOLFSSL_ROOT defined: $(WOLFSSL_ROOT)" +# @echo "WOLFSSL_ROOT actual: $(abs_WOLFSSL_ROOT)" + +$(info WOLFSSL_ROOT defined: $(WOLFSSL_ROOT)) +$(info WOLFSSL_ROOT actual: $(abs_WOLFSSL_ROOT)) + # NOTE: The wolfSSL include directory (e.g. user_settings.h) is # located HERE in THIS project, and *not* in the wolfSSL root. COMPONENT_ADD_INCLUDEDIRS := . @@ -64,7 +109,6 @@ COMPONENT_ADD_INCLUDEDIRS += $(WOLFSSL_ROOT)/. COMPONENT_ADD_INCLUDEDIRS += $(WOLFSSL_ROOT)/wolfssl COMPONENT_ADD_INCLUDEDIRS += $(WOLFSSL_ROOT)/wolfssl/wolfcrypt COMPONENT_ADD_INCLUDEDIRS += $(WOLFSSL_ROOT)/wolfssl/wolfcrypt/port/Espressif -COMPONENT_ADD_INCLUDEDIRS += $(WOLFSSL_ROOT)wolfssl/wolfcrypt/port/Espressif # COMPONENT_ADD_INCLUDEDIRS += $ENV(IDF_PATH)/components/freertos/include/freertos # COMPONENT_ADD_INCLUDEDIRS += "$ENV(IDF_PATH)/soc/esp32s3/include/soc" @@ -120,7 +164,7 @@ COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/aes.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/arc4.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/asm.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/asn.o -COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/async.o +# COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/async.o # autogen exclusion COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/blake2b.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/blake2s.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/camellia.o @@ -144,7 +188,7 @@ COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/ed25519.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/ed448.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/error.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/evp.o -# COMPONENT_OBJS += $(WOLFSSL_ROOT)wolfcrypt/src/ext_kyber.o +# COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/ext_kyber.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/ext_lms.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/ext_xmss.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/falcon.o @@ -176,7 +220,7 @@ COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/rc2.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/ripemd.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/rsa.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/sakke.o -COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/selftest.o +# COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/selftest.o # autogen exclusion COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/sha.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/sha256.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/sha3.o @@ -213,8 +257,8 @@ COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wc_lms.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wc_pkcs11.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wc_port.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wc_xmss.o -COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wolfcrypt_first.o -COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wolfcrypt_last.o +# COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wolfcrypt_first.o # autogen exclusion +# COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wolfcrypt_last.o # autogen exclusion COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wolfevent.o COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/wolfmath.o @@ -246,5 +290,7 @@ COMPONENT_OBJS += $(WOLFSSL_ROOT)/wolfcrypt/src/port/Espressif/esp_sdk_wifi_lib. ## ## wolfcrypt ## -# COMPONENT_PRIV_INCLUDEDIRS += $(PROJECT_PATH)/components/wolfssl/include -COMPONENT_SRCDIRS += $(WOLFSSL_ROOT)wolfcrypt/src +## COMPONENT_PRIV_INCLUDEDIRS += $(PROJECT_PATH)/components/wolfssl/include +## COMPONENT_SRCDIRS += $(WOLFSSL_ROOT)/wolfcrypt/src + +$(info ********** end wolfssl component **********) 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 1f00afa3c5..638fdf343d 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 @@ -297,8 +297,8 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args) /* see user_settings PROJECT_DH for HAVE_DH and HAVE_FFDHE_2048 */ #ifndef NO_DH - ret = wolfSSL_CTX_SetMinDhKey_Sz(ctx, (word16)minDhKeyBits); - if (ret != WOLFSSL_SUCCESS) { + ret_i = wolfSSL_CTX_SetMinDhKey_Sz(ctx, (word16)minDhKeyBits); + if (ret_i != WOLFSSL_SUCCESS) { ESP_LOGE(TAG, "Error setting minimum DH key size"); } #endif diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md index c663c78cbc..6baa41aa7a 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md @@ -20,18 +20,18 @@ The Example contains a wolfSSL simple server. 1. `idf.py menuconfig` to configure the project 1-1. Example Connection Configuration -> - - WIFI SSID : your own WIFI, which is connected to the Internet.(default is "myssid") + + WIFI SSID : your own WIFI, which is connected to the Internet.(default is "myssid") WIFI Password : WIFI password, and default is "mypassword" When you want to test the wolfSSL simple server demo 1. `idf.py -p flash` to compile the code and load the firmware 2. `idf.py monitor` to see the context. The assigned IP address can be found in output message. -3. Once the server connects to the wifi, it is waiting for client request. +3. Once the server connects to the wifi, it is waiting for client request. ("Waiting for a connection..." message will be displayed.) - -4. You can use /examples/client to test the server + +4. You can use /examples/client to test the server e.g ./example/client/client -h xx.xx.xx See the README.md file in the upper level 'examples' directory for more information about examples. diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README_server_sm.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README_server_sm.md index 01dd6baf8a..71ab1b6c11 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README_server_sm.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README_server_sm.md @@ -49,7 +49,7 @@ make clean && make ### Others... ``` -# Success: Linux Client to ESP32 Server TLS1.2 +# Success: Linux Client to ESP32 Server TLS1.2 ./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C ./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-GCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C ./examples/client/client -h 192.168.1.113 -v 3 -l ECDHE-ECDSA-SM4-CCM-SM3 -c ./certs/sm2/client-sm2.pem -k ./certs/sm2/client-sm2-priv.pem -A ./certs/sm2/root-sm2.pem -C @@ -81,7 +81,7 @@ be the same as the Linux server files. | Usage | Certificate | Key | Certificate Authority file, default ./certs/client-cert.pem | | ----- | ---------------------------------- | ----------------------------------- | --------------------------------- | -| server | -c ./certs/sm2/server-sm2.pem | -k ./certs/sm2/server-sm2-priv.pem | -A ./certs/sm2/client-sm2.pem -V | +| server | -c ./certs/sm2/server-sm2.pem | -k ./certs/sm2/server-sm2-priv.pem | -A ./certs/sm2/client-sm2.pem -V | | client | -c ./certs/sm2/client-sm2.pem | -k ./certs/sm2/client-sm2-priv.pem | -A ./certs/sm2/root-sm2.pem -C | | emdedded: | server | wolfSSL_CTX_use_certificate_buffer
server_sm2 | wolfSSL_CTX_use_PrivateKey_buffer
server_sm2_priv | wolfSSL_CTX_load_verify_buffer
client-sm2 | @@ -156,7 +156,7 @@ I (622) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM I (628) heap_init: At 40094DC8 len 0000B238 (44 KiB): IRAM I (636) spi_flash: detected chip: generic I (639) spi_flash: flash io: dio -W (643) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the +W (643) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. I (657) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. @@ -358,12 +358,12 @@ I (14715) internal.c: GrowOutputBuffer ok I (14715) wolfssl: wolfSSL Entering wolfSSL_get_options I (14725) wolfssl: Point Formats extension to write W (14735) wolfio: ssl->wflags = 0 -I (14735) wolfio: 16 03 03 00 52 02 00 00 4e 03 03 af 87 e2 58 57 -I (14735) wolfio: 73 c3 c1 35 1a 59 39 b2 03 9d 14 03 e0 b8 fb e8 -I (14745) wolfio: 9d 5b 9c 44 4f 57 4e 47 52 44 01 20 85 77 75 20 -I (14755) wolfio: 95 dd 00 e2 91 f8 42 33 f8 61 3f 1f de 81 15 58 -I (14755) wolfio: 23 0c e7 1e 71 e6 10 e5 67 23 e0 40 e0 11 00 00 -I (14765) wolfio: 06 00 0b 00 02 01 00 +I (14735) wolfio: 16 03 03 00 52 02 00 00 4e 03 03 af 87 e2 58 57 +I (14735) wolfio: 73 c3 c1 35 1a 59 39 b2 03 9d 14 03 e0 b8 fb e8 +I (14745) wolfio: 9d 5b 9c 44 4f 57 4e 47 52 44 01 20 85 77 75 20 +I (14755) wolfio: 95 dd 00 e2 91 f8 42 33 f8 61 3f 1f de 81 15 58 +I (14755) wolfio: 23 0c e7 1e 71 e6 10 e5 67 23 e0 40 e0 11 00 00 +I (14765) wolfio: 06 00 0b 00 02 01 00 W (14775) wolfio: sz = 87 I (14775) wolfssl: Shrinking output buffer I (14775) wolfssl: wolfSSL Leaving SendServerHello, return 0 @@ -372,53 +372,53 @@ I (14795) wolfssl: wolfSSL Entering SendCertificate I (14795) wolfssl: growing output buffer I (14805) internal.c: GrowOutputBuffer ok W (14815) wolfio: ssl->wflags = 0 -I (14815) wolfio: 16 03 03 02 e6 0b 00 02 e2 00 02 df 00 02 dc 30 -I (14815) wolfio: 82 02 d8 30 82 02 7e a0 03 02 01 02 02 01 01 30 -I (14825) wolfio: 0a 06 08 2a 81 1c cf 55 01 83 75 30 81 ac 31 0b -I (14835) wolfio: 30 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06 -I (14835) wolfio: 03 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30 -I (14845) wolfio: 0e 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31 -I (14855) wolfio: 14 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53 -I (14855) wolfio: 4c 5f 73 6d 32 31 0f 30 0d 06 03 55 04 0b 0c 06 -I (14865) wolfio: 43 41 2d 73 6d 32 31 18 30 16 06 03 55 04 03 0c -I (14875) wolfio: 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e 63 6f 6d -I (14875) wolfio: 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01 09 01 16 -I (14885) wolfio: 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c 2e 63 6f -I (14895) wolfio: 6d 31 17 30 15 06 0a 09 92 26 89 93 f2 2c 64 01 -I (14895) wolfio: 01 0c 07 77 6f 6c 66 53 53 4c 30 1e 17 0d 32 33 -I (14905) wolfio: 30 32 31 35 30 36 32 33 30 37 5a 17 0d 32 35 31 -I (14915) wolfio: 31 31 31 30 36 32 33 30 37 5a 30 81 b0 31 0b 30 -I (14915) wolfio: 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06 03 -I (14925) wolfio: 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30 0e -I (14935) wolfio: 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31 14 -I (14945) wolfio: 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53 4c -I (14945) wolfio: 5f 73 6d 32 31 13 30 11 06 03 55 04 0b 0c 0a 53 -I (14955) wolfio: 65 72 76 65 72 2d 73 6d 32 31 18 30 16 06 03 55 -I (14965) wolfio: 04 03 0c 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e -I (14965) wolfio: 63 6f 6d 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01 -I (14975) wolfio: 09 01 16 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c -I (14985) wolfio: 2e 63 6f 6d 31 17 30 15 06 0a 09 92 26 89 93 f2 -I (14985) wolfio: 2c 64 01 01 0c 07 77 6f 6c 66 53 53 4c 30 5a 30 -I (14995) wolfio: 14 06 08 2a 81 1c cf 55 01 82 2d 06 08 2a 81 1c -I (15005) wolfio: cf 55 01 82 2d 03 42 00 04 94 70 2b 46 e4 5e 0f -I (15005) wolfio: 41 fb 8f 2d 34 0a 41 40 19 5e fb d4 1d 11 ac fa -I (15015) wolfio: f5 93 37 c6 fa 87 08 f7 16 1f 2c ce 30 40 9d 4f -I (15025) wolfio: a6 2a 0a a1 d6 95 33 c3 a6 03 98 e6 8d 05 34 b0 -I (15025) wolfio: 97 0c de a4 c7 cf 53 8f d1 a3 81 89 30 81 86 30 -I (15035) wolfio: 1d 06 03 55 1d 0e 04 16 04 14 67 ae 60 ff 7e 1b -I (15045) wolfio: 0f 95 ae 1f 82 59 f2 6c 56 2d 93 ef 17 32 30 1f -I (15045) wolfio: 06 03 55 1d 23 04 18 30 16 80 14 47 0a 48 7e bb -I (15055) wolfio: 02 a8 5a 26 57 2b 19 a9 7b 61 8b 7f 5d 99 6e 30 -I (15065) wolfio: 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0e 06 -I (15075) wolfio: 03 55 1d 0f 01 01 ff 04 04 03 02 03 a8 30 13 06 -I (15075) wolfio: 03 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 -I (15085) wolfio: 03 01 30 11 06 09 60 86 48 01 86 f8 42 01 01 04 -I (15095) wolfio: 04 03 02 06 40 30 0a 06 08 2a 81 1c cf 55 01 83 -I (15095) wolfio: 75 03 48 00 30 45 02 20 1b ca 94 28 7f f6 b2 0d -I (15105) wolfio: 31 43 50 e1 d5 34 17 dd af 3a de 81 06 67 9a b3 -I (15115) wolfio: 06 22 7e 64 ec fd 0e b9 02 21 00 a1 48 a8 32 d1 -I (15115) wolfio: 05 09 6b 1c eb 89 12 66 d8 38 a1 c4 5c 89 09 0f -I (15125) wolfio: fd e9 c0 3b 1d fb cd b5 4c 31 68 +I (14815) wolfio: 16 03 03 02 e6 0b 00 02 e2 00 02 df 00 02 dc 30 +I (14815) wolfio: 82 02 d8 30 82 02 7e a0 03 02 01 02 02 01 01 30 +I (14825) wolfio: 0a 06 08 2a 81 1c cf 55 01 83 75 30 81 ac 31 0b +I (14835) wolfio: 30 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06 +I (14835) wolfio: 03 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30 +I (14845) wolfio: 0e 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31 +I (14855) wolfio: 14 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53 +I (14855) wolfio: 4c 5f 73 6d 32 31 0f 30 0d 06 03 55 04 0b 0c 06 +I (14865) wolfio: 43 41 2d 73 6d 32 31 18 30 16 06 03 55 04 03 0c +I (14875) wolfio: 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e 63 6f 6d +I (14875) wolfio: 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01 09 01 16 +I (14885) wolfio: 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c 2e 63 6f +I (14895) wolfio: 6d 31 17 30 15 06 0a 09 92 26 89 93 f2 2c 64 01 +I (14895) wolfio: 01 0c 07 77 6f 6c 66 53 53 4c 30 1e 17 0d 32 33 +I (14905) wolfio: 30 32 31 35 30 36 32 33 30 37 5a 17 0d 32 35 31 +I (14915) wolfio: 31 31 31 30 36 32 33 30 37 5a 30 81 b0 31 0b 30 +I (14915) wolfio: 09 06 03 55 04 06 13 02 55 53 31 10 30 0e 06 03 +I (14925) wolfio: 55 04 08 0c 07 4d 6f 6e 74 61 6e 61 31 10 30 0e +I (14935) wolfio: 06 03 55 04 07 0c 07 42 6f 7a 65 6d 61 6e 31 14 +I (14945) wolfio: 30 12 06 03 55 04 0a 0c 0b 77 6f 6c 66 53 53 4c +I (14945) wolfio: 5f 73 6d 32 31 13 30 11 06 03 55 04 0b 0c 0a 53 +I (14955) wolfio: 65 72 76 65 72 2d 73 6d 32 31 18 30 16 06 03 55 +I (14965) wolfio: 04 03 0c 0f 77 77 77 2e 77 6f 6c 66 73 73 6c 2e +I (14965) wolfio: 63 6f 6d 31 1f 30 1d 06 09 2a 86 48 86 f7 0d 01 +I (14975) wolfio: 09 01 16 10 69 6e 66 6f 40 77 6f 6c 66 73 73 6c +I (14985) wolfio: 2e 63 6f 6d 31 17 30 15 06 0a 09 92 26 89 93 f2 +I (14985) wolfio: 2c 64 01 01 0c 07 77 6f 6c 66 53 53 4c 30 5a 30 +I (14995) wolfio: 14 06 08 2a 81 1c cf 55 01 82 2d 06 08 2a 81 1c +I (15005) wolfio: cf 55 01 82 2d 03 42 00 04 94 70 2b 46 e4 5e 0f +I (15005) wolfio: 41 fb 8f 2d 34 0a 41 40 19 5e fb d4 1d 11 ac fa +I (15015) wolfio: f5 93 37 c6 fa 87 08 f7 16 1f 2c ce 30 40 9d 4f +I (15025) wolfio: a6 2a 0a a1 d6 95 33 c3 a6 03 98 e6 8d 05 34 b0 +I (15025) wolfio: 97 0c de a4 c7 cf 53 8f d1 a3 81 89 30 81 86 30 +I (15035) wolfio: 1d 06 03 55 1d 0e 04 16 04 14 67 ae 60 ff 7e 1b +I (15045) wolfio: 0f 95 ae 1f 82 59 f2 6c 56 2d 93 ef 17 32 30 1f +I (15045) wolfio: 06 03 55 1d 23 04 18 30 16 80 14 47 0a 48 7e bb +I (15055) wolfio: 02 a8 5a 26 57 2b 19 a9 7b 61 8b 7f 5d 99 6e 30 +I (15065) wolfio: 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0e 06 +I (15075) wolfio: 03 55 1d 0f 01 01 ff 04 04 03 02 03 a8 30 13 06 +I (15075) wolfio: 03 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 +I (15085) wolfio: 03 01 30 11 06 09 60 86 48 01 86 f8 42 01 01 04 +I (15095) wolfio: 04 03 02 06 40 30 0a 06 08 2a 81 1c cf 55 01 83 +I (15095) wolfio: 75 03 48 00 30 45 02 20 1b ca 94 28 7f f6 b2 0d +I (15105) wolfio: 31 43 50 e1 d5 34 17 dd af 3a de 81 06 67 9a b3 +I (15115) wolfio: 06 22 7e 64 ec fd 0e b9 02 21 00 a1 48 a8 32 d1 +I (15115) wolfio: 05 09 6b 1c eb 89 12 66 d8 38 a1 c4 5c 89 09 0f +I (15125) wolfio: fd e9 c0 3b 1d fb cd b5 4c 31 68 W (15135) wolfio: sz = 747 I (15135) wolfssl: Shrinking output buffer I (15135) wolfssl: wolfSSL Leaving SendCertificate, return 0 @@ -440,16 +440,16 @@ I (15915) wolfssl: wolfSSL Entering SendHandshakeMsg I (15925) wolfssl: growing output buffer I (15925) internal.c: GrowOutputBuffer ok W (15925) wolfio: ssl->wflags = 0 -I (15935) wolfio: 16 03 03 00 95 0c 00 00 91 03 00 29 41 04 fd f5 -I (15935) wolfio: 5e 74 15 30 1d f3 84 ae a5 69 96 a9 5b dd 27 b3 -I (15945) wolfio: 00 7d 40 3a 59 93 93 6f 4d 1f 62 dc 60 48 34 1f -I (15955) wolfio: a8 1d 34 b8 76 8f 8b 27 4a 1b 77 64 8e 2e d5 27 -I (15955) wolfio: 03 95 8b 9d a5 ed a4 a6 b9 40 1b ea aa 10 07 08 -I (15965) wolfio: 00 48 30 46 02 21 00 cb 89 61 e9 21 f9 c6 4d ad -I (15975) wolfio: aa e7 f1 3f 6f 27 46 f0 35 ec 45 4e 8a ae f3 ac -I (15985) wolfio: 7c c0 cf 68 11 44 e2 02 21 00 f6 40 5c bc 66 5a -I (15985) wolfio: 74 1e 92 5d 9a 03 75 e7 7f 16 c2 b3 c8 fe 8d 5c -I (15995) wolfio: 63 35 36 da 61 38 76 dc 4e d6 +I (15935) wolfio: 16 03 03 00 95 0c 00 00 91 03 00 29 41 04 fd f5 +I (15935) wolfio: 5e 74 15 30 1d f3 84 ae a5 69 96 a9 5b dd 27 b3 +I (15945) wolfio: 00 7d 40 3a 59 93 93 6f 4d 1f 62 dc 60 48 34 1f +I (15955) wolfio: a8 1d 34 b8 76 8f 8b 27 4a 1b 77 64 8e 2e d5 27 +I (15955) wolfio: 03 95 8b 9d a5 ed a4 a6 b9 40 1b ea aa 10 07 08 +I (15965) wolfio: 00 48 30 46 02 21 00 cb 89 61 e9 21 f9 c6 4d ad +I (15975) wolfio: aa e7 f1 3f 6f 27 46 f0 35 ec 45 4e 8a ae f3 ac +I (15985) wolfio: 7c c0 cf 68 11 44 e2 02 21 00 f6 40 5c bc 66 5a +I (15985) wolfio: 74 1e 92 5d 9a 03 75 e7 7f 16 c2 b3 c8 fe 8d 5c +I (15995) wolfio: 63 35 36 da 61 38 76 dc 4e d6 W (15995) wolfio: sz = 154 I (16005) wolfssl: Shrinking output buffer I (16005) wolfssl: wolfSSL Leaving SendServerKeyExchange, return 0 @@ -459,7 +459,7 @@ I (16025) wolfssl: wolfSSL Entering SendServerHelloDone I (16035) wolfssl: growing output buffer I (16035) internal.c: GrowOutputBuffer ok W (16045) wolfio: ssl->wflags = 0 -I (16045) wolfio: 16 03 03 00 04 0e 00 00 00 +I (16045) wolfio: 16 03 03 00 04 0e 00 00 00 W (16045) wolfio: sz = 9 I (16055) wolfssl: Embed Send error I (16055) wolfssl: Connection reset @@ -479,14 +479,14 @@ I (16125) wolfssl: User calling wolfSSL_read in error state, not allowed I (16135) wolfssl: wolfSSL Leaving wolfSSL_read_internal, return -308 E (16145) tls_server: ERROR: failed to read I (16145) wolfssl: Client sends: -I (16145) wolfssl: +I (16145) wolfssl: I (16155) wolfssl: wolfSSL Entering wolfSSL_write I (16155) wolfssl: handshake not complete, trying to finish I (16165) wolfssl: wolfSSL Entering wolfSSL_negotiate I (16165) wolfssl: wolfSSL Entering wolfSSL_accept I (16175) wolfssl: wolfSSL Entering ReinitSSL W (16185) wolfio: ssl->wflags = 0 -I (16185) wolfio: 16 03 03 00 04 0e 00 00 00 +I (16185) wolfio: 16 03 03 00 04 0e 00 00 00 W (16185) wolfio: sz = 9 I (16195) wolfssl: Embed Send error I (16195) wolfssl: General error 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 60297155f5..b809a17142 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 @@ -1,21 +1,21 @@ # -# Copyright (C) 2006-2024 wolfSSL Inc. +# Copyright (C) 2006-2024 wolfSSL Inc. # -# This file is part of wolfSSL. +# This file is part of wolfSSL. # -# wolfSSL is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# wolfSSL is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA # # cmake for wolfssl Espressif projects # diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/include/user_settings.h b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/include/user_settings.h index 9109e6f706..380da3e691 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/include/user_settings.h +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/include/user_settings.h @@ -132,7 +132,7 @@ #define WOLFSSL_SHA384 #if defined(CONFIG_IDF_TARGET_ESP8266) - /* Some known low-memory devices have features not enabled by default. */ + /* Some known low-memory devices have features not enabled by default. */ #else /* when you want to use SHA512 */ #define WOLFSSL_SHA512 @@ -140,7 +140,7 @@ /* when you want to use SHA3 */ #define WOLFSSL_SHA3 - /* ED25519 requires SHA512 */ + /* ED25519 requires SHA512 */ #define HAVE_ED25519 #define HAVE_ECC diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/component.mk index d31083f65b..44bd2b5273 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/component.mk +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/component.mk @@ -1,3 +1,3 @@ # # Main Makefile. This is basically the same as a component makefile. -# \ No newline at end of file +# diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md index e4e79dce8d..ee66039f04 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md @@ -7,7 +7,7 @@ For general information on [wolfSSL examples for Espressif](../README.md), see t ## ESP Registry -The easiest way to get started with wolfSSL is by using the +The easiest way to get started with wolfSSL is by using the [ESP Registry](https://components.espressif.com/components/wolfssl/wolfssl/) examples. ``` @@ -24,10 +24,10 @@ No wolfSSL setup is needed. You may need to adjust your specific COM port. The d ## ESP-IDF Commandline -1. `idf.py menuconfig` to configure the program. +1. `idf.py menuconfig` to configure the program. 1-1. Example Configuration -> - TEST_ARG : argument that you want to use. Default is "-lng 0" + TEST_ARG : argument that you want to use. Default is "-lng 0" The list of argument can be find in help. When you want to run the test program @@ -60,16 +60,16 @@ idf.py set-target esp32s3 idf.py erase-flash -p /dev/ttyS24 -b 115200 # start with a low upload speed, then increase as found operational -idf.py +idf.py # build and flash, in this example to COM24 idf.py build flash -p /dev/ttyS24 -b 115200 monitor ``` ## Example Output -Note the default wolfSSL `user_settings.h` is configured by default to be the most +Note the default wolfSSL `user_settings.h` is configured by default to be the most compatible across the widest ranges of targets. Contact wolfSSL at support@wolfssl.com -for help in optimizing for your particular application, or see the +for help in optimizing for your particular application, or see the [docs](https://www.wolfssl.com/documentation/manuals/wolfssl/index.html). Compiled and flashed with `idf.py build flash -p /dev/ttyS7 -b 115200 monitor`: 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 b0be1c2dd0..5f42ad3452 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 @@ -1,21 +1,21 @@ # -# Copyright (C) 2006-2024 wolfSSL Inc. +# Copyright (C) 2006-2024 wolfSSL Inc. # -# This file is part of wolfSSL. +# This file is part of wolfSSL. # -# wolfSSL is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# wolfSSL is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA # # cmake for wolfssl Espressif projects # diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/include/user_settings.h b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/include/user_settings.h index 59709233f2..9cf87e8fdb 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/include/user_settings.h +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/include/user_settings.h @@ -705,7 +705,7 @@ Turn on timer debugging (used when CPU cycles not available) #define WOLFSSL_BASE16 #else #if defined(USE_CERT_BUFFERS_2048) - /* Be sure to include in app when using example certs: */ + /* Be sure to include in app when using example certs: */ /* #include */ #define CTX_CA_CERT ca_cert_der_2048 #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048 @@ -726,7 +726,7 @@ Turn on timer debugging (used when CPU cycles not available) #define CTX_CLIENT_KEY_TYPE WOLFSSL_FILETYPE_ASN1 #elif defined(USE_CERT_BUFFERS_1024) - /* Be sure to include in app when using example certs: */ + /* Be sure to include in app when using example certs: */ /* #include */ #define CTX_CA_CERT ca_cert_der_1024 #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_1024 diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/testAll.sh b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/testAll.sh index e0a7643bea..0d8de0fd6f 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/testAll.sh +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/testAll.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # testAll.sh [keyword suffix] # diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/testMonitor.sh b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/testMonitor.sh index f71c0f6cc9..9876995117 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/testMonitor.sh +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/testMonitor.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Syntax: # ./testMonitor.sh diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/README.md index f2efc2f3dd..f8ec01cec6 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/README.md @@ -12,10 +12,10 @@ Open the VisualGDB Visual Studio Project file in the VisualGDB directory and cli ## ESP-IDF Commandline -1. `idf.py menuconfig` to configure the program. +1. `idf.py menuconfig` to configure the program. 1-1. Example Configuration -> - TEST_ARG : argument that you want to use. Default is "-lng 0" + TEST_ARG : argument that you want to use. Default is "-lng 0" The list of argument can be find in help. When you want to run the test program @@ -46,9 +46,9 @@ idf.py build flash -p /dev/ttyS20 -b 115200 monitor ## Example Output -Note the default wolfSSL `user_settings.h` is configured by default to be the most +Note the default wolfSSL `user_settings.h` is configured by default to be the most compatible across the widest ranges of targets. Contact wolfSSL at support@wolfssl.com -for help in optimizing for your particular application, or see the +for help in optimizing for your particular application, or see the [docs](https://www.wolfssl.com/documentation/manuals/wolfssl/index.html). Compiled and flashed with `idf.py build flash -p /dev/ttyS7 -b 115200 monitor`: diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/component.mk index e19e22a535..0adf45649a 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/component.mk +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/component.mk @@ -1,8 +1,8 @@ # # Main component makefile. # -# This Makefile can be left empty. By default, it will take the sources in the -# src/ directory, compile them and link them into lib(subdirectory_name).a +# This Makefile can be left empty. By default, it will take the sources in the +# src/ directory, compile them and link them into lib(subdirectory_name).a # in the build directory. This behaviour is entirely configurable, # please read the ESP-IDF documents if you need to do this. -# \ No newline at end of file +# diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/component.mk index d31083f65b..44bd2b5273 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/component.mk +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/component.mk @@ -1,3 +1,3 @@ # # Main Makefile. This is basically the same as a component makefile. -# \ No newline at end of file +# diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main_wip.c.ex b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main_wip.c.ex index b301e65201..a1a18d9812 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main_wip.c.ex +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main_wip.c.ex @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Espressif/ESP-IDF/libs/CMakeLists.txt b/IDE/Espressif/ESP-IDF/libs/CMakeLists.txt index b63775e143..a0ec798a2b 100644 --- a/IDE/Espressif/ESP-IDF/libs/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/libs/CMakeLists.txt @@ -1,21 +1,21 @@ # -# Copyright (C) 2006-2022 wolfSSL Inc. +# Copyright (C) 2006-2024 wolfSSL Inc. # -# This file is part of wolfSSL. +# This file is part of wolfSSL. # -# wolfSSL is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# wolfSSL is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA # # cmake for wolfssl # diff --git a/IDE/Espressif/ESP-IDF/libs/README.md b/IDE/Espressif/ESP-IDF/libs/README.md index 703baf1ea4..d5dc4c993d 100644 --- a/IDE/Espressif/ESP-IDF/libs/README.md +++ b/IDE/Espressif/ESP-IDF/libs/README.md @@ -4,4 +4,4 @@ Files in IDE\Espressif\ESP-IDF\libs: `component.mk` used in ESP-IDF `wolfssl` component directory -`tigard.cfg` Tigard JTAG config file \ No newline at end of file +`tigard.cfg` Tigard JTAG config file diff --git a/IDE/Espressif/ESP-IDF/libs/component.mk b/IDE/Espressif/ESP-IDF/libs/component.mk index ac239e538e..047bb83ea0 100644 --- a/IDE/Espressif/ESP-IDF/libs/component.mk +++ b/IDE/Espressif/ESP-IDF/libs/component.mk @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +#/ # # # Component Makefile diff --git a/IDE/Espressif/ESP-IDF/setup.sh b/IDE/Espressif/ESP-IDF/setup.sh index 8d10a59b72..7a68ae4d99 100755 --- a/IDE/Espressif/ESP-IDF/setup.sh +++ b/IDE/Espressif/ESP-IDF/setup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # check if IDF_PATH is set if [ -z "$IDF_PATH" ]; then diff --git a/IDE/Espressif/ESP-IDF/test/README.md b/IDE/Espressif/ESP-IDF/test/README.md index e832b5c50f..8a12a50fea 100644 --- a/IDE/Espressif/ESP-IDF/test/README.md +++ b/IDE/Espressif/ESP-IDF/test/README.md @@ -2,9 +2,9 @@ The test contains of wolfSSL unit-test app on Unity. -When you want to run the app -1. Go to /esp-idf/tools/unit-test-app/ folder -2. `idf.py menuconfig` to configure unit test app. -3. `idf.py -T wolfssl build` to build wolfssl unit test app. +When you want to run the app +1. Go to /esp-idf/tools/unit-test-app/ folder +2. `idf.py menuconfig` to configure unit test app. +3. `idf.py -T wolfssl build` to build wolfssl unit test app. See [https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/unit-tests.html] for more information about unit test app. diff --git a/IDE/Espressif/include.am b/IDE/Espressif/include.am index 7fa3887361..ab57c84ab7 100644 --- a/IDE/Espressif/include.am +++ b/IDE/Espressif/include.am @@ -22,7 +22,9 @@ EXTRA_DIST+= IDE/Espressif/ESP-IDF/user_settings.h # Template EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/template/components +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/Kconfig EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/template/main +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/template/main/Kconfig.projbuild EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/template/partitions_singleapp_large.csv EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/template/README.md EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/template/sdkconfig.defaults diff --git a/IDE/GCC-ARM/Header/user_settings.h b/IDE/GCC-ARM/Header/user_settings.h index f1f8fd6d11..40986b08b4 100644 --- a/IDE/GCC-ARM/Header/user_settings.h +++ b/IDE/GCC-ARM/Header/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -250,10 +250,10 @@ extern "C" { /* AES */ #undef NO_AES #if 1 - #undef HAVE_AES_CBC - #define HAVE_AES_CBC + #undef HAVE_AES_CBC + #define HAVE_AES_CBC - #undef HAVE_AESGCM + #undef HAVE_AESGCM #define HAVE_AESGCM /* GCM Method: GCM_SMALL, GCM_WORD32 or GCM_TABLE */ @@ -419,6 +419,7 @@ extern "C" { /* prototypes for user heap override functions */ /* Note: Realloc only required for normal math */ + /* Note2: XFREE(NULL) must be properly handled */ #include /* for size_t */ extern void *myMalloc(size_t n, void* heap, int type); extern void myFree(void *p, void* heap, int type); diff --git a/IDE/GCC-ARM/README.md b/IDE/GCC-ARM/README.md index 2aa29d969d..40b2bdfd1d 100644 --- a/IDE/GCC-ARM/README.md +++ b/IDE/GCC-ARM/README.md @@ -118,7 +118,7 @@ These settings are located in `Header/user_settings.h`. * `USE_SLOW_SHA`: Enables smaller/slower version of SHA. * `USE_SLOW_SHA256`: About 2k smaller and about 25% slower * `USE_SLOW_SHA512`: Over twice as small, but 50% slower -* `USE_CERT_BUFFERS_1024` or `USE_CERT_BUFFERS_2048`: Size of RSA certs / keys to test with. +* `USE_CERT_BUFFERS_1024` or `USE_CERT_BUFFERS_2048`: Size of RSA certs / keys to test with. * `BENCH_EMBEDDED`: Define this if using the wolfCrypt test/benchmark and using a low memory target. * `ECC_USER_CURVES`: Allows user to define curve sizes to enable. Default is 256-bit on. To enable others use `HAVE_ECC192`, `HAVE_ECC224`, etc.... * `TFM_ARM`, `TFM_SSE2`, `TFM_AVR32`, `TFM_PPC32`, `TFM_MIPS`, `TFM_X86` or `TFM_X86_64`: These are assembly optimizations available with USE_FAST_MATH. diff --git a/IDE/GCC-ARM/Source/armtarget.c b/IDE/GCC-ARM/Source/armtarget.c index 4780be1f1d..8b62a6b756 100644 --- a/IDE/GCC-ARM/Source/armtarget.c +++ b/IDE/GCC-ARM/Source/armtarget.c @@ -1,6 +1,6 @@ /* armtarget.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Source/benchmark_main.c b/IDE/GCC-ARM/Source/benchmark_main.c index e113c86ef6..1151bbc32c 100644 --- a/IDE/GCC-ARM/Source/benchmark_main.c +++ b/IDE/GCC-ARM/Source/benchmark_main.c @@ -1,6 +1,6 @@ /* benchmark_main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Source/test_main.c b/IDE/GCC-ARM/Source/test_main.c index bf7216b116..c63246368b 100644 --- a/IDE/GCC-ARM/Source/test_main.c +++ b/IDE/GCC-ARM/Source/test_main.c @@ -1,6 +1,6 @@ /* test_main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Source/tls_client.c b/IDE/GCC-ARM/Source/tls_client.c index 00afe6ef95..927b854d3d 100644 --- a/IDE/GCC-ARM/Source/tls_client.c +++ b/IDE/GCC-ARM/Source/tls_client.c @@ -1,6 +1,6 @@ /* tls_client.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Source/tls_server.c b/IDE/GCC-ARM/Source/tls_server.c index 50e93d1a1e..1a19b4e53c 100644 --- a/IDE/GCC-ARM/Source/tls_server.c +++ b/IDE/GCC-ARM/Source/tls_server.c @@ -1,6 +1,6 @@ /* tls_server.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Source/wolf_main.c b/IDE/GCC-ARM/Source/wolf_main.c index 3c705d2451..0956773b6e 100644 --- a/IDE/GCC-ARM/Source/wolf_main.c +++ b/IDE/GCC-ARM/Source/wolf_main.c @@ -1,6 +1,6 @@ /* wolf_main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/HEXAGON/DSP/Makefile b/IDE/HEXAGON/DSP/Makefile index 5b73cef4db..361873ee8c 100644 --- a/IDE/HEXAGON/DSP/Makefile +++ b/IDE/HEXAGON/DSP/Makefile @@ -1,6 +1,6 @@ # Makefile # -# Copyright (C) 2006-2023 wolfSSL Inc. +# Copyright (C) 2006-2024 wolfSSL Inc. # # This file is part of wolfSSL. # diff --git a/IDE/HEXAGON/Makefile b/IDE/HEXAGON/Makefile index cdf6a1c59e..cf7252c866 100644 --- a/IDE/HEXAGON/Makefile +++ b/IDE/HEXAGON/Makefile @@ -1,6 +1,6 @@ # Makefile # -# Copyright (C) 2006-2023 wolfSSL Inc. +# Copyright (C) 2006-2024 wolfSSL Inc. # # This file is part of wolfSSL. # diff --git a/IDE/HEXAGON/README.md b/IDE/HEXAGON/README.md index 8ac7913db2..4cf6ffe170 100644 --- a/IDE/HEXAGON/README.md +++ b/IDE/HEXAGON/README.md @@ -71,5 +71,5 @@ benchmarking using threads on aDSP 20000 verifies on 4 threads took 23.261446 seconds benchmarking 1 thread on cDSP -5000 verifies on 1 threads took 18.560995 seconds +5000 verifies on 1 threads took 18.560995 seconds diff --git a/IDE/HEXAGON/build.sh b/IDE/HEXAGON/build.sh index 5e09fba45e..29fc8ed0ac 100755 --- a/IDE/HEXAGON/build.sh +++ b/IDE/HEXAGON/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [ -z $1 ]; then echo "./build " exit 1 diff --git a/IDE/HEXAGON/ecc-verify-benchmark.c b/IDE/HEXAGON/ecc-verify-benchmark.c index 24f9125702..bc88c38818 100644 --- a/IDE/HEXAGON/ecc-verify-benchmark.c +++ b/IDE/HEXAGON/ecc-verify-benchmark.c @@ -1,6 +1,6 @@ /* ecc-verify-benchmark.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -32,14 +32,14 @@ #define MAX_TIMES 5000 #define MAX_BLOCK_SIZE 1024 -#include +#include -static double get_time() -{ - struct timeval tv; - gettimeofday(&tv, 0); - return (double)tv.tv_sec + (double)tv.tv_usec / 1000000; -} +static double get_time() +{ + struct timeval tv; + gettimeofday(&tv, 0); + return (double)tv.tv_sec + (double)tv.tv_usec / 1000000; +} /* software version */ diff --git a/IDE/HEXAGON/ecc-verify.c b/IDE/HEXAGON/ecc-verify.c index ccbc18d81b..1e2d9510fb 100644 --- a/IDE/HEXAGON/ecc-verify.c +++ b/IDE/HEXAGON/ecc-verify.c @@ -1,6 +1,6 @@ /* ecc-verify.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/HEXAGON/user_settings.h b/IDE/HEXAGON/user_settings.h index 1897e883c4..5643e759db 100644 --- a/IDE/HEXAGON/user_settings.h +++ b/IDE/HEXAGON/user_settings.h @@ -13,25 +13,25 @@ #define USE_FAST_MATH #define TFM_TIMING_RESISTANT #ifdef HAVE_ECC - #define ECC_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT #endif #ifndef NO_RSA - #define WC_RSA_BLINDING + #define WC_RSA_BLINDING #endif #if 1 - #define WOLFSSL_HAVE_SP_RSA - #define WOLFSSL_HAVE_SP_ECC - #define WOLFSSL_SP_MATH + #define WOLFSSL_HAVE_SP_RSA + #define WOLFSSL_HAVE_SP_ECC + #define WOLFSSL_SP_MATH - #if 1 - /* ARM NEON instructions */ - #define WOLFSSL_SP_ARM64_ASM - #endif - #if 1 - /* Use DSP */ - #define WOLFSSL_DSP - #endif + #if 1 + /* ARM NEON instructions */ + #define WOLFSSL_SP_ARM64_ASM + #endif + #if 1 + /* Use DSP */ + #define WOLFSSL_DSP + #endif #endif #endif diff --git a/IDE/IAR-EWARM/Projects/benchmark/benchmark-main.c b/IDE/IAR-EWARM/Projects/benchmark/benchmark-main.c index f5e51cd977..76d4470c75 100644 --- a/IDE/IAR-EWARM/Projects/benchmark/benchmark-main.c +++ b/IDE/IAR-EWARM/Projects/benchmark/benchmark-main.c @@ -1,6 +1,6 @@ /* benchmark-main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/IAR-EWARM/Projects/benchmark/current_time.c b/IDE/IAR-EWARM/Projects/benchmark/current_time.c index 0e8d402687..cf0f57ac68 100644 --- a/IDE/IAR-EWARM/Projects/benchmark/current_time.c +++ b/IDE/IAR-EWARM/Projects/benchmark/current_time.c @@ -1,6 +1,6 @@ /* current-time.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/IAR-EWARM/Projects/common/minimum-startup.c b/IDE/IAR-EWARM/Projects/common/minimum-startup.c index ec79e29a4f..4463b158d2 100644 --- a/IDE/IAR-EWARM/Projects/common/minimum-startup.c +++ b/IDE/IAR-EWARM/Projects/common/minimum-startup.c @@ -1,6 +1,6 @@ /* minimum-startup.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/IAR-EWARM/Projects/test/test-main.c b/IDE/IAR-EWARM/Projects/test/test-main.c index d472d5d1e1..13d1308d55 100644 --- a/IDE/IAR-EWARM/Projects/test/test-main.c +++ b/IDE/IAR-EWARM/Projects/test/test-main.c @@ -1,6 +1,6 @@ /* test-main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/IAR-EWARM/embOS/SAMV71_XULT/embOS_wolfcrypt_test_SAMV71_XULT/Application/runWolfcryptTests.c b/IDE/IAR-EWARM/embOS/SAMV71_XULT/embOS_wolfcrypt_test_SAMV71_XULT/Application/runWolfcryptTests.c index 36937deeff..07fd6c5bc8 100644 --- a/IDE/IAR-EWARM/embOS/SAMV71_XULT/embOS_wolfcrypt_test_SAMV71_XULT/Application/runWolfcryptTests.c +++ b/IDE/IAR-EWARM/embOS/SAMV71_XULT/embOS_wolfcrypt_test_SAMV71_XULT/Application/runWolfcryptTests.c @@ -26,4 +26,4 @@ int main(void) { OS_CREATETASK(&WLFTASK, "Tests task", wolfTask, 100, WLFSTACK); OS_Start(); /* Start the OS */ return 0; -} \ No newline at end of file +} diff --git a/IDE/IAR-MSP430/main.c b/IDE/IAR-MSP430/main.c index e89afb6280..c99cb0075a 100644 --- a/IDE/IAR-MSP430/main.c +++ b/IDE/IAR-MSP430/main.c @@ -1,6 +1,6 @@ /* MSP430 example main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/IAR-MSP430/user_settings.h b/IDE/IAR-MSP430/user_settings.h index 1e4caea9d3..fc8f6ba621 100644 --- a/IDE/IAR-MSP430/user_settings.h +++ b/IDE/IAR-MSP430/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/INTIME-RTOS/libwolfssl.c b/IDE/INTIME-RTOS/libwolfssl.c index 94d39bb24b..b92658eaf6 100644 --- a/IDE/INTIME-RTOS/libwolfssl.c +++ b/IDE/INTIME-RTOS/libwolfssl.c @@ -4,7 +4,7 @@ #include BOOLEAN __stdcall RslMain( RTHANDLE hModule, - DWORD ul_reason_for_call, + DWORD ul_reason_for_call, LPVOID lpReserved ) { diff --git a/IDE/LINUX-SGX/sgx_t_static.mk b/IDE/LINUX-SGX/sgx_t_static.mk index ebb718cf74..1941bae02b 100644 --- a/IDE/LINUX-SGX/sgx_t_static.mk +++ b/IDE/LINUX-SGX/sgx_t_static.mk @@ -115,7 +115,7 @@ ifeq ($(HAVE_WOLFSSL_SP), 1) endif -Flags_Just_For_C := -Wno-implicit-function-declaration -std=c11 +Flags_Just_For_C := -Wno-implicit-function-declaration -std=c99 Common_C_Cpp_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Wolfssl_Include_Paths) -fno-builtin-printf -I. Wolfssl_C_Flags := $(Flags_Just_For_C) $(Common_C_Cpp_Flags) $(Wolfssl_C_Extra_Flags) diff --git a/IDE/LPCXPRESSO/lib_wolfssl/lpc_18xx_port.c b/IDE/LPCXPRESSO/lib_wolfssl/lpc_18xx_port.c index dd27de2665..1bd3c8ecd2 100644 --- a/IDE/LPCXPRESSO/lib_wolfssl/lpc_18xx_port.c +++ b/IDE/LPCXPRESSO/lib_wolfssl/lpc_18xx_port.c @@ -1,6 +1,6 @@ /* lpc_18xx_port.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/LPCXPRESSO/wolf_example/src/lpc_18xx_startup.c b/IDE/LPCXPRESSO/wolf_example/src/lpc_18xx_startup.c index 8f67b1c33e..f5ffe3fe6c 100644 --- a/IDE/LPCXPRESSO/wolf_example/src/lpc_18xx_startup.c +++ b/IDE/LPCXPRESSO/wolf_example/src/lpc_18xx_startup.c @@ -1,6 +1,6 @@ /* lpc_18xx_startup.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/M68K/README.md b/IDE/M68K/README.md index 2fe43b67ac..64eaad8b5d 100644 --- a/IDE/M68K/README.md +++ b/IDE/M68K/README.md @@ -34,7 +34,7 @@ BUILD_C RSA 2048 public 7.619 ops/sec RSA 2048 private 0.276 ops/sec -###Building testwolfcryt/benchmark +###Building testwolfcrypt/benchmark To build either testwolfcrypt or benchmark first build wolfssl.a, place it in $(NBROOT)/lib and then cd into the respective directory. Running "make" will then create a .s19 application that can be ran on the board. diff --git a/IDE/M68K/benchmark/main.cpp b/IDE/M68K/benchmark/main.cpp index a7a76fb2d5..263b9289a2 100644 --- a/IDE/M68K/benchmark/main.cpp +++ b/IDE/M68K/benchmark/main.cpp @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/M68K/testwolfcrypt/main.cpp b/IDE/M68K/testwolfcrypt/main.cpp index 8b31c9e893..3df8ebd37c 100644 --- a/IDE/M68K/testwolfcrypt/main.cpp +++ b/IDE/M68K/testwolfcrypt/main.cpp @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MCUEXPRESSO/RT1170/user_settings.h b/IDE/MCUEXPRESSO/RT1170/user_settings.h index f620b1cc9f..f89e398664 100644 --- a/IDE/MCUEXPRESSO/RT1170/user_settings.h +++ b/IDE/MCUEXPRESSO/RT1170/user_settings.h @@ -53,7 +53,7 @@ /* using the RTC */ //#define NO_ASN_TIME #ifndef NO_ASN_TIME - #define FREESCALE_SNVS_RTC + #define FREESCALE_SNVS_RTC #endif #define NO_CRYPT_TEST @@ -64,19 +64,19 @@ #include static void myPrintf(const char* fmt, ...) { - int ret; - char line[150]; - va_list ap; + int ret; + char line[150]; + va_list ap; - va_start(ap, fmt); - ret = vsnprintf(line, sizeof(line), fmt, ap); - line[sizeof(line)-1] = '\0'; + va_start(ap, fmt); + ret = vsnprintf(line, sizeof(line), fmt, ap); + line[sizeof(line)-1] = '\0'; - DbgConsole_Printf("%s", line); + DbgConsole_Printf("%s", line); - /* add CR on newlines */ - if (ret > 0 && line[ret-1] == '\n') { - DbgConsole_Printf("\r"); + /* add CR on newlines */ + if (ret > 0 && line[ret-1] == '\n') { + DbgConsole_Printf("\r"); } } #define XPRINTF myPrintf diff --git a/IDE/MCUEXPRESSO/benchmark/source/run_benchmark.c b/IDE/MCUEXPRESSO/benchmark/source/run_benchmark.c index c413251325..bf092fce9c 100644 --- a/IDE/MCUEXPRESSO/benchmark/source/run_benchmark.c +++ b/IDE/MCUEXPRESSO/benchmark/source/run_benchmark.c @@ -1,6 +1,6 @@ /* run_benchmark.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MCUEXPRESSO/user_settings.h b/IDE/MCUEXPRESSO/user_settings.h index 77e137852f..d9fd0766c2 100644 --- a/IDE/MCUEXPRESSO/user_settings.h +++ b/IDE/MCUEXPRESSO/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -40,19 +40,19 @@ #include static void myPrintf(const char* fmt, ...) { - int ret; - char line[150]; - va_list ap; + int ret; + char line[150]; + va_list ap; - va_start(ap, fmt); - ret = vsnprintf(line, sizeof(line), fmt, ap); - line[sizeof(line)-1] = '\0'; + va_start(ap, fmt); + ret = vsnprintf(line, sizeof(line), fmt, ap); + line[sizeof(line)-1] = '\0'; - DbgConsole_Printf("%s", line); + DbgConsole_Printf("%s", line); - /* add CR on newlines */ - if (ret > 0 && line[ret-1] == '\n') { - DbgConsole_Printf("\r"); + /* add CR on newlines */ + if (ret > 0 && line[ret-1] == '\n') { + DbgConsole_Printf("\r"); } } #define XPRINTF myPrintf @@ -70,9 +70,9 @@ #define USE_FAST_MATH #ifdef USE_FAST_MATH /* big enough for even 4096 bit RSA key */ - #define FP_MAX_BITS 8192 - #define TFM_TIMING_RESISTANT - #define ECC_TIMING_RESISTANT + #define FP_MAX_BITS 8192 + #define TFM_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT #define ALT_ECC_SIZE #endif diff --git a/IDE/MCUEXPRESSO/wolfcrypt_test.c b/IDE/MCUEXPRESSO/wolfcrypt_test.c index 08a0d432e8..8d8993dda2 100644 --- a/IDE/MCUEXPRESSO/wolfcrypt_test.c +++ b/IDE/MCUEXPRESSO/wolfcrypt_test.c @@ -1,6 +1,6 @@ /* wolfcrypt_test.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/LPC43xx/time-LCP43xx.c b/IDE/MDK-ARM/LPC43xx/time-LCP43xx.c index 1e7fba4f12..04d4802165 100644 --- a/IDE/MDK-ARM/LPC43xx/time-LCP43xx.c +++ b/IDE/MDK-ARM/LPC43xx/time-LCP43xx.c @@ -1,6 +1,6 @@ /* time.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/Retarget.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/Retarget.c index 5732479838..dadffe9dcf 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/Retarget.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/Retarget.c @@ -2,7 +2,7 @@ #ifdef HAVE_CONFIG_H #include #endif - + #include #include #include @@ -39,7 +39,7 @@ extern int SER_PutChar (int ch); /*----------------------------------------------------------------------------- Write character to the Serial Port *----------------------------------------------------------------------------*/ -int sendchar (int c) +int sendchar (int c) { if (c == '\n') { SER_PutChar ('\r'); @@ -52,7 +52,7 @@ int sendchar (int c) /*----------------------------------------------------------------------------- Read character from the Serial Port *----------------------------------------------------------------------------*/ -int getkey (void) +int getkey (void) { int ch = SER_GetChar(); #if defined (HAVE_KEIL_RTX) @@ -67,7 +67,7 @@ int getkey (void) /*--------------------------- _ttywrch ---------------------------------------*/ -void _ttywrch (int ch) +void _ttywrch (int ch) { #ifdef STDIO sendchar (ch); @@ -76,28 +76,28 @@ void _ttywrch (int ch) /*--------------------------- _sys_open --------------------------------------*/ #ifndef NO_FILESYSTEM -static int KEIL_FS_open(const char *name, int openmode) +static int KEIL_FS_open(const char *name, int openmode) { int i ; int ret ; #define PATHSIZE 100 char path[PATHSIZE] ; char *p ; - + if(strlen(name) > PATHSIZE)return(-1) ; - + for(i = 0; i<= strlen(name); i++) { if(name[i] == '/')path[i] = '\\' ; else path[i] = name[i] ; - } + } if(path[0] == '.' && path[1] == '\\') p = path + 2 ; else p = path ; ret = __sys_open (p, openmode) ; - + return(ret) ; } #endif -FILEHANDLE _sys_open (const char *name, int openmode) +FILEHANDLE _sys_open (const char *name, int openmode) { /* Register standard Input Output devices. */ if (strcmp(name, "STDIN") == 0) { @@ -118,7 +118,7 @@ FILEHANDLE _sys_open (const char *name, int openmode) /*--------------------------- _sys_close -------------------------------------*/ -int _sys_close (FILEHANDLE fh) +int _sys_close (FILEHANDLE fh) { if (fh > 0x8000) { return (0); @@ -132,7 +132,7 @@ int _sys_close (FILEHANDLE fh) /*--------------------------- _sys_write -------------------------------------*/ -int _sys_write (FILEHANDLE fh, const U8 *buf, U32 len, int mode) +int _sys_write (FILEHANDLE fh, const U8 *buf, U32 len, int mode) { #ifdef STDIO if (fh == STDOUT) { @@ -155,7 +155,7 @@ int _sys_write (FILEHANDLE fh, const U8 *buf, U32 len, int mode) /*--------------------------- _sys_read --------------------------------------*/ -int _sys_read (FILEHANDLE fh, U8 *buf, U32 len, int mode) +int _sys_read (FILEHANDLE fh, U8 *buf, U32 len, int mode) { #ifdef STDIO if (fh == STDIN) { @@ -183,7 +183,7 @@ int _sys_read (FILEHANDLE fh, U8 *buf, U32 len, int mode) /*--------------------------- _sys_istty -------------------------------------*/ -int _sys_istty (FILEHANDLE fh) +int _sys_istty (FILEHANDLE fh) { if (fh > 0x8000) { return (1); @@ -193,7 +193,7 @@ int _sys_istty (FILEHANDLE fh) /*--------------------------- _sys_seek --------------------------------------*/ -int _sys_seek (FILEHANDLE fh, long pos) +int _sys_seek (FILEHANDLE fh, long pos) { if (fh > 0x8000) { return (-1); @@ -207,7 +207,7 @@ int _sys_seek (FILEHANDLE fh, long pos) /*--------------------------- _sys_ensure ------------------------------------*/ -int _sys_ensure (FILEHANDLE fh) +int _sys_ensure (FILEHANDLE fh) { if (fh > 0x8000) { return (-1); @@ -221,7 +221,7 @@ int _sys_ensure (FILEHANDLE fh) /*--------------------------- _sys_flen --------------------------------------*/ -long _sys_flen (FILEHANDLE fh) +long _sys_flen (FILEHANDLE fh) { if (fh > 0x8000) { return (0); @@ -236,21 +236,21 @@ long _sys_flen (FILEHANDLE fh) /*--------------------------- _sys_tmpnam ------------------------------------*/ -int _sys_tmpnam (char *name, int sig, unsigned maxlen) +int _sys_tmpnam (char *name, int sig, unsigned maxlen) { return (1); } /*--------------------------- _sys_command_string ----------------------------*/ -char *_sys_command_string (char *cmd, int len) +char *_sys_command_string (char *cmd, int len) { return (cmd); } /*--------------------------- _sys_exit --------------------------------------*/ -void _sys_exit (int return_code) +void _sys_exit (int return_code) { #ifdef WOLFSSL_MDK_SHELL return ; @@ -258,6 +258,6 @@ void _sys_exit (int return_code) /* Endless loop. */ while (1); #endif - + } diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.c index 3f2af99c99..0f57692e27 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.c @@ -1,6 +1,6 @@ /* certs_test.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.h index d06afdd1d6..f63a58eb06 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.h +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.h @@ -8,8 +8,8 @@ extern int sizeof_client_key_der_1024 ; extern const unsigned char client_cert_der_1024[] ; extern int sizeof_client_cert_der_1024 ; /* ./certs/1024/dh1024.der, 1024-bit */ -extern const unsigned char dh_key_der_1024[] ; -extern int sizeof_dh_key_der_1024 ; +extern const unsigned char dh_key_der_1024[] ; +extern int sizeof_dh_key_der_1024 ; /* ./certs/1024/dsa1024.der, 1024-bit */ extern const unsigned char dsa_key_der_1024[] ; extern int sizeof_dsa_key_der_1024 ; diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h index ca36781692..04373c97ab 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h @@ -1,6 +1,6 @@ /* config-BEREFOOT.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h index 45b8c1b329..85e02db34c 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h @@ -1,6 +1,6 @@ /* config-FS.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h index a96e5d7862..eb93fa931a 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h @@ -1,6 +1,6 @@ /* config-RTX-TCP-FS.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config.h index 98562cd164..d6fe1aa16d 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config.h +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config.h @@ -1,6 +1,6 @@ /* config.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c index de71e9941e..84d3bc4ba0 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/shell.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/shell.c index 63e2cdc2f1..1ce952e037 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/shell.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/shell.c @@ -1,6 +1,6 @@ /*shell.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-CortexM3-4.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-CortexM3-4.c index 024943bd3d..f7cb61f0df 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-CortexM3-4.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-CortexM3-4.c @@ -1,6 +1,6 @@ /* time-STM32F2.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-dummy.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-dummy.c index bd7d515026..f41a948137 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-dummy.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-dummy.c @@ -1,6 +1,6 @@ /* time-dummy.c.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.c index 9b68ab8158..7908dfec68 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.c @@ -1,6 +1,6 @@ /* wolfssl_KEIL_RL.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.h index 6e3464ba6e..b52c547fde 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.h +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.h @@ -1,6 +1,6 @@ /* wolfssl_KEIL_RL.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -78,7 +78,7 @@ typedef int socklen_t ; #define tcp_listen wolfssl_tcp_listen #define tcp_select wolfssl_tcp_select -extern int wolfssl_connect(int sd, const struct sockaddr* sa, int sz) ; +extern int wolfssl_connect(int sd, const struct sockaddr* sa, int sz) ; extern int wolfssl_accept(int sd, struct sockaddr*addr, socklen_t *addrlen); extern int wolfssl_recv(int sd, void *buf, size_t len, int flags); extern int wolfssl_send(int sd, const void *buf, size_t len, int flags); diff --git a/IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c b/IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c index 08dcbdf8f3..3a30349cac 100644 --- a/IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c +++ b/IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c @@ -1,6 +1,6 @@ /* time-STM32F2xx.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Conf/user_settings.h b/IDE/MDK5-ARM/Conf/user_settings.h index c58b5fb6a9..089712b852 100644 --- a/IDE/MDK5-ARM/Conf/user_settings.h +++ b/IDE/MDK5-ARM/Conf/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h b/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h index e6d314a771..66623a9441 100644 --- a/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h +++ b/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h @@ -1,6 +1,6 @@ /* wolfssl_MDK_ARM.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c b/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c index 1b055e7fa0..a9b0bc0add 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/CryptTest/main.c b/IDE/MDK5-ARM/Projects/CryptTest/main.c index 6425e654e5..826a8ade2b 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/main.c +++ b/IDE/MDK5-ARM/Projects/CryptTest/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/EchoClient/main.c b/IDE/MDK5-ARM/Projects/EchoClient/main.c index 22f27cb153..0e40a7249e 100644 --- a/IDE/MDK5-ARM/Projects/EchoClient/main.c +++ b/IDE/MDK5-ARM/Projects/EchoClient/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/EchoServer/main.c b/IDE/MDK5-ARM/Projects/EchoServer/main.c index 53a27bec00..a99244f63c 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/main.c +++ b/IDE/MDK5-ARM/Projects/EchoServer/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/main.c b/IDE/MDK5-ARM/Projects/SimpleClient/main.c index 0461547014..686cda6b6a 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/main.c +++ b/IDE/MDK5-ARM/Projects/SimpleClient/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/main.c b/IDE/MDK5-ARM/Projects/SimpleServer/main.c index 973fdbbe1d..22e6a9b056 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/main.c +++ b/IDE/MDK5-ARM/Projects/SimpleServer/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c index 9eab03cc69..db26c5b262 100644 --- a/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c index 3958f4a23e..06f39b0e86 100644 --- a/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c @@ -1,6 +1,6 @@ /*shell.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c index 8b1de0aa51..a4ce55fc60 100644 --- a/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c @@ -1,6 +1,6 @@ /* time-STM32F2.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Src/ssl-dummy.c b/IDE/MDK5-ARM/Src/ssl-dummy.c index 7cfd82ec69..734b126ce0 100644 --- a/IDE/MDK5-ARM/Src/ssl-dummy.c +++ b/IDE/MDK5-ARM/Src/ssl-dummy.c @@ -1,6 +1,6 @@ /* ssl-dummy.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MPLABX16/user_settings.h b/IDE/MPLABX16/user_settings.h index d4754db89f..174551e95e 100644 --- a/IDE/MPLABX16/user_settings.h +++ b/IDE/MPLABX16/user_settings.h @@ -51,7 +51,7 @@ extern "C" { #undef FP_MAX_BITS #define FP_MAX_BITS 2048 #else - #define WOLFSSL_SP_MATH + #define WOLFSSL_SP_MATH #define WOLFSSL_SP_SMALL #define WOLFSSL_SP_MATH_ALL #define SP_INT_BITS 256 @@ -162,7 +162,7 @@ extern "C" { /* #undef WOLFSSL_AES_DIRECT #define WOLFSSL_AES_DIRECT */ - + #undef NO_AES_CBC #define NO_AES_CBC #else @@ -301,7 +301,7 @@ extern "C" { #define NO_PKCS8 #define WOLFSSL_NO_PEM - + /* ------------------------------------------------------------------------- */ /* Enable Features */ /* ------------------------------------------------------------------------- */ @@ -397,7 +397,7 @@ extern "C" { #undef NO_PWDBASED #define NO_PWDBASED -#undef NO_MD5 +#undef NO_MD5 #define NO_MD5 #undef NO_DES3 diff --git a/IDE/MQX/README-jp.md b/IDE/MQX/README-jp.md index 093e98b6bd..649e7c65df 100644 --- a/IDE/MQX/README-jp.md +++ b/IDE/MQX/README-jp.md @@ -26,4 +26,3 @@ CC: コンパイラコマンド AR: ARコマンド WOLF_ROOT: Makefileの格納位置を変える場合はこの定義を変更してください - \ No newline at end of file diff --git a/IDE/MQX/client-tls.c b/IDE/MQX/client-tls.c index 9834251c0d..70ef3b4eaa 100644 --- a/IDE/MQX/client-tls.c +++ b/IDE/MQX/client-tls.c @@ -1,6 +1,6 @@ /* client-tls.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MQX/include.am b/IDE/MQX/include.am index 27687d33e7..deb5ebc765 100644 --- a/IDE/MQX/include.am +++ b/IDE/MQX/include.am @@ -8,4 +8,4 @@ EXTRA_DIST+= IDE/MQX/README-jp.md EXTRA_DIST+= IDE/MQX/README.md EXTRA_DIST+= IDE/MQX/server-tls.c EXTRA_DIST+= IDE/MQX/user_config.h -EXTRA_DIST+= IDE/MQX/user_settings.h \ No newline at end of file +EXTRA_DIST+= IDE/MQX/user_settings.h diff --git a/IDE/MQX/server-tls.c b/IDE/MQX/server-tls.c index e7e1a48529..33e26a9263 100644 --- a/IDE/MQX/server-tls.c +++ b/IDE/MQX/server-tls.c @@ -1,6 +1,6 @@ /* server-tls.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -193,4 +193,4 @@ int main() wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */ close(sockfd); /* Close the socket listening for clients */ return 0; /* Return reporting a success */ -} \ No newline at end of file +} diff --git a/IDE/MQX/user_config.h b/IDE/MQX/user_config.h index d66e532355..81bbf4e49e 100644 --- a/IDE/MQX/user_config.h +++ b/IDE/MQX/user_config.h @@ -1 +1 @@ -#define MQX_CPU PSP_CPU_MK60DN512Z \ No newline at end of file +#define MQX_CPU PSP_CPU_MK60DN512Z diff --git a/IDE/MSVS-2019-AZSPHERE/client/client.c b/IDE/MSVS-2019-AZSPHERE/client/client.c index 6756c89a57..c206ce217a 100644 --- a/IDE/MSVS-2019-AZSPHERE/client/client.c +++ b/IDE/MSVS-2019-AZSPHERE/client/client.c @@ -1,6 +1,6 @@ -/* client.c +/* client.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MSVS-2019-AZSPHERE/client/client.h b/IDE/MSVS-2019-AZSPHERE/client/client.h index f10c0db94f..edef19afc3 100644 --- a/IDE/MSVS-2019-AZSPHERE/client/client.h +++ b/IDE/MSVS-2019-AZSPHERE/client/client.h @@ -1,6 +1,6 @@ /* client.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MSVS-2019-AZSPHERE/server/server.c b/IDE/MSVS-2019-AZSPHERE/server/server.c index 7c4528a06d..5ffe865a46 100644 --- a/IDE/MSVS-2019-AZSPHERE/server/server.c +++ b/IDE/MSVS-2019-AZSPHERE/server/server.c @@ -1,6 +1,6 @@ -/* server.c +/* server.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MSVS-2019-AZSPHERE/server/server.h b/IDE/MSVS-2019-AZSPHERE/server/server.h index e4d5edfeaf..e3a53b5e3a 100644 --- a/IDE/MSVS-2019-AZSPHERE/server/server.h +++ b/IDE/MSVS-2019-AZSPHERE/server/server.h @@ -1,6 +1,6 @@ /* server.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MSVS-2019-AZSPHERE/shared/util.h b/IDE/MSVS-2019-AZSPHERE/shared/util.h index fc54a709ae..0cab4bf60e 100644 --- a/IDE/MSVS-2019-AZSPHERE/shared/util.h +++ b/IDE/MSVS-2019-AZSPHERE/shared/util.h @@ -1,6 +1,6 @@ /* util.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MSVS-2019-AZSPHERE/user_settings.h b/IDE/MSVS-2019-AZSPHERE/user_settings.h index 0dc2354b50..ea18de895f 100644 --- a/IDE/MSVS-2019-AZSPHERE/user_settings.h +++ b/IDE/MSVS-2019-AZSPHERE/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -31,9 +31,9 @@ #ifndef SERVER_IP #define SERVER_IP "192.168.1.200" /* Local Test Server IP */ #endif - #ifndef DEFAULT_PORT - #define DEFAULT_PORT 11111 - #endif + #ifndef DEFAULT_PORT + #define DEFAULT_PORT 11111 + #endif #define CERT ca_cert_der_2048 #define SIZEOF_CERT sizeof_ca_cert_der_2048 static const char msg[] = "Are you listening wolfSSL Server?"; @@ -41,9 +41,9 @@ #ifndef SERVER_IP #define SERVER_IP "www.wolfssl.com" #endif - #ifndef DEFAULT_PORT - #define DEFAULT_PORT 443 - #endif + #ifndef DEFAULT_PORT + #define DEFAULT_PORT 443 + #endif #define CERT wolfssl_website_root_ca #define SIZEOF_CERT sizeof_wolfssl_website_root_ca static const char msg[] = "GET /index.html HTTP/1.1\r\n\r\n"; diff --git a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/avnet_mt3620_sk/inc/hw/template_appliance.h b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/avnet_mt3620_sk/inc/hw/template_appliance.h index 2837ac3c2d..6cca8f6015 100644 --- a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/avnet_mt3620_sk/inc/hw/template_appliance.h +++ b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/avnet_mt3620_sk/inc/hw/template_appliance.h @@ -1,6 +1,6 @@ -/* template_appliance.h +/* template_appliance.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/mt3620_rdb/inc/hw/template_appliance.h b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/mt3620_rdb/inc/hw/template_appliance.h index 05ed1790f6..403300de22 100644 --- a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/mt3620_rdb/inc/hw/template_appliance.h +++ b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/mt3620_rdb/inc/hw/template_appliance.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2006-2022 wolfSSL Inc. +/ * Copyright (C) 2006-2024 wolfSSL Inc. + * * This file is part of wolfSSL. * * wolfSSL is free software; you can redistribute it and/or modify diff --git a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/seeed_mt3620_mdb/inc/hw/template_appliance.h b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/seeed_mt3620_mdb/inc/hw/template_appliance.h index 051b6ac03b..df84198e92 100644 --- a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/seeed_mt3620_mdb/inc/hw/template_appliance.h +++ b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/seeed_mt3620_mdb/inc/hw/template_appliance.h @@ -1,6 +1,6 @@ -/* template_appliance.h +/* template_appliance.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/applibs_versions.h b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/applibs_versions.h index 2afdfcf3ee..4078fb7a5b 100644 --- a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/applibs_versions.h +++ b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/applibs_versions.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once /// /// This identifier should be defined before including any of the networking-related header files. diff --git a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/main.c b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/main.c index ca8e80577c..0d95b29e8e 100644 --- a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/main.c +++ b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/main.c @@ -1,6 +1,6 @@ -/* main.c +/* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MYSQL/CMakeLists_wolfCrypt.txt b/IDE/MYSQL/CMakeLists_wolfCrypt.txt index 566b7d8b80..ba6d98116a 100644 --- a/IDE/MYSQL/CMakeLists_wolfCrypt.txt +++ b/IDE/MYSQL/CMakeLists_wolfCrypt.txt @@ -1,6 +1,6 @@ # CMakeLists.txt # -# Copyright (C) 2006-2023 wolfSSL Inc. +# Copyright (C) 2006-2024 wolfSSL Inc. # # This file is part of wolfSSL. # diff --git a/IDE/MYSQL/CMakeLists_wolfSSL.txt b/IDE/MYSQL/CMakeLists_wolfSSL.txt index e95c929103..7bfaa88c90 100644 --- a/IDE/MYSQL/CMakeLists_wolfSSL.txt +++ b/IDE/MYSQL/CMakeLists_wolfSSL.txt @@ -1,6 +1,6 @@ # CMakeLists.txt # -# Copyright (C) 2006-2023 wolfSSL Inc. +# Copyright (C) 2006-2024 wolfSSL Inc. # # This file is part of wolfSSL. # diff --git a/IDE/NETOS/user_settings.h b/IDE/NETOS/user_settings.h index ceb70ec663..efdbf01614 100644 --- a/IDE/NETOS/user_settings.h +++ b/IDE/NETOS/user_settings.h @@ -1,23 +1,23 @@ /* user_settings.h * -* Copyright (C) 2006-2021 wolfSSL Inc. -* -* This file is part of wolfSSL. -* -* wolfSSL is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* wolfSSL is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -*/ + * Copyright (C) 2006-2024 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ /* Custom wolfSSL user settings for GCC ARM */ @@ -410,6 +410,7 @@ extern "C" { /* prototypes for user heap override functions */ /* Note: Realloc only required for normal math */ + /* Note2: XFREE(NULL) must be properly handled */ #include /* for size_t */ extern void *myMalloc(size_t n, void* heap, int type); extern void myFree(void *p, void* heap, int type); diff --git a/IDE/NETOS/wolfssl_netos_custom.c b/IDE/NETOS/wolfssl_netos_custom.c index 8617eee66b..db4b518aa0 100644 --- a/IDE/NETOS/wolfssl_netos_custom.c +++ b/IDE/NETOS/wolfssl_netos_custom.c @@ -1,6 +1,6 @@ /* wolfssl_netos_custom.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/README.md b/IDE/PlatformIO/examples/wolfssl_benchmark/README.md index c602facfe5..6505ecbb5c 100644 --- a/IDE/PlatformIO/examples/wolfssl_benchmark/README.md +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/README.md @@ -9,9 +9,9 @@ For general information on [wolfSSL examples for Espressif](../README.md), see t ## Example Output -Note the default wolfSSL `user_settings.h` is configured by default to be the most +Note the default wolfSSL `user_settings.h` is configured by default to be the most compatible across the widest ranges of targets. Contact wolfSSL at support@wolfssl.com -for help in optimizing for your particular application, or see the +for help in optimizing for your particular application, or see the [docs](https://www.wolfssl.com/documentation/manuals/wolfssl/index.html). ``` @@ -59,7 +59,7 @@ I (323) cpu_start: Compile time: May 17 2024 19:42:07 I (329) cpu_start: ELF file SHA256: eebe816ce... I (334) cpu_start: ESP-IDF: 5.2.1 I (339) cpu_start: Min chip rev: v0.0 -I (344) cpu_start: Max chip rev: v3.99 +I (344) cpu_start: Max chip rev: v3.99 I (349) cpu_start: Chip rev: v1.0 I (354) heap_init: Initializing. RAM available for dynamic allocation: I (361) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM @@ -83,7 +83,7 @@ W (449) esp32_util: Warning: old cmake, user_settings.h location unknown. I (457) esp32_util: LIBWOLFSSL_VERSION_STRING = 5.7.0 I (463) esp32_util: LIBWOLFSSL_VERSION_HEX = 5007000 I (468) esp32_util: Stack HWM: 9204 -I (472) esp32_util: +I (472) esp32_util: I (475) esp32_util: Macro Name Defined Not Defined I (482) esp32_util: ------------------------- --------- ------------- I (489) esp32_util: NO_ESPIDF_DEFAULT........ X @@ -115,7 +115,7 @@ I (638) esp32_util: FREERTOS................. X I (643) esp32_util: NO_WOLFSSL_DIR........... X I (649) esp32_util: WOLFSSL_NO_CURRDIR....... X I (654) esp32_util: WOLFSSL_LWIP............. X -I (660) esp32_util: +I (660) esp32_util: I (663) esp32_util: Compiler Optimization: Default I (668) esp32_util: I (671) esp32_util: CONFIG_IDF_TARGET = esp32 diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/platformio.ini b/IDE/PlatformIO/examples/wolfssl_benchmark/platformio.ini index c9e32235c5..a83ae32410 100644 --- a/IDE/PlatformIO/examples/wolfssl_benchmark/platformio.ini +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/platformio.ini @@ -17,4 +17,4 @@ monitor_port = COM19 monitor_speed = 115200 build_flags = -DWOLFSSL_USER_SETTINGS, -DWOLFSSL_ESP32 monitor_filters = direct -lib_deps = wolfssl/wolfSSL@^5.7.0-rev.3b +lib_deps = wolfssl/wolfSSL@^5.7.2 diff --git a/IDE/PlatformIO/examples/wolfssl_test/README.md b/IDE/PlatformIO/examples/wolfssl_test/README.md index d67d76111c..86058cd572 100644 --- a/IDE/PlatformIO/examples/wolfssl_test/README.md +++ b/IDE/PlatformIO/examples/wolfssl_test/README.md @@ -10,9 +10,9 @@ For general information on [wolfSSL examples for Espressif](../README.md), see t ## Example Output -Note the default wolfSSL `user_settings.h` is configured by default to be the most +Note the default wolfSSL `user_settings.h` is configured by default to be the most compatible across the widest ranges of targets. Contact wolfSSL at support@wolfssl.com -for help in optimizing for your particular application, or see the +for help in optimizing for your particular application, or see the [docs](https://www.wolfssl.com/documentation/manuals/wolfssl/index.html). @@ -61,7 +61,7 @@ I (511) cpu_start: Compile time: May 17 2024 19:31:47 I (517) cpu_start: ELF file SHA256: 40b2541a0... I (523) cpu_start: ESP-IDF: 5.2.1 I (528) cpu_start: Min chip rev: v0.0 -I (532) cpu_start: Max chip rev: v3.99 +I (532) cpu_start: Max chip rev: v3.99 I (537) cpu_start: Chip rev: v1.0 I (542) heap_init: Initializing. RAM available for dynamic allocation: I (549) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM diff --git a/IDE/PlatformIO/examples/wolfssl_test/platformio.ini b/IDE/PlatformIO/examples/wolfssl_test/platformio.ini index 79356a165c..5382576311 100644 --- a/IDE/PlatformIO/examples/wolfssl_test/platformio.ini +++ b/IDE/PlatformIO/examples/wolfssl_test/platformio.ini @@ -39,4 +39,4 @@ monitor_port = COM19 monitor_speed = 115200 build_flags = -DWOLFSSL_USER_SETTINGS, -DWOLFSSL_ESP32 monitor_filters = direct -lib_deps = wolfssl/wolfssl@^5.7.0-rev.3d +lib_deps = wolfssl/wolfssl@^5.7.2 diff --git a/IDE/QNX/README.md b/IDE/QNX/README.md index fb79abf6b4..4a283f158c 100644 --- a/IDE/QNX/README.md +++ b/IDE/QNX/README.md @@ -17,7 +17,7 @@ source ~/qnx700/qnxsdp-env.sh make ``` -Once the wolfSSL library has been built cd to IDE/QNX/CAAM-DRIVER and run "make". This will produce the wolfCrypt resource manager. It should be started on the device with root permissions. Once wolfCrypt is running on the device with root permissions then any user with access to open a connection to /dev/wolfCrypt can make use of the driver. +Once the wolfSSL library has been built cd to IDE/QNX/CAAM-DRIVER and run "make". This will produce the wolfCrypt resource manager. It should be started on the device with root permissions. Once wolfCrypt is running on the device with root permissions then any user with access to open a connection to /dev/wolfCrypt can make use of the driver. ### Momentics To build in momentics IDE: diff --git a/IDE/QNX/example-client/client-tls.c b/IDE/QNX/example-client/client-tls.c index 27e56e3438..9c9b6e4b0c 100644 --- a/IDE/QNX/example-client/client-tls.c +++ b/IDE/QNX/example-client/client-tls.c @@ -1,6 +1,6 @@ /* client-tls.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/QNX/example-cmac/cmac-test.c b/IDE/QNX/example-cmac/cmac-test.c index f72277e9d9..64d5ccacd4 100644 --- a/IDE/QNX/example-cmac/cmac-test.c +++ b/IDE/QNX/example-cmac/cmac-test.c @@ -1,6 +1,6 @@ /* cmac-test.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/QNX/example-server/server-tls.c b/IDE/QNX/example-server/server-tls.c index 6c2a9f1f4e..1257e3b331 100644 --- a/IDE/QNX/example-server/server-tls.c +++ b/IDE/QNX/example-server/server-tls.c @@ -1,6 +1,6 @@ /* server-tls.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/RISCV/SIFIVE-HIFIVE1/README.md b/IDE/RISCV/SIFIVE-HIFIVE1/README.md index 5e1183deab..5b3f3ed89b 100644 --- a/IDE/RISCV/SIFIVE-HIFIVE1/README.md +++ b/IDE/RISCV/SIFIVE-HIFIVE1/README.md @@ -44,7 +44,7 @@ The `IDE/RISCV/SIFIVE-HIFIVE1/main.c` example application provides a function to $ export WOLFSSL_SRC_DIR=~/wolfssl ``` -5. Setup your riscv64 compiler +5. Setup your riscv64 compiler ``` $ export RISCV_OPENOCD_PATH=/opt/riscv-openocd @@ -64,7 +64,7 @@ You can build from source or create a static library. $ cd freedom-e-sdk $ make PROGRAM=wolfcrypt TARGET=sifive-hifive1-revb CONFIGURATION=debug clean software upload ``` -This example cleans, builds and uploads the software on the sifive-hifive1-revb target but you can also combine and build for any of the supported targets. +This example cleans, builds and uploads the software on the sifive-hifive1-revb target but you can also combine and build for any of the supported targets. Review the test results on the target console. diff --git a/IDE/RISCV/SIFIVE-HIFIVE1/main.c b/IDE/RISCV/SIFIVE-HIFIVE1/main.c index ff0488956b..eeaf4e29c7 100644 --- a/IDE/RISCV/SIFIVE-HIFIVE1/main.c +++ b/IDE/RISCV/SIFIVE-HIFIVE1/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -35,7 +35,7 @@ #ifndef NO_CRYPT_BENCHMARK -/*-specs=nano.specs doesn’t include support for floating point in printf()*/ +/*-specs=nano.specs doesn't include support for floating point in printf()*/ asm (".global _printf_float"); #ifndef RTC_FREQ diff --git a/IDE/RISCV/SIFIVE-HIFIVE1/user_settings.h b/IDE/RISCV/SIFIVE-HIFIVE1/user_settings.h index e0a4a9077c..75d5f54d22 100644 --- a/IDE/RISCV/SIFIVE-HIFIVE1/user_settings.h +++ b/IDE/RISCV/SIFIVE-HIFIVE1/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -397,6 +397,7 @@ extern "C" { /* prototypes for user heap override functions */ /* Note: Realloc only required for normal math */ + /* Note2: XFREE(NULL) must be properly handled */ #include /* for size_t */ extern void *myMalloc(size_t n, void* heap, int type); extern void myFree(void *p, void* heap, int type); diff --git a/IDE/RISCV/SIFIVE-UNLEASHED/README.md b/IDE/RISCV/SIFIVE-UNLEASHED/README.md index 64f88ae811..c2e1c1ba61 100644 --- a/IDE/RISCV/SIFIVE-UNLEASHED/README.md +++ b/IDE/RISCV/SIFIVE-UNLEASHED/README.md @@ -6,7 +6,7 @@ Instructions for cross-compiling and running wolfSSL on the HiFive Unleashed boa SiFive Freedom U540 SoC at 1.5GHz -Getting started guide: +Getting started guide: https://sifive.cdn.prismic.io/sifive%2Ffa3a584a-a02f-4fda-b758-a2def05f49f9_hifive-unleashed-getting-started-guide-v1p1.pdf Make sure your ethernet is attached and power up board. You can connecct the micro-usb to get a UART console that will display the DHCP IP address. Default user is "root" and login password is "sifive". diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/README.md b/IDE/ROWLEY-CROSSWORKS-ARM/README.md index beb9416454..fc305b631a 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/README.md +++ b/IDE/ROWLEY-CROSSWORKS-ARM/README.md @@ -4,11 +4,11 @@ This directory contains a CrossWorks solution named wolfssl.hzp. Inside are three projects: -1. libwolfssl: +1. libwolfssl: This generates a library file named "libwolfssl_ARM_Debug/libwolfssl_v7em_t_le_eabi.a" -2. benchmark: +2. benchmark: This is a sample benchmark application. It runs the "benchmark_test" suite repeatedly until a failure occurs. -3. test: +3. test: This is a sample test application. It runs "wolfcrypt_test" suite suite repeatedly until a failure occurs. # Prerequisites @@ -21,7 +21,7 @@ All hardware functions are defined in `kinetis_hw.c` and are currently setup for To create support for a new ARM microcontroller the functions in `hw.h` will need to be implemented. -Also you will need to configure the ARM Architecture and ARM Core Type in the "Solution Properties" -> "ARM". +Also you will need to configure the ARM Architecture and ARM Core Type in the "Solution Properties" -> "ARM". Also the "Target Processor" in each of the projects ("Project Properties" -> "Target Processor") ## Hardware Crypto Acceleration diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c b/IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c index 2e1d7707bc..085fa4109a 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c +++ b/IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c @@ -1,6 +1,6 @@ /* arm_startup.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c b/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c index e95059e9ef..94f55bfb52 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c +++ b/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c @@ -1,6 +1,6 @@ /* benchmark_main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c b/IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c index 5626126920..ffe76bf1b8 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c +++ b/IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c @@ -1,6 +1,6 @@ /* kinetis_hw.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/retarget.c b/IDE/ROWLEY-CROSSWORKS-ARM/retarget.c index bfd53ff703..752ec6e663 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/retarget.c +++ b/IDE/ROWLEY-CROSSWORKS-ARM/retarget.c @@ -1,6 +1,6 @@ /* retarget.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/test_main.c b/IDE/ROWLEY-CROSSWORKS-ARM/test_main.c index 1f6339d908..062c0982b7 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/test_main.c +++ b/IDE/ROWLEY-CROSSWORKS-ARM/test_main.c @@ -1,6 +1,6 @@ /* test_main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/common/strings.h b/IDE/Renesas/cs+/Projects/common/strings.h index 030e4ffad0..a66c8bbbf8 100644 --- a/IDE/Renesas/cs+/Projects/common/strings.h +++ b/IDE/Renesas/cs+/Projects/common/strings.h @@ -1,6 +1,6 @@ /* strings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/common/unistd.h b/IDE/Renesas/cs+/Projects/common/unistd.h index d288552e6c..12f9374948 100644 --- a/IDE/Renesas/cs+/Projects/common/unistd.h +++ b/IDE/Renesas/cs+/Projects/common/unistd.h @@ -1,6 +1,6 @@ /* unistd.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/common/user_settings.h b/IDE/Renesas/cs+/Projects/common/user_settings.h index 5e0d375360..c4aeaa786a 100644 --- a/IDE/Renesas/cs+/Projects/common/user_settings.h +++ b/IDE/Renesas/cs+/Projects/common/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -25,11 +25,11 @@ #define NO_DEV_RANDOM #define USE_CERT_BUFFERS_2048 #define SIZEOF_LONG_LONG 8 -#define NO_WOLFSSL_DIR +#define NO_WOLFSSL_DIR #define WOLFSSL_NO_CURRDIR #define WOLFSSL_LOG_PRINTF #define NO_WOLFSSL_STUB -#define NO_DYNAMIC_ARRAY /* for compilers not allowed dynamic size array */ +#define NO_DYNAMIC_ARRAY /* for compilers not allowed dynamic size array */ #define WOLFSSL_SMALL_STACK #define WOLFSSL_DH_CONST diff --git a/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c b/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c index 8feffe8f31..f6d9abaa79 100644 --- a/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c +++ b/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c @@ -1,6 +1,6 @@ /* wolfssl_dummy.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -51,10 +51,10 @@ int strncasecmp(const char *s1, const char * s2, unsigned int sz) return 1; } } - return 0; + return 0; } - -void abort(void) + +void abort(void) { while(1); } diff --git a/IDE/Renesas/cs+/Projects/t4_demo/wolf_client.c b/IDE/Renesas/cs+/Projects/t4_demo/wolf_client.c index c556f647af..e25b038c9e 100644 --- a/IDE/Renesas/cs+/Projects/t4_demo/wolf_client.c +++ b/IDE/Renesas/cs+/Projects/t4_demo/wolf_client.c @@ -1,6 +1,6 @@ /* wolf_client.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/t4_demo/wolf_main.c b/IDE/Renesas/cs+/Projects/t4_demo/wolf_main.c index 3cffc7191c..64f5aff137 100644 --- a/IDE/Renesas/cs+/Projects/t4_demo/wolf_main.c +++ b/IDE/Renesas/cs+/Projects/t4_demo/wolf_main.c @@ -1,6 +1,6 @@ /* wolf_main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -40,7 +40,7 @@ static void timeTick(void *pdata) double current_time(int reset) { if(reset) tick = 0 ; - return ((double)tick/FREQ) ; + return ((double)tick/FREQ) ; } #define ARG_SZ 256 @@ -50,10 +50,10 @@ static int get_arg(func_args *args) int i; char *arg = argBuff; args->argc = 0; - + for(i=0; i : client\n$ "); c = getchar(); - + switch(c) { case 't': get_arg(&args); @@ -95,14 +95,14 @@ void wolfSSL_main() wolfcrypt_test(&args); printf("End wolfCrypt Test\n"); break; - + case 'b': get_arg(&args); printf("Start wolfCrypt Benchmark\n"); benchmark_test(NULL); printf("End wolfCrypt Benchmark\n"); break; - + case 'c': if(get_arg(&args) < 0) break; @@ -110,7 +110,7 @@ void wolfSSL_main() wolfSSL_TLS_client(wolfSSL_cl_ctx, &args); printf("End TLS Client\n"); break; - + case 's': if(get_arg(&args) < 0) break; diff --git a/IDE/Renesas/cs+/Projects/t4_demo/wolf_server.c b/IDE/Renesas/cs+/Projects/t4_demo/wolf_server.c index a86ff18c81..858347170f 100644 --- a/IDE/Renesas/cs+/Projects/t4_demo/wolf_server.c +++ b/IDE/Renesas/cs+/Projects/t4_demo/wolf_server.c @@ -1,6 +1,6 @@ /* wolf_server.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/test/test_main.c b/IDE/Renesas/cs+/Projects/test/test_main.c index a1e00ef0af..c92fdddfb3 100644 --- a/IDE/Renesas/cs+/Projects/test/test_main.c +++ b/IDE/Renesas/cs+/Projects/test/test_main.c @@ -1,6 +1,6 @@ /* test_main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -45,7 +45,7 @@ void wolfcrypt_test(func_args args); void main(void) { func_args args = { 1 }; - + printf("Start wolfCrypt Test\n"); wolfcrypt_test(args); printf("End wolfCrypt Test\n"); diff --git a/IDE/Renesas/e2studio/DK-S7G2/benchmark-template/src/app_entry.c b/IDE/Renesas/e2studio/DK-S7G2/benchmark-template/src/app_entry.c index 705b53fc46..353f906dc0 100644 --- a/IDE/Renesas/e2studio/DK-S7G2/benchmark-template/src/app_entry.c +++ b/IDE/Renesas/e2studio/DK-S7G2/benchmark-template/src/app_entry.c @@ -1,6 +1,6 @@ /* app_entry.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/DK-S7G2/example_server-template/src/app_entry.c b/IDE/Renesas/e2studio/DK-S7G2/example_server-template/src/app_entry.c index ea15ee4f12..c52f8aaf3c 100644 --- a/IDE/Renesas/e2studio/DK-S7G2/example_server-template/src/app_entry.c +++ b/IDE/Renesas/e2studio/DK-S7G2/example_server-template/src/app_entry.c @@ -1,6 +1,6 @@ /* app_entry.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/DK-S7G2/wolfcrypttest-template/src/app_entry.c b/IDE/Renesas/e2studio/DK-S7G2/wolfcrypttest-template/src/app_entry.c index a056213313..9edf7ff84e 100644 --- a/IDE/Renesas/e2studio/DK-S7G2/wolfcrypttest-template/src/app_entry.c +++ b/IDE/Renesas/e2studio/DK-S7G2/wolfcrypttest-template/src/app_entry.c @@ -1,6 +1,6 @@ /* app_entry.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/common/strings.h b/IDE/Renesas/e2studio/Projects/common/strings.h index 030e4ffad0..a66c8bbbf8 100644 --- a/IDE/Renesas/e2studio/Projects/common/strings.h +++ b/IDE/Renesas/e2studio/Projects/common/strings.h @@ -1,6 +1,6 @@ /* strings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/common/unistd.h b/IDE/Renesas/e2studio/Projects/common/unistd.h index d288552e6c..12f9374948 100644 --- a/IDE/Renesas/e2studio/Projects/common/unistd.h +++ b/IDE/Renesas/e2studio/Projects/common/unistd.h @@ -1,6 +1,6 @@ /* unistd.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/common/user_settings.h b/IDE/Renesas/e2studio/Projects/common/user_settings.h index a9cc84ac76..01b01dbc3b 100644 --- a/IDE/Renesas/e2studio/Projects/common/user_settings.h +++ b/IDE/Renesas/e2studio/Projects/common/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -27,7 +27,7 @@ #define USE_CERT_BUFFERS_2048 #define WOLFSSL_USER_CURRTIME #define SIZEOF_LONG_LONG 8 -#define NO_WOLFSSL_DIR +#define NO_WOLFSSL_DIR #define WOLFSSL_NO_CURRDIR #define NO_FILESYSTEM #define WOLFSSL_LOG_PRINTF diff --git a/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c b/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c index b6b21e85bb..bf2006d491 100644 --- a/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c +++ b/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c @@ -1,6 +1,6 @@ /* wolfssl_dummy.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/test/src/key_data.c b/IDE/Renesas/e2studio/Projects/test/src/key_data.c index 8d06ccc1dd..d3e7a04164 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/key_data.c +++ b/IDE/Renesas/e2studio/Projects/test/src/key_data.c @@ -1,6 +1,6 @@ /* key_data.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/test/src/key_data.h b/IDE/Renesas/e2studio/Projects/test/src/key_data.h index 5c58e35298..c9be7039d7 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/key_data.h +++ b/IDE/Renesas/e2studio/Projects/test/src/key_data.h @@ -1,6 +1,6 @@ /* key_data.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/test/src/test_main.c b/IDE/Renesas/e2studio/Projects/test/src/test_main.c index 5264faef29..3e59160275 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/test_main.c +++ b/IDE/Renesas/e2studio/Projects/test/src/test_main.c @@ -1,6 +1,6 @@ /* test_main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/test/src/wolf_client.c b/IDE/Renesas/e2studio/Projects/test/src/wolf_client.c index 314243d0ed..7ebbe29234 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/wolf_client.c +++ b/IDE/Renesas/e2studio/Projects/test/src/wolf_client.c @@ -1,6 +1,6 @@ /* wolf_client.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/test/src/wolf_server.c b/IDE/Renesas/e2studio/Projects/test/src/wolf_server.c index 6454017771..615ef60a3a 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/wolf_server.c +++ b/IDE/Renesas/e2studio/Projects/test/src/wolf_server.c @@ -1,6 +1,6 @@ /* wolf_server.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -124,7 +124,7 @@ void wolfSSL_TLS_server_init(byte doClientCheck) #if !defined(NO_FILESYSTEM) ret = wolfSSL_CTX_use_PrivateKey_file(server_ctx, key, 0); #else - ret = wolfSSL_CTX_use_PrivateKey_buffer(server_ctx, key, sizeof_key, + ret = wolfSSL_CTX_use_PrivateKey_buffer(server_ctx, key, sizeof_key, SSL_FILETYPE_ASN1); #endif if (ret != SSL_SUCCESS) { @@ -138,20 +138,20 @@ void wolfSSL_TLS_server_init(byte doClientCheck) wolfSSL_CTX_set_verify(server_ctx, WOLFSSL_VERIFY_PEER | WOLFSSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0); #if !defined(NO_FILESYSTEM) - if (wolfSSL_CTX_load_verify_locations(server_ctx, clientCert, 0) + if (wolfSSL_CTX_load_verify_locations(server_ctx, clientCert, 0) != WOLFSSL_SUCCESS) #else - if (wolfSSL_CTX_load_verify_buffer(server_ctx, clientCert, + if (wolfSSL_CTX_load_verify_buffer(server_ctx, clientCert, sizeof_clicert, SSL_FILETYPE_ASN1) != SSL_SUCCESS) #endif printf("can't load ca file, Please run from wolfSSL home dir\n"); } - + /* Register callbacks */ wolfSSL_SetIORecv(server_ctx, my_IORecv); wolfSSL_SetIOSend(server_ctx, my_IOSend); - + } void wolfSSL_TLS_server( ) diff --git a/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h b/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h index 385a5d7bd4..2168ad0a05 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h +++ b/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h @@ -1,6 +1,6 @@ /* wolfssl_demo.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/tools/generate_rsa_keypair.sh b/IDE/Renesas/e2studio/Projects/tools/generate_rsa_keypair.sh index d221e5428d..c5256060dd 100755 --- a/IDE/Renesas/e2studio/Projects/tools/generate_rsa_keypair.sh +++ b/IDE/Renesas/e2studio/Projects/tools/generate_rsa_keypair.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash function usage(){ cat << _EOT_ @@ -7,7 +7,7 @@ function usage(){ Description: Generate 2048 bit Rsa key pair and Display modulus and public exponent - + Options: -g generate rsa key pair, default on -s only show modulus and public exponent @@ -39,7 +39,7 @@ FLAG_S="off" if [ $FLAG_G = "on" ]; then # generate 2048bit Rsa private key - openssl genrsa 2048 2> /dev/null > private-key.pem + openssl genrsa 2048 2> /dev/null > private-key.pem # expose public key openssl rsa -in private-key.pem -pubout -out public-key.pem 2> /dev/null fi diff --git a/IDE/Renesas/e2studio/Projects/tools/genhexbuf.pl b/IDE/Renesas/e2studio/Projects/tools/genhexbuf.pl index ca9074b201..42e547f244 100755 --- a/IDE/Renesas/e2studio/Projects/tools/genhexbuf.pl +++ b/IDE/Renesas/e2studio/Projects/tools/genhexbuf.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # genhexbuf.pl # Copyright (C) 2020 wolfSSL Inc. diff --git a/IDE/Renesas/e2studio/Projects/tools/rsa_pss_sign.sh b/IDE/Renesas/e2studio/Projects/tools/rsa_pss_sign.sh index 3c1f30032a..5dde500e84 100755 --- a/IDE/Renesas/e2studio/Projects/tools/rsa_pss_sign.sh +++ b/IDE/Renesas/e2studio/Projects/tools/rsa_pss_sign.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash SIGOPT=rsa_padding_mode:pss SIGOPT2=rsa_pss_saltlen:-1 diff --git a/IDE/Renesas/e2studio/RA6M3/README_APRA6M_en.md b/IDE/Renesas/e2studio/RA6M3/README_APRA6M_en.md index 0a68c65656..43bf3b91d1 100644 --- a/IDE/Renesas/e2studio/RA6M3/README_APRA6M_en.md +++ b/IDE/Renesas/e2studio/RA6M3/README_APRA6M_en.md @@ -84,9 +84,9 @@ The following steps explain how to generate the missing files and where to place (Click the drop-down arrow to the left of the project name.) + Select and Copy the following folders/files inside dummy_library - `ra/` - `ra_gen/` - `ra_cfg/` + `ra/` + `ra_gen/` + `ra_cfg/` `script/` + Paste the copied folders/files into wolfSSL_RA6M3G @@ -108,7 +108,7 @@ The following steps explain how to generate the missing files and where to place + Select and Copy the following folder inside dummy_app - `src/` + `src/` `script/` + Paste the copied folders into `./IDE/Renesas/e2studio/RA6M3/common/ra6m3g/` @@ -132,17 +132,17 @@ Right-Click each Project and select Build. ### Run wolfCrypt Test and Benchmark -1.) Right-Click the Project name. -2.) Select `Debug As` -> `Renesas GDB Hardware Debugging` -3.) Select J-Link ARM. Click OK. +1.) Right-Click the Project name. +2.) Select `Debug As` -> `Renesas GDB Hardware Debugging` +3.) Select J-Link ARM. Click OK. 4.) Select R7Fa6M3AH. Click OK. ### Run the wolfSSL TLS Server Example. -1.) Right-Click the Project name. -2.) Select `Debug As` -> `Renesas GDB Hardware Debugging` -3.) Select J-Link ARM. Click OK. -4.) Select R7Fa6M3AH. Click OK. +1.) Right-Click the Project name. +2.) Select `Debug As` -> `Renesas GDB Hardware Debugging` +3.) Select J-Link ARM. Click OK. +4.) Select R7Fa6M3AH. Click OK. 5.) Run the following wolfSSL example client command inside the base of the wolfssl directory. ``` diff --git a/IDE/Renesas/e2studio/RA6M3/README_APRA6M_jp.md b/IDE/Renesas/e2studio/RA6M3/README_APRA6M_jp.md index d3dc23a96c..93a5437115 100644 --- a/IDE/Renesas/e2studio/RA6M3/README_APRA6M_jp.md +++ b/IDE/Renesas/e2studio/RA6M3/README_APRA6M_jp.md @@ -83,9 +83,9 @@ wolfSSL のプロジェクトファイルは、wolfSSL と wolfCrypt の両方 プロジェクト名横にある矢印マークをクリック + `dummy_library` の以下のフォルダーとファイルを選択 - `ra/` - `ra_gen/` - `ra_cfg/` + `ra/` + `ra_gen/` + `ra_cfg/` `script/` + 選択したフォルダーとファイルを `wolfSSL_RA6M3G`プロジェクトに貼り付け @@ -110,7 +110,7 @@ wolfSSL のプロジェクトファイルは、wolfSSL と wolfCrypt の両方 + `dummy_app`の以下のフォルダーをコピー - `src/` + `src/` `script/` + 選択したフォルダーを`./IDE/Renesas/e2studio/RA6M3/common/ra6m3g/`へコピー diff --git a/IDE/Renesas/e2studio/RA6M3/benchmark-wolfcrypt/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3/benchmark-wolfcrypt/src/wolfssl_thread_entry.c index 0a850be473..cf7f270612 100644 --- a/IDE/Renesas/e2studio/RA6M3/benchmark-wolfcrypt/src/wolfssl_thread_entry.c +++ b/IDE/Renesas/e2studio/RA6M3/benchmark-wolfcrypt/src/wolfssl_thread_entry.c @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/client-wolfssl/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3/client-wolfssl/src/wolfssl_thread_entry.c index 5bc8e55ece..5ba72ce492 100644 --- a/IDE/Renesas/e2studio/RA6M3/client-wolfssl/src/wolfssl_thread_entry.c +++ b/IDE/Renesas/e2studio/RA6M3/client-wolfssl/src/wolfssl_thread_entry.c @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/client-wolfssl/wolfssl_thread_entry.h b/IDE/Renesas/e2studio/RA6M3/client-wolfssl/wolfssl_thread_entry.h index 701e4bd4bb..d1f7e0f8cc 100644 --- a/IDE/Renesas/e2studio/RA6M3/client-wolfssl/wolfssl_thread_entry.h +++ b/IDE/Renesas/e2studio/RA6M3/client-wolfssl/wolfssl_thread_entry.h @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/common/src/freertos_tcp_port.c b/IDE/Renesas/e2studio/RA6M3/common/src/freertos_tcp_port.c index c45d550417..faf154dc13 100644 --- a/IDE/Renesas/e2studio/RA6M3/common/src/freertos_tcp_port.c +++ b/IDE/Renesas/e2studio/RA6M3/common/src/freertos_tcp_port.c @@ -1,6 +1,6 @@ /* freertos_tcp_port.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/common/user_settings.h b/IDE/Renesas/e2studio/RA6M3/common/user_settings.h index 78f7cf86a8..a2869400f2 100644 --- a/IDE/Renesas/e2studio/RA6M3/common/user_settings.h +++ b/IDE/Renesas/e2studio/RA6M3/common/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -50,7 +50,6 @@ #define HAVE_CHACHA #define HAVE_POLY1305 #define HAVE_ECC -#define HAVE_RSA #define HAVE_SHA256 #define HAVE_SUPPORTED_CURVES #define HAVE_TLS_EXTENSIONS diff --git a/IDE/Renesas/e2studio/RA6M3/common/util.h b/IDE/Renesas/e2studio/RA6M3/common/util.h index 036d4627d0..57eaf767b7 100644 --- a/IDE/Renesas/e2studio/RA6M3/common/util.h +++ b/IDE/Renesas/e2studio/RA6M3/common/util.h @@ -1,6 +1,6 @@ /* util.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/server-wolfssl/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3/server-wolfssl/src/wolfssl_thread_entry.c index 03179846ba..47808cb423 100644 --- a/IDE/Renesas/e2studio/RA6M3/server-wolfssl/src/wolfssl_thread_entry.c +++ b/IDE/Renesas/e2studio/RA6M3/server-wolfssl/src/wolfssl_thread_entry.c @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/server-wolfssl/wolfssl_thread_entry.h b/IDE/Renesas/e2studio/RA6M3/server-wolfssl/wolfssl_thread_entry.h index 0907433e6d..7720180f1b 100644 --- a/IDE/Renesas/e2studio/RA6M3/server-wolfssl/wolfssl_thread_entry.h +++ b/IDE/Renesas/e2studio/RA6M3/server-wolfssl/wolfssl_thread_entry.h @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/test-wolfcrypt/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3/test-wolfcrypt/src/wolfssl_thread_entry.c index e7e4cb6ffe..454f5744a5 100644 --- a/IDE/Renesas/e2studio/RA6M3/test-wolfcrypt/src/wolfssl_thread_entry.c +++ b/IDE/Renesas/e2studio/RA6M3/test-wolfcrypt/src/wolfssl_thread_entry.c @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M4/README.md b/IDE/Renesas/e2studio/RA6M4/README.md index 4ce63ab332..b93879d986 100644 --- a/IDE/Renesas/e2studio/RA6M4/README.md +++ b/IDE/Renesas/e2studio/RA6M4/README.md @@ -4,13 +4,13 @@ wolfSSL for Renesas RA Evaluation Kit (EK-RA6M4) ## Description This directory contains e2studio projects targeted at the Renesas RA 32-bit MCUs. -The example projects include a wolfSSL TLS client. +The example projects include a wolfSSL TLS client. They also include benchmark and cryptography tests for the wolfCrypt library. The wolfssl project contains both the wolfSSL and wolfCrypt libraries. It is built as a `Renesas RA C Library Project` and contains the Renesas RA -configuration. The wolfssl project uses `Secure Cryptography Engine on RA6 Protected Mode` +configuration. The wolfssl project uses `Secure Cryptography Engine on RA6 Protected Mode` as hardware acceleration for cypto and TLS operation. @@ -24,27 +24,29 @@ The wolfssl Project Summary is listed below and is relevant for every project. |Board|EK-RA6M4| |Device|R7FA6M4AF3CFB| |Toolchain|GCC ARM Embedded| -|FSP Version|3.5.0| +|FSP Version|5.4.0| #### Selected software components |Components|Version| |:--|:--| -|Board Support Package Common Files|v3.6.0| -|Secure Cryptography Engine on RA6 Protected Mode|v3.6.0| -|I/O Port|v3.6.0| -|Arm CMSIS Version 5 - Core (M)|v5.8.0+fsp.3.6.0| -|RA6M4-EK Board Support Files|v3.5.0| -|Board support package for R7FA6M4AF3CFB|v3.6.0| -|Board support package for RA6M4|v3.6.0| -|Board support package for RA6M4 - FSP Data|v3.6.0| -|FreeRTOS|v10.4.3-LTS.Patch.2+fsp.3.6.0| -|FreeRTOS - Memory Management - Heap 4|v10.4.3-LTS.Patch.2+fsp.3.6.0| -|r_ether to FreeRTOS+TCP Wrapper|v3.6.0| -|Ethernet|v3.6.0| -|Ethernet PHY|v3.6.0| -|FreeRTOS+TCP|v2.3.2-LTS.Patch.1+fsp.3.6.0| -|FreeRTOS - Buffer Allocation 2|v2.3.2-LTS.Patch.1+fsp.3.6.0| +|Board Support Package Common Files|v5.4.0| +|Secure Cryptography Engine on RA6 Protected Mode|v5.4.0| +|I/O Port|v5.4.0| +|Arm CMSIS Version 5 - Core (M)|v6.1.0+fsp.5.4.0| +|RA6M4-EK Board Support Files|v5.4.0| +|Board support package for R7FA6M4AF3CFB|v5.4.0| +|Board support package for RA6M4 - Events|v5.4.0| +|Board support package for RA6M4|v5.4.0| +|Board support package for RA6M4 - FSP Data|v5.4.0| +|FreeRTOS|v10.6.1+fsp.5.4.0| +|FreeRTOS - Memory Management - Heap 4|v10.6.1+fsp.5.4.0| +|r_ether to FreeRTOS+TCP Wrapper|v5.4.0| +|Ethernet|v5.4.0| +|Ethernet PHY|v5.4.0| +|FreeRTOS+TCP|v4.0.0+fsp.5.4.0| +|FreeRTOS - Buffer Allocation 2|v4.0.0+fsp.5.4.0| +|FreeRTOS Port|v5.4.0| ## Setup Steps and Build wolfSSL Library @@ -85,7 +87,7 @@ The wolfssl Project Summary is listed below and is relevant for every project. |:--|:--| |Network Events call vApplicationIPNetworkEventHook|Disable| |Use DHCP|Disable| - + + Save `dummy_library` FSP configuration + Copy configuration.xml and pincfg under `dummy_library` to `wolfSSL_RA6M4` + Open Smart Configurator by clicking copied configuration.xml @@ -105,7 +107,7 @@ The wolfssl Project Summary is listed below and is relevant for every project. + Copy the following folder and file at `dummy_application` to `test_RA6M4`\ script/\ src/sce_tst_thread_entry.c - + + Add `sce_test()` call under /* TODO: add your own code here */ line at sce_tst_thread_entry.c ``` ... @@ -119,7 +121,7 @@ The wolfssl Project Summary is listed below and is relevant for every project. + Download J-Link software from [Segger](https://www.segger.com/downloads/jlink) + Choose `J-Link Software and Documentation Pack` + Copy sample program files below from `Installed SEGGER` folder, `e.g C:\Program Files\SEGGER\JLink\Samples\RTT`, to /path/to/wolfssl/IDE/Reenesas/e2studio/RA6M4/test/src/SEGGER_RTT\ - + SEGGER_RTT.c\ SEGGER_RTT.h\ SEGGER_RTT_Conf.h\ @@ -134,7 +136,7 @@ The wolfssl Project Summary is listed below and is relevant for every project. you can specify "RTT control block" to 0x200232a8 by Address\ OR\ you can specify "RTT control block" to 0x20020000 0x10000 by Search Range - + ## Run Client 1.) Enable TLS_CLIENT definition in wolfssl_demo.h of test_RA6M4 project @@ -175,7 +177,7 @@ $./examples/server/server -b -d -i -c ./certs/server-ecc.pem -k ./certs/ecc-key. You will see the following message on J-LinK RTT Viewer when using RSA sign and verify. ``` - Start Client Example, + Start Client Example, Connecting to 192.168.11.xx [wolfSSL_TLS_client_do(00)][00] Start to connect to the server. @@ -204,7 +206,7 @@ You will see the following message on J-LinK RTT Viewer when using RSA sign and You will see the following message on J-LinK RTT Viewer when using ECDSA sign and verify. ``` - Start Client Example, + Start Client Example, Connecting to 192.168.11.xx [wolfSSL_TLS_client_do(00)][00] Start to connect to the server. @@ -235,7 +237,7 @@ You will see the following message on J-LinK RTT Viewer when using ECDSA sign an ### Run Multi Client Session example 1.) Enable TLS_CLIENT and TLS_MULTITHREAD_TEST definition in wolfssl_demo.h of test_RA6M4 project -2.) Follow [Run Client](#run-client) instruction +2.) Follow [Run Client](#run-client) instruction 3.) Prepare peer wolfssl server @@ -258,7 +260,7 @@ $./examples/server/server -b -d -c -i ./certs/server-ecc.pem -k ./certs/ecc-key. 4.) Run Multi Client Session Example You will see similar following message on J-LinK RTT Viewer when using ECDSA sign and verify. ``` - Start Client Example, + Start Client Example, Connecting to 192.168.11.xx clt_thd_taskA connecting to 11111 port @@ -291,7 +293,7 @@ You will see similar following message on J-LinK RTT Viewer when using ECDSA sig You will see similar following message on J-LinK RTT Viewer when using ECDSA sign and verify. ``` - Start Client Example, + Start Client Example, Connecting to 192.168.11.xx clt_thd_taskA connecting to 11111 port diff --git a/IDE/Renesas/e2studio/RA6M4/common/user_settings.h b/IDE/Renesas/e2studio/RA6M4/common/user_settings.h index 485415317c..6f40f37f22 100644 --- a/IDE/Renesas/e2studio/RA6M4/common/user_settings.h +++ b/IDE/Renesas/e2studio/RA6M4/common/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M4/common/wolfssl_demo.h b/IDE/Renesas/e2studio/RA6M4/common/wolfssl_demo.h index dd56fc1e7f..cbe535b2ab 100644 --- a/IDE/Renesas/e2studio/RA6M4/common/wolfssl_demo.h +++ b/IDE/Renesas/e2studio/RA6M4/common/wolfssl_demo.h @@ -1,6 +1,6 @@ /* wolfssl_demo.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M4/include.am b/IDE/Renesas/e2studio/RA6M4/include.am index cd8adec9c3..db3f280f3e 100644 --- a/IDE/Renesas/e2studio/RA6M4/include.am +++ b/IDE/Renesas/e2studio/RA6M4/include.am @@ -16,4 +16,4 @@ EXTRA_DIST+= IDE/Renesas/e2studio/RA6M4/test/src/common/.gitignore EXTRA_DIST+= IDE/Renesas/e2studio/RA6M4/test/key_data/key_data_sce.c EXTRA_DIST+= IDE/Renesas/e2studio/RA6M4/test/key_data/key_data.h EXTRA_DIST+= IDE/Renesas/e2studio/RA6M4/common/wolfssl_demo.h -EXTRA_DIST+= IDE/Renesas/e2studio/RA6M4/common/user_settings.h \ No newline at end of file +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M4/common/user_settings.h diff --git a/IDE/Renesas/e2studio/RA6M4/test/key_data/key_data_sce.c b/IDE/Renesas/e2studio/RA6M4/test/key_data/key_data_sce.c index 41fb29c07a..5ab5c2656e 100644 --- a/IDE/Renesas/e2studio/RA6M4/test/key_data/key_data_sce.c +++ b/IDE/Renesas/e2studio/RA6M4/test/key_data/key_data_sce.c @@ -1,6 +1,6 @@ /* key_data.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -28,112 +28,112 @@ const st_user_key_block_data_t g_key_block_data = { /* uint8_t encrypted_provisioning_key[R_TSIP_AES_CBC_IV_BYTE_SIZE * 2]; */ { - 0xE7, 0x1C, 0xEB, 0xCA, 0x3A, 0x64, 0x0B, 0xD2, 0xC5, 0xB8, 0xF2, 0xD0, - 0xF7, 0x1B, 0xA9, 0x4A, 0x98, 0xFF, 0xF3, 0x48, 0x81, 0xAD, 0xAF, 0x63, + 0xE7, 0x1C, 0xEB, 0xCA, 0x3A, 0x64, 0x0B, 0xD2, 0xC5, 0xB8, 0xF2, 0xD0, + 0xF7, 0x1B, 0xA9, 0x4A, 0x98, 0xFF, 0xF3, 0x48, 0x81, 0xAD, 0xAF, 0x63, 0x19, 0x24, 0x4B, 0x2B, 0xC0, 0x8B, 0x9C, 0x6B }, /* uint8_t iv[R_TSIP_AES_CBC_IV_BYTE_SIZE]; */ { - 0xD7, 0x97, 0x56, 0x82, 0x5B, 0x4B, 0x7F, 0xB2, 0x1C, 0x1F, 0xEE, 0x85, + 0xD7, 0x97, 0x56, 0x82, 0x5B, 0x4B, 0x7F, 0xB2, 0x1C, 0x1F, 0xEE, 0x85, 0x02, 0xC5, 0xD0, 0xBA }, /* uint8_t encrypted_user_rsa2048_ne_key[R_TSIP_RSA2048_NE_KEY_BYTE_SIZE + 16]; */ { - 0x3F, 0xA5, 0xBE, 0xBF, 0x86, 0xEC, 0x23, 0x37, 0x82, 0x37, 0x71, 0x0C, - 0x83, 0xA7, 0x8E, 0x86, 0xF0, 0x16, 0xD3, 0x7B, 0xF1, 0x25, 0xA4, 0x37, - 0x7A, 0x2D, 0x16, 0xF2, 0xFF, 0x3D, 0xEE, 0x46, 0xE0, 0x05, 0x58, 0x56, + 0x3F, 0xA5, 0xBE, 0xBF, 0x86, 0xEC, 0x23, 0x37, 0x82, 0x37, 0x71, 0x0C, + 0x83, 0xA7, 0x8E, 0x86, 0xF0, 0x16, 0xD3, 0x7B, 0xF1, 0x25, 0xA4, 0x37, + 0x7A, 0x2D, 0x16, 0xF2, 0xFF, 0x3D, 0xEE, 0x46, 0xE0, 0x05, 0x58, 0x56, 0xC2, 0xE7, 0x9D, 0x2C, 0x01, 0x84, 0x59, 0x8E, 0xA8, 0x9E, 0xEE, 0x3F, 0x22, 0x83, 0x68, 0xDA, 0x9E, 0xCE, 0xEA, 0x99, 0xFD, 0xAF, 0xDF, 0x67, - 0x1E, 0x73, 0x25, 0x68, 0xBF, 0x0A, 0xDF, 0xAF, 0xC4, 0x3D, 0xF1, 0xBD, - 0x41, 0xF5, 0xAC, 0xAC, 0xA4, 0x36, 0xF8, 0x96, 0xC0, 0x8C, 0x2F, 0x1A, + 0x1E, 0x73, 0x25, 0x68, 0xBF, 0x0A, 0xDF, 0xAF, 0xC4, 0x3D, 0xF1, 0xBD, + 0x41, 0xF5, 0xAC, 0xAC, 0xA4, 0x36, 0xF8, 0x96, 0xC0, 0x8C, 0x2F, 0x1A, 0x79, 0x75, 0x28, 0xAE, 0x67, 0xC9, 0x5A, 0xDE, 0x2A, 0xB4, 0x99, 0xDB, - 0x8C, 0x25, 0x53, 0x58, 0x8C, 0xDC, 0xA8, 0x0D, 0xFE, 0xEE, 0x0F, 0x6C, - 0x61, 0xE6, 0x43, 0x66, 0xE8, 0x4A, 0xE3, 0xEB, 0xAB, 0xA2, 0x52, 0xE4, - 0x67, 0xC2, 0x9A, 0x57, 0xA4, 0x1F, 0xE0, 0xFC, 0x2B, 0xBE, 0x25, 0xBF, + 0x8C, 0x25, 0x53, 0x58, 0x8C, 0xDC, 0xA8, 0x0D, 0xFE, 0xEE, 0x0F, 0x6C, + 0x61, 0xE6, 0x43, 0x66, 0xE8, 0x4A, 0xE3, 0xEB, 0xAB, 0xA2, 0x52, 0xE4, + 0x67, 0xC2, 0x9A, 0x57, 0xA4, 0x1F, 0xE0, 0xFC, 0x2B, 0xBE, 0x25, 0xBF, 0xF0, 0x70, 0x18, 0x88, 0x93, 0xB7, 0x2F, 0x74, 0xF8, 0xF3, 0x88, 0xB8, - 0xFA, 0x18, 0xBE, 0xC1, 0xB2, 0x24, 0x4B, 0xBC, 0x89, 0x2D, 0xC4, 0x02, - 0xB3, 0x82, 0xEC, 0xDB, 0xC9, 0xF0, 0xA9, 0xC3, 0x30, 0x7C, 0xF5, 0x15, - 0xEB, 0x9B, 0x16, 0x8C, 0x9D, 0xEF, 0x42, 0x8A, 0xCA, 0x5D, 0x28, 0xDF, + 0xFA, 0x18, 0xBE, 0xC1, 0xB2, 0x24, 0x4B, 0xBC, 0x89, 0x2D, 0xC4, 0x02, + 0xB3, 0x82, 0xEC, 0xDB, 0xC9, 0xF0, 0xA9, 0xC3, 0x30, 0x7C, 0xF5, 0x15, + 0xEB, 0x9B, 0x16, 0x8C, 0x9D, 0xEF, 0x42, 0x8A, 0xCA, 0x5D, 0x28, 0xDF, 0x68, 0xEA, 0xE0, 0xB8, 0x76, 0x7C, 0xBB, 0x4A, 0x51, 0xDD, 0x55, 0x14, - 0xB7, 0xAB, 0xD2, 0xF1, 0xB9, 0x51, 0x19, 0x05, 0x26, 0x87, 0xF7, 0x5C, - 0x69, 0x45, 0x3C, 0x82, 0xE8, 0x82, 0x05, 0x5D, 0x33, 0x8E, 0xD1, 0x42, - 0x71, 0xD6, 0x96, 0xDA, 0xAB, 0xB8, 0xC0, 0x0F, 0xF7, 0x85, 0x8A, 0x12, + 0xB7, 0xAB, 0xD2, 0xF1, 0xB9, 0x51, 0x19, 0x05, 0x26, 0x87, 0xF7, 0x5C, + 0x69, 0x45, 0x3C, 0x82, 0xE8, 0x82, 0x05, 0x5D, 0x33, 0x8E, 0xD1, 0x42, + 0x71, 0xD6, 0x96, 0xDA, 0xAB, 0xB8, 0xC0, 0x0F, 0xF7, 0x85, 0x8A, 0x12, 0xEF, 0xB9, 0x53, 0xFF, 0xD2, 0x95, 0x18, 0x2F, 0x0C, 0xA6, 0x72, 0x98, - 0xC3, 0xC6, 0x9B, 0x95, 0x70, 0x69, 0xC5, 0xB7, 0xD5, 0x24, 0x77, 0x05, - 0xD0, 0x68, 0x85, 0x36, 0xB8, 0x57, 0xE3, 0xED, 0x2E, 0x4D, 0x95, 0xD3, - 0xFC, 0x24, 0x1B, 0x22, 0xFA, 0x43, 0xD8, 0x62, 0x28, 0x57, 0x6B, 0x34, + 0xC3, 0xC6, 0x9B, 0x95, 0x70, 0x69, 0xC5, 0xB7, 0xD5, 0x24, 0x77, 0x05, + 0xD0, 0x68, 0x85, 0x36, 0xB8, 0x57, 0xE3, 0xED, 0x2E, 0x4D, 0x95, 0xD3, + 0xFC, 0x24, 0x1B, 0x22, 0xFA, 0x43, 0xD8, 0x62, 0x28, 0x57, 0x6B, 0x34, 0xBF, 0xD1, 0x63, 0x4B, 0xB5, 0xF5, 0x88, 0xBC, 0xB8, 0x69, 0xF3, 0xB5 }, }; #ifndef USE_CERT_BUFFERS_256 -/* ca-cert.der.sign, - * ca-cert.der signed by RSA2048 PSS with SHA256 +/* ca-cert.der.sign, + * ca-cert.der signed by RSA2048 PSS with SHA256 * This is used for Root Certificate verify by SCE */ const unsigned char ca_cert_der_sign[] = { - 0x70, 0x4D, 0x6C, 0xCC, 0xAD, 0xD0, 0x74, 0x34, 0x10, 0xB3, - 0x1F, 0x26, 0x49, 0x31, 0xD0, 0xD5, 0x0B, 0x4F, 0x50, 0xD4, - 0x21, 0x7D, 0x3D, 0xE6, 0x9D, 0x5A, 0xF1, 0xE4, 0x48, 0xBD, - 0x6D, 0xB3, 0x58, 0xB4, 0x07, 0xF1, 0x06, 0xA7, 0x3D, 0xB7, - 0x24, 0x60, 0xBD, 0x72, 0xB2, 0x7B, 0xA8, 0x4F, 0xFC, 0x47, - 0x64, 0xF0, 0x04, 0xBE, 0xC7, 0xAE, 0xB6, 0x6F, 0xA5, 0xD6, - 0x65, 0xE9, 0xB5, 0x3D, 0x8A, 0xC8, 0x27, 0x9A, 0x3B, 0x4C, - 0x98, 0xB0, 0x5F, 0x1E, 0x54, 0xA5, 0xEF, 0xBC, 0x61, 0xA7, - 0x3F, 0xB7, 0x5D, 0x36, 0x5A, 0x27, 0x1C, 0x5A, 0xAF, 0x65, - 0x7A, 0x89, 0x4F, 0x00, 0xB1, 0x75, 0xA7, 0xA9, 0x5C, 0xE8, - 0xC8, 0x0E, 0x5C, 0x83, 0x12, 0x47, 0x11, 0xD1, 0xBD, 0xF4, - 0x10, 0x7D, 0x7B, 0xD6, 0x05, 0xF7, 0xBE, 0xD2, 0x70, 0x05, - 0x56, 0xD6, 0x84, 0x70, 0x11, 0x3D, 0x67, 0x93, 0x2E, 0xB0, - 0x93, 0xBA, 0x34, 0xD0, 0xDE, 0xB8, 0x16, 0x7B, 0x0D, 0x67, - 0x16, 0x92, 0x91, 0x79, 0xAC, 0x3C, 0xC9, 0x4D, 0x8A, 0xEE, - 0x31, 0xCC, 0xFC, 0xF7, 0x78, 0xB3, 0x1B, 0x0F, 0x54, 0xCE, - 0xF4, 0xBB, 0xE7, 0xF4, 0xAC, 0x80, 0xEF, 0xDD, 0xFF, 0x84, - 0x7A, 0x37, 0xED, 0xC4, 0x45, 0x3D, 0x7C, 0x19, 0x81, 0x95, - 0x2E, 0x71, 0xE7, 0x1B, 0x1C, 0x75, 0x67, 0xBC, 0x62, 0x0F, - 0xAA, 0x90, 0x41, 0x01, 0x53, 0xD0, 0x3A, 0x6E, 0xE9, 0xC9, - 0xAA, 0x2F, 0xD1, 0xD8, 0xB3, 0x3B, 0x80, 0xCA, 0xE5, 0xA1, - 0x1B, 0x7F, 0xCF, 0xF5, 0xBF, 0x2C, 0x2B, 0xBE, 0x1F, 0x77, - 0x89, 0x21, 0xD7, 0x76, 0x51, 0xA8, 0xD0, 0x31, 0xE1, 0x97, - 0xD1, 0x63, 0x84, 0xA2, 0xAA, 0x6E, 0x9A, 0x33, 0x43, 0x65, - 0x2A, 0x6B, 0x40, 0x03, 0x84, 0x6F, 0xC7, 0xB3, 0xE5, 0xD8, - 0x64, 0x30, 0x12, 0x2A, 0x45, 0x1D + 0x42, 0xDC, 0x1F, 0xF5, 0x71, 0x54, 0x13, 0xB5, 0x86, 0x30, + 0x34, 0xF3, 0x04, 0x50, 0x69, 0x50, 0x6C, 0x94, 0x05, 0x60, + 0xC6, 0x34, 0x12, 0xCC, 0xA1, 0x68, 0x56, 0x1F, 0x54, 0x4D, + 0x6C, 0x3E, 0xCB, 0xFB, 0xEB, 0xEF, 0x4E, 0xCF, 0xA8, 0xB0, + 0xA7, 0xDE, 0xAD, 0x64, 0xBA, 0xB8, 0xE5, 0x0C, 0x97, 0x31, + 0x16, 0xEE, 0xF7, 0x73, 0xCC, 0xAF, 0x54, 0x20, 0xE1, 0xFF, + 0xF7, 0x94, 0x6D, 0x7B, 0xC7, 0x83, 0xA3, 0xE5, 0xF6, 0x01, + 0xA1, 0xA7, 0x90, 0xF1, 0x3D, 0xCE, 0x95, 0xD8, 0x15, 0x29, + 0x7A, 0x6C, 0xC1, 0x43, 0xB8, 0x29, 0x30, 0xC9, 0x38, 0x36, + 0x85, 0x03, 0x23, 0x3D, 0xAE, 0x40, 0xAA, 0x0A, 0x38, 0xF8, + 0x06, 0xDB, 0xA5, 0x7B, 0xBF, 0x72, 0x12, 0xD7, 0xB1, 0x35, + 0x82, 0x47, 0xA8, 0x9E, 0xCB, 0xFF, 0xD1, 0x34, 0xA2, 0x15, + 0xBB, 0xC8, 0x35, 0xE7, 0x91, 0x58, 0x52, 0xD8, 0xA6, 0x9F, + 0x1D, 0x68, 0xD2, 0x92, 0x0E, 0xAD, 0x42, 0xB9, 0xE5, 0x72, + 0xE9, 0x3B, 0x24, 0xF2, 0x05, 0xEA, 0x9F, 0xAD, 0x07, 0xE0, + 0xD8, 0x40, 0x33, 0x7D, 0x1C, 0x8C, 0x71, 0x7E, 0x37, 0x22, + 0x1B, 0x13, 0x27, 0xE5, 0xBC, 0x6E, 0x6E, 0x6A, 0xE5, 0x66, + 0x4C, 0xAB, 0x74, 0x74, 0x12, 0xE4, 0x12, 0x36, 0xD5, 0xB0, + 0x56, 0x0E, 0x79, 0xFB, 0x56, 0xA0, 0x09, 0x4B, 0xBD, 0xE0, + 0xF5, 0x75, 0x0E, 0xA1, 0xB1, 0xDC, 0xA6, 0xC5, 0x0B, 0x7E, + 0x79, 0x83, 0xD5, 0xCE, 0x2A, 0xB3, 0x2C, 0xE8, 0x49, 0xDE, + 0x18, 0xB2, 0x50, 0x58, 0x58, 0x2E, 0x31, 0xAD, 0xF1, 0x25, + 0x71, 0xD2, 0x74, 0xA1, 0xC8, 0x1C, 0xF6, 0xF7, 0xE6, 0xDA, + 0xA3, 0x9F, 0x32, 0x5A, 0xA0, 0xBC, 0x1D, 0x13, 0xAC, 0x9C, + 0x41, 0x97, 0xDB, 0xA4, 0xF4, 0xE2, 0xE4, 0x28, 0xD3, 0x30, + 0xC3, 0x14, 0xF2, 0xB0, 0xBF, 0x94 }; const int sizeof_ca_cert_der_sign = sizeof(ca_cert_der_sign); #else -/* ca-ecc-cert.der.sign, - * ca-ecc-cert.der signed by RSA2048 PSS with SHA256 +/* ca-ecc-cert.der.sign, + * ca-ecc-cert.der signed by RSA2048 PSS with SHA256 * This is used for Root Certificate verify by SCE */ const unsigned char ca_ecc_cert_der_sign[] = { - 0xB9, 0x59, 0x94, 0xE6, 0xD1, 0x5B, 0xFD, 0x59, 0xBB, 0x4F, - 0x14, 0x0B, 0x9E, 0x30, 0x61, 0xF9, 0xFA, 0x2C, 0xD8, 0xE2, - 0x7F, 0xD0, 0x1F, 0x47, 0xDE, 0x14, 0x8E, 0xD1, 0x78, 0x86, - 0xA4, 0x9B, 0xDC, 0x86, 0x64, 0x2A, 0xD9, 0xBC, 0xBE, 0x61, - 0x60, 0xB8, 0x1C, 0x46, 0xCE, 0x66, 0x97, 0xC0, 0x32, 0x04, - 0x38, 0x3B, 0xCB, 0xB7, 0x38, 0x89, 0x11, 0xCE, 0xBA, 0x64, - 0xE1, 0xDD, 0x4E, 0x3C, 0x6F, 0xA0, 0x48, 0xFA, 0x9F, 0x8F, - 0xEC, 0x6A, 0xCA, 0xAC, 0x29, 0x4B, 0xD9, 0xF7, 0xE3, 0x03, - 0xF7, 0xBA, 0xB8, 0xCC, 0x2C, 0xD1, 0xC8, 0x84, 0xFA, 0xF6, - 0xFA, 0xE4, 0x72, 0xAF, 0x8D, 0x07, 0xF0, 0x3D, 0xD7, 0x58, - 0x95, 0x08, 0x6F, 0xD5, 0x77, 0x1B, 0x92, 0x81, 0x99, 0x69, - 0x5C, 0x4D, 0x8F, 0x98, 0xC6, 0x09, 0xC1, 0xEB, 0xB5, 0x86, - 0x87, 0x47, 0xD7, 0x68, 0x73, 0xE8, 0x1D, 0x1B, 0xFE, 0xA5, - 0x9C, 0x7A, 0x4B, 0xAD, 0x1A, 0x54, 0x46, 0xA0, 0xC8, 0xF7, - 0x6C, 0xDD, 0xA6, 0xEF, 0x16, 0x21, 0x18, 0xCE, 0xF8, 0xDE, - 0x3D, 0xB4, 0x56, 0x0C, 0xBA, 0xB7, 0x95, 0xD1, 0x6D, 0x0D, - 0x49, 0xE7, 0x78, 0x64, 0x65, 0xC7, 0x24, 0x26, 0x81, 0xCD, - 0x56, 0xB7, 0xB2, 0x31, 0xF2, 0xD7, 0x64, 0x55, 0x89, 0xCC, - 0xDB, 0x69, 0x56, 0xED, 0x9B, 0x07, 0x9E, 0xD4, 0x07, 0x5E, - 0xAF, 0xF0, 0x98, 0x94, 0xD6, 0x87, 0x0C, 0x22, 0xE1, 0x3A, - 0x88, 0xE1, 0xC4, 0xBC, 0x51, 0x4B, 0x07, 0x4D, 0x2A, 0xCE, - 0xA8, 0xE8, 0x9F, 0xF7, 0xA2, 0x8A, 0xEA, 0x90, 0x32, 0x20, - 0xFC, 0xB6, 0x32, 0xE6, 0x8A, 0x47, 0x2B, 0xF4, 0xB4, 0x0F, - 0x96, 0x7A, 0xC9, 0x0B, 0xF6, 0xBF, 0x69, 0x51, 0x9B, 0x44, - 0xC2, 0xE2, 0xD6, 0x2D, 0xB1, 0x17, 0xAC, 0x7B, 0x32, 0xF2, - 0x0E, 0x7A, 0x28, 0x67, 0xAB, 0xA5 + 0x34, 0x5E, 0xA6, 0xED, 0xA7, 0x19, 0xC1, 0x57, 0x3F, 0x89, + 0x71, 0xEC, 0xA0, 0x26, 0x94, 0x67, 0xFF, 0x2A, 0xE3, 0x88, + 0xAF, 0xD5, 0xD8, 0x7A, 0x23, 0x9D, 0xD5, 0x4A, 0x11, 0x0D, + 0x28, 0xB7, 0x00, 0xB3, 0xC9, 0xD9, 0x5C, 0xAD, 0xB0, 0x5C, + 0xD6, 0xFF, 0xD5, 0x98, 0x9A, 0x3D, 0xFC, 0xC2, 0x1A, 0xC8, + 0x9C, 0x17, 0x60, 0xD7, 0xA8, 0x10, 0x62, 0x56, 0x87, 0xD7, + 0x95, 0x71, 0xE5, 0xC8, 0x65, 0xA9, 0x16, 0xC0, 0x21, 0x08, + 0x31, 0x51, 0xED, 0x51, 0x02, 0xED, 0x1C, 0x8A, 0xEA, 0x82, + 0x93, 0x0E, 0x9C, 0xBD, 0x25, 0x1B, 0xD7, 0x91, 0x12, 0xC1, + 0x49, 0xC5, 0x2E, 0x1D, 0x04, 0x5D, 0x60, 0x63, 0x68, 0xF3, + 0x5A, 0x18, 0x60, 0xF3, 0xD9, 0x88, 0x2C, 0xCC, 0x56, 0x49, + 0xA4, 0x07, 0x9C, 0xA7, 0x50, 0x36, 0x83, 0xFB, 0x39, 0x83, + 0x1F, 0xB9, 0x6B, 0x1F, 0x19, 0x2B, 0x4B, 0x6D, 0xEC, 0xC5, + 0xC5, 0x08, 0x8D, 0x38, 0x80, 0xEC, 0x8D, 0xC1, 0x8B, 0x74, + 0xC4, 0xD7, 0x60, 0xB4, 0x29, 0xA9, 0xE1, 0x2B, 0x98, 0xF6, + 0x9C, 0xFB, 0x73, 0x40, 0x80, 0xA8, 0x5D, 0x64, 0xDA, 0x12, + 0xE0, 0x43, 0x5B, 0xC9, 0x65, 0xB2, 0x76, 0x11, 0xB7, 0x06, + 0x0C, 0x81, 0x62, 0x18, 0xD3, 0x34, 0x0C, 0xAC, 0xD0, 0x61, + 0x98, 0x5A, 0x3E, 0x94, 0x6F, 0xAA, 0x51, 0xF2, 0x75, 0xF7, + 0xBE, 0x6C, 0xA8, 0xCB, 0xDC, 0xFD, 0x3C, 0x9C, 0xF3, 0x15, + 0xA5, 0x5B, 0x8A, 0x81, 0x11, 0x15, 0x50, 0x3D, 0x8B, 0xA9, + 0x3E, 0xD9, 0xAA, 0x22, 0x0B, 0xB5, 0x20, 0x83, 0x7C, 0xAF, + 0x74, 0x4C, 0x51, 0x60, 0x44, 0xC2, 0x04, 0xA0, 0xB2, 0x17, + 0x57, 0xE0, 0xEE, 0x63, 0x13, 0xBF, 0xEA, 0x21, 0x16, 0x4D, + 0x2D, 0xFB, 0x0D, 0x66, 0x66, 0x43, 0x1F, 0xAB, 0xFE, 0xE3, + 0x14, 0xAD, 0xE4, 0xE2, 0xEB, 0xBF }; static const int sizeof_ca_ecc_cert_der_sign = sizeof(ca_ecc_cert_der_sign); #endif /* USE_CERT_BUFFERS_256 */ diff --git a/IDE/Renesas/e2studio/RA6M4/test/src/SEGGER_RTT/myprint.c b/IDE/Renesas/e2studio/RA6M4/test/src/SEGGER_RTT/myprint.c index 4ff71d1548..eb025be711 100644 --- a/IDE/Renesas/e2studio/RA6M4/test/src/SEGGER_RTT/myprint.c +++ b/IDE/Renesas/e2studio/RA6M4/test/src/SEGGER_RTT/myprint.c @@ -1,6 +1,6 @@ /* myprintf.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M4/test/src/test_main.c b/IDE/Renesas/e2studio/RA6M4/test/src/test_main.c index e6dca444c7..199970e4a4 100644 --- a/IDE/Renesas/e2studio/RA6M4/test/src/test_main.c +++ b/IDE/Renesas/e2studio/RA6M4/test/src/test_main.c @@ -1,6 +1,6 @@ /* test_main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -100,9 +100,9 @@ static int SetScetlsKey() #endif -#endif +#endif return 0; -} +} #endif typedef struct func_args { @@ -142,8 +142,8 @@ void SCE_KeyGeneration(FSPSM_ST *g) if (err == FSP_SUCCESS) g->keyflgs_crypt.bits.aes256_installedkey_set = 1; } - - + + } void Clr_CallbackCtx(FSPSM_ST *g) @@ -151,17 +151,11 @@ void Clr_CallbackCtx(FSPSM_ST *g) (void) g; #if defined(WOLFSSL_RENESAS_SCEPROTECT_CRYPTONLY) - if (g->wrapped_key_rsapri2048 != NULL) - XFREE(g->wrapped_key_rsapri2048, - NULL, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(g->wrapped_key_rsapri2048, NULL, DYNAMIC_TYPE_TMP_BUFFER); - if (g->wrapped_key_rsapub2048 != NULL) - XFREE(g->wrapped_key_rsapub2048, - NULL, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(g->wrapped_key_rsapub2048, NULL, DYNAMIC_TYPE_TMP_BUFFER); - if (g->wrapped_key_rsapri1024 != NULL) - XFREE(g->wrapped_key_rsapri1024, - NULL, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(g->wrapped_key_rsapri1024, NULL, DYNAMIC_TYPE_TMP_BUFFER); if (g->wrapped_key_rsapub2048 != NULL) XFREE(g->wrapped_key_rsapub1024, @@ -245,7 +239,7 @@ void sce_test(void) if ((ret = wolfCrypt_Init()) != 0) { printf("wolfCrypt_Init failed %d\n", ret); } - + #if defined(HAVE_RENESAS_SYNC) && \ defined(HAVE_AES_CBC) @@ -267,14 +261,14 @@ void sce_test(void) printf("Start wolfCrypt Benchmark\n"); benchmark_test(NULL); printf("End wolfCrypt Benchmark\n"); - + /* free */ Clr_CallbackCtx(&guser_PKCbInfo); #elif defined(TLS_CLIENT) #include "hal_data.h" #include "r_sce.h" - + #if defined(WOLFSSL_TLS13) /* TLS1.3 needs RSA_PSS enabled. * SCE doesn't support RSA PSS Padding @@ -335,6 +329,7 @@ void sce_test(void) int j = 0; #endif int i = 0; + int ret = 0; printf("\n Start Client Example, "); printf("\n Connecting to %s\n\n", SERVER_IP); @@ -359,20 +354,20 @@ void sce_test(void) info[j].log_f = my_Logging_cb; memset(info[j].name, 0, sizeof(info[j].name)); - sprintf(info[j].name, "clt_thd_%s", ((j%2) == 0) ? + sprintf(info[j].name, "clt_thd_%s", ((j%2) == 0) ? "taskA" : "taskB"); printf(" %s connecting to %d port\n", info[j].name, info[j].port); - xReturned = xTaskCreate(wolfSSL_TLS_client_do, info[j].name, + xReturned = xTaskCreate(wolfSSL_TLS_client_do, info[j].name, THREAD_STACK_SIZE, &info[j], 2, NULL); if (xReturned != pdPASS) { printf("Failed to create task\n"); } } - + for(j = i; j < (i+2); j++) { - xSemaphoreGiveFromISR(info[j].xBinarySemaphore, + xSemaphoreGiveFromISR(info[j].xBinarySemaphore, &xHigherPriorityTaskWoken); } @@ -404,7 +399,8 @@ void sce_test(void) XMEMSET(info[i].name, 0, sizeof(info[i].name)); XSPRINTF(info[i].name, "wolfSSL_TLS_client_do(%02d)", i); - if(wolfSSL_TLS_client_do(&info[i]) == -116) { + ret = wolfSSL_TLS_client_do(&info[i]); + if(ret == -116 || ret == -128) { TCP_connect_retry++; continue; } diff --git a/IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c b/IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c index 5a920a250e..19c523f6c9 100644 --- a/IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c +++ b/IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c @@ -1,6 +1,6 @@ /* wolf_client.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -72,7 +72,7 @@ static int msg(const char* pname, int l, void TCPInit( ) { BaseType_t fr_status; - + /* FreeRTOS+TCP Ethernet and IP Setup */ fr_status = FreeRTOS_IPInit(ucIPAddress, ucNetMask, @@ -114,14 +114,14 @@ void wolfSSL_TLS_client_init() /* set callback functions for ECC */ wc_sce_set_callbacks(client_ctx); #endif - + #if !defined(NO_FILESYSTEM) if (wolfSSL_CTX_load_verify_locations(client_ctx, cert, 0) != SSL_SUCCESS) { printf("ERROR: can't load \"%s\"\n", cert); return NULL; } #else - if (wolfSSL_CTX_load_verify_buffer(client_ctx, cert, SIZEOF_CERT, + if (wolfSSL_CTX_load_verify_buffer(client_ctx, cert, SIZEOF_CERT, SSL_FILETYPE_ASN1) != SSL_SUCCESS){ printf("ERROR: can't load certificate data\n"); return; @@ -142,16 +142,16 @@ int wolfSSL_TLS_client_do(void *pvParam) socklen_t xSize = sizeof(struct freertos_sockaddr); xSocket_t xClientSocket = NULL; struct freertos_sockaddr xRemoteAddress; - + WOLFSSL_CTX *ctx = (WOLFSSL_CTX *)p->ctx; WOLFSSL *ssl = NULL; const char* pcName = p->name; #define BUFF_SIZE 256 static const char sendBuff[]= "Hello Server\n" ; - + char rcvBuff[BUFF_SIZE] = {0}; - + i = p->id; /* Client Socket Setup */ xRemoteAddress.sin_port = FreeRTOS_htons(p->port); @@ -195,11 +195,11 @@ int wolfSSL_TLS_client_do(void *pvParam) /* Set callback CTX */ #if !defined(TLS_MULTITHREAD_TEST) - + XMEMSET(&guser_PKCbInfo, 0, sizeof(FSPSM_ST)); guser_PKCbInfo.devId = 0; wc_sce_set_callback_ctx(ssl, (void*)&guser_PKCbInfo); - + #else if (p->port - DEFAULT_PORT == 0) { XMEMSET(&guser_PKCbInfo_taskA, 0, sizeof(FSPSM_ST)); @@ -210,7 +210,7 @@ int wolfSSL_TLS_client_do(void *pvParam) wc_sce_set_callback_ctx(ssl, (void*)&guser_PKCbInfo_taskB); } #endif - + #endif /* Attach wolfSSL to the socket */ @@ -219,10 +219,10 @@ int wolfSSL_TLS_client_do(void *pvParam) msg(pcName, i, " Error [%d]: wolfSSL_set_fd.\n",ret); } - msg(pcName, i, " Cipher : %s\n", + msg(pcName, i, " Cipher : %s\n", (p->cipher == NULL) ? "NULL" : p->cipher); /* use specific cipher */ - if (p->cipher != NULL && wolfSSL_set_cipher_list(ssl, p->cipher) + if (p->cipher != NULL && wolfSSL_set_cipher_list(ssl, p->cipher) != WOLFSSL_SUCCESS) { msg(pcName, i, " client can't set cipher list 1"); goto out; @@ -241,7 +241,7 @@ int wolfSSL_TLS_client_do(void *pvParam) wolfSSL_Debugging_OFF(); #endif - if (wolfSSL_write(ssl, sendBuff, (int)strlen(sendBuff)) + if (wolfSSL_write(ssl, sendBuff, (int)strlen(sendBuff)) != (int)strlen(sendBuff)) { msg(pcName, i, " ERROR SSL write: %d\n", wolfSSL_get_error(ssl, 0)); goto out; diff --git a/IDE/Renesas/e2studio/RA6M4/test/src/wolfssl_sce_unit_test.c b/IDE/Renesas/e2studio/RA6M4/test/src/wolfssl_sce_unit_test.c index f3cef8ffc7..0a819468c0 100644 --- a/IDE/Renesas/e2studio/RA6M4/test/src/wolfssl_sce_unit_test.c +++ b/IDE/Renesas/e2studio/RA6M4/test/src/wolfssl_sce_unit_test.c @@ -1,6 +1,6 @@ /* wolfssl_sce_unit_test.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -70,7 +70,7 @@ int sce_crypt_sha_multitest(); int sce_crypt_test(); int sce_crypt_sha256_multitest(); void tskSha256_Test1(void *pvParam); - + void Clr_CallbackCtx(FSPSM_ST *g); void SCE_KeyGeneration(FSPSM_ST *g); @@ -111,7 +111,7 @@ static int sce_aes_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key) byte plain[AES_BLOCK_SIZE]; int ret = 0; - WOLFSSL_SMALL_STACK_STATIC const byte msg[] = { + WOLFSSL_SMALL_STACK_STATIC const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */ 0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74, 0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20, @@ -125,10 +125,10 @@ static int sce_aes_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key) if (prnt) { printf(" sce_aes_cbc_test() "); } - + ret = wc_AesInit(aes, NULL, devId); if (ret == 0) { - ret = wc_AesSetKey(aes, (byte*)aes_key, + ret = wc_AesSetKey(aes, (byte*)aes_key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION); if (ret == 0) { ret = wc_AesCbcEncrypt(aes, cipher, msg, AES_BLOCK_SIZE); @@ -143,7 +143,7 @@ static int sce_aes_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key) #ifdef HAVE_AES_DECRYPT ret = wc_AesInit(aes, NULL, devId); if (ret == 0) { - ret = wc_AesSetKey(aes, (byte*)aes_key, + ret = wc_AesSetKey(aes, (byte*)aes_key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION); if (ret == 0) ret = wc_AesCbcDecrypt(aes, plain, cipher, AES_BLOCK_SIZE); @@ -161,7 +161,7 @@ static int sce_aes_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key) if (prnt) { RESULT_STR(ret) } - + return ret; } @@ -169,7 +169,7 @@ static void tskAes128_Cbc_Test(void *pvParam) { int ret = 0; Info *p = (Info*)pvParam; - + while (exit_loop == 0) { ret = sce_aes_cbc_test(0, &p->aes_key); vTaskDelay(10/portTICK_PERIOD_MS); @@ -207,7 +207,7 @@ static int sce_aes256_test(int prnt, FSPSM_AES_PWKEY aes_key) if (prnt) printf(" sce_aes256_test() "); - + if (wc_AesInit(enc, NULL, devId) != 0) { ret = -1; goto out; @@ -259,7 +259,7 @@ static int sce_aes256_test(int prnt, FSPSM_AES_PWKEY aes_key) if (prnt) { RESULT_STR(ret) } - + return ret; } @@ -267,7 +267,7 @@ static void tskAes256_Cbc_Test(void *pvParam) { int ret = 0; Info *p = (Info*)pvParam; - + while (exit_loop == 0) { ret = sce_aes256_test(0, &p->aes_key); vTaskDelay(10/portTICK_PERIOD_MS); @@ -289,8 +289,8 @@ static int sce_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key) Aes enc[1]; Aes dec[1]; FSPSM_ST userContext; - - + + /* * This is Test Case 16 from the document Galois/ * Counter Mode of Operation (GCM) by McGrew and @@ -350,7 +350,7 @@ static int sce_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key) if (prnt) { printf(" sce_aes256_gcm_test() "); } - + XMEMSET(resultT, 0, sizeof(resultT)); XMEMSET(resultC, 0, sizeof(resultC)); XMEMSET(resultP, 0, sizeof(resultP)); @@ -365,7 +365,7 @@ static int sce_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key) goto out; } - result = wc_AesGcmSetKey(enc, + result = wc_AesGcmSetKey(enc, (byte*)aes256_key, AES_BLOCK_SIZE*2); if (result != 0) { ret = -3; @@ -374,7 +374,7 @@ static int sce_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key) /* AES-GCM encrypt and decrypt both use AES encrypt internally */ result = wc_AesGcmEncrypt(enc, resultC, p, sizeof(p), - (byte*)iv1, sizeof(iv1), + (byte*)iv1, sizeof(iv1), resultT, sizeof(resultT), a, sizeof(a)); if (result != 0) { @@ -382,7 +382,7 @@ static int sce_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key) goto out; } - result = wc_AesGcmSetKey(dec, + result = wc_AesGcmSetKey(dec, (byte*)aes256_key, AES_BLOCK_SIZE*2); if (result != 0) { ret = -7; @@ -407,7 +407,7 @@ static int sce_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key) XMEMSET(resultC, 0, sizeof(resultC)); XMEMSET(resultP, 0, sizeof(resultP)); - wc_AesGcmSetKey(enc, + wc_AesGcmSetKey(enc, (byte*)aes256_key, AES_BLOCK_SIZE*2); /* AES-GCM encrypt and decrypt both use AES encrypt internally */ result = wc_AesGcmEncrypt(enc, resultC, p, sizeof(p), @@ -420,7 +420,7 @@ static int sce_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key) } result = wc_AesGcmDecrypt(enc, resultP, resultC, sizeof(p), - iv1, sizeof(iv1), resultT + 1, sizeof(resultT) - 1, + iv1, sizeof(iv1), resultT + 1, sizeof(resultT) - 1, a, sizeof(a)); if (result != 0) { @@ -437,11 +437,11 @@ static int sce_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key) out: wc_AesFree(enc); wc_AesFree(dec); - + if (prnt) { RESULT_STR(ret) } - + return ret; } @@ -449,7 +449,7 @@ static void tskAes256_Gcm_Test(void *pvParam) { int ret = 0; Info *p = (Info*)pvParam; - + while (exit_loop == 0) { ret = sce_aesgcm256_test(0, &p->aes_key); vTaskDelay(10/portTICK_PERIOD_MS); @@ -471,7 +471,7 @@ static int sce_aesgcm128_test(int prnt, FSPSM_AES_PWKEY aes128_key) Aes enc[1]; Aes dec[1]; FSPSM_ST userContext; - + /* * This is Test Case 16 from the document Galois/ * Counter Mode of Operation (GCM) by McGrew and @@ -565,7 +565,7 @@ static int sce_aesgcm128_test(int prnt, FSPSM_AES_PWKEY aes128_key) ret = -4; goto out; } - + result = wc_AesGcmDecrypt(enc, resultP, resultC, sizeof(c3), iv3, sizeof(iv3), resultT, sizeof(t3), a3, sizeof(a3)); @@ -583,11 +583,11 @@ static int sce_aesgcm128_test(int prnt, FSPSM_AES_PWKEY aes128_key) out: wc_AesFree(enc); wc_AesFree(dec); - + if (prnt) { RESULT_STR(ret) } - + return ret; } @@ -595,7 +595,7 @@ static void tskAes128_Gcm_Test(void *pvParam) { int ret = 0; Info *p = (Info*)pvParam; - + while (exit_loop == 0) { ret = sce_aesgcm128_test(0, &p->aes_key); vTaskDelay(10/portTICK_PERIOD_MS); @@ -622,7 +622,7 @@ static void tskAes128_Gcm_Test(void *pvParam) static int sce_rsa_test(int prnt, int keySize) { int ret = 0; - + RsaKey *key = (RsaKey *)XMALLOC(sizeof *key, NULL, DYNAMIC_TYPE_TMP_BUFFER); WC_RNG rng; const char inStr [] = TEST_STRING; @@ -633,32 +633,32 @@ static int sce_rsa_test(int prnt, int keySize) byte *in2 = NULL; byte *out= NULL; byte *out2 = NULL; - + in = (byte*)XMALLOC(inLen, NULL, DYNAMIC_TYPE_TMP_BUFFER); in2 = (byte*)XMALLOC(inLen, NULL, DYNAMIC_TYPE_TMP_BUFFER); out= (byte*)XMALLOC(outSz, NULL, DYNAMIC_TYPE_TMP_BUFFER); out2 = (byte*)XMALLOC(outSz, NULL, DYNAMIC_TYPE_TMP_BUFFER); - + (void) prnt; - + if (key == NULL || in == NULL || out == NULL || in2 == NULL || out2 == NULL) { ret = -1; goto out; } - + XMEMSET(&rng, 0, sizeof(rng)); XMEMSET(key, 0, sizeof *key); XMEMCPY(in, inStr, inLen); XMEMCPY(in2, inStr2, inLen); XMEMSET(out, 0, outSz); XMEMSET(out2, 0, outSz); - + ret = wc_InitRsaKey_ex(key, NULL, 7890/* fixed devid for TSIP/SCE*/); if (ret != 0) { goto out; } - + if ((ret = wc_InitRng(&rng)) != 0) goto out; @@ -669,7 +669,7 @@ static int sce_rsa_test(int prnt, int keySize) if ((ret = wc_MakeRsaKey(key, keySize, 65537, &rng)) != 0) { goto out; } - + ret = wc_RsaPublicEncrypt(in, inLen, out, outSz, key, &rng); if (ret < 0) { goto out; @@ -691,26 +691,18 @@ static int sce_rsa_test(int prnt, int keySize) wc_FreeRsaKey(key); XFREE(key, NULL, DYNAMIC_TYPE_TMP_BUFFER); } - if (in != NULL) { - XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER); - } - if (in2 != NULL) { - XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER); - } - if (out != NULL) { - XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER); - } - if (out2 != NULL) { - XFREE(out2, NULL, DYNAMIC_TYPE_TMP_BUFFER); - } - + XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(out2, NULL, DYNAMIC_TYPE_TMP_BUFFER); + return ret; } static int sce_rsa_SignVerify_test(int prnt, int keySize) { int ret = 0; - + RsaKey *key = (RsaKey *)XMALLOC(sizeof *key, NULL, DYNAMIC_TYPE_TMP_BUFFER); WC_RNG rng; const char inStr [] = TEST_STRING; @@ -725,14 +717,14 @@ static int sce_rsa_SignVerify_test(int prnt, int keySize) in = (byte*)XMALLOC(inLen, NULL, DYNAMIC_TYPE_TMP_BUFFER); in2 = (byte*)XMALLOC(inLen, NULL, DYNAMIC_TYPE_TMP_BUFFER); out= (byte*)XMALLOC(outSz, NULL, DYNAMIC_TYPE_TMP_BUFFER); - + (void) prnt; if (key == NULL || in == NULL || out == NULL) { ret = -1; goto out; } - + XMEMSET(&rng, 0, sizeof(rng)); XMEMSET(key, 0, sizeof *key); XMEMCPY(in, inStr, inLen); @@ -742,10 +734,10 @@ static int sce_rsa_SignVerify_test(int prnt, int keySize) if (ret != 0) { goto out; } - + if ((ret = wc_InitRng(&rng)) != 0) goto out; - + if ((ret = wc_RsaSetRNG(key, &rng)) != 0) goto out; @@ -753,7 +745,7 @@ static int sce_rsa_SignVerify_test(int prnt, int keySize) if ((ret = wc_MakeRsaKey(key, keySize, 65537, &rng)) != 0) { goto out; } - + gCbInfo.keyflgs_crypt.bits.message_type = 0; ret = wc_RsaSSL_Sign(in, inLen, out, outSz, key, &rng); if (ret < 0) { @@ -778,16 +770,10 @@ static int sce_rsa_SignVerify_test(int prnt, int keySize) wc_FreeRsaKey(key); XFREE(key, NULL, DYNAMIC_TYPE_TMP_BUFFER); } - if (in != NULL) { - XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER); - } - if (in2 != NULL) { - XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER); - } - if (out != NULL) { - XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER); - } - + XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER); + return ret; } #endif @@ -796,45 +782,45 @@ int sce_crypt_test() { int ret = 0; fsp_err_t err; - + Clr_CallbackCtx(&gCbInfo); Clr_CallbackCtx(&gCbInfo_a); - + /* sets wrapped aes key */ gCbInfo.wrapped_key_aes128 = &g_user_aes128_key_index1; gCbInfo.wrapped_key_aes256 = &g_user_aes256_key_index1; /* Aes Key Gen */ SCE_KeyGeneration(&gCbInfo); - + /* Rsa Key Gen */ err = R_SCE_RSA1024_WrappedKeyPairGenerate(&g_wrapped_pair_1024key); if (err == FSP_SUCCESS) { /* sets wrapped rsa 1024 bits key */ - gCbInfo.wrapped_key_rsapri1024 = + gCbInfo.wrapped_key_rsapri1024 = &g_wrapped_pair_1024key.priv_key; gCbInfo.keyflgs_crypt.bits.rsapri1024_installedkey_set = 1; - gCbInfo.wrapped_key_rsapub1024 = + gCbInfo.wrapped_key_rsapub1024 = &g_wrapped_pair_1024key.pub_key; gCbInfo.keyflgs_crypt.bits.rsapub1024_installedkey_set = 1; } - + err = R_SCE_RSA2048_WrappedKeyPairGenerate(&g_wrapped_pair_2048key); if (err == FSP_SUCCESS) { /* sets wrapped rsa 1024 bits key */ - gCbInfo.wrapped_key_rsapri2048 = + gCbInfo.wrapped_key_rsapri2048 = &g_wrapped_pair_2048key.priv_key; gCbInfo.keyflgs_crypt.bits.rsapri2048_installedkey_set = 1; - - gCbInfo.wrapped_key_rsapub2048 = + + gCbInfo.wrapped_key_rsapub2048 = &g_wrapped_pair_2048key.pub_key; gCbInfo.keyflgs_crypt.bits.rsapub2048_installedkey_set = 1; } - + /* Key generation for multi testing */ gCbInfo_a.wrapped_key_aes128 = &g_user_aes128_key_index2; gCbInfo_a.wrapped_key_aes256 = &g_user_aes256_key_index2; SCE_KeyGeneration(&gCbInfo_a); - + ret = wc_CryptoCb_CryptInitRenesasCmn(NULL, &gCbInfo); if ( ret > 0) ret = 0; @@ -882,7 +868,7 @@ int sce_crypt_test() if (ret == 0) { ret = sce_aesgcm128_test(1, &g_user_aes128_key_index1); } - + if (ret == 0) { ret = sce_aesgcm256_test(1, &g_user_aes256_key_index1); } @@ -904,12 +890,12 @@ int sce_crypt_test() sce_crypt_Sha_AesCbcGcm_multitest(); } else ret = -1; - + #if defined(WOLFSSL_RENESAS_RSIP_CRYPTONLY) Clr_CallbackCtx(&gCbInfo); Clr_CallbackCtx(&gCbInfo_a); #endif - + return ret; } @@ -958,7 +944,7 @@ int sce_crypt_sha256_multitest() int num = 0; int i; BaseType_t xRet; - + #ifndef NO_SHA256 num+=2; #endif @@ -968,7 +954,7 @@ int sce_crypt_sha256_multitest() exit_semaph = xSemaphoreCreateCounting(num, 0); xRet = pdPASS; - + #ifndef NO_SHA256 xRet = xTaskCreate(tskSha256_Test1, "sha256_test1", STACK_SIZE, NULL, 2, NULL); @@ -990,15 +976,15 @@ int sce_crypt_sha256_multitest() } } } - + vSemaphoreDelete(exit_semaph); - + if ((xRet == pdPASS) && (sha256_multTst_rslt1 == 0 && sha256_multTst_rslt2 == 0)) ret = 0; else ret = -1; - + RESULT_STR(ret) return ret; @@ -1015,7 +1001,7 @@ int sce_crypt_AesCbc_multitest() Info info_aes256_1; Info info_aes256_2; BaseType_t xRet; - + #if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128) num+=2; #endif @@ -1028,7 +1014,7 @@ int sce_crypt_AesCbc_multitest() exit_semaph = xSemaphoreCreateCounting(num, 0); xRet = pdPASS; - + #if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128) XMEMCPY(&info_aes1.aes_key, &g_user_aes128_key_index1, sizeof(sce_aes_wrapped_key_t)); @@ -1057,7 +1043,7 @@ int sce_crypt_AesCbc_multitest() xRet = xTaskCreate(tskAes256_Cbc_Test, "aes256_cbc_test2", STACK_SIZE, &info_aes256_2, 3, NULL); #endif - + if (xRet == pdPASS) { printf(" Waiting for completing tasks ... "); vTaskDelay(10000/portTICK_PERIOD_MS); @@ -1071,7 +1057,7 @@ int sce_crypt_AesCbc_multitest() } } } - + vSemaphoreDelete(exit_semaph); if ((xRet == pdPASS) && @@ -1096,7 +1082,7 @@ int sce_crypt_AesGcm_multitest() Info info_aes256_1; Info info_aes256_2; BaseType_t xRet; - + #if defined(WOLFSSL_AES_128) num+=2; #endif @@ -1110,7 +1096,7 @@ int sce_crypt_AesGcm_multitest() exit_semaph = xSemaphoreCreateCounting(num, 0); xRet = pdPASS; - + #if defined(WOLFSSL_AES_128) XMEMCPY(&info_aes1.aes_key, &g_user_aes128_key_index1, sizeof(sce_aes_wrapped_key_t)); @@ -1155,7 +1141,7 @@ int sce_crypt_AesGcm_multitest() } } } - + vSemaphoreDelete(exit_semaph); if ((xRet == pdPASS) && @@ -1179,7 +1165,7 @@ int sce_crypt_Sha_AesCbcGcm_multitest() Info info_aes256cbc; Info info_aes256gcm; BaseType_t xRet; - + #ifndef NO_SHA256 num+=2; #endif @@ -1201,45 +1187,45 @@ int sce_crypt_Sha_AesCbcGcm_multitest() exit_semaph = xSemaphoreCreateCounting(num, 0); xRet = pdPASS; - + #ifndef NO_SHA256 - xRet = xTaskCreate(tskSha256_Test1, "sha256_test1", + xRet = xTaskCreate(tskSha256_Test1, "sha256_test1", STACK_SIZE, NULL, 3, NULL); if (xRet == pdPASS) - xRet = xTaskCreate(tskSha256_Test2, "sha256_test2", + xRet = xTaskCreate(tskSha256_Test2, "sha256_test2", STACK_SIZE, NULL, 3, NULL); #endif #if defined(WOLFSSL_AES_128) - XMEMCPY(&info_aes128cbc.aes_key, &g_user_aes128_key_index1, + XMEMCPY(&info_aes128cbc.aes_key, &g_user_aes128_key_index1, sizeof(sce_aes_wrapped_key_t)); if (xRet == pdPASS) - xRet = xTaskCreate(tskAes128_Cbc_Test, "aes128_cbc_test1", + xRet = xTaskCreate(tskAes128_Cbc_Test, "aes128_cbc_test1", STACK_SIZE, &info_aes128cbc, 3, NULL); #endif #if defined(WOLFSSL_AES_128) - XMEMCPY(&info_aes128gcm.aes_key, &g_user_aes128_key_index2, + XMEMCPY(&info_aes128gcm.aes_key, &g_user_aes128_key_index2, sizeof(sce_aes_wrapped_key_t)); if (xRet == pdPASS) - xRet = xTaskCreate(tskAes128_Gcm_Test, "aes128_gcm_test2", + xRet = xTaskCreate(tskAes128_Gcm_Test, "aes128_gcm_test2", STACK_SIZE, &info_aes128gcm, 3, NULL); #endif #if defined(WOLFSSL_AES_256) - XMEMCPY(&info_aes256cbc.aes_key, &g_user_aes256_key_index1, + XMEMCPY(&info_aes256cbc.aes_key, &g_user_aes256_key_index1, sizeof(sce_aes_wrapped_key_t)); if (xRet == pdPASS) - xRet = xTaskCreate(tskAes256_Cbc_Test, "aes256_cbc_test1", + xRet = xTaskCreate(tskAes256_Cbc_Test, "aes256_cbc_test1", STACK_SIZE, &info_aes256cbc, 3, NULL); #endif #if defined(WOLFSSL_AES_256) - XMEMCPY(&info_aes256gcm.aes_key, &g_user_aes256_key_index2, + XMEMCPY(&info_aes256gcm.aes_key, &g_user_aes256_key_index2, sizeof(sce_aes_wrapped_key_t)); if (xRet == pdPASS) - xRet = xTaskCreate(tskAes256_Gcm_Test, "aes256_gcm_test2", + xRet = xTaskCreate(tskAes256_Gcm_Test, "aes256_gcm_test2", STACK_SIZE, &info_aes256gcm, 3, NULL); #endif @@ -1256,19 +1242,19 @@ int sce_crypt_Sha_AesCbcGcm_multitest() } } } - + vSemaphoreDelete(exit_semaph); - - if ((xRet == pdPASS) && + + if ((xRet == pdPASS) && (Aes128_Gcm_multTst_rslt == 0 && Aes256_Gcm_multTst_rslt == 0) && (sha256_multTst_rslt1 == 0 && sha256_multTst_rslt2 == 0)) { - + ret = 0; } else { ret = -1; } - + RESULT_STR(ret) return ret; diff --git a/IDE/Renesas/e2studio/RA6M4/tools/README.md b/IDE/Renesas/e2studio/RA6M4/tools/README.md new file mode 100644 index 0000000000..dcb17b70ab --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M4/tools/README.md @@ -0,0 +1,39 @@ +# Create/Update Signed CA +This document describes how to create/update Signed CA data that is used at an example program. + +## Signed CA Creatation +### Generate RSA Key pair +``` +2048 bit RSA key pair +$ openssl genrsa 2048 2> /dev/null > rsa_private.pem +$ openssl rsa -in rsa_private.pem -pubout -out rsa_public.pem 2> /dev/null +``` + +### Sign to CA certificate +``` +Signed by 2048-bit RSA +$ openssl dgst -sha256 -sign rsa_private.pem -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-1-out .sign + +For an example program, it assumes that wolfSSL example CA cert is to be signed. +e.g. +$ openssl dgst -sha256 -sign rsa_private.pem -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-1-out Signed-CA.sign /path/for/wolfssl/certs/ca-cert.der +``` + +### Convert Signed CA to C source +It is able to use `dertoc.pl` to generate c-source data from signed-ca binary data. + +``` +$ /path/to/wolfssl/scripts/dertoc.pl ./ca-cert.der.sign ca_cert_der_sig example.c +``` + + +## Appendix +### Example Keys +There are multiple example keys for testing in the `example_keys` folder. +``` + +| ++----+ rsa_private.pem an example 2048-bit rsa private key for signing CA cert + + rsa_public.pem an example 2048-bit rsa public key for verifying CA cert + + generate_signCA.sh an example script to genearte signed-certificate data for the example program +``` diff --git a/IDE/Renesas/e2studio/RA6M4/tools/example_keys/generate_SignedCA.sh b/IDE/Renesas/e2studio/RA6M4/tools/example_keys/generate_SignedCA.sh new file mode 100755 index 0000000000..772f5ddfa1 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M4/tools/example_keys/generate_SignedCA.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# example usage +# ./generate_SignedCA.sh rsa_private.pem rsa_public.pem ../../../../../../../wolfssl/certs/ca-cert.der ../../../../../../../wolfssl +# ./generate_SignedCA.sh rsa_private.pem rsa_public.pem ../../../../../../../wolfssl/certs/ca-ecc-cert.der ../../../../../../../wolfssl +# +SIGOPT=rsa_padding_mode:pss +SIGOPT2=rsa_pss_saltlen:-1 +CURRENT=$(cd $(dirname $0);pwd) + +function usage() { + cat <<- _EOT_ + Usage: + $0 private-key public-key file-name wolfssl-dir + + Options: + private-key : private key for sign/verify + public-key : public key for verify + file-name : file name to be signed + wolfssl-dir : wolfssl folder path + +_EOT_ +exit 1 +} + +if [ $# -ne 4 ]; then + usage +fi + +# $1 private key for sign/verify +# $2 public key for verify +# $3 file for sign/verify +signed_file=$(basename $3) +wolf_dir=$4 + +openssl dgst -sha256 -sign $1 -sigopt $SIGOPT -sigopt $SIGOPT2 -out ${CURRENT}/${signed_file}.sign $3 + +echo Verify by private key +openssl dgst -sha256 -prverify $1 -sigopt $SIGOPT -sigopt $SIGOPT2 -signature ${CURRENT}/${signed_file}.sign $3 +echo Verifiy by public key +openssl dgst -sha256 -verify $2 -sigopt $SIGOPT -sigopt $SIGOPT2 -signature ${CURRENT}/${signed_file}.sign $3 + +# Convert Signed CA to c source +${wolf_dir}/scripts/dertoc.pl ${CURRENT}/${signed_file}.sign XXXXXXX ${signed_file}.c diff --git a/IDE/Renesas/e2studio/RA6M4/tools/example_keys/rsa_private.pem b/IDE/Renesas/e2studio/RA6M4/tools/example_keys/rsa_private.pem new file mode 100644 index 0000000000..a6246b036b --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M4/tools/example_keys/rsa_private.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEA1m5BL7AjTKZidSHuz0dvqKWrhY3/eD5swV8FBe2y6L1u2ulR +FAmyHUmMnmy3YMIx+Zhi+Qc4Ra27t/3/ffFhTBwx2Snr5oqryxfB2rj1+Cc6kDQL +aUIVY1z2y9s9E4NJIQAzSlzQ5e7oGiXH3cLjOTlEI8xKDGLJEhah58Lh18am4Dqp +DilrkL+p0H+HQJPC6eJs3urEn7ueeqQaKCv1OOsrmQfeCfkjxSqbyrR/+F5VV4H6 +PjyXHCW0lbNhxSmF9wVK8+t4DRARU5ONoECY7dIkPMqFHdzGdRmOrfEsGl++wjPH +CvvUOLJ7/Pt0h6c7yazZngt1kqKYmKWJR7+FLQIDAQABAoIBAQCdfIqJwL6cPBNR +3eMr/1ZlsY+A3mKD6K0tdGEXEpX007RIOVXf9qMHWY5aiJRCDz5vB1mhdokAu/GD +15u+3vpL0OVXjq+AOdakqcUpo/CbGgyr/l1nKC7XNF7aKCH6Y9Dg2OnSssqGJWn4 +UkkxeUIzM/j0pcS4xhDRJSgyNHJ0a0xjY37K5JXTVhzgAAWxAVmh0iaptNpGAsU2 ++DN6yQgtsGcKmrUp5ERtuiT66X79uDJdDL5OE070LpRGz+547rXE7haSzM0Iepup +hEENj1UB8PZ8xK9Ki/h7iWaRNllv5TV5SfryHGlUi/kPbTDWCc+CoVG8o7tQPQ12 +yxOxMaehAoGBAPbMLvr132Kt3mCQa2SbAIV+fnv9hqY+K5jiV+Vp220kmc4ji7L/ +uleiKT8jkmO93mvLau3uLelGN2udVaBbhn5llZIwhK8R/jLP0XIap9v7EKKhuRad ++UbfYWKs6zANM8hIrRkW0P6BNlSZyjL1KiIY8kdNIBn/ZpIQh8evpcFJAoGBAN5t +HIiiSe9mY1HCbArxD9BjKebfIMDhgwb+vgWHwk6iexdE9aFRLVhriYvQA8dhOoqZ +LFeExaIfG0XJnrcgkEyOuuGnO3M2KUv/UKM1/F+nP3g5pCD8MC0qSM4kukFEMG2u +3oPPCUsdRUoQBjCoae89g1CQADDfTe3zMVIda4jFAoGBALSASawKv8KwX4BIoAMI +yqzYAzI0DpLvzXsXsCl97po4trTpknbsSiFl3LztC1gfudklAaPbG4ENdeMjQ0jx +J8CyE17EVYalpkELdaf6juJ5EYWgunosN/D514QP7ENMpJ7LaK583YYGgvIFOLlk +Tdh6Xlh/tAbPoPkbVfNaJ+ThAoGAHIMeIkGzepXEa4mhsfFe1pavm2HE4BTIaBAl +qa3ScaQQZVY4qnouduQqGJsMsPU8vOGPtpRVhUe5hkOnLdBlzvqI6D44t7ccqhpL +avCTrmtRDodNC9FoF5IRDSPWIGGuV5EQAxN6HH/fDvRo5rngAoP/HkenTpyBb9w5 +2U3eKAUCgYB0M2INdmqs8DltOVLo2vJqJxKQGtbeizB1HdQjQ9NKH+cyjmnXHZ4v +0x1AtQsyO9FNYhib52ExYgTCpLc5rX6QNHA14mrhWpLtzB2noM4fo9BdKopMrQtE +Kt8tl+JWmKtpBnPdTMeoF+0GYd8KZCgxITcE0SccsNl6yROBquA/pQ== +-----END RSA PRIVATE KEY----- diff --git a/IDE/Renesas/e2studio/RA6M4/tools/example_keys/rsa_public.pem b/IDE/Renesas/e2studio/RA6M4/tools/example_keys/rsa_public.pem new file mode 100644 index 0000000000..bc83722139 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M4/tools/example_keys/rsa_public.pem @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1m5BL7AjTKZidSHuz0dv +qKWrhY3/eD5swV8FBe2y6L1u2ulRFAmyHUmMnmy3YMIx+Zhi+Qc4Ra27t/3/ffFh +TBwx2Snr5oqryxfB2rj1+Cc6kDQLaUIVY1z2y9s9E4NJIQAzSlzQ5e7oGiXH3cLj +OTlEI8xKDGLJEhah58Lh18am4DqpDilrkL+p0H+HQJPC6eJs3urEn7ueeqQaKCv1 +OOsrmQfeCfkjxSqbyrR/+F5VV4H6PjyXHCW0lbNhxSmF9wVK8+t4DRARU5ONoECY +7dIkPMqFHdzGdRmOrfEsGl++wjPHCvvUOLJ7/Pt0h6c7yazZngt1kqKYmKWJR7+F +LQIDAQAB +-----END PUBLIC KEY----- diff --git a/IDE/Renesas/e2studio/RA6M4/wolfssl/.cproject b/IDE/Renesas/e2studio/RA6M4/wolfssl/.cproject index 7684a0b608..0daf30fa0e 100644 --- a/IDE/Renesas/e2studio/RA6M4/wolfssl/.cproject +++ b/IDE/Renesas/e2studio/RA6M4/wolfssl/.cproject @@ -81,10 +81,14 @@ + + + @@ -111,6 +115,9 @@ + + + @@ -361,10 +369,14 @@ + + + @@ -389,10 +401,14 @@ + + + diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/README_EN.md b/IDE/Renesas/e2studio/RX65N/GR-ROSE/README_EN.md index 967b6ec739..0ea94144ca 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/README_EN.md +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/README_EN.md @@ -6,16 +6,16 @@ wolfSSL sample application project for GR-ROSE evaluation board ## 1. Overview ----- -We provide a sample program for evaluating wolfSSL targeting the GR-ROSE evaluation board, which has RX65N MCU on it. The sample program runs in a bare metal environment that does not use a real-time OS and uses e2 studio as an IDE. This document describes the procedure from build to execution of the sample program. +We provide a sample program for evaluating wolfSSL targeting the GR-ROSE evaluation board, which has RX65N MCU on it. The sample program runs in a bare metal environment that does not use a real-time OS and uses e2 studio as an IDE. This document describes the procedure from build to execution of the sample program. The sample provided is a single application that can evaluate the following three functions: - CryptoTest: A program that automatically tests various cryptographic operation functions -- Benchmark: A program that measures the execution speed of various cryptographic operations +- Benchmark: A program that measures the execution speed of various cryptographic operations - TlsClient: A program that performs TLS communication with the opposite TLS server application

-Since the H/W settings and S/W settings for operating the evaluation board have already been prepared, the minimum settings are required to operate the sample application. In addition, the RootCA certificate and server-side certificate required for TLS communication have already been set for sample use only. +Since the H/W settings and S/W settings for operating the evaluation board have already been prepared, the minimum settings are required to operate the sample application. In addition, the RootCA certificate and server-side certificate required for TLS communication have already been set for sample use only. The following sections will walk you through the steps leading up to running the sample application.

@@ -23,16 +23,16 @@ The following sections will walk you through the steps leading up to running the ## 2. Target H/W, components and libraries ----- -This sample program uses the following hardware and software libraries. If a new version of the software component is available at the time of use, please update it as appropriate. +This sample program uses the following hardware and software libraries. If a new version of the software component is available at the time of use, please update it as appropriate. |item|name & version| |:--|:--| |Board|GR-ROSE| |Device|R5F565NEHxFP| -|IDE| Renesas e2Studio Version:2022-01 | +|IDE| Renesas e2Studio Version:2024-04 (24.4.0) | |Emulator| E1, E2 Emulator Lite | -|Toolchain|CCRX v3.04.00| -|TSIP| TSIP v1.17| +|Toolchain|CCRX v3.06.00| +|TSIP| TSIP v1.21|
The project of this sample program has a configuration file that uses the following FIT components. @@ -47,21 +47,20 @@ However, the FIT components themselves are not included in the distribution of t |Generic system timer for RX MCUs|1.01|r_sys_time_rx| |TCP/IP protocol stack[M3S-T4-Tiny] - RX Ethernet Driver Interface|1.09|r_t4_driver_rx| |TCP/IP protocol stack[M3S-T4-Tiny] for Renesas MCUs|2.10|r_t4_rx| -|TSIP(Trusted Secure IP) driver|1.17.l|r_tsip_rx| +|TSIP(Trusted Secure IP) driver|1.21|r_tsip_rx|
-Note) As of April 2022, TIPS v1.15 does not seem to be able to be added as a FIT component by adding a component in the Smart Configurator Perspective. Add it manually along the method described later.

## 3. Importing sample application project into e2Studio ---- -There is no need to create a new sample program. Since the project file is already prepared, please import the project from the IDE by following the steps below. +There is no need to create a new sample program. Since the project file is already prepared, please import the project from the IDE by following the steps below. -+ e2studio "File" menu> "Open project from file system ..."> "Directory (R) ..." Click the import source button and select the folder from which the project will be imported. Select the folder (Renesas/e2studio/{MCU}/{board-name-folder}) where this README file exists. -+ Four projects that can be imported are listed, but check only the three projects "smc", "test" and "wolfssl" and click the "Finish" button. ++ e2studio "File" menu> "Open project from file system ..."> "Directory (R) ..." Click the import source button and select the folder from which the project will be imported. Select the folder (Renesas/e2studio/{MCU}/{board-name-folder}) where this README file exists. ++ Four projects that can be imported are listed, but check only the three projects "smc", "test" and "wolfssl" and click the "Finish" button. -You should see the **smc**, **test**, and **wolfssl** 3 projects you imported into the project explorer. +You should see the **smc**, **test**, and **wolfssl** 3 projects you imported into the project explorer.

## 4. FIT module download and smart configurator file generation @@ -69,13 +68,13 @@ You should see the **smc**, **test**, and **wolfssl** 3 projects you imported in You will need to get the required FIT modules yourself. Follow the steps below to get them. -1. Open the smc project in Project Explorer and double-click the **smc.scfg** file to open the Smart Configurator Perspective. +1. Open the smc project in Project Explorer and double-click the **smc.scfg** file to open the Smart Configurator Perspective. 2. Select the "Components" tab on the software component settings pane. Then click the "Add Component" button at the top right of the pane. The software component selection dialog will pop up. Click "Download the latest version of FIT driver and middleware" at the bottom of the dialog to get the modules. You can check the download destination folder by pressing "Basic settings...". 3. The latest version of the TSIP component may not be automatically obtained due to the delay in Renesas' support by the method in step 2 above. In that case, you can download it manually from the Renesas website. Unzip the downloaded component and store the files contained in the FIT Modules folder in the download destination folder of step 2. -4. Select the required FIT components shown from the list and press the "Finish" button. Repeat this operation until you have the required FIT components. +4. Select the required FIT components shown from the list and press the "Finish" button. Repeat this operation until you have the required FIT components. 5. Select the Components tab on the Software Component Settings pane and select the r_t4_rx component. In the settings pane on the right, specify the IP address of this board as the value of the "# IP address for ch0, when DHCP disable." Property (e.g. 192.168.1.9). @@ -117,7 +116,7 @@ Then build the test application. ## 7. Build and run the test application ----- -Now that the test application is ready to build. +Now that the test application is ready to build. 1. Build the wolfssl project on the project explorer, then the test project. @@ -129,14 +128,14 @@ Now that the test application is ready to build. 5. Press the run button to run the test application. -6. CryptoTest, Benchmark or TLS_Client After displaying the execution result according to the selected behavior, it enters an infinite loop, so if you think that the output has stopped, stop debugging. +6. CryptoTest, Benchmark or TLS_Client After displaying the execution result according to the selected behavior, it enters an infinite loop, so if you think that the output has stopped, stop debugging.

## 8. Running test application as TLS_Client -----
-### 8.1 TLS version supported by the test application +### 8.1 TLS version supported by the test application
You can use the TLS1.3 protocol in addition to the existing TLS1.2. The following macro is defined to {board-name-folder}/common/user_settings.h. @@ -177,7 +176,7 @@ In the test application, the TLS version and certificate type determine the ciph |:--|:--|:--| |TLS1.3|RSA/ECDSA certificate| | |||TLS_AES_128_GCM_SHA256| -|||TLS_AES_128_CCM_SHA256| +|||TLS_AES_128_CCM_SHA256| |TLS1.2|RSA certificate| |||TLS_RSA_WITH_AES_128_CBC_SHA| |||TLS_RSA_WITH_AES_256_CBC_SHA| @@ -200,7 +199,7 @@ To operate as TLS_Client, an opposite application for TLS communication is requi Configuration options need to be changed depending on the certificate type used. -#### 8.4.1 Configuration when using ECDSA certificates +#### 8.4.1 Configuration when using ECDSA certificates
@@ -217,7 +216,7 @@ Note: Do not forget to specify "-DNO_RSA"
With the above build, /examples/server/server -Is generated. This executable acts as a TLS server application. If you execute it with the following options, it will be in the listening state for the connection from TLS_Client. +Is generated. This executable acts as a TLS server application. If you execute it with the following options, it will be in the listening state for the connection from TLS_Client.

``` @@ -247,7 +246,7 @@ is generated. This executable program acts as a server application. If you execu

``` -$ examples / server / server -b -v4 -i +$ examples / server / server -b -v 4 -i ```
@@ -298,7 +297,7 @@ If you want to use it for purposes beyond functional evaluation, you need to pre 2. RSA key pair required for RootCA certificate validation 3. The signature generated by the RootCA certificate with the private key in 2 above. -will become necessary. Please refer to the manual provided by Renesas for how to generate them. +will become necessary. Please refer to the manual provided by Renesas for how to generate them.
@@ -316,7 +315,7 @@ Use wolfSSL_use_certificate_buffer or wolfSSL_CTX_use_certificate_buffer to load (2) Loading client private key/public key -Type of the client certificate decides the keys to be loaded. +Type of the client certificate decides the keys to be loaded. a) ECDSA certificate:
Load private key using tsip_use_PrivateKey_buffer. @@ -324,25 +323,25 @@ a) ECDSA certificate:
b) RSA certificate:
Load private key using tsip_use_PrivateKey_buffer. Load public key using tsip_use_PublicKey_buffer. -Note. In case of RSA certificate, the public key will be used for internal verification of signature process. +Note. In case of RSA certificate, the public key will be used for internal verification of signature process. (3) How to generate encrypted keys The keys (private and public keys) to be loaded should be encrypted-key format. Those keys could be generated with Renesas Secure Flash Programmer or SecurityKeyManagementTool. Refer the section 7.5 and 7.6 of the application note named “RX Family TSIP Module Firmware Integration technology” how to operate above key wrapping tool. (4) Macro to be defined -Define “WOLF_PRIVATE_KEY_ID” in your user_settings.h. +Define “WOLF_PRIVATE_KEY_ID” in your user_settings.h.
## 11. Limitations ----
-wolfSSL, which supports TSIPv1.17, has the following functional restrictions. +wolfSSL, which supports TSIPv1.21, has the following functional restrictions.

1. Handshake message packets exchanged with the server during the TLS handshake are stored in plaintext in memory. This is used to calculate the hash of handshake messages. The content will be deleted at the end of the session. 1. Session resumption and early data using TSIP are not supported. -The above limitations are expected to be improved by TSIP or wolfSSL from the next version onwards. \ No newline at end of file +The above limitations are expected to be improved by TSIP or wolfSSL from the next version onwards. diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/README_JP.md b/IDE/Renesas/e2studio/RX65N/GR-ROSE/README_JP.md index c3186924ab..29ca1169aa 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/README_JP.md +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/README_JP.md @@ -30,10 +30,10 @@ Renesas社製MCU RX65Nを搭載した評価ボードGR-ROSEをターゲットと |:--|:--| |評価ボード|GR-ROSE| |Device|R5F565NEHxFP| -|IDE| Renesas e2Studio Version:2022-01 | +|IDE| Renesas e2Studio Version:2024-04 (24.4.0) | |エミュレーター| E1, E2エミュレーターLite | -|Toolchain|CCRX v3.04.00| -|TSIP| TSIP v1.17| +|Toolchain|CCRX v3.06.00| +|TSIP| TSIP v1.21|
本サンプルプログラムのプロジェクトには以下のFITコンポーネントを使用する設定ファイルが用意されています。 @@ -50,10 +50,7 @@ Renesas社製MCU RX65Nを搭載した評価ボードGR-ROSEをターゲットと |Generic system timer for RX MCUs|1.01|r_sys_time_rx| |TCP/IP protocol stack[M3S-T4-Tiny] - RX Ethernet Driver Interface|1.09|r_t4_driver_rx| |TCP/IP protocol stack[M3S-T4-Tiny] for Renesas MCUs|2.10|r_t4_rx| -|TSIP(Trusted Secure IP) driver|1.17.l|r_tsip_rx| - -(注意)2022年4月現在、TIPSv1.15はFITコンポーネントとしてスマートコンフィギュレータパースペクティブのコンポーネントの追加操作では追加できないようです。後ほど説明する手動での追加方法を使って追加してください。
- +|TSIP(Trusted Secure IP) driver|1.21|r_tsip_rx|

@@ -186,7 +183,7 @@ testアプリケーションでは、TLSバージョンと証明書のタイプ |:--|:--|:--| |TLS1.3|RSA/ECDSA証明書| | |||TLS_AES_128_GCM_SHA256| -|||TLS_AES_128_CCM_SHA256| +|||TLS_AES_128_CCM_SHA256| |TLS1.2|RSA証明書| |||TLS_RSA_WITH_AES_128_CBC_SHA| |||TLS_RSA_WITH_AES_256_CBC_SHA| @@ -246,7 +243,7 @@ $ make

``` -$ examples/server/server -b -v4 -i +$ examples/server/server -b -v 4 -i ```
testアプリケーションには、サーバーアプリケーションに割り当てられたIPアドレスを指定します。 @@ -336,7 +333,7 @@ user_settings.hにWOLF_PRIVATE_KEY_IDの定義を行ってください。 ## 11. 制限事項 ----- -TSIPv1.17をサポートしたwolfSSLでは以下の機能制限があります。 +TSIPv1.21をサポートしたwolfSSLでは以下の機能制限があります。 1. TLSハンドシェーク中にサーバーと交換したメッセージパケットが平文でメモリ上に蓄積されています。これはハンドシェークメッセージのハッシュ計算に使用されます。内容はセッション終了時に削除されます。 diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/strings.h b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/strings.h index 030e4ffad0..a66c8bbbf8 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/strings.h +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/strings.h @@ -1,6 +1,6 @@ /* strings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/unistd.h b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/unistd.h index d288552e6c..12f9374948 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/unistd.h +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/unistd.h @@ -1,6 +1,6 @@ /* unistd.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/user_settings.h b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/user_settings.h index fa80de8404..ecf532359e 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/user_settings.h +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -30,7 +30,7 @@ /*-- Renesas TSIP usage and its version --------------------------------------- * * "WOLFSSL_RENESAS_TSIP" definition makes wolfSSL to use H/W acceleration - * for cipher operations. + * for cipher operations. * TSIP definition asks to have its version number. * "WOLFSSL_RENESAS_TSIP_VER" takes following value: * 106: TSIPv1.06 @@ -38,27 +38,29 @@ * 113: TSIPv1.13 * 114: TSIPv1.14 * 115: TSIPv1.15 + * 117: TSIPv1.17 + * 121: TSIPv1.21 *----------------------------------------------------------------------------*/ #define WOLFSSL_RENESAS_TSIP - #define WOLFSSL_RENESAS_TSIP_VER 117 + #define WOLFSSL_RENESAS_TSIP_VER 121 /*-- TLS version definitions -------------------------------------------------- * * wolfSSL supports TLSv1.2 by default. In case you want your system to support * TLSv1.3, uncomment line below. - * + * *----------------------------------------------------------------------------*/ #define WOLFSSL_TLS13 /*-- Operating System related definitions -------------------------------------- - * + * * In case any real-time OS is used, define its name(e.g. FREERTOS). * Otherwise, define "SINGLE_THREADED". They are exclusive each other. - * + * *----------------------------------------------------------------------------*/ - #define SINGLE_THREADED + #define SINGLE_THREADED /*#define FREERTOS*/ /*-- Compiler related definitions --------------------------------------------- @@ -98,34 +100,34 @@ /* USE_ECC_CERT * This macro is for selecting root CA certificate to load, it is valid only - * in example applications. wolfSSL does not refer this macro. - * If you want to use cipher suites including ECDSA authentication in + * in example applications. wolfSSL does not refer this macro. + * If you want to use cipher suites including ECDSA authentication in * the example applications with TSIP, enable this macro. - * In TSIP 1.13 or later version, following cipher suites are + * In TSIP 1.13 or later version, following cipher suites are * available: * - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 * - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SAH256 - * + * * Note that, this macro disables cipher suites including RSA * authentication such as: * - TLS_RSA_WITH_AES_128_CBC_SHA - * - TLS_RSA_WITH_AES_256_CBC_SHA + * - TLS_RSA_WITH_AES_256_CBC_SHA * - TLS_RSA_WITH_AES_128_CBC_SHA256 * - TLS_RSA_WITH_AES_256_CBC_SHA256 * - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 * - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA256 - * + * */ #define USE_ECC_CERT - /* In this example application, Root CA cert buffer named - * "ca_ecc_cert_der_256" is used under the following macro definition + /* In this example application, Root CA cert buffer named + * "ca_ecc_cert_der_256" is used under the following macro definition * for ECDSA. */ #define USE_CERT_BUFFERS_256 - /* In this example application, Root CA cert buffer named - * "ca_cert_der_2048" is used under the following macro definition + /* In this example application, Root CA cert buffer named + * "ca_cert_der_2048" is used under the following macro definition * for RSA authentication. */ #define USE_CERT_BUFFERS_2048 @@ -137,7 +139,7 @@ #define SIZEOF_LONG_LONG 8 /*#define WOLFSSL_STATIC_MEMORY*/ - + #if defined(WOLFSSL_STATIC_MEMORY) #define USE_FAST_MATH #else @@ -146,24 +148,24 @@ - /* + /* * -- "NO_ASN_TIME" macro is to avoid certificate expiration validation -- - * - * Note. In your actual products, do not forget to comment-out + * + * Note. In your actual products, do not forget to comment-out * "NO_ASN_TIME" macro. And prepare time function to get calendar time, - * otherwise, certificate expiration validation will not work. + * otherwise, certificate expiration validation will not work. */ /*#define NO_ASN_TIME*/ - + #define NO_MAIN_DRIVER #define BENCH_EMBEDDED - #define NO_WOLFSSL_DIR + #define NO_WOLFSSL_DIR #define WOLFSSL_NO_CURRDIR #define NO_FILESYSTEM #define WOLFSSL_LOG_PRINTF #define WOLFSSL_HAVE_MIN #define WOLFSSL_HAVE_MAX - + #define NO_WRITEV #define WOLFSSL_USER_IO @@ -175,7 +177,7 @@ #define USE_WOLF_SUSECONDS_T #define USE_WOLF_TIMEVAL_T - + #define WC_RSA_BLINDING #define TFM_TIMING_RESISTANT #define ECC_TIMING_RESISTANT @@ -191,7 +193,7 @@ /*-- Definitions for functionality negation ----------------------------------- * - * + * *----------------------------------------------------------------------------*/ /*#define NO_RENESAS_TSIP_CRYPT*/ @@ -203,7 +205,7 @@ /*-- Consistency checking between definitions --------------------------------- * - * + * *----------------------------------------------------------------------------*/ /*-- TSIP TLS specific definitions --*/ @@ -229,7 +231,6 @@ #define WOLFSSL_RENESAS_TSIP_TLS #if !defined(NO_RENESAS_TSIP_CRYPT) - #define WOLFSSL_RENESAS_TSIP_CRYPTONLY #define HAVE_PK_CALLBACKS #define WOLF_CRYPTO_CB #if defined(WOLFSSL_RENESAS_TSIP_TLS) @@ -243,10 +244,20 @@ # undef WOLFSSL_RENESAS_TSIP_TLS # undef WOLFSSL_RENESAS_TSIP_CRYPT #endif - + /*------------------------------------------------------------------------- + * TSIP generates random numbers using the CRT-DRBG described + * in NIST SP800-90A. Recommend to define the CUSTOM_RAND_GENERATE_BLOCK + * so that wc_RNG_GenerateByte/Block() call TSIP random generatoion API + * directly. Comment out the macro will generate random number by + * wolfSSL Hash DRBG by using a seed which is generated by TSIP API. + *-----------------------------------------------------------------------*/ + #define CUSTOM_RAND_GENERATE_BLOCK wc_tsip_GenerateRandBlock #else #define OPENSSL_EXTRA #define WOLFSSL_GENSEED_FORTEST /* Warning: define your own seed gen */ + #if !defined(min) + #define min(data1, data2) _builtin_min(data1, data2) + #endif #endif @@ -260,7 +271,3 @@ #define XSTRCASECMP(s1,s2) strcmp((s1),(s2)) -#if !defined(WOLFSSL_RENESAS_TSIP_TLS) - #define min(x,y) ((x)<(y)?(x):(y)) -#endif - diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/wolfssl_dummy.c b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/wolfssl_dummy.c index 251d6481b6..b26cd7d6bc 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/wolfssl_dummy.c +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/wolfssl_dummy.c @@ -1,6 +1,6 @@ /* wolfssl_dummy.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -18,18 +18,33 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ - #include -#define YEAR 2023 -#define MON 6 - static int tick = 0; +#define YEAR ( \ + ((__DATE__)[7] - '0') * 1000 + \ + ((__DATE__)[8] - '0') * 100 + \ + ((__DATE__)[9] - '0') * 10 + \ + ((__DATE__)[10] - '0') * 1 \ +) + +#define MONTH ( \ + __DATE__[2] == 'n' ? (__DATE__[1] == 'a' ? 1 : 6) \ + : __DATE__[2] == 'b' ? 2 \ + : __DATE__[2] == 'r' ? (__DATE__[0] == 'M' ? 3 : 4) \ + : __DATE__[2] == 'y' ? 5 \ + : __DATE__[2] == 'l' ? 7 \ + : __DATE__[2] == 'g' ? 8 \ + : __DATE__[2] == 'p' ? 9 \ + : __DATE__[2] == 't' ? 10 \ + : __DATE__[2] == 'v' ? 11 \ + : 12 \ + ) time_t time(time_t *t) { (void)t; - return ((YEAR-1970)*365+30*MON)*24*60*60 + tick++; + return ((YEAR-1970)*365+30*MONTH)*24*60*60 + tick++; } #include diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/include.am b/IDE/Renesas/e2studio/RX65N/GR-ROSE/include.am index 60df793e5c..ce88e9b152 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/include.am +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/include.am @@ -23,4 +23,8 @@ EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/GR-ROSE/common/unistd.h EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/GR-ROSE/common/user_settings.h EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/GR-ROSE/smc/.cproject EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/GR-ROSE/smc/.project -EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/GR-ROSE/smc/smc.scfg \ No newline at end of file +EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/GR-ROSE/smc/smc.scfg +EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/GR-ROSE/tools/README.md +EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/GR-ROSE/tools/example_keys/generate_SignedCA.sh +EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/GR-ROSE/tools/example_keys/rsa_private.pem +EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/GR-ROSE/tools/example_keys/rsa_public.pem diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/smc/smc.scfg b/IDE/Renesas/e2studio/RX65N/GR-ROSE/smc/smc.scfg index 393a20ac49..9193414c7a 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/smc/smc.scfg +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/smc/smc.scfg @@ -4,16 +4,18 @@ + - - @@ -128,7 +129,7 @@ - @@ -338,13 +339,12 @@ diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/client/simple_tcp_client.c b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/client/simple_tcp_client.c index eaeb627405..68cd8c8668 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/client/simple_tcp_client.c +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/client/simple_tcp_client.c @@ -1,6 +1,6 @@ /* simple_tcp_client.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -88,11 +88,11 @@ void simple_tcp_client( ) #define BUFF_SIZE 256 static const char sendBuff[]= "Hello Server\n" ; - + char rcvBuff[BUFF_SIZE] = {0}; - + static T_IPV4EP my_addr = { 0, 0 }; - + T_IPV4EP dst_addr; if((dst_addr.ipaddr = getIPaddr(SIMPLE_TCPSEVER_IP)) == 0){ @@ -109,7 +109,7 @@ void simple_tcp_client( ) goto out; } - if (my_IOSend((char*)sendBuff, strlen(sendBuff), (void*)&cepid) != + if (my_IOSend((char*)sendBuff, strlen(sendBuff), (void*)&cepid) != strlen(sendBuff)) { printf("ERROR TCP write \n"); goto out; @@ -129,4 +129,4 @@ void simple_tcp_client( ) tcp_cls_cep(cepid, TMO_FEVR); return; -} \ No newline at end of file +} diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/client/simple_tls_tsip_client.c b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/client/simple_tls_tsip_client.c index 452d0ac747..62c426ca08 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/client/simple_tls_tsip_client.c +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/client/simple_tls_tsip_client.c @@ -1,6 +1,6 @@ /* simpel_tls_tsip_client.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -31,7 +31,7 @@ #include #endif -#define SIMPLE_TLSSEVER_IP "192.168.11.9" +#define SIMPLE_TLSSEVER_IP "192.168.11.5" #define SIMPLE_TLSSERVER_PORT "11111" ER t4_tcp_callback(ID cepid, FN fncd , VP p_parblk); @@ -198,7 +198,7 @@ void wolfSSL_TLS_client( ) { ID cepid = 1; ER ercd; - int ret; + int ret = 0; WOLFSSL_CTX *ctx = (WOLFSSL_CTX *)client_ctx; WOLFSSL *ssl = NULL; @@ -231,44 +231,95 @@ void wolfSSL_TLS_client( ) } #ifdef SIMPLE_TLS_TSIP_CLIENT - tsip_set_callback_ctx(ssl, &userContext); + ret = tsip_set_callback_ctx(ssl, &userContext); #endif /* set client private key data */ -#if defined(WOLFSSL_TLS13) && defined(SIMPLE_TLS_TSIP_CLIENT) - #if defined(USE_ECC_CERT) - if (tsip_use_PrivateKey_buffer_TLS(ssl, - (const char*)g_key_block_data.encrypted_user_ecc256_private_key, +#ifdef USE_ECC_CERT + + #ifdef WOLFSSL_RENESAS_TSIP_TLS + + /* TSIP specific ECC private key */ + if (ret == 0){ + ret = tsip_use_PrivateKey_buffer_TLS(ssl, + (const char*)g_key_block_data.encrypted_user_ecc256_private_key, sizeof(g_key_block_data.encrypted_user_ecc256_private_key), - TSIP_ECCP256) != 0) { - printf("ERROR: can't load client-private key\n"); - return; + TSIP_ECCP256); + if (ret != 0) { + printf("ERROR tsip_use_PrivateKey_buffer_TLS\n"); + } + } + # if defined(WOLFSSL_CHECK_SIG_FAULTS) + if (ret == 0){ + ret = tsip_use_PublicKey_buffer_TLS(ssl, + (const char*)g_key_block_data.encrypted_user_ecc256_public_key, + sizeof(g_key_block_data.encrypted_user_ecc256_public_key), + TSIP_ECCP256); + if (ret != 0) { + printf("ERROR tsip_use_PublicKey_buffer_TLS\n"); } + } + #endif /* WOLFSSL_CHECK_SIG_FAULTS */ + #else - if (tsip_use_PrivateKey_buffer_TLS(ssl, + + /* DER format ECC private key */ + if (ret == 0) { + ret = wolfSSL_use_PrivateKey_buffer(ssl, + ecc_clikey_der_256, + sizeof_ecc_clikey_der_256, + WOLFSSL_FILETYPE_ASN1); + if (ret != SSL_SUCCESS) { + printf("ERROR wolfSSL_use_PrivateKey_buffer: %d\n", + wolfSSL_get_error(ssl, 0)); + ret = -1; + } + } + + #endif /* WOLFSSL_RENESAS_TSIP_TLS */ + +#else + + #if defined(WOLFSSL_RENESAS_TSIP_TLS) + + /* Note: TSIP asks RSA client key pair for client authentication. */ + + /* TSIP specific RSA private key */ + if (ret == 0) { + ret = tsip_use_PrivateKey_buffer_TLS(ssl, (const char*)g_key_block_data.encrypted_user_rsa2048_private_key, sizeof(g_key_block_data.encrypted_user_rsa2048_private_key), - TSIP_RSA2048) != 0) { - printf("ERROR: can't load client-private key\n"); - return; + TSIP_RSA2048); + if (ret != 0) { + printf("ERROR tsip_use_PrivateKey_buffer_TLS :%d\n", ret); } + } + if (ret == 0) { ret = tsip_use_PublicKey_buffer_TLS(ssl, (const char*)g_key_block_data.encrypted_user_rsa2048_public_key, - sizeof(g_key_block_data.encrypted_user_rsa2048_public_key), TSIP_RSA2048); + sizeof(g_key_block_data.encrypted_user_rsa2048_public_key), + TSIP_RSA2048); if (ret != 0) { - printf("ERROR tsip_use_PublicKey_buffer: %d\n", ret); - return; + printf("ERROR tsip_use_PublicKey_buffer_TLS: %d\n", ret); } - #endif -#else - if (wolfSSL_use_PrivateKey_buffer(ssl, - ecc_clikey_der_256, - sizeof_ecc_clikey_der_256, - SSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) { - printf("ERROR: can't load private-key data.\n"); - return; } -#endif /* WOLFSSL_TLS13 */ + + #else + + if (ret == 0) { + err = wolfSSL_use_PrivateKey_buffer(ssl, client_key_der_2048, + sizeof_client_key_der_2048, WOLFSSL_FILETYPE_ASN1); + + if (err != SSL_SUCCESS) { + printf("ERROR wolfSSL_use_PrivateKey_buffer: %d\n", + wolfSSL_get_error(ssl, 0)); + ret = -1; + } + } + + #endif /* WOLFSSL_RENESAS_TSIP_TLS */ + +#endif /* USE_ECC_CERT */ /* set callback context */ wolfSSL_SetIOReadCtx(ssl, (void *)&cepid); diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/server/simple_tcp_server.c b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/server/simple_tcp_server.c index dfa4858916..1a096d37f6 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/server/simple_tcp_server.c +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/server/simple_tcp_server.c @@ -1,6 +1,6 @@ /* simple_tcp_server.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/server/simple_tls_server.c b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/server/simple_tls_server.c index d5138b0ea6..1066e536f7 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/server/simple_tls_server.c +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/server/simple_tls_server.c @@ -1,6 +1,6 @@ /* simple_tls_server.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -123,18 +123,18 @@ void wolfSSL_TLS_server_init() #if !defined(NO_FILESYSTEM) ret = wolfSSL_CTX_use_PrivateKey_file(server_ctx, key, 0); #else - ret = wolfSSL_CTX_use_PrivateKey_buffer(server_ctx, key, sizeof_key, + ret = wolfSSL_CTX_use_PrivateKey_buffer(server_ctx, key, sizeof_key, SSL_FILETYPE_ASN1); #endif if (ret != SSL_SUCCESS) { printf("Error %d loading server-key!\n", ret); return; } - + /* Register callbacks */ wolfSSL_SetIORecv(server_ctx, my_IORecv); wolfSSL_SetIOSend(server_ctx, my_IOSend); - + } void wolfSSL_TLS_server( ) diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/test_main.c b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/test_main.c index 42d62359ff..276ab79a7f 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/test_main.c +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/test_main.c @@ -1,6 +1,6 @@ /* test_main.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -259,7 +259,7 @@ void main(void) #if defined(SIMPLE_TLS_TSIP_CLIENT) SetTsiptlsKey(); #endif - + do { /* simply use TCP */ #if defined(SIMPLE_TCP_CLIENT) diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/wolfssl_simple_demo.h b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/wolfssl_simple_demo.h index c62cd4a38d..ff328622e5 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/wolfssl_simple_demo.h +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/wolfssl_simple_demo.h @@ -1,6 +1,6 @@ /* wolfssl_simple_demo.h * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -36,9 +36,9 @@ /* cannot enable with other definition */ /* simplest tcp client*/ /*#define SIMPLE_TCP_CLIENT */ -/* software TLS client */ +/* software TLS client */ /* #define SIMPLE_TLS_CLIENT */ -/* use TSIP Acceleration */ +/* use TSIP Acceleration */ /*#define SIMPLE_TLS_TSIP_CLIENT*/ /* simplest tcp server */ diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/test.scfg b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/test.scfg index bf7fe09204..d5c797c884 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/test.scfg +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/test.scfg @@ -362,14 +362,14 @@ - + - - + + @@ -437,14 +437,14 @@ - - + + - - - - + + + + @@ -457,8 +457,8 @@ - - + + @@ -608,110 +608,110 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - +