From fe5e5955bd48fb000c5aa8227686a7390d0483a1 Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Mon, 13 May 2024 19:12:34 -0700 Subject: [PATCH 1/4] Introduce IDE/PlatformIO --- .gitignore | 8 ++ IDE/PlatformIO/README.md | 82 ++++++++++++ IDE/PlatformIO/examples/README.md | 13 ++ .../examples/wolfssl_benchmark/CMakeLists.txt | 3 + .../examples/wolfssl_benchmark/README.md | 124 ++++++++++++++++++ .../examples/wolfssl_benchmark/include/README | 39 ++++++ .../examples/wolfssl_benchmark/lib/README | 46 +++++++ .../examples/wolfssl_benchmark/platformio.ini | 20 +++ .../wolfssl_benchmark/sdkconfig.defaults | 98 ++++++++++++++ .../wolfssl_benchmark/src/CMakeLists.txt | 6 + .../examples/wolfssl_benchmark/src/main.c | 26 ++++ .../examples/wolfssl_benchmark/test/README | 11 ++ .../wolfssl_benchmark.code-workspace | 13 ++ .../wolfssl_platformio.code-workspace | 22 ++++ .../examples/wolfssl_test/CMakeLists.txt | 3 + .../examples/wolfssl_test/README.md | 118 +++++++++++++++++ .../examples/wolfssl_test/include/README | 39 ++++++ .../examples/wolfssl_test/lib/README | 46 +++++++ .../examples/wolfssl_test/platformio.ini | 20 +++ .../examples/wolfssl_test/sdkconfig.defaults | 98 ++++++++++++++ .../examples/wolfssl_test/src/CMakeLists.txt | 6 + .../examples/wolfssl_test/src/main.c | 24 ++++ .../examples/wolfssl_test/test/README | 11 ++ .../wolfssl_test/wolfssl_test.code-workspace | 13 ++ IDE/PlatformIO/include.am | 39 ++++++ IDE/include.am | 2 + 26 files changed, 930 insertions(+) create mode 100644 IDE/PlatformIO/README.md create mode 100644 IDE/PlatformIO/examples/README.md create mode 100644 IDE/PlatformIO/examples/wolfssl_benchmark/CMakeLists.txt create mode 100644 IDE/PlatformIO/examples/wolfssl_benchmark/README.md create mode 100644 IDE/PlatformIO/examples/wolfssl_benchmark/include/README create mode 100644 IDE/PlatformIO/examples/wolfssl_benchmark/lib/README create mode 100644 IDE/PlatformIO/examples/wolfssl_benchmark/platformio.ini create mode 100644 IDE/PlatformIO/examples/wolfssl_benchmark/sdkconfig.defaults create mode 100644 IDE/PlatformIO/examples/wolfssl_benchmark/src/CMakeLists.txt create mode 100644 IDE/PlatformIO/examples/wolfssl_benchmark/src/main.c create mode 100644 IDE/PlatformIO/examples/wolfssl_benchmark/test/README create mode 100644 IDE/PlatformIO/examples/wolfssl_benchmark/wolfssl_benchmark.code-workspace create mode 100644 IDE/PlatformIO/examples/wolfssl_platformio.code-workspace create mode 100644 IDE/PlatformIO/examples/wolfssl_test/CMakeLists.txt create mode 100644 IDE/PlatformIO/examples/wolfssl_test/README.md create mode 100644 IDE/PlatformIO/examples/wolfssl_test/include/README create mode 100644 IDE/PlatformIO/examples/wolfssl_test/lib/README create mode 100644 IDE/PlatformIO/examples/wolfssl_test/platformio.ini create mode 100644 IDE/PlatformIO/examples/wolfssl_test/sdkconfig.defaults create mode 100644 IDE/PlatformIO/examples/wolfssl_test/src/CMakeLists.txt create mode 100644 IDE/PlatformIO/examples/wolfssl_test/src/main.c create mode 100644 IDE/PlatformIO/examples/wolfssl_test/test/README create mode 100644 IDE/PlatformIO/examples/wolfssl_test/wolfssl_test.code-workspace create mode 100644 IDE/PlatformIO/include.am diff --git a/.gitignore b/.gitignore index 5bd31033f1..833b664af3 100644 --- a/.gitignore +++ b/.gitignore @@ -433,3 +433,11 @@ MagicCrypto debian/changelog debian/control *.deb + +# PlatformIO +/**/.pio +/**/.vscode/.browse.c_cpp.db* +/**/.vscode/c_cpp_properties.json +/**/.vscode/launch.json +/**/.vscode/ipch +/**/sdkconfig.esp32dev diff --git a/IDE/PlatformIO/README.md b/IDE/PlatformIO/README.md new file mode 100644 index 0000000000..89c8c3c098 --- /dev/null +++ b/IDE/PlatformIO/README.md @@ -0,0 +1,82 @@ +# PlatformIO + +Follow the [instructions](https://docs.platformio.org/en/latest/core/installation/methods/index.html) to install PlatformIO. + +Note there are two options: + +- [Core CLI](https://docs.platformio.org/en/latest/core/index.html) +- [VSCode IDE](https://docs.platformio.org/en/latest/integration/ide/vscode.html#ide-vscode) + + +## Publishing + +The PlatformIO Core CLI is needed to publish wolfSSL: + +See also the [Arduino](../ARDUINO/README.md) publishing notes. + + +### Publish PlatformIO Arduino Library with Windows + +The wolfSSL publishing is done from the `scripts`. Here are somple examples: + +Setup the PlatformIO CLI: + +```dos +set PATH=%PATH%;C:\Users\%USERNAME%\.platformio\penv\Scripts\ +pio --help +pio account show +``` + +Publish + +```dos +pio pkg publish --owner wolfSSL C:\workspace\Arduino-wolfSSL +``` + +### Publish with Linux + +```bash +set PATH=%PATH%;C:\Users\%USERNAME%\.platformio\penv\Scripts\ +pio --help +pio account show +``` + +```bash +pio pkg publish --owner wolfSSL ~\workspace\Arduino-wolfSSL +``` + +### Create a staging / preview wolfssl org + +See + +``` +pio org create wolfssl-staging --email support@wolfssl.com --displayname "testing preview wolfssl" +``` + +### Add user to org + +The creator of an org is automatically added as user / owner at org creation time. Others can be added: + +``` +pio org add wolfssl-staging gojimmypi +``` + +### Publish Arduino wolfSSL to staging / preview site: + +``` +pio pkg publish --owner wolfssl-staging C:\workspace\Arduino-wolfSSL +``` + +### Publish Regular wolfSSL to staging / preview site: + +``` +pio pkg publish --owner wolfssl-staging C:\workspace\wolfssl-gojimmypi\IDE\PlatformIO\PlatformIO_wolfSSL +``` + +### Remove published version from staging site: + +`pio pkg unpublish [/][@] [OPTIONS]` + +``` +pio pkg unpublish wolfssl-staging/wolfssl@5.6.6-test1 +``` diff --git a/IDE/PlatformIO/examples/README.md b/IDE/PlatformIO/examples/README.md new file mode 100644 index 0000000000..f4ab164368 --- /dev/null +++ b/IDE/PlatformIO/examples/README.md @@ -0,0 +1,13 @@ +# PlatformIO + +Follow the [instructions](https://docs.platformio.org/en/latest/core/installation/methods/index.html) to install PlatformIO. + +Note there are two options: + +- [Core CLI](https://docs.platformio.org/en/latest/core/index.html) +- [VSCode IDE](https://docs.platformio.org/en/latest/integration/ide/vscode.html#ide-vscode) + +# Examples + +- [wolfssl_benchmark](./wolfssl_benchmark/README.md) +- [wolfssl_test](./wolfssl_test/README.md) diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/CMakeLists.txt b/IDE/PlatformIO/examples/wolfssl_benchmark/CMakeLists.txt new file mode 100644 index 0000000000..196bba158e --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.16.0) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(ESP_IDF_Hello_World) diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/README.md b/IDE/PlatformIO/examples/wolfssl_benchmark/README.md new file mode 100644 index 0000000000..32460b83ed --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/README.md @@ -0,0 +1,124 @@ +# wolfSSL Benchmark Example + +This ESP32 example uses the [wolfSSL wolfcrypt Benchmark Application](https://github.com/wolfSSL/wolfssl/tree/master/wolfcrypt/benchmark). + +Other target boards _should_ work, but have not yet been tested. + +For general information on [wolfSSL examples for Espressif](../README.md), see the +[README](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md) file. + +## Example Output + +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 +[docs](https://www.wolfssl.com/documentation/manuals/wolfssl/index.html). + +Compiled and flashed with `idf.py build flash -p /dev/ttyS7 -b 115200 monitor`: + +``` +--- idf_monitor on /dev/ttyS7 115200 --- +--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- + (377) cpu_start: Starting scheduler ets Jun 8 2016 00:22:57 + +rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) +configsip: 0, SPIWP:0xee +clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 +mode:DIO, clock div:2 +load:0x3fff0030,len:6664 +load:0x40078000,len:14848 +load:0x40080400,len:3792 +0x40080400: _init at ??:? + +entry 0x40080694 +I (27) boot: ESP-IDF v4.4.2-dirty 2nd stage bootloader +I (27) boot: compile time 13:41:41 +I (27) boot: chip revision: 1 +I (30) boot_comm: chip revision: 1, min. bootloader chip revision: 0 +I (37) boot.esp32: SPI Speed : 40MHz +I (42) boot.esp32: SPI Mode : DIO +I (46) boot.esp32: SPI Flash Size : 2MB +I (51) boot: Enabling RNG early entropy source... +I (56) boot: Partition Table: +I (60) boot: ## Label Usage Type ST Offset Length +I (67) boot: 0 nvs WiFi data 01 02 00009000 00006000 +I (75) boot: 1 phy_init RF data 01 01 0000f000 00001000 +I (82) boot: 2 factory factory app 00 00 00010000 00100000 +I (90) boot: End of partition table +I (94) boot_comm: chip revision: 1, min. application chip revision: 0 +I (101) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=12bf4h ( 76788) map +I (137) esp_image: segment 1: paddr=00022c1c vaddr=3ffb0000 size=02420h ( 9248) load +I (141) esp_image: segment 2: paddr=00025044 vaddr=40080000 size=0afd4h ( 45012) load +I (161) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=33148h (209224) map +I (237) esp_image: segment 4: paddr=00063170 vaddr=4008afd4 size=00550h ( 1360) load +I (238) esp_image: segment 5: paddr=000636c8 vaddr=50000000 size=00010h ( 16) load +I (249) boot: Loaded app from partition at offset 0x10000 +I (249) boot: Disabling RNG early entropy source... +I (266) cpu_start: Pro cpu up. +I (266) cpu_start: Starting app cpu, entry point is 0x40081098 +0x40081098: call_start_cpu1 at /mnt/c/SysGCC/esp32/esp-idf/v4.4.2/components/esp_system/port/cpu_start.c:160 + +I (0) cpu_start: App cpu up. +I (280) cpu_start: Pro cpu start user code +I (280) cpu_start: cpu freq: 240000000 +I (280) cpu_start: Application information: +I (285) cpu_start: Project name: wolfssl_benchmark +I (291) cpu_start: App version: v5.5.3-stable-108-gbd7b442df-di +I (298) cpu_start: Compile time: Nov 17 2022 14:10:03 +I (304) cpu_start: ELF file SHA256: fbb520f5bbf963a0... +I (310) cpu_start: ESP-IDF: v4.4.2-dirty +I (316) heap_init: Initializing. RAM available for dynamic allocation: +I (323) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM +I (329) heap_init: At 3FFB3DE8 len 0002C218 (176 KiB): DRAM +I (335) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM +I (341) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM +I (348) heap_init: At 4008B524 len 00014ADC (82 KiB): IRAM +I (355) spi_flash: detected chip: generic +I (359) spi_flash: flash io: dio +W (362) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. +I (377) cpu_start: Starting scheduler on PRO CPU. +I (0) cpu_start: Starting scheduler on APP CPU. +I (391) wolfssl_benchmark: app_main CONFIG_BENCH_ARGV = -lng 0 +I (397) wolfssl_benchmark: construct_argv arg:-lng 0 + +------------------------------------------------------------------------------ + wolfSSL version 5.5.3 +------------------------------------------------------------------------------ +wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each) +RNG 1 MiB took 1.017 seconds, 1.320 MiB/s +AES-128-CBC-enc 6 MiB took 1.002 seconds, 5.726 MiB/s +AES-128-CBC-dec 5 MiB took 1.000 seconds, 5.347 MiB/s +AES-192-CBC-enc 6 MiB took 1.004 seconds, 5.714 MiB/s +AES-192-CBC-dec 5 MiB took 1.001 seconds, 5.341 MiB/s +AES-256-CBC-enc 6 MiB took 1.000 seconds, 5.713 MiB/s +AES-256-CBC-dec 5 MiB took 1.002 seconds, 5.336 MiB/s +AES-128-GCM-enc 300 KiB took 1.004 seconds, 298.805 KiB/s +AES-128-GCM-dec 300 KiB took 1.004 seconds, 298.805 KiB/s +AES-192-GCM-enc 300 KiB took 1.007 seconds, 297.915 KiB/s +AES-192-GCM-dec 300 KiB took 1.008 seconds, 297.619 KiB/s +AES-256-GCM-enc 300 KiB took 1.011 seconds, 296.736 KiB/s +AES-256-GCM-dec 300 KiB took 1.011 seconds, 296.736 KiB/s +GMAC Default 403 KiB took 1.002 seconds, 402.196 KiB/s +3DES 450 KiB took 1.028 seconds, 437.743 KiB/s +MD5 14 MiB took 1.001 seconds, 13.756 MiB/s +SHA 14 MiB took 1.001 seconds, 14.463 MiB/s +SHA-256 14 MiB took 1.000 seconds, 14.233 MiB/s +SHA-512 17 MiB took 1.000 seconds, 16.626 MiB/s +HMAC-MD5 14 MiB took 1.000 seconds, 13.599 MiB/s +HMAC-SHA 14 MiB took 1.000 seconds, 13.989 MiB/s +HMAC-SHA256 14 MiB took 1.000 seconds, 13.940 MiB/s +HMAC-SHA512 16 MiB took 1.000 seconds, 16.064 MiB/s +PBKDF2 640 bytes took 1.009 seconds, 634.291 bytes/s +RSA 2048 public 52 ops took 1.022 sec, avg 19.654 ms, 50.881 ops/sec +RSA 2048 private 4 ops took 1.056 sec, avg 264.000 ms, 3.788 ops/sec +ECC [ SECP256R1] 256 key gen 4 ops took 1.216 sec, avg 304.000 ms, 3.289 ops/sec +ECDHE [ SECP256R1] 256 agree 4 ops took 1.215 sec, avg 303.750 ms, 3.292 ops/sec +ECDSA [ SECP256R1] 256 sign 4 ops took 1.226 sec, avg 306.500 ms, 3.263 ops/sec +ECDSA [ SECP256R1] 256 verify 2 ops took 1.172 sec, avg 586.000 ms, 1.706 ops/sec +CURVE 25519 key gen 3 ops took 1.279 sec, avg 426.333 ms, 2.346 ops/sec +CURVE 25519 agree 4 ops took 1.701 sec, avg 425.250 ms, 2.352 ops/sec +ED 25519 key gen 46 ops took 1.008 sec, avg 21.913 ms, 45.635 ops/sec +ED 25519 sign 42 ops took 1.038 sec, avg 24.714 ms, 40.462 ops/sec +ED 25519 verify 26 ops took 1.009 sec, avg 38.808 ms, 25.768 ops/sec +Benchmark complete +``` diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/include/README b/IDE/PlatformIO/examples/wolfssl_benchmark/include/README new file mode 100644 index 0000000000..45496b1f1e --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/include/README @@ -0,0 +1,39 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the usual convention is to give header files names that end with `.h'. +It is most portable to use only letters, digits, dashes, and underscores in +header file names, and at most one dot. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/lib/README b/IDE/PlatformIO/examples/wolfssl_benchmark/lib/README new file mode 100644 index 0000000000..a10cadebe8 --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into executable file. + +The source code of each library should be placed in an own separate directory +("lib/your_library_name/[here are source files]"). + +For example, see a structure of the following two libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +and a contents of `src/main.c`: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +PlatformIO Library Dependency Finder will find automatically dependent +libraries scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/platformio.ini b/IDE/PlatformIO/examples/wolfssl_benchmark/platformio.ini new file mode 100644 index 0000000000..1600026146 --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/platformio.ini @@ -0,0 +1,20 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:esp32dev] +platform = espressif32 +board = esp32dev +framework = espidf +upload_port = COM82 +monitor_port = COM82 +monitor_speed = 115200 +build_flags = -DWOLFSSL_USER_SETTINGS, -DWOLFSSL_ESP32 +monitor_filters = direct +lib_deps = wolfssl/wolfSSL@^5.7.0-rev.3b diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/sdkconfig.defaults b/IDE/PlatformIO/examples/wolfssl_benchmark/sdkconfig.defaults new file mode 100644 index 0000000000..2a5ad756d7 --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/sdkconfig.defaults @@ -0,0 +1,98 @@ +# sdkconfig.defaults for ESP8266 + ESP32 +# Note that during the build process, settings from sdkconfig.defaults will not override those already in sdkconfig. +# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#custom-sdkconfig-defaults +CONFIG_BENCH_ARGV="-lng 0" +CONFIG_FREERTOS_HZ=1000 +CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y + +# +# Default main stack size. See user_settings.h +# +# For wolfSSL SMALL_STACK, 3072 bytes should be sufficient for benchmark app. +# When using RSA, assign at least 10500 bytes, otherwise 5500 usually works for others +CONFIG_ESP_MAIN_TASK_STACK_SIZE=10500 + +# Legacy stack size for older ESP-IDF versions +CONFIG_MAIN_TASK_STACK_SIZE=10500 + +# +# Benchmark must not have CONFIG_NEWLIB_NANO_FORMAT enabled +CONFIG_NEWLIB_NANO_FORMAT=n +# +# Watchdog Timers +# +# We don't want to have the watchdog timeout during tests & benchmarks +# +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n +# Panic & Watchdog +CONFIG_ESP_INT_WDT_TIMEOUT_MS=10000 +CONFIG_ESP_TASK_WDT_EN=n +CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +CONFIG_ESP_INT_WDT=n + +# ESP8266 WDT +# CONFIG_ESP_PANIC_PRINT_REBOOT is not set +CONFIG_ESP_PANIC_PRINT_REBOOT=n +CONFIG_ESP_PANIC_PRINT_HALT=y + +# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set +CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=n + +# ESP8266 Memory +CONFIG_FREERTOS_GLOBAL_DATA_LINK_IRAM=y +CONFIG_HEAP_DISABLE_IRAM=y + +# Performance +# CONFIG_COMPILER_OPTIMIZATION_PERF=y + +# Set max COU frequency (falls back as needed for lower maximum) +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y + +# FreeRTOS ticks at 1ms interval +CONFIG_FREERTOS_UNICORE=y +CONFIG_FREERTOS_HZ=1000 + +# +# Compiler options +# +CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y +# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set +# CONFIG_COMPILER_OPTIMIZATION_PERF is not set +# CONFIG_COMPILER_OPTIMIZATION_NONE is not set +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set +CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 +# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set +CONFIG_COMPILER_HIDE_PATHS_MACROS=y +# CONFIG_COMPILER_CXX_EXCEPTIONS is not set +# CONFIG_COMPILER_CXX_RTTI is not set +# CONFIG_COMPILER_STACK_CHECK_MODE_NONE is not set +CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y +# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set +# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set +CONFIG_COMPILER_STACK_CHECK=y +# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set +# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set +# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set +# CONFIG_COMPILER_DUMP_RTL_FILES is not set +# end of Compiler options + +# We don't know that the min is actually v2, +# but this is the earliest tested. +CONFIG_ESP32C3_REV_MIN_2=y + +# +# Partition Table +# +# CONFIG_PARTITION_TABLE_SINGLE_APP is not set +CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y +# CONFIG_PARTITION_TABLE_TWO_OTA is not set +# CONFIG_PARTITION_TABLE_CUSTOM is not set +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp_large.csv" +CONFIG_PARTITION_TABLE_OFFSET=0x8000 +CONFIG_PARTITION_TABLE_MD5=y +# end of Partition Table diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/src/CMakeLists.txt b/IDE/PlatformIO/examples/wolfssl_benchmark/src/CMakeLists.txt new file mode 100644 index 0000000000..ab3ad38f1b --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/src/CMakeLists.txt @@ -0,0 +1,6 @@ +# This file was automatically generated for projects +# without default 'CMakeLists.txt' file. + +FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*) + +idf_component_register(SRCS ${app_sources}) diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/src/main.c b/IDE/PlatformIO/examples/wolfssl_benchmark/src/main.c new file mode 100644 index 0000000000..be14beb322 --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/src/main.c @@ -0,0 +1,26 @@ +#include +#ifdef WOLFSSL_ESPIDF + #include + #include + #include +#endif + +#include +#include +#include + +#define TAG "demo" + +void app_main() { + int ret = 0; +#ifdef WOLFSSL_ESPIDF + ESP_LOGI(TAG, "Found WOLFSSL_ESPIDF!"); +#endif + printf("Hello World wolfSSL Version %s", LIBWOLFSSL_VERSION_STRING); + +#if defined(HAVE_VERSION_EXTENDED_INFO) && defined(WOLFSSL_ESPIDF) + esp_ShowExtendedSystemInfo(); +#endif + ret = benchmark_test(NULL); + printf("benchmark_test result %d", ret); +} diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/test/README b/IDE/PlatformIO/examples/wolfssl_benchmark/test/README new file mode 100644 index 0000000000..b0416ad8be --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/wolfssl_benchmark.code-workspace b/IDE/PlatformIO/examples/wolfssl_benchmark/wolfssl_benchmark.code-workspace new file mode 100644 index 0000000000..67488baf28 --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/wolfssl_benchmark.code-workspace @@ -0,0 +1,13 @@ +{ + "folders": [ + { + "name": "wolfssl_benchmark", + "path": "." + } + ], + "settings": { + "files.associations": { + "settings.h": "c" + } + } +} diff --git a/IDE/PlatformIO/examples/wolfssl_platformio.code-workspace b/IDE/PlatformIO/examples/wolfssl_platformio.code-workspace new file mode 100644 index 0000000000..1c1f915989 --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_platformio.code-workspace @@ -0,0 +1,22 @@ +{ + "folders": [ + { + "name": "wolfsl_test", + "path": "wolfsl_test" + }, + { + "name": "wolfsl_benchmark", + "path": "wolfsl_benchmark" + } + ], + "settings": { + "files.associations": { + "version.h": "c", + "types.h": "c", + "settings.h": "c", + "freertos.h": "c", + "esp32-crypt.h": "c", + "esp_log.h": "c" + } + } +} diff --git a/IDE/PlatformIO/examples/wolfssl_test/CMakeLists.txt b/IDE/PlatformIO/examples/wolfssl_test/CMakeLists.txt new file mode 100644 index 0000000000..196bba158e --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_test/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.16.0) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(ESP_IDF_Hello_World) diff --git a/IDE/PlatformIO/examples/wolfssl_test/README.md b/IDE/PlatformIO/examples/wolfssl_test/README.md new file mode 100644 index 0000000000..0c7ca935e9 --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_test/README.md @@ -0,0 +1,118 @@ +# wolfSSL Crypt Test Example + +This is the ESP32 Version of the [wolfSSL wolfcrypt test application](https://github.com/wolfSSL/wolfssl/tree/master/wolfcrypt/test). + +Other target boards _should_ work, but have not yet been tested. + +For general information on [wolfSSL examples for Espressif](../README.md), see the +[README](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md) file. + + +## Example Output + +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 +[docs](https://www.wolfssl.com/documentation/manuals/wolfssl/index.html). + +Compiled and flashed with `idf.py build flash -p /dev/ttyS7 -b 115200 monitor`: + +``` +ets Jun 8 2016 00:22:57 + +rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) +configsip: 0, SPIWP:0xee +clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 +mode:DIO, clock div:2 +load:0x3fff0030,len:6612 +load:0x40078000,len:14788 +load:0x40080400,len:3792 +entry 0x40080694 +I (26) boot: ESP-IDF v4.4.1-dirty 2nd stage bootloader +I (26) boot: compile time 15:25:38 +I (26) boot: chip revision: 1 +I (29) boot_comm: chip revision: 1, min. bootloader chip revision: 0 +I (37) boot.esp32: SPI Speed : 40MHz +I (41) boot.esp32: SPI Mode : DIO +I (46) boot.esp32: SPI Flash Size : 2MB +I (50) boot: Enabling RNG early entropy source... +I (56) boot: Partition Table: +I (59) boot: ## Label Usage Type ST Offset Length +I (67) boot: 0 nvs WiFi data 01 02 00009000 00006000 +I (74) boot: 1 phy_init RF data 01 01 0000f000 00001000 +I (81) boot: 2 factory factory app 00 00 00010000 00100000 +I (89) boot: End of partition table +I (93) boot_comm: chip revision: 1, min. application chip revision: 0 +I (100) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=16ca4h ( 93348) map +I (143) esp_image: segment 1: paddr=00026ccc vaddr=3ffb0000 size=024d4h ( 9428) load +I (147) esp_image: segment 2: paddr=000291a8 vaddr=40080000 size=06e70h ( 28272) load +I (160) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=412d8h (266968) map +I (257) esp_image: segment 4: paddr=00071300 vaddr=40086e70 size=045a8h ( 17832) load +I (265) esp_image: segment 5: paddr=000758b0 vaddr=50000000 size=00010h ( 16) load +I (270) boot: Loaded app from partition at offset 0x10000 +I (270) boot: Disabling RNG early entropy source... +I (285) cpu_start: Pro cpu up. +I (286) cpu_start: Starting app cpu, entry point is 0x40081088 +I (273) cpu_start: App cpu up. +I (300) cpu_start: Pro cpu start user code +I (300) cpu_start: cpu freq: 160000000 +I (300) cpu_start: Application information: +I (305) cpu_start: Project name: wolfssl_test +I (310) cpu_start: App version: v5.5.3-stable-108-gbd7b442df-di +I (317) cpu_start: Compile time: Nov 17 2022 15:24:40 +I (323) cpu_start: ELF file SHA256: 90957eeb4f0d2246... +I (329) cpu_start: ESP-IDF: v4.4.1-dirty +I (335) heap_init: Initializing. RAM available for dynamic allocation: +I (342) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM +I (348) heap_init: At 3FFB2DF0 len 0002D210 (180 KiB): DRAM +I (354) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM +I (360) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM +I (367) heap_init: At 4008B418 len 00014BE8 (82 KiB): IRAM +I (374) spi_flash: detected chip: generic +I (378) spi_flash: flash io: dio +W (382) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. +I (396) cpu_start: Starting scheduler on PRO CPU. +I (0) cpu_start: Starting scheduler on APP CPU. +------------------------------------------------------------------------------ + wolfSSL version 5.5.3 +------------------------------------------------------------------------------ +error test passed! +MEMORY test passed! +base64 test passed! +asn test passed! +RANDOM test passed! +MD5 test passed! +MD4 test passed! +SHA test passed! +SHA-256 test passed! +SHA-512 test passed! +Hash test passed! +HMAC-MD5 test passed! +HMAC-SHA test passed! +HMAC-SHA256 test passed! +HMAC-SHA512 test passed! +HMAC-KDF test passed! +TLSv1.3 KDF test passed! +GMAC test passed! +DES test passed! +DES3 test passed! +AES test passed! +AES192 test passed! +AES256 test passed! +AES-GCM test passed! +RSA test passed! +PWDBASED test passed! +ECC test passed! +ECC buffer test passed! +CURVE25519 test passed! +ED25519 test passed! +logging test passed! +time test passed! +mutex test passed! +Test complete +I (136548) wolfcrypt_test: Exiting main with return code: 0 + +I (136548) wolfssl_test: wolf_test_task complete success result code = 0 +``` + +See the README.md file in the upper level 'examples' directory for [more information about examples](../README.md). diff --git a/IDE/PlatformIO/examples/wolfssl_test/include/README b/IDE/PlatformIO/examples/wolfssl_test/include/README new file mode 100644 index 0000000000..45496b1f1e --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_test/include/README @@ -0,0 +1,39 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the usual convention is to give header files names that end with `.h'. +It is most portable to use only letters, digits, dashes, and underscores in +header file names, and at most one dot. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/IDE/PlatformIO/examples/wolfssl_test/lib/README b/IDE/PlatformIO/examples/wolfssl_test/lib/README new file mode 100644 index 0000000000..a10cadebe8 --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_test/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into executable file. + +The source code of each library should be placed in an own separate directory +("lib/your_library_name/[here are source files]"). + +For example, see a structure of the following two libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +and a contents of `src/main.c`: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +PlatformIO Library Dependency Finder will find automatically dependent +libraries scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/IDE/PlatformIO/examples/wolfssl_test/platformio.ini b/IDE/PlatformIO/examples/wolfssl_test/platformio.ini new file mode 100644 index 0000000000..dda24761dd --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_test/platformio.ini @@ -0,0 +1,20 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:esp32dev] +platform = espressif32 +board = esp32dev +framework = espidf +upload_port = COM82 +monitor_port = COM82 +monitor_speed = 115200 +build_flags = -DWOLFSSL_USER_SETTINGS, -DWOLFSSL_ESP32 +monitor_filters = direct +lib_deps = wolfssl-staging/wolfSSL@^5.7.0-test.1 diff --git a/IDE/PlatformIO/examples/wolfssl_test/sdkconfig.defaults b/IDE/PlatformIO/examples/wolfssl_test/sdkconfig.defaults new file mode 100644 index 0000000000..2a5ad756d7 --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_test/sdkconfig.defaults @@ -0,0 +1,98 @@ +# sdkconfig.defaults for ESP8266 + ESP32 +# Note that during the build process, settings from sdkconfig.defaults will not override those already in sdkconfig. +# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#custom-sdkconfig-defaults +CONFIG_BENCH_ARGV="-lng 0" +CONFIG_FREERTOS_HZ=1000 +CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y + +# +# Default main stack size. See user_settings.h +# +# For wolfSSL SMALL_STACK, 3072 bytes should be sufficient for benchmark app. +# When using RSA, assign at least 10500 bytes, otherwise 5500 usually works for others +CONFIG_ESP_MAIN_TASK_STACK_SIZE=10500 + +# Legacy stack size for older ESP-IDF versions +CONFIG_MAIN_TASK_STACK_SIZE=10500 + +# +# Benchmark must not have CONFIG_NEWLIB_NANO_FORMAT enabled +CONFIG_NEWLIB_NANO_FORMAT=n +# +# Watchdog Timers +# +# We don't want to have the watchdog timeout during tests & benchmarks +# +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n +# Panic & Watchdog +CONFIG_ESP_INT_WDT_TIMEOUT_MS=10000 +CONFIG_ESP_TASK_WDT_EN=n +CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +CONFIG_ESP_INT_WDT=n + +# ESP8266 WDT +# CONFIG_ESP_PANIC_PRINT_REBOOT is not set +CONFIG_ESP_PANIC_PRINT_REBOOT=n +CONFIG_ESP_PANIC_PRINT_HALT=y + +# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set +CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=n + +# ESP8266 Memory +CONFIG_FREERTOS_GLOBAL_DATA_LINK_IRAM=y +CONFIG_HEAP_DISABLE_IRAM=y + +# Performance +# CONFIG_COMPILER_OPTIMIZATION_PERF=y + +# Set max COU frequency (falls back as needed for lower maximum) +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y + +# FreeRTOS ticks at 1ms interval +CONFIG_FREERTOS_UNICORE=y +CONFIG_FREERTOS_HZ=1000 + +# +# Compiler options +# +CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y +# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set +# CONFIG_COMPILER_OPTIMIZATION_PERF is not set +# CONFIG_COMPILER_OPTIMIZATION_NONE is not set +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set +CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 +# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set +CONFIG_COMPILER_HIDE_PATHS_MACROS=y +# CONFIG_COMPILER_CXX_EXCEPTIONS is not set +# CONFIG_COMPILER_CXX_RTTI is not set +# CONFIG_COMPILER_STACK_CHECK_MODE_NONE is not set +CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y +# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set +# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set +CONFIG_COMPILER_STACK_CHECK=y +# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set +# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set +# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set +# CONFIG_COMPILER_DUMP_RTL_FILES is not set +# end of Compiler options + +# We don't know that the min is actually v2, +# but this is the earliest tested. +CONFIG_ESP32C3_REV_MIN_2=y + +# +# Partition Table +# +# CONFIG_PARTITION_TABLE_SINGLE_APP is not set +CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y +# CONFIG_PARTITION_TABLE_TWO_OTA is not set +# CONFIG_PARTITION_TABLE_CUSTOM is not set +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp_large.csv" +CONFIG_PARTITION_TABLE_OFFSET=0x8000 +CONFIG_PARTITION_TABLE_MD5=y +# end of Partition Table diff --git a/IDE/PlatformIO/examples/wolfssl_test/src/CMakeLists.txt b/IDE/PlatformIO/examples/wolfssl_test/src/CMakeLists.txt new file mode 100644 index 0000000000..ab3ad38f1b --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_test/src/CMakeLists.txt @@ -0,0 +1,6 @@ +# This file was automatically generated for projects +# without default 'CMakeLists.txt' file. + +FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*) + +idf_component_register(SRCS ${app_sources}) diff --git a/IDE/PlatformIO/examples/wolfssl_test/src/main.c b/IDE/PlatformIO/examples/wolfssl_test/src/main.c new file mode 100644 index 0000000000..5ef7558dfe --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_test/src/main.c @@ -0,0 +1,24 @@ +#include +#ifdef WOLFSSL_ESPIDF + #include + #include + #include +#endif +#include +#include +#include +#define TAG "demo" + +void app_main() { + int ret = 0; +#ifdef WOLFSSL_ESPIDF + ESP_LOGI(TAG, "Found WOLFSSL_ESPIDF!"); +#endif + printf("Hello World wolfSSL Version %s", LIBWOLFSSL_VERSION_STRING); + +#if defined(HAVE_VERSION_EXTENDED_INFO) && defined(WOLFSSL_ESPIDF) + esp_ShowExtendedSystemInfo(); +#endif + ret = wolf_test_task(); + printf("wolf_test_task result %d", ret); +} diff --git a/IDE/PlatformIO/examples/wolfssl_test/test/README b/IDE/PlatformIO/examples/wolfssl_test/test/README new file mode 100644 index 0000000000..b0416ad8be --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_test/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/IDE/PlatformIO/examples/wolfssl_test/wolfssl_test.code-workspace b/IDE/PlatformIO/examples/wolfssl_test/wolfssl_test.code-workspace new file mode 100644 index 0000000000..782d7ef505 --- /dev/null +++ b/IDE/PlatformIO/examples/wolfssl_test/wolfssl_test.code-workspace @@ -0,0 +1,13 @@ +{ + "folders": [ + { + "name": "wolfssl_test", + "path": "." + } + ], + "settings": { + "files.associations": { + "settings.h": "c" + } + } +} diff --git a/IDE/PlatformIO/include.am b/IDE/PlatformIO/include.am new file mode 100644 index 0000000000..a112a337f0 --- /dev/null +++ b/IDE/PlatformIO/include.am @@ -0,0 +1,39 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root +# +# NOTE: append_wolfssl_git_version.sh is not included as the +# distribution file set will not contain GitHub info +# +# see: https://github.com/wolfSSL/wolfssl/pull/5955 +# +# Don't list any config.h files here + +EXTRA_DIST+= IDE/PlatformIO/README.md + +EXTRA_DIST+= IDE/PlatformIO/examples/README.md +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_platformio.code-workspace + +# wolfssl_benchmark example +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_benchmark/CMakeLists.txt +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_benchmark/platformio.ini +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_benchmark/README.md +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_benchmark/sdkconfig.defaults +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_benchmark/wolfssl_benchmark.code-workspace +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_benchmark/include/README +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_benchmark/lib/README +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_benchmark/src/CMakeLists.txt +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_benchmark/src/main.c +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_benchmark/test/README + +# wolfssl_test example +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_test/CMakeLists.txt +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_test/platformio.ini +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_test/README.md +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_test/sdkconfig.defaults +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_test/wolfssl_test.code-workspace +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_test/include/README +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_test/lib/README +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_test/src/CMakeLists.txt +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_test/src/main.c +EXTRA_DIST+= IDE/PlatformIO/examples/wolfssl_test/test/README diff --git a/IDE/include.am b/IDE/include.am index 6343981e11..65e07cc338 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -31,6 +31,7 @@ include IDE/MQX/include.am include IDE/MSVS-2019-AZSPHERE/include.am include IDE/mynewt/include.am include IDE/NETOS/include.am +include IDE/PlatformIO/include.am include IDE/QNX/include.am include IDE/Renesas/cs+/Projects/include.am include IDE/Renesas/e2studio/DK-S7G2/include.am @@ -70,3 +71,4 @@ EXTRA_DIST+= IDE/LPCXPRESSO EXTRA_DIST+= IDE/MDK-ARM EXTRA_DIST+= IDE/MYSQL EXTRA_DIST+= IDE/OPENSTM32/README.md +EXTRA_DIST+= IDE/PlatformIO From 503bbbec8fcb0cd1ece6404fcade60945fa454ab Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Wed, 15 May 2024 17:13:03 -0700 Subject: [PATCH 2/4] Update PlatformIO wolfssl/wolfssl@^5.7.0-rev.3c --- .../examples/wolfssl_test/platformio.ini | 62 +- .../examples/wolfssl_test/src/main.c | 48 +- .../wolfssl_test/wolfssl_test.code-workspace | 3 +- examples/configs/user_settings_platformio.h | 791 ++++++++++++++++++ 4 files changed, 859 insertions(+), 45 deletions(-) create mode 100644 examples/configs/user_settings_platformio.h diff --git a/IDE/PlatformIO/examples/wolfssl_test/platformio.ini b/IDE/PlatformIO/examples/wolfssl_test/platformio.ini index dda24761dd..79356a165c 100644 --- a/IDE/PlatformIO/examples/wolfssl_test/platformio.ini +++ b/IDE/PlatformIO/examples/wolfssl_test/platformio.ini @@ -1,20 +1,42 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:esp32dev] -platform = espressif32 -board = esp32dev -framework = espidf -upload_port = COM82 -monitor_port = COM82 -monitor_speed = 115200 -build_flags = -DWOLFSSL_USER_SETTINGS, -DWOLFSSL_ESP32 -monitor_filters = direct -lib_deps = wolfssl-staging/wolfSSL@^5.7.0-test.1 +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +; +; To ensure that you are always using the newest version of a library: +; lib_deps = wolfssl/wolfSSL@* +; +; If you want to stay within a certain range of versions while still +; getting updates, you can use semantic versioning to specify an acceptable +; range. For example, to get any version in the 5.x.x series: +; lib_deps = wolfssl/wolfSSL@^5.0.0 +; +; If you specifically want to ensure that you always get the latest version +; that matches 5.7.0 or newer, you could use: +; lib_deps = wolfssl/wolfSSL@>=5.7.0 +; +; If you want to test drive previews, see the staging versions: +; https://registry.platformio.org/search?q=owner%3Awolfssl-staging +; +; lib_deps = wolfssl-staging/wolfSSL@^5.7.0-test.rev03 +; +; The regular release of wolfssl (yes there's a case difference from staging') +; +; lib_deps = wolfssl/wolfssl@^5.7.0-rev.3c + +[env:esp32dev] +platform = espressif32 +board = esp32dev +framework = espidf +upload_port = COM19 +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 diff --git a/IDE/PlatformIO/examples/wolfssl_test/src/main.c b/IDE/PlatformIO/examples/wolfssl_test/src/main.c index 5ef7558dfe..1427005160 100644 --- a/IDE/PlatformIO/examples/wolfssl_test/src/main.c +++ b/IDE/PlatformIO/examples/wolfssl_test/src/main.c @@ -1,24 +1,24 @@ -#include -#ifdef WOLFSSL_ESPIDF - #include - #include - #include -#endif -#include -#include -#include -#define TAG "demo" - -void app_main() { - int ret = 0; -#ifdef WOLFSSL_ESPIDF - ESP_LOGI(TAG, "Found WOLFSSL_ESPIDF!"); -#endif - printf("Hello World wolfSSL Version %s", LIBWOLFSSL_VERSION_STRING); - -#if defined(HAVE_VERSION_EXTENDED_INFO) && defined(WOLFSSL_ESPIDF) - esp_ShowExtendedSystemInfo(); -#endif - ret = wolf_test_task(); - printf("wolf_test_task result %d", ret); -} +#include +#ifdef WOLFSSL_ESPIDF + #include + #include + #include +#endif +#include +#include +#include +#define TAG "demo" + +void app_main() { + int ret = 0; +#ifdef WOLFSSL_ESPIDF + ESP_LOGI(TAG, "Found WOLFSSL_ESPIDF!"); +#endif + printf("Hello World wolfSSL Version\n %s", LIBWOLFSSL_VERSION_STRING); + +#if defined(HAVE_VERSION_EXTENDED_INFO) && defined(WOLFSSL_ESPIDF) + esp_ShowExtendedSystemInfo(); +#endif + ret = wolf_test_task(); + printf("wolf_test_task result %d", ret); +} diff --git a/IDE/PlatformIO/examples/wolfssl_test/wolfssl_test.code-workspace b/IDE/PlatformIO/examples/wolfssl_test/wolfssl_test.code-workspace index 782d7ef505..85bc4e058f 100644 --- a/IDE/PlatformIO/examples/wolfssl_test/wolfssl_test.code-workspace +++ b/IDE/PlatformIO/examples/wolfssl_test/wolfssl_test.code-workspace @@ -7,7 +7,8 @@ ], "settings": { "files.associations": { - "settings.h": "c" + "settings.h": "c", + "sdkconfig.h": "c" } } } diff --git a/examples/configs/user_settings_platformio.h b/examples/configs/user_settings_platformio.h new file mode 100644 index 0000000000..25babd2113 --- /dev/null +++ b/examples/configs/user_settings_platformio.h @@ -0,0 +1,791 @@ +/* examples/configs/user_settings_platformio.h + * + * 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 + */ + +/* This is a sample PlatformIO user_settings.h for wolfSSL + * + * Do not include any wolfssl headers here + * + * When editing this file: + * ensure wolfssl_test and wolfssl_benchmark settings match. + */ + + /* Define a macro to display user settings version in example code: */ +#define WOLFSSL_USER_SETTINGS_ID "PlatformIO user_settings.h v5.7.0-test.rev02" + +/* + * For other platforms see: + * https://github.com/wolfSSL/wolfssl/tree/master/examples/configs + */ + +#if defined(ESP_IDF_VERSION_MAJOR) || defined(WOLFSSL_ESPIDF) || \ + defined(ESP_PLATFORM) || defined(WOLFSSL_ESP32) + #include "sdkconfig.h" + /* The #include "protocol_examples_common.h" fails for PlatformIO, + * so disable the WiFi *not needed for test and benchmark examples. */ + #define NO_ESP_SDK_WIFI +#endif + + +/* We don't use WiFi, so don't compile in the esp-sdk-lib WiFi helpers: */ +/* #define USE_WOLFSSL_ESP_SDK_WIFI */ + +/* Experimental Kyber */ +#if 0 + /* Kyber typically needs a minimum 10K stack */ + #define WOLFSSL_EXPERIMENTAL_SETTINGS + #define WOLFSSL_HAVE_KYBER + #define WOLFSSL_WC_KYBER + #define WOLFSSL_SHA3 +#endif + +/* Used only by benchmark: */ +#define BENCH_EMBEDDED +#define WOLFSSL_BENCHMARK_FIXED_UNITS_KB + + +#define HAVE_VERSION_EXTENDED_INFO +/* Due to limited build control, we'll ignore file warnings. */ +/* See github.com/arduino/arduino-cli/issues/631 */ +#undef WOLFSSL_IGNORE_FILE_WARN +#define WOLFSSL_IGNORE_FILE_WARN + +/* when you want to use SINGLE THREAD. Note Default ESP-IDF is FreeRTOS */ +/* TODO: known PlatformIO problem if SINGLE_THREADED is not enabled. */ +/* See https://github.com/wolfSSL/wolfssl/issues/7533 */ +#define SINGLE_THREADED + +/* 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. */ +#define NO_SESSION_CACHE + +/* Small Stack uses more heap. */ +#define WOLFSSL_SMALL_STACK + +/* Full debugging turned off, but show malloc failure detail */ +/* #define DEBUG_WOLFSSL */ +#define DEBUG_WOLFSSL_MALLOC + +/* See test.c that sets cert buffers; we'll set them here: */ +#define USE_CERT_BUFFERS_256 +#define USE_CERT_BUFFERS_2048 + +/* RSA_LOW_MEM: Half as much memory but twice as slow. */ +#define RSA_LOW_MEM + +/* Uncommon settings for testing only */ +#define TEST_ESPIDF_ALL_WOLFSSL +#ifdef TEST_ESPIDF_ALL_WOLFSSL + #define WOLFSSL_MD2 + #define HAVE_BLAKE2 + #define HAVE_BLAKE2B + #define HAVE_BLAKE2S + + #define WC_RC2 + #define WOLFSSL_ALLOW_RC4 + + #define HAVE_POLY1305 + + #define WOLFSSL_AES_128 + #define WOLFSSL_AES_OFB + #define WOLFSSL_AES_CFB + #define WOLFSSL_AES_XTS + + #define WOLFSSL_WOLFSSH + + #define HAVE_AESGCM + #define WOLFSSL_AES_COUNTER + + #define HAVE_FFDHE + #define HAVE_FFDHE_2048 + #if defined(CONFIG_IDF_TARGET_ESP8266) + /* TODO Full size SRP is disabled on the ESP8266 at this time. + * Low memory issue? */ + #define WOLFCRYPT_HAVE_SRP + /* MIN_FFDHE_FP_MAX_BITS = (MIN_FFDHE_BITS * 2); see settings.h */ + #define FP_MAX_BITS MIN_FFDHE_FP_MAX_BITS + #elif defined(CONFIG_IDF_TARGET_ESP32) || \ + defined(CONFIG_IDF_TARGET_ESP32S2) || \ + defined(CONFIG_IDF_TARGET_ESP32S3) + /* SRP Known to be working on this target:*/ + #define WOLFCRYPT_HAVE_SRP + #define FP_MAX_BITS (8192 * 2) + #elif defined(CONFIG_IDF_TARGET_ESP32C3) || \ + defined(CONFIG_IDF_TARGET_ESP32H2) + /* SRP Known to be working on this target:*/ + #define WOLFCRYPT_HAVE_SRP + #define FP_MAX_BITS (8192 * 2) + #else + /* For everything else, give a try and see if SRP working: */ + #define WOLFCRYPT_HAVE_SRP + #define FP_MAX_BITS (8192 * 2) + #endif + + #define HAVE_DH + + /* TODO: there may be a problem with HAVE_CAMELLIA with HW AES disabled. + * Do not define NO_WOLFSSL_ESP32_CRYPT_AES when enabled: */ + /* #define HAVE_CAMELLIA */ + + /* DSA requires old SHA */ + #define HAVE_DSA + + /* Needs SHA512 ? */ + #define HAVE_HPKE + + /* Not for Espressif? */ + #if defined(CONFIG_IDF_TARGET_ESP32C2) || \ + defined(CONFIG_IDF_TARGET_ESP8684) || \ + defined(CONFIG_IDF_TARGET_ESP32H2) || \ + defined(CONFIG_IDF_TARGET_ESP8266) + + #if defined(CONFIG_IDF_TARGET_ESP8266) + #undef HAVE_ECC + #undef HAVE_ECC_CDH + #undef HAVE_CURVE25519 + + /* TODO does CHACHA also need alignment? Failing on ESP8266 + * See SHA256 __attribute__((aligned(4))); and WC_SHA256_ALIGN */ + #ifdef HAVE_CHACHA + #error "HAVE_CHACHA not supported on ESP8266" + #endif + #ifdef HAVE_XCHACHA + #error "HAVE_XCHACHA not supported on ESP8266" + #endif + #else + #define HAVE_XCHACHA + #define HAVE_CHACHA + /* TODO Not enabled at this time, needs further testing: + * #define WC_SRTP_KDF + * #define HAVE_COMP_KEY + * #define WOLFSSL_HAVE_XMSS + */ + #endif + /* TODO AES-EAX not working on this platform */ + + /* Optionally disable DH + * #undef HAVE_DH + * #undef HAVE_FFDHE + */ + + /* ECC_SHAMIR out of memory on ESP32-C2 during ECC */ + #ifndef HAVE_ECC + #define ECC_SHAMIR + #endif + #else + #define WOLFSSL_AES_EAX + + #define ECC_SHAMIR + #endif + + /* Only for WOLFSSL_IMX6_CAAM / WOLFSSL_QNX_CAAM ? */ + /* #define WOLFSSL_CAAM */ + /* #define WOLFSSL_CAAM_BLOB */ + + #define WOLFSSL_AES_SIV + #define WOLFSSL_CMAC + + #define WOLFSSL_CERT_PIV + + /* HAVE_SCRYPT may turn on HAVE_PBKDF2 see settings.h */ + /* #define HAVE_SCRYPT */ + #define SCRYPT_TEST_ALL + #define HAVE_X963_KDF +#endif + +/* optionally turn off SHA512/224 SHA512/256 */ +/* #define WOLFSSL_NOSHA512_224 */ +/* #define WOLFSSL_NOSHA512_256 */ + +/* when you want to use SINGLE THREAD. Note Default ESP-IDF is FreeRTOS */ +/* #define SINGLE_THREADED */ + +/* When you don't want to use the old SHA */ +/* #define NO_SHA */ +/* #define NO_OLD_TLS */ + +/* Cannot use WOLFSSL_NO_MALLOC with small stack */ +/* #define WOLFSSL_NO_MALLOC */ + +#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 + +#define WOLFSSL_BENCHMARK_FIXED_UNITS_KB + +#define NO_FILESYSTEM + +/* To further reduce size, client or server functionality can be disabled. + * Here, we check if the example code gave us a hint. + * + * The calling application can define either one of these macros before + * including the Arduino wolfssl.h library file: + * + * WOLFSSL_CLIENT_EXAMPLE + * WOLFSSL_SERVER_EXAMPLE + */ +#if defined(WOLFSSL_CLIENT_EXAMPLE) + #define NO_WOLFSSL_SERVER +#elif defined(WOLFSSL_SERVER_EXAMPLE) + #define NO_WOLFSSL_CLIENT +#else + /* Provide a hint to application that neither WOLFSSL_CLIENT_EXAMPLE + * or WOLFSSL_SERVER_EXAMPLE macro hint was desired but not found. */ + #define NO_WOLFSSL_SERVER_CLIENT_MISSING + /* Both can be disabled in wolfssl test & benchmark */ +#endif + +#define NO_OLD_TLS + +#define HAVE_AESGCM + +/* Optional RIPEMD: RACE Integrity Primitives Evaluation Message Digest */ +/* #define WOLFSSL_RIPEMD */ + +/* when you want to use SHA224 */ +#define WOLFSSL_SHA224 + +/* 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) + /* TODO determine low memory configuration for ECC. */ +#else + #define HAVE_ECC + #define HAVE_CURVE25519 + #define CURVE25519_SMALL +#endif + +#define HAVE_ED25519 + +/* Optional OPENSSL compatibility */ +#define OPENSSL_EXTRA + +/* #Optional HAVE_PKCS7 */ +#define HAVE_PKCS7 + +#if defined(HAVE_PKCS7) + /* HAVE_PKCS7 may enable HAVE_PBKDF2 see settings.h */ + #define NO_PBKDF2 + + #define HAVE_AES_KEYWRAP + #define HAVE_X963_KDF + #define WOLFSSL_AES_DIRECT +#endif + +/* when you want to use AES counter mode */ +/* #define WOLFSSL_AES_DIRECT */ +/* #define WOLFSSL_AES_COUNTER */ + +/* esp32-wroom-32se specific definition */ +#if defined(WOLFSSL_ESPWROOM32SE) + #define WOLFSSL_ATECC508A + #define HAVE_PK_CALLBACKS + /* when you want to use a custom slot allocation for ATECC608A */ + /* unless your configuration is unusual, you can use default */ + /* implementation. */ + /* #define CUSTOM_SLOT_ALLOCATION */ +#endif + +/* WC_NO_CACHE_RESISTANT: slower but more secure */ +/* #define WC_NO_CACHE_RESISTANT */ + +/* TFM_TIMING_RESISTANT: slower but more secure */ +/* #define TFM_TIMING_RESISTANT */ + +/* #define WOLFSSL_ATECC508A_DEBUG */ + +/* date/time */ +/* if it cannot adjust time in the device, */ +/* enable macro below */ +/* #define NO_ASN_TIME */ +/* #define XTIME time */ + + +/* adjust wait-timeout count if you see timeout in RSA HW acceleration */ +#define ESP_RSA_TIMEOUT_CNT 0x349F00 + +/* hash limit for test.c */ +#define HASH_SIZE_LIMIT + +/* USE_FAST_MATH is default */ +#define USE_FAST_MATH + +/***** Use SP_MATH *****/ +/* #undef USE_FAST_MATH */ +/* #define SP_MATH */ +/* #define WOLFSSL_SP_MATH_ALL */ +/* #define WOLFSSL_SP_RISCV32 */ + +/***** Use Integer Heap Math *****/ +/* #undef USE_FAST_MATH */ +/* #define USE_INTEGER_HEAP_MATH */ + + +#define WOLFSSL_SMALL_STACK + + +#define HAVE_VERSION_EXTENDED_INFO +/* #define HAVE_WC_INTROSPECTION */ + +#define HAVE_SESSION_TICKET + +/* #define HAVE_HASHDRBG */ + +#define WOLFSSL_KEY_GEN +#define WOLFSSL_CERT_REQ +#define WOLFSSL_CERT_GEN +#define WOLFSSL_CERT_EXT +#define WOLFSSL_SYS_CA_CERTS + + +#define WOLFSSL_CERT_TEXT + +#define WOLFSSL_ASN_TEMPLATE + +/* +#undef WOLFSSL_KEY_GEN +#undef WOLFSSL_CERT_REQ +#undef WOLFSSL_CERT_GEN +#undef WOLFSSL_CERT_EXT +#undef WOLFSSL_SYS_CA_CERTS +*/ + +/* command-line options +--enable-keygen +--enable-certgen +--enable-certreq +--enable-certext +--enable-asn-template +*/ + +/* 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) + /* Alternatively, if there's an ECC Secure Element present: */ + /* #define WOLFSSL_ESPWROOM32SE */ + + /* wolfSSL HW Acceleration supported on ESP32. Uncomment to disable: */ + /* #define NO_ESP32_CRYPT */ + /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ + /* #define NO_WOLFSSL_ESP32_CRYPT_AES */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */ + + /* These are defined automatically in esp32-crypt.h, here for clarity: */ + #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA224 /* no SHA224 HW on ESP32 */ + + #undef ESP_RSA_MULM_BITS + #define ESP_RSA_MULM_BITS 16 /* TODO add compile-time warning */ + /***** END CONFIG_IDF_TARGET_ESP32 *****/ + +#elif defined(CONFIG_IDF_TARGET_ESP32S2) + /* wolfSSL HW Acceleration supported on ESP32-S2. Uncomment to disable: */ + /* #define NO_ESP32_CRYPT */ + /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ + /* Note: There's no AES192 HW on the ESP32-S2; falls back to SW */ + /* #define NO_WOLFSSL_ESP32_CRYPT_AES */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */ + /***** END CONFIG_IDF_TARGET_ESP32S2 *****/ + +#elif defined(CONFIG_IDF_TARGET_ESP32S3) + /* wolfSSL HW Acceleration supported on ESP32-S3. Uncomment to disable: */ + /* #define NO_ESP32_CRYPT */ + /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ + /* Note: There's no AES192 HW on the ESP32-S3; falls back to SW */ + /* #define NO_WOLFSSL_ESP32_CRYPT_AES */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */ + /***** END CONFIG_IDF_TARGET_ESP32S3 *****/ + +#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \ + defined(CONFIG_IDF_TARGET_ESP8684) + /* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a + * single QFN 4x4 mm package. Out of released documentation, Technical + * Reference Manual as well as ESP-IDF Programming Guide is applicable + * to both ESP32-C2 and ESP8684. + * + * See: www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */ + + /* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */ + /* #define NO_ESP32_CRYPT */ + /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */ + + /* These are defined automatically in esp32-crypt.h, here for clarity */ + #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */ + #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */ + + /* There's no AES or RSA/Math accelerator on the ESP32-C2 + * Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */ + #define NO_WOLFSSL_ESP32_CRYPT_AES + #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI + #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL + #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD + #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD + /***** END CONFIG_IDF_TARGET_ESP32C2 *****/ + +#elif defined(CONFIG_IDF_TARGET_ESP32C3) + /* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */ + + /* #define NO_ESP32_CRYPT */ + /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */ + + /* These are defined automatically in esp32-crypt.h, here for clarity: */ + #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */ + #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */ + + /* #define NO_WOLFSSL_ESP32_CRYPT_AES */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */ + /***** END CONFIG_IDF_TARGET_ESP32C3 *****/ + +#elif defined(CONFIG_IDF_TARGET_ESP32C6) + /* wolfSSL HW Acceleration supported on ESP32-C6. Uncomment to disable: */ + + /* #define NO_ESP32_CRYPT */ + /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ + /* These are defined automatically in esp32-crypt.h, here for clarity: */ + #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */ + #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */ + + /* #define NO_WOLFSSL_ESP32_CRYPT_AES */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */ + /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */ + /***** END CONFIG_IDF_TARGET_ESP32C6 *****/ + +#elif defined(CONFIG_IDF_TARGET_ESP32H2) + /* wolfSSL Hardware Acceleration not yet implemented */ + #define NO_ESP32_CRYPT + #define NO_WOLFSSL_ESP32_CRYPT_HASH + #define NO_WOLFSSL_ESP32_CRYPT_AES + #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI + /***** END CONFIG_IDF_TARGET_ESP32H2 *****/ + +#elif defined(CONFIG_IDF_TARGET_ESP8266) + #define WOLFSSL_ESP8266 + + /* There's no hardware encryption on the ESP8266 */ + /* Consider using the ESP32-C2/C3/C6 + * See www.espressif.com/en/products/socs/esp32-c2 */ + #define NO_ESP32_CRYPT + #define NO_WOLFSSL_ESP32_CRYPT_HASH + #define NO_WOLFSSL_ESP32_CRYPT_AES + #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI + /***** END CONFIG_IDF_TARGET_ESP266 *****/ + +#elif defined(CONFIG_IDF_TARGET_ESP8684) + /* There's no Hardware Acceleration available on ESP8684 */ + #define NO_ESP32_CRYPT + #define NO_WOLFSSL_ESP32_CRYPT_HASH + #define NO_WOLFSSL_ESP32_CRYPT_AES + #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI + /***** END CONFIG_IDF_TARGET_ESP8684 *****/ + +#else + /* Anything else encountered, disable HW acceleration */ + #define NO_ESP32_CRYPT + #define NO_WOLFSSL_ESP32_CRYPT_HASH + #define NO_WOLFSSL_ESP32_CRYPT_AES + #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI +#endif /* CONFIG_IDF_TARGET Check */ + +/* RSA primitive specific definition, listed AFTER the Chipset detection */ +#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE) + /* Consider USE_FAST_MATH and SMALL_STACK */ + + #ifndef NO_RSA + #define ESP32_USE_RSA_PRIMITIVE + + #if defined(CONFIG_IDF_TARGET_ESP32) + #ifdef CONFIG_ESP_MAIN_TASK_STACK_SIZE + #if CONFIG_ESP_MAIN_TASK_STACK_SIZE < 10500 + #warning "RSA may be difficult with less than 10KB Stack "/ + #endif + #endif + + /* NOTE HW unreliable for small values! */ + /* threshold for performance adjustment for HW primitive use */ + /* X bits of G^X mod P greater than */ + #undef ESP_RSA_EXPT_XBITS + #define ESP_RSA_EXPT_XBITS 32 + + /* X and Y of X * Y mod P greater than */ + #undef ESP_RSA_MULM_BITS + #define ESP_RSA_MULM_BITS 16 + #endif + #endif +#endif + +/* Debug options: +See wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h for details on debug options + +#define ESP_VERIFY_MEMBLOCK +#define DEBUG_WOLFSSL +#define DEBUG_WOLFSSL_VERBOSE +#define DEBUG_WOLFSSL_SHA_MUTEX +#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_ESP_RSA_MULM_BITS +#define ESP_DISABLE_HW_TASK_LOCK + +See wolfcrypt/benchmark/benchmark.c for debug and other settings: + +Turn on benchmark timing debugging (CPU Cycles, RTOS ticks, etc) +#define DEBUG_WOLFSSL_BENCHMARK_TIMING + +Turn on timer debugging (used when CPU cycles not available) +#define WOLFSSL_BENCHMARK_TIMER_DEBUG +*/ + +/* Pause in a loop rather than exit. */ +#define WOLFSSL_ESPIDF_ERROR_PAUSE + +#define WOLFSSL_HW_METRICS +#define ALT_ECC_SIZE + +/* for test.c: */ +/* #define HASH_SIZE_LIMIT */ + +/* Optionally turn off HW math checks */ +/* #define NO_HW_MATH_TEST */ + +/* Optionally include alternate HW test library: alt_hw_test.h */ +/* When enabling, the ./components/wolfssl/CMakeLists.txt file + * will need the name of the library in the idf_component_register + * for the PRIV_REQUIRES list. */ +/* #define INCLUDE_ALT_HW_TEST */ + +/* optionally turn off individual math HW acceleration features */ + +/* Turn off Large Number ESP32 HW Multiplication: +** [Z = X * Y] in esp_mp_mul() */ +/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */ + +/* Turn off Large Number ESP32 HW Modular Exponentiation: +** [Z = X^Y mod M] in esp_mp_exptmod() */ +/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */ + +/* Turn off Large Number ESP32 HW Modular Multiplication +** [Z = X * Y mod M] in esp_mp_mulmod() */ +/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */ + + +/* used by benchmark: */ +#define WOLFSSL_PUBLIC_MP + +/* when turning on ECC508 / ECC608 support +#define WOLFSSL_ESPWROOM32SE +#define HAVE_PK_CALLBACKS +#define WOLFSSL_ATECC508A +#define ATCA_WOLFSSL +*/ + +/* optional SM4 Ciphers. See github.com/wolfSSL/wolfsm */ + +/***************************** Certificate Macros ***************************** + * + * The section below defines macros used in typically all of the wolfSSL + * examples such as the client and server for certs stored in header files. + * + * There are various certificate examples in this header file: + * https://github.com/wolfSSL/wolfssl/blob/master/wolfssl/certs_test.h + * + * To use the sets of macros below, define *one* of these: + * + * USE_CERT_BUFFERS_1024 - ECC 1024 bit encoded ASN1 + * USE_CERT_BUFFERS_2048 - RSA 2048 bit encoded ASN1 + * WOLFSSL_SM[2,3,4] - SM Ciphers + * + * For example: define USE_CERT_BUFFERS_2048 to use CA Certs used in this + * wolfSSL function for the `ca_cert_der_2048` buffer, size and types: + * + * ret = wolfSSL_CTX_load_verify_buffer(ctx, + * CTX_CA_CERT, + * CTX_CA_CERT_SIZE, + * CTX_CA_CERT_TYPE); + * + * See www.wolfssl.com/documentation/manuals/wolfssl/group__CertsKeys.html#function-wolfssl_ctx_load_verify_buffer + * + * In this case the CTX_CA_CERT will be defined as `ca_cert_der_2048` as + * defined here: github.com/wolfSSL/wolfssl/blob/master/wolfssl/certs_test.h + * + * The CTX_CA_CERT_SIZE and CTX_CA_CERT_TYPE are similarly used to reference + * array size and cert type respectively. + * + * Similarly for loading the private client key: + * + * ret = wolfSSL_CTX_use_PrivateKey_buffer(ctx, + * CTX_CLIENT_KEY, + * CTX_CLIENT_KEY_SIZE, + * CTX_CLIENT_KEY_TYPE); + * + * see www.wolfssl.com/documentation/manuals/wolfssl/group__CertsKeys.html#function-wolfssl_ctx_use_privatekey_buffer + * + * Similarly, the other macros are for server certificates and keys: + * `CTX_SERVER_CERT` and `CTX_SERVER_KEY` are available. + * + * The certificate and key names are typically `static const unsigned char` + * arrays. The [NAME]_size are typically `sizeof([array name])`, and the types + * are the known wolfSSL encoding type integers (e.g. WOLFSSL_FILETYPE_PEM). + * + * See `SSL_FILETYPE_[name]` in + * github.com/wolfSSL/wolfssl/blob/master/wolfssl/ssl.h + * + * See Abstract Syntax Notation One (ASN.1) in: + * github.com/wolfSSL/wolfssl/blob/master/wolfssl/wolfcrypt/asn.h + * + * Optional SM4 Ciphers: + * + * Although the SM ciphers are shown here, the `certs_test_sm.h` may not yet + * be available. See: + * github.com/wolfSSL/wolfssl/pull/6825 + * github.com/wolfSSL/wolfsm + * + * Uncomment these 3 macros to enable the SM Ciphers and use the macros below. + */ + +/* +#define WOLFSSL_SM2 +#define WOLFSSL_SM3 +#define WOLFSSL_SM4 +*/ + +/* Conditional macros used in wolfSSL TLS client and server examples */ +#if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4) + #define CTX_CA_CERT root_sm2 + #define CTX_CA_CERT_SIZE sizeof_root_sm2 + #define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_PEM + #define CTX_SERVER_CERT server_sm2 + #define CTX_SERVER_CERT_SIZE sizeof_server_sm2 + #define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_PEM + #define CTX_SERVER_KEY server_sm2_priv + #define CTX_SERVER_KEY_SIZE sizeof_server_sm2_priv + #define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_PEM + + #undef WOLFSSL_BASE16 + #define WOLFSSL_BASE16 +#else + #if defined(USE_CERT_BUFFERS_2048) + #ifdef USE_CERT_BUFFERS_1024 + #error "USE_CERT_BUFFERS_1024 is already defined. Pick one." + #endif + #include + #define CTX_CA_CERT ca_cert_der_2048 + #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048 + #define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1 + + #define CTX_SERVER_CERT server_cert_der_2048 + #define CTX_SERVER_CERT_SIZE sizeof_server_cert_der_2048 + #define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_ASN1 + #define CTX_SERVER_KEY server_key_der_2048 + #define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048 + #define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1 + + #define CTX_CLIENT_CERT client_cert_der_2048 + #define CTX_CLIENT_CERT_SIZE sizeof_client_cert_der_2048 + #define CTX_CLIENT_CERT_TYPE WOLFSSL_FILETYPE_ASN1 + #define CTX_CLIENT_KEY client_key_der_2048 + #define CTX_CLIENT_KEY_SIZE sizeof_client_key_der_2048 + #define CTX_CLIENT_KEY_TYPE WOLFSSL_FILETYPE_ASN1 + + #elif defined(USE_CERT_BUFFERS_1024) + #ifdef USE_CERT_BUFFERS_2048 + #error "USE_CERT_BUFFERS_2048 is already defined. Pick one." + #endif + #define CTX_CA_CERT ca_cert_der_1024 + #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_1024 + #define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1 + + #define CTX_CLIENT_CERT client_cert_der_1024 + #define CTX_CLIENT_CERT_SIZE sizeof_client_cert_der_1024 + #define CTX_CLIENT_CERT_TYPE WOLFSSL_FILETYPE_ASN1 + #define CTX_CLIENT_KEY client_key_der_1024 + #define CTX_CLIENT_KEY_SIZE sizeof_client_key_der_1024 + #define CTX_CLIENT_KEY_TYPE WOLFSSL_FILETYPE_ASN1 + + #define CTX_SERVER_CERT server_cert_der_1024 + #define CTX_SERVER_CERT_SIZE sizeof_server_cert_der_1024 + #define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_ASN1 + #define CTX_SERVER_KEY server_key_der_1024 + #define CTX_SERVER_KEY_SIZE sizeof_server_key_der_1024 + #define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1 + #else + /* Optionally define custom cert arrays, sizes, and types here */ + #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 From 74c0d9b9f695abcade101b0c19db29c9ae8c333c Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Thu, 16 May 2024 10:48:14 -0700 Subject: [PATCH 3/4] Update example/configs list, sort order. --- examples/configs/README.md | 9 ++++++--- examples/configs/include.am | 9 +++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/configs/README.md b/examples/configs/README.md index 8ed282cc72..596cd5db02 100644 --- a/examples/configs/README.md +++ b/examples/configs/README.md @@ -6,13 +6,16 @@ Example wolfSSL configuration file templates for use when autoconf is not availa * `user_settings_template.h`: Template that allows modular algorithm and feature selection using `#if 0` logic. * `user_settings_all.h`: This is wolfSSL with all features enabled. Equivalent to `./configure --enable-all`. -* `user_settings_min_ecc.h`: This is ECC and SHA-256 only. For ECC verify only add `BUILD_VERIFY_ONLY`. -* `user_settings_wolfboot_keytools.h`: This from wolfBoot tools/keytools and is ECC, RSA, ED25519 and ChaCha20. +* `user_settings_arduino.h`: An example Arduino file. See also [wolfSSL/Arduino-wolfSSL](https://github.com/wolfSSL/Arduino-wolfSSL). +*.`user_settings_EBSnet.h`: Example configuration file for use with EBSnet ports. * `user_settings_fipsv2.h`: The FIPS v2 (3389) 140-2 certificate build options. * `user_settings_fipsv5.h`: The FIPS v5 (ready) 140-3 build options. Equivalent to `./configure --enable-fips=v5-dev`. +* `user_settings_min_ecc.h`: This is ECC and SHA-256 only. For ECC verify only add `BUILD_VERIFY_ONLY`. +* `user_settings_platformio.h`: An example for PlatformIO library. See also [platformio/wolfssl](https://registry.platformio.org/libraries/wolfssl/wolfssl) * `user_settings_stm32.h`: Example configuration file generated from the wolfSSL STM32 Cube pack. +* `user_settings_tls12`: Example for TLS v1.2 client only, ECC only, AES GCM only, SHA2-256 only. +* `user_settings_wolfboot_keytools.h`: This from wolfBoot tools/keytools and is ECC, RSA, ED25519 and ChaCha20. * `user_settings_wolftpm.h`: Minimum options for building wolfTPM. See comment at top for ./configure used to generate. -*.`user_settings_EBSnet.h`: Example configuration file for use with EBSnet ports. ## Usage diff --git a/examples/configs/include.am b/examples/configs/include.am index 61154167a1..dd52d97e91 100644 --- a/examples/configs/include.am +++ b/examples/configs/include.am @@ -4,12 +4,13 @@ EXTRA_DIST += examples/configs/README.md EXTRA_DIST += examples/configs/user_settings_all.h EXTRA_DIST += examples/configs/user_settings_arduino.h -EXTRA_DIST += examples/configs/user_settings_min_ecc.h -EXTRA_DIST += examples/configs/user_settings_wolfboot_keytools.h -EXTRA_DIST += examples/configs/user_settings_template.h +EXTRA_DIST += examples/configs/user_settings_EBSnet.h EXTRA_DIST += examples/configs/user_settings_fipsv2.h EXTRA_DIST += examples/configs/user_settings_fipsv5.h +EXTRA_DIST += examples/configs/user_settings_min_ecc.h +EXTRA_DIST += examples/configs/user_settings_platformio.h EXTRA_DIST += examples/configs/user_settings_stm32.h +EXTRA_DIST += examples/configs/user_settings_template.h EXTRA_DIST += examples/configs/user_settings_tls12.h +EXTRA_DIST += examples/configs/user_settings_wolfboot_keytools.h EXTRA_DIST += examples/configs/user_settings_wolftpm.h -EXTRA_DIST += examples/configs/user_settings_EBSnet.h From 439d81e0c9bcc651454f0f77a96f2ac72ad20969 Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Thu, 16 May 2024 10:50:02 -0700 Subject: [PATCH 4/4] Add PlatformIO license headers --- .../examples/wolfssl_benchmark/src/main.c | 21 +++++++++++++++++++ .../examples/wolfssl_test/src/main.c | 21 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/IDE/PlatformIO/examples/wolfssl_benchmark/src/main.c b/IDE/PlatformIO/examples/wolfssl_benchmark/src/main.c index be14beb322..3c561e4d4a 100644 --- a/IDE/PlatformIO/examples/wolfssl_benchmark/src/main.c +++ b/IDE/PlatformIO/examples/wolfssl_benchmark/src/main.c @@ -1,3 +1,24 @@ +/* PlatformIO wolfssl_benchmark main.c + * + * 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 + */ + #include #ifdef WOLFSSL_ESPIDF #include diff --git a/IDE/PlatformIO/examples/wolfssl_test/src/main.c b/IDE/PlatformIO/examples/wolfssl_test/src/main.c index 1427005160..957bebb7a8 100644 --- a/IDE/PlatformIO/examples/wolfssl_test/src/main.c +++ b/IDE/PlatformIO/examples/wolfssl_test/src/main.c @@ -1,3 +1,24 @@ +/* PlatformIO wolfssl_test main.c + * + * 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 + */ + #include #ifdef WOLFSSL_ESPIDF #include