Merge pull request #7559 from gojimmypi/PR-PlatformIO-FreeRTOS

Update PlatformIO README and Examples
This commit is contained in:
David Garske
2024-05-20 09:36:23 -07:00
committed by GitHub
9 changed files with 461 additions and 250 deletions

View File

@ -2,81 +2,25 @@
Follow the [instructions](https://docs.platformio.org/en/latest/core/installation/methods/index.html) to install PlatformIO.
Note there are two options:
Note there are two options for using PlatformIO:
- [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)
There are two types wolfSSL libraries for PlatformIO:
- Regular (release): https://registry.platformio.org/libraries/wolfssl/wolfssl
- Arduino (release): https://registry.platformio.org/libraries/wolfssl/Arduino-wolfSSL
There are staging / preview libraries for each of the two types wolfSSL libraries for PlatformIO:
- Regular (staging / preview): https://registry.platformio.org/libraries/wolfssl-staging/wolfSSL
- Arduino (staging / preview): https://registry.platformio.org/libraries/wolfssl-staging/Arduino-wolfSSL
# Examples
See the [examples directory](./examples/)
## 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 [<organization>/]<pkgname>[@<version>] [OPTIONS]`
```
pio pkg unpublish wolfssl-staging/wolfssl@5.6.6-test1
```
The wolfSSL publishing is performed from the `scripts`.

View File

@ -14,111 +14,201 @@ compatible across the widest ranges of targets. Contact wolfSSL at support@wolfs
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
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 ??:?
load:0x3fff0030,len:7168
load:0x40078000,len:15612
load:0x40080400,len:4
load:0x40080404,len:3736
entry 0x40080624
I (28) boot: ESP-IDF 5.2.1 2nd stage bootloader
I (29) boot: compile time May 17 2024 19:42:46
W (29) boot: Unicore bootloader
I (32) boot: chip revision: v1.0
I (36) boot.esp32: SPI Speed : 40MHz
I (41) boot.esp32: SPI Mode : DIO
I (45) boot.esp32: SPI Flash Size : 4MB
I (50) boot: Enabling RNG early entropy source...
I (55) boot: Partition Table:
I (59) boot: ## Label Usage Type ST Offset Length
I (66) 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) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=1900ch (102412) map
I (138) esp_image: segment 1: paddr=00029034 vaddr=3ffb0000 size=01794h ( 6036) load
I (141) esp_image: segment 2: paddr=0002a7d0 vaddr=40080000 size=05848h ( 22600) load
I (154) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=4bc50h (310352) map
I (266) esp_image: segment 4: paddr=0007bc78 vaddr=40085848 size=05b64h ( 23396) load
I (276) esp_image: segment 5: paddr=000817e4 vaddr=50000000 size=00004h ( 4) load
I (282) boot: Loaded app from partition at offset 0x10000
I (282) boot: Disabling RNG early entropy source...
I (297) cpu_start: Unicore app
I (297) cpu_start: Single core mode
I (305) cpu_start: Pro cpu start user code
I (305) cpu_start: cpu freq: 240000000 Hz
I (305) cpu_start: Application information:
I (310) cpu_start: Project name: ESP_IDF_Hello_World
I (316) cpu_start: App version: v5.7.0-stable-512-g15af87af8-di
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 (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
I (367) heap_init: At 3FFB2018 len 0002DFE8 (183 KiB): DRAM
I (373) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (379) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (386) heap_init: At 4008B3AC len 00014C54 (83 KiB): IRAM
I (392) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
I (399) spi_flash: detected chip: generic
I (403) spi_flash: flash io: dio
I (407) main_task: Started on CPU0
I (410) main_task: Calling app_main()
I (415) wolfSSL demo: Found WOLFSSL_ESPIDF!
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
------------------------------------------------------------------------------
Hello World wolfSSL Version 5.7.0
I (423) esp32_util: Extended Version and Platform Information.
I (429) esp32_util: Chip revision: v1.0
I (434) esp32_util: SSID and plain text WiFi password not displayed in startup logs.
I (442) esp32_util: Define SHOW_SSID_AND_PASSWORD to enable display.
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 (475) esp32_util: Macro Name Defined Not Defined
I (482) esp32_util: ------------------------- --------- -------------
I (489) esp32_util: NO_ESPIDF_DEFAULT........ X
I (496) esp32_util: HW_MATH_ENABLED.......... X
I (502) esp32_util: WOLFSSL_SHA224........... X
I (507) esp32_util: WOLFSSL_SHA384........... X
I (513) esp32_util: WOLFSSL_SHA512........... X
I (518) esp32_util: WOLFSSL_SHA3............. X
I (524) esp32_util: HAVE_ED25519............. X
I (529) esp32_util: HAVE_AES_ECB............. X
I (536) esp32_util: HAVE_AES_DIRECT.......... X
I (543) esp32_util: USE_FAST_MATH............ X
I (548) esp32_util: WOLFSSL_SP_MATH_ALL...... X
I (555) esp32_util: SP_MATH.................. X
I (561) esp32_util: WOLFSSL_HW_METRICS....... X
I (567) esp32_util: RSA_LOW_MEM.............. X
I (572) esp32_util: SMALL_SESSION_CACHE...... X
I (579) esp32_util: WC_NO_HARDEN............. X
I (586) esp32_util: TFM_TIMING_RESISTANT..... X
I (591) esp32_util: ECC_TIMING_RESISTANT..... X
I (597) esp32_util: WC_NO_CACHE_RESISTANT.... X
I (602) esp32_util: WC_AES_BITSLICED......... X
I (609) esp32_util: WOLFSSL_AES_NO_UNROLL.... X
I (615) esp32_util: TFM_TIMING_RESISTANT..... X
I (621) esp32_util: ECC_TIMING_RESISTANT..... X
I (627) esp32_util: WC_RSA_BLINDING.......... X
I (632) esp32_util: NO_WRITEV................ X
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 (663) esp32_util: Compiler Optimization: Default
I (668) esp32_util:
I (671) esp32_util: CONFIG_IDF_TARGET = esp32
W (676) esp32_util: Watchdog active; missing WOLFSSL_ESP_NO_WATCHDOG definition.
I (684) esp32_util: CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ: 240 MHz
I (691) esp32_util: Xthal_have_ccount: 1
I (695) esp32_util: CONFIG_MAIN_TASK_STACK_SIZE: 10500
I (701) esp32_util: CONFIG_ESP_MAIN_TASK_STACK_SIZE: 10500
I (707) esp32_util: CONFIG_TIMER_TASK_STACK_SIZE: 3584
I (713) esp32_util: CONFIG_TIMER_TASK_STACK_DEPTH: 2048
I (719) esp32_util: Stack HWM: 3ffb4ebf
I (724) esp32_util: ESP32_CRYPT is enabled for ESP32.
I (729) esp32_util: SINGLE_THREADED
I (733) esp32_util: Boot count: 1
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
RNG 1625 KiB took 1.016 seconds, 1599.409 KiB/s Cycles per byte = 251.56
AES-128-CBC-enc 7600 KiB took 1.003 seconds, 7577.268 KiB/s Cycles per byte = 30.93
AES-128-CBC-dec 7350 KiB took 1.001 seconds, 7342.657 KiB/s Cycles per byte = 31.94
AES-192-CBC-enc 7575 KiB took 1.001 seconds, 7567.433 KiB/s Cycles per byte = 30.97
AES-192-CBC-dec 7325 KiB took 1.000 seconds, 7325.000 KiB/s Cycles per byte = 31.98
AES-256-CBC-enc 7375 KiB took 1.000 seconds, 7375.000 KiB/s Cycles per byte = 31.77
AES-256-CBC-dec 7325 KiB took 1.001 seconds, 7317.682 KiB/s Cycles per byte = 32.02
AES-128-GCM-enc 350 KiB took 1.008 seconds, 347.222 KiB/s Cycles per byte = 675.33
AES-128-GCM-dec 350 KiB took 1.009 seconds, 346.878 KiB/s Cycles per byte = 675.81
AES-192-GCM-enc 350 KiB took 1.013 seconds, 345.508 KiB/s Cycles per byte = 678.52
AES-192-GCM-dec 350 KiB took 1.014 seconds, 345.168 KiB/s Cycles per byte = 679.06
AES-256-GCM-enc 350 KiB took 1.018 seconds, 343.811 KiB/s Cycles per byte = 681.98
AES-256-GCM-dec 350 KiB took 1.020 seconds, 343.137 KiB/s Cycles per byte = 682.55
GMAC Default 415 KiB took 1.001 seconds, 414.585 KiB/s Cycles per byte = 565.02
AES-XTS-enc 1950 KiB took 1.000 seconds, 1950.000 KiB/s Cycles per byte = 120.17
AES-XTS-dec 1950 KiB took 1.002 seconds, 1946.108 KiB/s Cycles per byte = 120.49
AES-128-CFB 2425 KiB took 1.009 seconds, 2403.370 KiB/s Cycles per byte = 97.53
AES-192-CFB 2350 KiB took 1.010 seconds, 2326.733 KiB/s Cycles per byte = 100.67
AES-256-CFB 2250 KiB took 1.000 seconds, 2250.000 KiB/s Cycles per byte = 104.12
AES-128-OFB 2425 KiB took 1.009 seconds, 2403.370 KiB/s Cycles per byte = 97.47
AES-192-OFB 2350 KiB took 1.009 seconds, 2329.039 KiB/s Cycles per byte = 100.62
AES-256-OFB 2275 KiB took 1.010 seconds, 2252.475 KiB/s Cycles per byte = 104.07
AES-128-CTR 2450 KiB took 1.007 seconds, 2432.969 KiB/s Cycles per byte = 96.33
AES-192-CTR 2375 KiB took 1.009 seconds, 2353.816 KiB/s Cycles per byte = 99.50
AES-256-CTR 2275 KiB took 1.000 seconds, 2275.000 KiB/s Cycles per byte = 102.92
AES-256-SIV-enc 900 KiB took 1.019 seconds, 883.219 KiB/s Cycles per byte = 265.22
AES-256-SIV-dec 900 KiB took 1.019 seconds, 883.219 KiB/s Cycles per byte = 265.40
AES-384-SIV-enc 875 KiB took 1.015 seconds, 862.069 KiB/s Cycles per byte = 271.82
AES-384-SIV-dec 875 KiB took 1.016 seconds, 861.220 KiB/s Cycles per byte = 272.09
AES-512-SIV-enc 850 KiB took 1.012 seconds, 839.921 KiB/s Cycles per byte = 279.14
AES-512-SIV-dec 850 KiB took 1.014 seconds, 838.264 KiB/s Cycles per byte = 279.36
ARC4 4100 KiB took 1.003 seconds, 4087.737 KiB/s Cycles per byte = 57.30
3DES 450 KiB took 1.001 seconds, 449.550 KiB/s Cycles per byte = 521.21
MD5 13775 KiB took 1.000 seconds, 13775.000 KiB/s Cycles per byte = 17.01
POLY1305 7350 KiB took 1.000 seconds, 7350.000 KiB/s Cycles per byte = 31.89
SHA 16175 KiB took 1.000 seconds, 16175.000 KiB/s Cycles per byte = 14.49
SHA-224 1325 KiB took 1.004 seconds, 1319.721 KiB/s Cycles per byte = 177.55
SHA-256 15975 KiB took 1.001 seconds, 15959.041 KiB/s Cycles per byte = 14.69
SHA-384 17400 KiB took 1.000 seconds, 17400.000 KiB/s Cycles per byte = 13.48
SHA-512 17200 KiB took 1.000 seconds, 17200.000 KiB/s Cycles per byte = 13.63
SHA-512/224 1150 KiB took 1.012 seconds, 1136.364 KiB/s Cycles per byte = 206.14
SHA-512/256 1150 KiB took 1.010 seconds, 1138.614 KiB/s Cycles per byte = 205.91
SHA3-224 1125 KiB took 1.001 seconds, 1123.876 KiB/s Cycles per byte = 208.50
SHA3-256 1075 KiB took 1.013 seconds, 1061.204 KiB/s Cycles per byte = 220.77
SHA3-384 825 KiB took 1.007 seconds, 819.265 KiB/s Cycles per byte = 285.94
SHA3-512 575 KiB took 1.002 seconds, 573.852 KiB/s Cycles per byte = 408.48
SHAKE128 1300 KiB took 1.000 seconds, 1300.000 KiB/s Cycles per byte = 180.29
SHAKE256 1075 KiB took 1.012 seconds, 1062.253 KiB/s Cycles per byte = 220.72
BLAKE2b 1650 KiB took 1.007 seconds, 1638.530 KiB/s Cycles per byte = 143.04
BLAKE2s 3475 KiB took 1.003 seconds, 3464.606 KiB/s Cycles per byte = 67.59
AES-128-CMAC 2350 KiB took 1.009 seconds, 2329.039 KiB/s Cycles per byte = 100.65
AES-256-CMAC 2200 KiB took 1.006 seconds, 2186.879 KiB/s Cycles per byte = 107.22
HMAC-MD5 13625 KiB took 1.000 seconds, 13625.000 KiB/s Cycles per byte = 17.21
HMAC-SHA 15800 KiB took 1.000 seconds, 15800.000 KiB/s Cycles per byte = 14.84
HMAC-SHA224 1325 KiB took 1.012 seconds, 1309.289 KiB/s Cycles per byte = 179.02
HMAC-SHA256 15575 KiB took 1.000 seconds, 15575.000 KiB/s Cycles per byte = 15.05
HMAC-SHA384 16375 KiB took 1.000 seconds, 16375.000 KiB/s Cycles per byte = 14.32
HMAC-SHA512 15850 KiB took 1.000 seconds, 15850.000 KiB/s Cycles per byte = 14.80
PBKDF2 1 KiB took 1.024 seconds, 0.549 KiB/s Cycles per byte = 426593.36
RSA 1024 key gen 1 ops took 1.142 sec, avg 1142.000 ms, 0.876 ops/sec
RSA 2048 key gen 1 ops took 2.817 sec, avg 2817.000 ms, 0.355 ops/sec
RSA 2048 public 14 ops took 1.115 sec, avg 79.643 ms, 12.556 ops/sec
RSA 2048 private 6 ops took 1.272 sec, avg 212.000 ms, 4.717 ops/sec
DH 2048 key gen 5 ops took 1.206 sec, avg 241.200 ms, 4.146 ops/sec
DH 2048 agree 14 ops took 1.106 sec, avg 79.000 ms, 12.658 ops/sec
ECC [ SECP256R1] 256 key gen 4 ops took 1.525 sec, avg 381.250 ms, 2.623 ops/sec
ECDHE [ SECP256R1] 256 agree 4 ops took 1.522 sec, avg 380.500 ms, 2.628 ops/sec
ECDSA [ SECP256R1] 256 sign 4 ops took 1.541 sec, avg 385.250 ms, 2.596 ops/sec
ECDSA [ SECP256R1] 256 verify 4 ops took 1.014 sec, avg 253.500 ms, 3.945 ops/sec
CURVE 25519 key gen 3 ops took 1.186 sec, avg 395.333 ms, 2.530 ops/sec
CURVE 25519 agree 4 ops took 1.577 sec, avg 394.250 ms, 2.536 ops/sec
ED 25519 key gen 45 ops took 1.006 sec, avg 22.356 ms, 44.732 ops/sec
ED 25519 sign 40 ops took 1.036 sec, avg 25.900 ms, 38.610 ops/sec
ED 25519 verify 26 ops took 1.014 sec, avg 39.000 ms, 25.641 ops/sec
Benchmark complete
benchmark_test complete! result code: 0
I (82083) main_task: Returned from app_main()
```
See the README.md file in the upper level 'examples' directory for [more information about examples](../README.md).

View File

@ -0,0 +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
*/
#ifndef _MAIN_H_
#define _MAIN_H_
#endif

View File

@ -12,8 +12,8 @@
platform = espressif32
board = esp32dev
framework = espidf
upload_port = COM82
monitor_port = COM82
upload_port = COM19
monitor_port = COM19
monitor_speed = 115200
build_flags = -DWOLFSSL_USER_SETTINGS, -DWOLFSSL_ESP32
monitor_filters = direct

View File

@ -18,30 +18,31 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#include "main.h"
#include <wolfssl/wolfcrypt/settings.h>
#ifdef WOLFSSL_ESPIDF
#include <esp_log.h>
#include <rtc_wdt.h>
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
#endif
#include <wolfssl/version.h>
#include <wolfssl/wolfcrypt/types.h>
#include <wolfcrypt/benchmark/benchmark.h>
#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);
}
#include <wolfssl/wolfcrypt/settings.h>
#ifdef WOLFSSL_ESPIDF
#include <esp_log.h>
#include <rtc_wdt.h>
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
#endif
#include <wolfssl/version.h>
#include <wolfssl/wolfcrypt/types.h>
#include <wolfcrypt/benchmark/benchmark.h>
#define TAG "wolfSSL demo"
void app_main() {
int ret = 0;
#ifdef WOLFSSL_ESPIDF
ESP_LOGI(TAG, "Found WOLFSSL_ESPIDF!");
#endif
printf("\nHello World wolfSSL Version %s\n", LIBWOLFSSL_VERSION_STRING);
#if defined(HAVE_VERSION_EXTENDED_INFO) && defined(WOLFSSL_ESPIDF)
esp_ShowExtendedSystemInfo();
#endif
ret = benchmark_test(NULL);
printf("\nbenchmark_test complete! result code: %d\n", ret);
}

View File

@ -1,6 +1,6 @@
# wolfSSL Crypt Test Example
This is the ESP32 Version of the [wolfSSL wolfcrypt test application](https://github.com/wolfSSL/wolfssl/tree/master/wolfcrypt/test).
This ESP32 example uses 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.
@ -15,104 +15,227 @@ compatible across the widest ranges of targets. Contact wolfSSL at support@wolfs
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)
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: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
load:0x3fff0030,len:7168
load:0x40078000,len:15612
load:0x40080400,len:4
load:0x40080404,len:3736
entry 0x40080624
I (28) boot: ESP-IDF 5.2.1 2nd stage bootloader
I (29) boot: compile time May 17 2024 19:32:25
W (29) boot: Unicore bootloader
I (32) boot: chip revision: v1.0
I (36) boot.esp32: SPI Speed : 40MHz
I (41) boot.esp32: SPI Mode : DIO
I (46) boot.esp32: SPI Flash Size : 2MB
I (45) boot.esp32: SPI Flash Size : 4MB
I (50) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (55) boot: Partition Table:
I (59) boot: ## Label Usage Type ST Offset Length
I (67) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (66) 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.
I (93) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=31e24h (204324) map
I (175) esp_image: segment 1: paddr=00041e4c vaddr=3ffb0000 size=01c54h ( 7252) load
I (178) esp_image: segment 2: paddr=00043aa8 vaddr=40080000 size=0b3c0h ( 46016) load
I (200) esp_image: segment 3: paddr=0004ee70 vaddr=50000000 size=00004h ( 4) load
I (200) esp_image: segment 4: paddr=0004ee7c vaddr=00000000 size=0119ch ( 4508)
I (207) esp_image: segment 5: paddr=00050020 vaddr=400d0020 size=abb7ch (703356) map
I (473) boot: Loaded app from partition at offset 0x10000
I (474) boot: Disabling RNG early entropy source...
I (485) cpu_start: Unicore app
I (485) cpu_start: Single core mode
I (493) cpu_start: Pro cpu start user code
I (493) cpu_start: cpu freq: 240000000 Hz
I (493) cpu_start: Application information:
I (498) cpu_start: Project name: ESP_IDF_Hello_World
I (504) cpu_start: App version: v5.7.0-stable-512-g15af87af8-di
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 (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
I (555) heap_init: At 3FFB38C0 len 0002C740 (177 KiB): DRAM
I (561) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (568) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (574) heap_init: At 4008B3C0 len 00014C40 (83 KiB): IRAM
I (580) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
I (588) spi_flash: detected chip: generic
I (591) spi_flash: flash io: dio
I (595) main_task: Started on CPU0
I (598) main_task: Calling app_main()
I (603) wolfSSL demo: Found WOLFSSL_ESPIDF!
Hello World wolfSSL Version 5.7.0
I (611) esp32_util: Extended Version and Platform Information.
I (617) esp32_util: Chip revision: v1.0
I (622) esp32_util: SSID and plain text WiFi password not displayed in startup logs.
I (630) esp32_util: Define SHOW_SSID_AND_PASSWORD to enable display.
W (637) esp32_util: Warning: old cmake, user_settings.h location unknown.
I (645) esp32_util: LIBWOLFSSL_VERSION_STRING = 5.7.0
I (650) esp32_util: LIBWOLFSSL_VERSION_HEX = 5007000
I (656) esp32_util: Stack HWM: 9212
I (660) esp32_util:
I (663) esp32_util: Macro Name Defined Not Defined
I (670) esp32_util: ------------------------- --------- -------------
I (677) esp32_util: NO_ESPIDF_DEFAULT........ X
I (684) esp32_util: HW_MATH_ENABLED.......... X
I (689) esp32_util: WOLFSSL_SHA224........... X
I (695) esp32_util: WOLFSSL_SHA384........... X
I (700) esp32_util: WOLFSSL_SHA512........... X
I (706) esp32_util: WOLFSSL_SHA3............. X
I (712) esp32_util: HAVE_ED25519............. X
I (717) esp32_util: HAVE_AES_ECB............. X
I (724) esp32_util: HAVE_AES_DIRECT.......... X
I (730) esp32_util: USE_FAST_MATH............ X
I (736) esp32_util: WOLFSSL_SP_MATH_ALL...... X
I (743) esp32_util: SP_MATH.................. X
I (749) esp32_util: WOLFSSL_HW_METRICS....... X
I (755) esp32_util: RSA_LOW_MEM.............. X
I (760) esp32_util: SMALL_SESSION_CACHE...... X
I (767) esp32_util: WC_NO_HARDEN............. X
I (773) esp32_util: TFM_TIMING_RESISTANT..... X
I (779) esp32_util: ECC_TIMING_RESISTANT..... X
I (785) esp32_util: WC_NO_CACHE_RESISTANT.... X
I (790) esp32_util: WC_AES_BITSLICED......... X
I (797) esp32_util: WOLFSSL_AES_NO_UNROLL.... X
I (803) esp32_util: TFM_TIMING_RESISTANT..... X
I (809) esp32_util: ECC_TIMING_RESISTANT..... X
I (814) esp32_util: WC_RSA_BLINDING.......... X
I (820) esp32_util: NO_WRITEV................ X
I (825) esp32_util: FREERTOS................. X
I (831) esp32_util: NO_WOLFSSL_DIR........... X
I (837) esp32_util: WOLFSSL_NO_CURRDIR....... X
I (842) esp32_util: WOLFSSL_LWIP............. X
I (848) esp32_util:
I (851) esp32_util: Compiler Optimization: Default
I (856) esp32_util:
I (859) esp32_util: CONFIG_IDF_TARGET = esp32
W (864) esp32_util: Watchdog active; missing WOLFSSL_ESP_NO_WATCHDOG definition.
I (872) esp32_util: CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ: 240 MHz
I (879) esp32_util: Xthal_have_ccount: 1
I (883) esp32_util: CONFIG_MAIN_TASK_STACK_SIZE: 10500
I (889) esp32_util: CONFIG_ESP_MAIN_TASK_STACK_SIZE: 10500
I (895) esp32_util: CONFIG_TIMER_TASK_STACK_SIZE: 3584
I (901) esp32_util: CONFIG_TIMER_TASK_STACK_DEPTH: 2048
I (907) esp32_util: Stack HWM: 8988
I (911) esp32_util: ESP32_CRYPT is enabled for ESP32.
I (917) esp32_util: NOT SINGLE_THREADED
I (921) esp32_util: Boot count: 1
------------------------------------------------------------------------------
wolfSSL version 5.5.3
wolfSSL version 5.7.0
------------------------------------------------------------------------------
error test passed!
MEMORY test passed!
base64 test passed!
base16 test passed!
asn test passed!
RANDOM test passed!
MD5 test passed!
MD2 test passed!
MD4 test passed!
SHA test passed!
SHA-224 test passed!
SHA-256 test passed!
SHA-384 test passed!
SHA-512 test passed!
SHA-512/224 test passed!
SHA-512/256 test passed!
SHA-3 test passed!
SHAKE128 test passed!
SHAKE256 test passed!
Hash test passed!
BLAKE2b test passed!
BLAKE2s test passed!
HMAC-MD5 test passed!
HMAC-SHA test passed!
HMAC-SHA224 test passed!
HMAC-SHA256 test passed!
HMAC-SHA384 test passed!
HMAC-SHA512 test passed!
HMAC-SHA3 test passed!
HMAC-KDF test passed!
SSH-KDF test passed!
PRF test passed!
TLSv1.2 KDF test passed!
TLSv1.3 KDF test passed!
X963-KDF test passed!
HPKE test passed!
GMAC test passed!
RC2 test passed!
ARC4 test passed!
POLY1305 test passed!
DES test passed!
DES3 test passed!
AES test passed!
AES192 test passed!
AES256 test passed!
AES-OFB test passed!
AES-GCM test passed!
AES-CFB test passed!
AES-XTS test passed!
AES Key Wrap test passed!
AES-SIV test passed!
AES-EAX test passed!
RSA test passed!
DH test passed!
DSA test passed!
SRP test passed!
PWDBASED test passed!
PKCS12 test passed!
openSSL extra test
OPENSSL test passed!
OPENSSL (EVP MD) passed!
OPENSSL (PKEY0) passed!
OPENSSL (PKEY1) passed!
OPENSSL (EVP Sign/Verify) passed!
ECC test passed!
ECC buffer test passed!
CURVE25519 test passed!
ED25519 test passed!
CMAC test passed!
PKCS7encrypted test passed!
PKCS7signed test passed!
PKCS7enveloped test passed!
PKCS7authenveloped test passed!
mp test passed!
prime test passed!
logging test passed!
time test passed!
time test passed!
mutex test passed!
cert piv test passed!
I (261247) wolfssl_esp32_mp:
I (261248) wolfssl_esp32_mp: esp_mp_mul HW acceleration enabled.
I (261255) wolfssl_esp32_mp: Number of calls to esp_mp_mul: 3413
I (261262) wolfssl_esp32_mp: Success: no esp_mp_mul() errors.
I (261268) wolfssl_esp32_mp:
I (261272) wolfssl_esp32_mp: esp_mp_mulmod HW acceleration enabled.
I (261279) wolfssl_esp32_mp: Number of calls to esp_mp_mulmod: 2170
I (261286) wolfssl_esp32_mp: Number of fallback to SW mp_mulmod: 331
I (261293) wolfssl_esp32_mp: Success: no esp_mp_mulmod errors.
I (261299) wolfssl_esp32_mp: Success: no esp_mp_mulmod even mod.
I (261306) wolfssl_esp32_mp: Success: no esp_mp_mulmod small x or y.
I (261313) wolfssl_esp32_mp:
I (261317) wolfssl_esp32_mp: Number of calls to esp_mp_exptmod: 659
I (261324) wolfssl_esp32_mp: Number of fallback to SW mp_exptmod: 105
I (261331) wolfssl_esp32_mp: Success: no esp_mp_exptmod errors.
I (261337) wolfssl_esp32_mp: Max N->used: esp_mp_max_used = 64
I (261344) wolfssl_esp32_mp: Max timeout: esp_mp_max_timeout = 1
Test complete
I (136548) wolfcrypt_test: Exiting main with return code: 0
I (261352) wc_test: Exiting main with return code: 0
I (136548) wolfssl_test: wolf_test_task complete success result code = 0
wolf_test_task complete! result code: 0
I (261361) main_task: Returned from app_main()
```
See the README.md file in the upper level 'examples' directory for [more information about examples](../README.md).

View File

@ -0,0 +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
*/
#ifndef _MAIN_H_
#define _MAIN_H_
#endif

View File

@ -18,6 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#include "main.h"
#include <wolfssl/wolfcrypt/settings.h>
#ifdef WOLFSSL_ESPIDF
@ -25,21 +26,23 @@
#include <rtc_wdt.h>
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
#endif
#include <wolfssl/version.h>
#include <wolfssl/wolfcrypt/types.h>
#include <wolfcrypt/test/test.h>
#define TAG "demo"
#define TAG "wolfSSL 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);
printf("Hello World wolfSSL Version %s\n", 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);
printf("\nwolf_test_task complete! result code: %d\n", ret);
}

View File

@ -20,6 +20,7 @@ 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/main.h
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
@ -32,6 +33,7 @@ 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/main.h
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