mirror of
https://github.com/Cateners/tiny_computer.git
synced 2026-05-21 00:45:49 +08:00
Update code to v1.0.14 (10)
This commit is contained in:
45
android/extern/wolfssl/IDE/Espressif/ESP-IDF/README.md
vendored
Normal file
45
android/extern/wolfssl/IDE/Espressif/ESP-IDF/README.md
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# ESP-IDF port
|
||||
|
||||
NOTICE: These Espressif examples have been created and tested with the latest stable release branch of
|
||||
[ESP-IDF V4](https://docs.espressif.com/projects/esp-idf/en/v4.4.1/esp32/get-started/index.html)
|
||||
and have not yet been upgraded to the master branch V5.
|
||||
See the latest [migration guides](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/migration-guides/index.html).
|
||||
|
||||
## Overview
|
||||
ESP-IDF development framework with wolfSSL by setting *WOLFSSL_ESPIDF* definition
|
||||
|
||||
Including the following examples:
|
||||
|
||||
* Simple [TLS client](./examples/wolfssl_client/)/[server](./examples/wolfssl_server/)
|
||||
* Cryptographic [test](./examples/wolfssl_test/)
|
||||
* Cryptographic [benchmark](./examples/wolfssl_benchmark/)
|
||||
|
||||
The *user_settings.h* file enables some of the hardened settings.
|
||||
|
||||
## Requirements
|
||||
1. [ESP-IDF development framework](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/)
|
||||
|
||||
## Setup for Linux
|
||||
1. Run `setup.sh` at _/path/to_`/wolfssl/IDE/Espressif/ESP-IDF/` to deploy files into ESP-IDF tree
|
||||
2. Find Wolfssl files at _/path/to/esp_`/esp-idf/components/wolfssl/`
|
||||
3. Find [Example programs](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples) under _/path/to/esp_`/esp-idf/examples/protocols/wolfssl_xxx` (where xxx is the project name)
|
||||
|
||||
## Setup for Windows
|
||||
1. Run ESP-IDF Command Prompt (cmd.exe) or Run ESP-IDF PowerShell Environment
|
||||
2. Run `setup_win.bat` at `.\IDE\Espressif\ESP-IDF\`
|
||||
3. Find Wolfssl files at _/path/to/esp_`/esp-idf/components/wolfssl/`
|
||||
4. Find [Example programs](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples) under _/path/to/esp_`/esp-idf/examples/protocols/wolfssl_xxx` (where xxx is the project name)
|
||||
|
||||
## Configuration
|
||||
1. The `user_settings.h` can be found in _/path/to/esp_`/esp-idf/components/wolfssl/include/user_settings.h`
|
||||
|
||||
## Build examples
|
||||
1. See README in each example folder
|
||||
|
||||
## Support
|
||||
For question please email [support@wolfssl.com]
|
||||
|
||||
Note: This is tested with :
|
||||
- OS: Ubuntu 20.04.3 LTS and Microsoft Windows 10 Pro 10.0.19041 and well as WSL Ubuntu
|
||||
- ESP-IDF: ESP-IDF v4.3.2
|
||||
- Module : ESP32-WROOM-32
|
||||
54
android/extern/wolfssl/IDE/Espressif/ESP-IDF/README_32se.md
vendored
Normal file
54
android/extern/wolfssl/IDE/Espressif/ESP-IDF/README_32se.md
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# DEMO program with ATECC608A on ESP-WROOM-32SE
|
||||
## Overview
|
||||
Running demo programs with ATECC608A on 32SE by setting `WOLFSSL_ESPWROOM32SE` definition
|
||||
|
||||
Including the following examples:
|
||||
|
||||
* simple `TLS client`/`server`
|
||||
* crypt benchmark
|
||||
|
||||
The `user_settings.h` file enables some of the hardened settings.
|
||||
|
||||
## Requirements
|
||||
1. ESP-IDF development framework: https://docs.espressif.com/projects/esp-idf/en/latest/get-started/
|
||||
|
||||
2. Microchip CryptoAuthentication Library: https://github.com/MicrochipTech/cryptoauthlib
|
||||
|
||||
## Setup
|
||||
1. Comment out `#define WOLFSSL_ESPWROOM32` in `/path/to/wolfssl/IDE/Espressif/ESP-IDF/user_settings.h`\
|
||||
Uncomment out `#define WOLFSSL_ESPWROOM32SE` in `/path/to/wolfssl/IDE/Espressif/ESP-IDF/user_settings.h`
|
||||
* **Note:** crypt test will fail if enabled `WOLFSSL_ESPWROOM32SE`
|
||||
3. wolfSSL under ESP-IDF. Please see [README.md](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md)
|
||||
4. CryptoAuthentication Library under ESP-IDF. Please see [README.md](https://github.com/miyazakh/cryptoauthlib_esp_idf/blob/master/README.md)
|
||||
|
||||
## Configuration
|
||||
1. The `user_settings.h` can be found in `/path/to/esp-idf/components/wolfssl/include/user_settings.h`
|
||||
|
||||
## Build examples
|
||||
1. See `README` in each example folder
|
||||
|
||||
## Benchmark
|
||||
w/o atecc608a
|
||||
```
|
||||
ECC 256 key gen 4 ops took 1.092 sec, avg 273.000 ms, 3.663 ops/sec
|
||||
ECDHE 256 agree 4 ops took 1.091 sec, avg 272.750 ms, 3.666 ops/sec
|
||||
ECDSA 256 sign 4 ops took 1.102 sec, avg 275.500 ms, 3.630 ops/sec
|
||||
ECDSA 256 verify 2 ops took 1.091 sec, avg 545.500 ms, 1.833 ops/sec
|
||||
```
|
||||
w/ atecc608a
|
||||
```
|
||||
ECC 256 key gen 11 ops took 1.074 sec, avg 97.636 ms, 10.242 ops/sec
|
||||
ECDHE 256 agree 6 ops took 1.068 sec, avg 178.000 ms, 5.618 ops/sec
|
||||
ECDSA 256 sign 8 ops took 1.009 sec, avg 126.125 ms, 7.929 ops/sec
|
||||
ECDSA 256 verify 14 ops took 1.079 sec, avg 77.071 ms, 12.975 ops/sec
|
||||
```
|
||||
|
||||
## Support
|
||||
For question please email [support@wolfssl.com](mailto:support@wolfssl.com)
|
||||
|
||||
Note: This is tested with the following condition:
|
||||
|
||||
- Model : ESP32-WROOM-32SE
|
||||
- ESP-IDF : v3.3-beta1-39-g6cb37ecc5(commit hash : 6cb37ecc5)
|
||||
- CryptAuthLib: commit hash : c6b176e
|
||||
- OS : Ubuntu 18.04.1 LTS (Bionic Beaver)
|
||||
23
android/extern/wolfssl/IDE/Espressif/ESP-IDF/UPDATE.md
vendored
Normal file
23
android/extern/wolfssl/IDE/Espressif/ESP-IDF/UPDATE.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# Espressif Updates
|
||||
|
||||
See [#5795]()
|
||||
|
||||
## Changes in November 2022
|
||||
|
||||
Updates to Espressif ESP-IDF wolfssl_benchmark and wolfssl_test examples:
|
||||
|
||||
- Benchmark example no longer runs tests.
|
||||
- Fixed Test example that was missing code files. (no longer installed locally)
|
||||
- Rename `benchmark/main` and `test/main` filenames from `helper.c` to `main.c`, cleaned up.
|
||||
- Added `main.h`
|
||||
- Revised `main/CMakeLists.txt` to use only `main.c`
|
||||
- Set components `main` and `wolfssl` for project `CMakeLists.txt`
|
||||
- Update wolfcrypt esp32_sha.c and sha256.c to now report unexpected reentry as verbose log rather than error message.
|
||||
- `wolfcrypt/test.c` now returns `args.return_code` when `WOLFSSL_ESPIDF` is defined.
|
||||
- `wolfcrypt/test.h` now declares `int wolf_test_task(void)` when `WOLFSSL_ESPIDF` is defined.
|
||||
- `setup.sh` no longer copies benchmark.c(.h) to local project directory.
|
||||
- Added `libs/Tigard.cfg` file for Tigard JTAG debugger.
|
||||
- Update `sdkconfig.defaults` with compiler optimizations and stack check.
|
||||
- Added VisualGDB Project file & Visual Studio solution file.
|
||||
- Added optional `time_helper` for wolfssl_test
|
||||
- Exclude `ssl_misc.c` in component cmake to fix warning: #warning ssl_misc.c does not need to be compiled separately from ssl.c
|
||||
24
android/extern/wolfssl/IDE/Espressif/ESP-IDF/dummy_config_h
vendored
Normal file
24
android/extern/wolfssl/IDE/Espressif/ESP-IDF/dummy_config_h
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/* config.h - dummy
|
||||
*
|
||||
* Copyright (C) 2006-2022 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 _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
#endif
|
||||
25
android/extern/wolfssl/IDE/Espressif/ESP-IDF/dummy_test_paths.h
vendored
Normal file
25
android/extern/wolfssl/IDE/Espressif/ESP-IDF/dummy_test_paths.h
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/* wolfcrypt/test/test_paths.h
|
||||
*
|
||||
* Copyright (C) 2006-2022 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 NO_FILESYSTEM
|
||||
#define CERT_PREFIX "@abs_top_srcdir@/"
|
||||
#define CERT_WRITE_TEMP_DIR "@abs_top_builddir@/"
|
||||
#endif /* NO_FILESYSTEM */
|
||||
12
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/CMakeLists.txt
vendored
Normal file
12
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
set(COMPONENTS
|
||||
main
|
||||
wolfssl
|
||||
) # set components
|
||||
|
||||
project(wolfssl_benchmark)
|
||||
190
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md
vendored
Normal file
190
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
# wolfSSL Benchmark Example
|
||||
|
||||
The Example contains of wolfSSL benchmark program.
|
||||
|
||||
1. `idf.py menuconfig` to configure the program.
|
||||
1-1. Example Configuration ->
|
||||
|
||||
BENCH_ARG : argument that you want to use. Default is "-lng 0"
|
||||
The list of argument can be find in help.
|
||||
|
||||
When you want to run the benchmark program
|
||||
|
||||
1. `idf.py -p <PORT> flash` to compile and load the firmware
|
||||
2. `idf.py monitor` to see the message
|
||||
|
||||
See the README.md file in the upper level 'examples' directory for more information about examples.
|
||||
|
||||
## Performance
|
||||
|
||||
Reminder than when building on WSL in `/mnt/c` there will be a noticeable performance degradation at compile time. Using `~/` will be faster at the cost of shared filesystems.
|
||||
|
||||
Example build on WSL:
|
||||
|
||||
```
|
||||
Optionally install wolfSSL component
|
||||
# cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF
|
||||
./setup.sh
|
||||
|
||||
cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark
|
||||
|
||||
# Pick ESP-IDF install directory, this one for v4.4.2 in VisualGDB
|
||||
. /mnt/c/SysGCC/esp32/esp-idf/v4.4.2/export.sh
|
||||
|
||||
|
||||
idf.py build flash -p /dev/ttyS20 -b 921600 monitor
|
||||
```
|
||||
|
||||
## 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 921600 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
|
||||
```
|
||||
|
||||
## Known Issues and Common Issues
|
||||
|
||||
### Permission denied
|
||||
|
||||
Delete project directory `build`, `.visualgdb` and `.vs` directories. Ensure no other build
|
||||
process is using the same files in Windows, WSL, Visual Studio, VSCode, etc.
|
||||
|
||||
Example message:
|
||||
|
||||
```
|
||||
-- Building ESP-IDF components for target esp32
|
||||
CMake Error at /mnt/c/SysGCC/esp32/esp-idf/v4.4.2/tools/cmake/component.cmake:131 (file):
|
||||
file failed to open for writing (Permission denied):
|
||||
|
||||
/mnt/c/workspace-pr/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/build/bootloader/component_properties.temp.cmake
|
||||
```
|
||||
|
||||
|
||||
### user_settings.h: No such file or directory
|
||||
|
||||
Ensure wolfSSL is installed in the ESP-IDF or local project `components` directory.
|
||||
|
||||
Example message:
|
||||
|
||||
```
|
||||
esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj -c ../main/main.c
|
||||
../main/main.c:27:10: fatal error: user_settings.h: No such file or directory
|
||||
#include <user_settings.h>
|
||||
^~~~~~~~~~~~~~~~~
|
||||
compilation terminated.
|
||||
```
|
||||
|
||||
A 'clean` may be needed after freshly installing a new component:
|
||||
|
||||
```
|
||||
idf.py clean build flash -p /dev/ttyS7 -b 921600 monitor
|
||||
```
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32802.440
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_benchmark", "VisualGDB_wolfssl_benchmark.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CF8A8B6E-ECCF-481A-92AC-1E2F432816E8}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
components\wolfssl\wolfcrypt\benchmark\benchmark.c = components\wolfssl\wolfcrypt\benchmark\benchmark.c
|
||||
components\wolfssl\wolfcrypt\benchmark\benchmark.h = components\wolfssl\wolfcrypt\benchmark\benchmark.h
|
||||
..\..\README.md = ..\..\README.md
|
||||
..\..\UPDATE.md = ..\..\UPDATE.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|VisualGDB = Debug|VisualGDB
|
||||
Release|VisualGDB = Release|VisualGDB
|
||||
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
|
||||
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {969EF1DC-F8DA-46B8-A2AC-A7FDC3234245}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,268 @@
|
||||
<?xml version="1.0"?>
|
||||
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Project xsi:type="com.visualgdb.project.external.esp-idf">
|
||||
<CustomSourceDirectories>
|
||||
<Directories />
|
||||
<PathStyle>Unknown</PathStyle>
|
||||
</CustomSourceDirectories>
|
||||
<AutoProgramSPIFFSPartition>true</AutoProgramSPIFFSPartition>
|
||||
<ProjectModeSettings>
|
||||
<ProjectGUID>7bbd1486-d457-4e49-92ba-0cfc9d80849e</ProjectGUID>
|
||||
<GroupSourcesByTypes>true</GroupSourcesByTypes>
|
||||
<GroupSourcesByPaths>true</GroupSourcesByPaths>
|
||||
<HeaderScanMode>SourceDirs</HeaderScanMode>
|
||||
</ProjectModeSettings>
|
||||
</Project>
|
||||
<Build xsi:type="com.visualgdb.build.cmake">
|
||||
<BuildLogMode xsi:nil="true" />
|
||||
<ToolchainID>
|
||||
<ID>com.visualgdb.xtensa-esp32-elf</ID>
|
||||
<Version>
|
||||
<GCC>8.4.0</GCC>
|
||||
<GDB>8.1.0</GDB>
|
||||
<Revision>9</Revision>
|
||||
</Version>
|
||||
</ToolchainID>
|
||||
<RelativeSourceDirectory />
|
||||
<ConfigurationType>DEBUG</ConfigurationType>
|
||||
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
|
||||
<MakeCommandTemplate>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<Command>$(ToolchainNinja)</Command>
|
||||
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</MakeCommandTemplate>
|
||||
<CMakeCommand>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<Command>$(SYSPROGS_CMAKE_PATH)</Command>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</CMakeCommand>
|
||||
<UpdateSourcesInCMakeFile>true</UpdateSourcesInCMakeFile>
|
||||
<ExportCompileCommands>false</ExportCompileCommands>
|
||||
<DisableToolchainFile>false</DisableToolchainFile>
|
||||
<CMakeMakefileType>Ninja</CMakeMakefileType>
|
||||
<DeployAsRoot>false</DeployAsRoot>
|
||||
<CMakeCleanMode>RemoveBuildDirectory</CMakeCleanMode>
|
||||
<UseCCache>false</UseCCache>
|
||||
<ProjectModeSettings>
|
||||
<ProjectItemSettings>
|
||||
<GroupSourcesByTypes>true</GroupSourcesByTypes>
|
||||
<GroupSourcesByPaths>true</GroupSourcesByPaths>
|
||||
<GroupTargetsByPaths>true</GroupTargetsByPaths>
|
||||
<FollowCMakeSourceGroups>false</FollowCMakeSourceGroups>
|
||||
<AutoRefreshProject>true</AutoRefreshProject>
|
||||
<AlwaysConsiderOutdated>false</AlwaysConsiderOutdated>
|
||||
<SortTargetsByName>true</SortTargetsByName>
|
||||
<RedundantTargetMode>HideOuterProjectTargets</RedundantTargetMode>
|
||||
<SortSourcesByName>true</SortSourcesByName>
|
||||
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
|
||||
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
|
||||
</ProjectItemSettings>
|
||||
<TargetSpecificSettings />
|
||||
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
|
||||
<ProjectGUID>eadcc9ab-72b3-4b51-a838-593e5d80ddf7</ProjectGUID>
|
||||
<VirtualFolders />
|
||||
<ConfigurationNameCase>Upper</ConfigurationNameCase>
|
||||
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
|
||||
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Subdirectory>esp-idf/v4.4.2</Subdirectory>
|
||||
<Type>ESPIDF</Type>
|
||||
</IDFCheckout>
|
||||
<COMPort>COM7</COMPort>
|
||||
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
|
||||
<UseCCache>false</UseCCache>
|
||||
<DeviceID>ESP32</DeviceID>
|
||||
</ESPIDFExtension>
|
||||
</ProjectModeSettings>
|
||||
</Build>
|
||||
<CustomBuild>
|
||||
<PreSyncActions />
|
||||
<PreBuildActions />
|
||||
<PostBuildActions />
|
||||
<PreCleanActions />
|
||||
<PostCleanActions />
|
||||
</CustomBuild>
|
||||
<CustomDebug>
|
||||
<PreDebugActions />
|
||||
<PostDebugActions />
|
||||
<DebugStopActions />
|
||||
<BreakMode>Default</BreakMode>
|
||||
</CustomDebug>
|
||||
<DeviceTerminalSettings>
|
||||
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
|
||||
<ComPortName>COM20</ComPortName>
|
||||
<AdvancedSettings>
|
||||
<BaudRate>115200</BaudRate>
|
||||
<DataBits>8</DataBits>
|
||||
<Parity>None</Parity>
|
||||
<StopBits>One</StopBits>
|
||||
<FlowControl>None</FlowControl>
|
||||
</AdvancedSettings>
|
||||
</Connection>
|
||||
<LastConnectionTime>0</LastConnectionTime>
|
||||
<EchoTypedCharacters>false</EchoTypedCharacters>
|
||||
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
|
||||
<ReconnectAutomatically>false</ReconnectAutomatically>
|
||||
<DisplayMode>ASCII</DisplayMode>
|
||||
<Colors>
|
||||
<Background>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>0</Red>
|
||||
<Green>0</Green>
|
||||
<Blue>0</Blue>
|
||||
</Background>
|
||||
<Disconnected>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>169</Red>
|
||||
<Green>169</Green>
|
||||
<Blue>169</Blue>
|
||||
</Disconnected>
|
||||
<Text>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>211</Red>
|
||||
<Green>211</Green>
|
||||
<Blue>211</Blue>
|
||||
</Text>
|
||||
<Echo>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>144</Red>
|
||||
<Green>238</Green>
|
||||
<Blue>144</Blue>
|
||||
</Echo>
|
||||
<Inactive>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>169</Red>
|
||||
<Green>169</Green>
|
||||
<Blue>169</Blue>
|
||||
</Inactive>
|
||||
</Colors>
|
||||
<HexSettings>
|
||||
<MaximumBytesPerLine>16</MaximumBytesPerLine>
|
||||
<ShowTextView>true</ShowTextView>
|
||||
<BreaksAroundEcho>true</BreaksAroundEcho>
|
||||
<AutoSend>true</AutoSend>
|
||||
<SendAsHex>true</SendAsHex>
|
||||
<TimeoutForAutoBreak>0</TimeoutForAutoBreak>
|
||||
</HexSettings>
|
||||
<LineEnding>LF</LineEnding>
|
||||
<TreatLFAsCRLF>false</TreatLFAsCRLF>
|
||||
<KeepOpenAfterExit>false</KeepOpenAfterExit>
|
||||
<ShowAfterProgramming>false</ShowAfterProgramming>
|
||||
</DeviceTerminalSettings>
|
||||
<CustomShortcuts>
|
||||
<Shortcuts />
|
||||
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
|
||||
</CustomShortcuts>
|
||||
<UserDefinedVariables />
|
||||
<ImportedPropertySheets />
|
||||
<CodeSense>
|
||||
<Enabled>Unknown</Enabled>
|
||||
<ExtraSettings>
|
||||
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
|
||||
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
|
||||
<CheckForClangFormatFiles>true</CheckForClangFormatFiles>
|
||||
<FormattingEngine xsi:nil="true" />
|
||||
</ExtraSettings>
|
||||
<CodeAnalyzerSettings>
|
||||
<Enabled>false</Enabled>
|
||||
</CodeAnalyzerSettings>
|
||||
</CodeSense>
|
||||
<Configurations>
|
||||
<VisualGDBConfiguration>
|
||||
<Name>Debug</Name>
|
||||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
<VisualGDBConfiguration>
|
||||
<Name>Release</Name>
|
||||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
</Configurations>
|
||||
<ProgramArgumentsSuggestions />
|
||||
<Debug xsi:type="com.visualgdb.debug.embedded">
|
||||
<AdditionalStartupCommands />
|
||||
<AdditionalGDBSettings>
|
||||
<Features>
|
||||
<DisableAutoDetection>false</DisableAutoDetection>
|
||||
<UseFrameParameter>false</UseFrameParameter>
|
||||
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
|
||||
<ListLocalsSupported>false</ListLocalsSupported>
|
||||
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
|
||||
<ThreadInfoSupported>false</ThreadInfoSupported>
|
||||
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
|
||||
<SupportTargetCommand>false</SupportTargetCommand>
|
||||
<ReliableBreakpointNotifications>false</ReliableBreakpointNotifications>
|
||||
</Features>
|
||||
<EnableSmartStepping>false</EnableSmartStepping>
|
||||
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
|
||||
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
|
||||
<UseAppleExtensions>false</UseAppleExtensions>
|
||||
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
|
||||
<MakeLogFile>false</MakeLogFile>
|
||||
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
|
||||
<UseRelativePathsOnly>false</UseRelativePathsOnly>
|
||||
<ExitAction>None</ExitAction>
|
||||
<DisableDisassembly>false</DisableDisassembly>
|
||||
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
|
||||
<StepIntoNewInstanceEntry>app_main</StepIntoNewInstanceEntry>
|
||||
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
|
||||
<DisableSignals>false</DisableSignals>
|
||||
<EnableAsyncExecutionMode>false</EnableAsyncExecutionMode>
|
||||
<AsyncModeSupportsBreakpoints>true</AsyncModeSupportsBreakpoints>
|
||||
<TemporaryBreakConsolidationTimeout>0</TemporaryBreakConsolidationTimeout>
|
||||
<EnableNonStopMode>false</EnableNonStopMode>
|
||||
<MaxBreakpointLimit>0</MaxBreakpointLimit>
|
||||
<EnableVerboseMode>true</EnableVerboseMode>
|
||||
<EnablePrettyPrinters>false</EnablePrettyPrinters>
|
||||
</AdditionalGDBSettings>
|
||||
<DebugMethod>
|
||||
<ID>openocd</ID>
|
||||
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
|
||||
<CommandLine>-f interface/tigard.cfg -c "adapter_khz 15000" -f target/esp32.cfg</CommandLine>
|
||||
<ExtraParameters>
|
||||
<Frequency xsi:nil="true" />
|
||||
<BoostedFrequency xsi:nil="true" />
|
||||
<ConnectUnderReset>false</ConnectUnderReset>
|
||||
</ExtraParameters>
|
||||
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
|
||||
<ProgramMode>Enabled</ProgramMode>
|
||||
<StartupCommands>
|
||||
<string>set remotetimeout 60</string>
|
||||
<string>target remote :$$SYS:GDB_PORT$$</string>
|
||||
<string>mon gdb_breakpoint_override hard</string>
|
||||
<string>mon reset halt</string>
|
||||
<string>load</string>
|
||||
</StartupCommands>
|
||||
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
|
||||
<PreferredGDBPort>0</PreferredGDBPort>
|
||||
<PreferredTelnetPort>0</PreferredTelnetPort>
|
||||
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
|
||||
<SelectedCoreIndex xsi:nil="true" />
|
||||
<LiveMemoryTimeout>5000</LiveMemoryTimeout>
|
||||
<SuggestionLogicRevision>1</SuggestionLogicRevision>
|
||||
<CheckFLASHSize>true</CheckFLASHSize>
|
||||
<FLASHSettings>
|
||||
<Size>size2MB</Size>
|
||||
<Frequency>freq40M</Frequency>
|
||||
<Mode>DIO</Mode>
|
||||
</FLASHSettings>
|
||||
<PatchBootloader>true</PatchBootloader>
|
||||
</Configuration>
|
||||
</DebugMethod>
|
||||
<AutoDetectRTOS>true</AutoDetectRTOS>
|
||||
<SemihostingSupport>Disabled</SemihostingSupport>
|
||||
<SemihostingPollingDelay>0</SemihostingPollingDelay>
|
||||
<StepIntoEntryPoint>false</StepIntoEntryPoint>
|
||||
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
|
||||
<ValidateEndOfStackAddress>true</ValidateEndOfStackAddress>
|
||||
<StopAtEntryPoint>false</StopAtEntryPoint>
|
||||
<EnableVirtualHalts>false</EnableVirtualHalts>
|
||||
<DynamicAnalysisSettings />
|
||||
<EndOfStackSymbol>_estack</EndOfStackSymbol>
|
||||
<TimestampProviderTicksPerSecond>0</TimestampProviderTicksPerSecond>
|
||||
<KeepConsoleAfterExit>false</KeepConsoleAfterExit>
|
||||
<UnusedStackFillPattern xsi:nil="true" />
|
||||
<CheckInterfaceDrivers>true</CheckInterfaceDrivers>
|
||||
</Debug>
|
||||
</VisualGDBProjectSettings2>
|
||||
10
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt
vendored
Normal file
10
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
#
|
||||
# wolfssl benchmark test
|
||||
#
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
|
||||
set(COMPONENT_SRCS main.c)
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
register_component()
|
||||
29
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/Kconfig.projbuild
vendored
Normal file
29
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/Kconfig.projbuild
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
menu "Example Configuration"
|
||||
|
||||
config BENCH_ARGV
|
||||
string "Arguments for benchmark test"
|
||||
default "-lng 0"
|
||||
help
|
||||
-? <num> Help, print this usage
|
||||
0: English, 1: Japanese
|
||||
-csv Print terminal output in csv format
|
||||
-base10 Display bytes as power of 10 (eg 1 kB = 1000 Bytes)
|
||||
-no_aad No additional authentication data passed.
|
||||
-dgst_full Full digest operation performed.
|
||||
-rsa_sign Measure RSA sign/verify instead of encrypt/decrypt.
|
||||
-<alg> Algorithm to benchmark. Available algorithms include:
|
||||
cipher aes-cbc aes-gcm chacha20 chacha20-poly1305
|
||||
digest md5 poly1305 sha sha2 sha224 sha256 sha384 sha512 sha3
|
||||
sha3-224 sha3-256 sha3-384 sha3-512
|
||||
mac hmac hmac-md5 hmac-sha hmac-sha224 hmac-sha256 hmac-sha384
|
||||
hmac-sha512
|
||||
asym rsa rsa-sz dh ecc-kg ecc
|
||||
other rng
|
||||
-lng <num> Display benchmark result by specified language.
|
||||
0: English, 1: Japanese
|
||||
<num> Size of block in bytes
|
||||
|
||||
e.g -lng 1
|
||||
e.g sha
|
||||
|
||||
endmenu
|
||||
8
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/component.mk
vendored
Normal file
8
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/component.mk
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# Main component makefile.
|
||||
#
|
||||
# This Makefile can be left empty. By default, it will take the sources in the
|
||||
# src/ directory, compile them and link them into lib(subdirectory_name).a
|
||||
# in the build directory. This behaviour is entirely configurable,
|
||||
# please read the ESP-IDF documents if you need to do this.
|
||||
#
|
||||
219
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/main.c
vendored
Normal file
219
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/main.c
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
/* benchmark main.c
|
||||
*
|
||||
* Copyright (C) 2006-2022 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
|
||||
*/
|
||||
/* ESP-IDF */
|
||||
#include <esp_log.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/* wolfSSL */
|
||||
#include <user_settings.h>
|
||||
#ifndef WOLFSSL_ESPIDF
|
||||
#warning "problem with wolfSSL user_settings. Check components/wolfssl/include"
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
#include <wolfcrypt/benchmark/benchmark.h>
|
||||
|
||||
/* check BENCH_ARGV in sdkconfig to determine need to set WOLFSSL_BENCH_ARGV */
|
||||
#ifdef CONFIG_BENCH_ARGV
|
||||
#define WOLFSSL_BENCH_ARGV CONFIG_BENCH_ARGV
|
||||
#define WOLFSSL_BENCH_ARGV_MAX_ARGUMENTS 22 /* arbitrary number of max args */
|
||||
#endif
|
||||
|
||||
/*
|
||||
** the wolfssl component can be installed in either:
|
||||
**
|
||||
** - the ESP-IDF component directory
|
||||
**
|
||||
** ** OR **
|
||||
**
|
||||
** - the local project component directory
|
||||
**
|
||||
** it is not recommended to install in both.
|
||||
**
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
|
||||
static const char* const TAG = "wolfssl_benchmark";
|
||||
|
||||
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
|
||||
&& defined(WOLFSSL_ATECC508A)
|
||||
|
||||
#include "wolfssl/wolfcrypt/port/atmel/atmel.h"
|
||||
|
||||
/* when you need to use a custom slot allocation, */
|
||||
/* enable the definition CUSTOM_SLOT_ALLOCAION. */
|
||||
#if defined(CUSTOM_SLOT_ALLOCATION)
|
||||
|
||||
static byte mSlotList[ATECC_MAX_SLOT];
|
||||
|
||||
/* initialize slot array */
|
||||
void my_atmel_slotInit()
|
||||
{
|
||||
int i;
|
||||
for(i = 0;i < ATECC_MAX_SLOT;i++) {
|
||||
mSlotList[i] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
|
||||
/* allocate slot depending on slotType */
|
||||
int my_atmel_alloc(int slotType)
|
||||
{
|
||||
int i, slot = -1;
|
||||
|
||||
switch(slotType){
|
||||
case ATMEL_SLOT_ENCKEY:
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_DEVICE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE_ENC:
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_ANY:
|
||||
for(i = 0;i < ATECC_MAX_SLOT;i++){
|
||||
if(mSlotList[i] == ATECC_INVALID_SLOT){
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
/* free slot array */
|
||||
void my_atmel_free(int slotId)
|
||||
{
|
||||
if(slotId >= 0 && slotId < ATECC_MAX_SLOT){
|
||||
mSlotList[slotId] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CUSTOM_SLOT_ALLOCATION */
|
||||
#endif /* WOLFSSL_ESPWROOM32SE && HAVE_PK_CALLBACK && WOLFSSL_ATECC508A */
|
||||
|
||||
/* the following are needed by benchmark.c with args */
|
||||
#ifdef WOLFSSL_BENCH_ARGV
|
||||
char* __argv[WOLFSSL_BENCH_ARGV_MAX_ARGUMENTS];
|
||||
|
||||
int construct_argv()
|
||||
{
|
||||
int cnt = 0;
|
||||
int i = 0;
|
||||
int len = 0;
|
||||
char *_argv; /* buffer for copying the string */
|
||||
char *ch; /* char pointer to trace the string */
|
||||
char buff[16] = { 0 }; /* buffer for a argument copy */
|
||||
|
||||
ESP_LOGI(TAG, "construct_argv arg:%s\n", CONFIG_BENCH_ARGV);
|
||||
len = strlen(CONFIG_BENCH_ARGV);
|
||||
_argv = (char*)malloc(len + 1);
|
||||
if (!_argv) {
|
||||
return -1;
|
||||
}
|
||||
memset(_argv, 0, len + 1);
|
||||
memcpy(_argv, CONFIG_BENCH_ARGV, len);
|
||||
_argv[len] = '\0';
|
||||
ch = _argv;
|
||||
|
||||
__argv[cnt] = malloc(10);
|
||||
sprintf(__argv[cnt], "benchmark");
|
||||
__argv[cnt][9] = '\0';
|
||||
cnt = 1;
|
||||
|
||||
while (*ch != '\0') {
|
||||
/* check that we don't overflow manual arg assembly */
|
||||
if (cnt >= (WOLFSSL_BENCH_ARGV_MAX_ARGUMENTS)) {
|
||||
ESP_LOGE(TAG, "Abort construct_argv;"
|
||||
"Reached maximum defined arguments = %d",
|
||||
WOLFSSL_BENCH_ARGV_MAX_ARGUMENTS);
|
||||
break;
|
||||
}
|
||||
|
||||
/* skip white-space */
|
||||
while (*ch == ' ') { ++ch; }
|
||||
|
||||
memset(buff, 0, sizeof(buff));
|
||||
/* copy each args into buffer */
|
||||
i = 0;
|
||||
while ((*ch != ' ') && (*ch != '\0') && (i < 16)) {
|
||||
buff[i] = *ch;
|
||||
++i;
|
||||
++ch;
|
||||
}
|
||||
/* copy the string into argv */
|
||||
__argv[cnt] = (char*)malloc(i + 1);
|
||||
memset(__argv[cnt], 0, i + 1);
|
||||
memcpy(__argv[cnt], buff, i + 1);
|
||||
/* next args */
|
||||
++cnt;
|
||||
}
|
||||
|
||||
free(_argv);
|
||||
|
||||
return (cnt);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* entry point */
|
||||
void app_main(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "app_main CONFIG_BENCH_ARGV = %s", WOLFSSL_BENCH_ARGV);
|
||||
|
||||
/* when using atecc608a on esp32-wroom-32se */
|
||||
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
|
||||
&& defined(WOLFSSL_ATECC508A)
|
||||
#if defined(CUSTOM_SLOT_ALLOCATION)
|
||||
my_atmel_slotInit();
|
||||
/* to register the callback, it needs to be initialized. */
|
||||
if ((wolfCrypt_Init()) != 0) {
|
||||
ESP_LOGE(TAG, "wolfCrypt_Init failed");
|
||||
return;
|
||||
}
|
||||
atmel_set_slot_allocator(my_atmel_alloc, my_atmel_free);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NO_CRYPT_BENCHMARK
|
||||
ESP_LOGI(TAG, "NO_CRYPT_BENCHMARK defined, skipping wolf_benchmark_task")
|
||||
#else
|
||||
|
||||
/* although wolfCrypt_Init() may be explicitly called above,
|
||||
** note it is still always called in wolf_benchmark_task.
|
||||
*/
|
||||
wolf_benchmark_task();
|
||||
/* wolfCrypt_Cleanup should always be called at completion,
|
||||
** and is called in wolf_benchmark_task().
|
||||
*/
|
||||
|
||||
/* after the test, we'll just wait */
|
||||
while (1) {
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
#endif /* NO_CRYPT_BENCHMARK */
|
||||
} /* main */
|
||||
29
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/main.h
vendored
Normal file
29
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/main.h
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
/* benchmark main.h
|
||||
*
|
||||
* Copyright (C) 2006-2022 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
|
||||
*/
|
||||
|
||||
void app_main(void);
|
||||
|
||||
/* see wolfssl/wolfcrypt/benchmark/benchmark.h */
|
||||
extern void wolf_benchmark_task();
|
||||
|
||||
|
||||
|
||||
31
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/sdkconfig.defaults
vendored
Normal file
31
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/sdkconfig.defaults
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
CONFIG_BENCH_ARGV="-lng 0"
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
||||
|
||||
#
|
||||
# Default main stack size
|
||||
#
|
||||
# This is typically way bigger than needed for stack size. See user_settings.h
|
||||
#
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE=55500
|
||||
|
||||
# Legacy stack size for older ESP-IDF versions
|
||||
CONFIG_MAIN_TASK_STACK_SIZE=55500
|
||||
|
||||
#
|
||||
# Watchdog Timers
|
||||
#
|
||||
# We don't want to have the watchdog timeout during tests
|
||||
#
|
||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
|
||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n
|
||||
|
||||
#
|
||||
# Compiler options
|
||||
#
|
||||
CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
|
||||
CONFIG_COMPILER_HIDE_PATHS_MACROS=y
|
||||
CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y
|
||||
CONFIG_COMPILER_STACK_CHECK=y
|
||||
11
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/CMakeLists.txt
vendored
Normal file
11
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# (Not part of the boilerplate)
|
||||
# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
|
||||
# disable the following line if there isn't the directory
|
||||
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(wolfssl_client)
|
||||
27
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md
vendored
Normal file
27
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
#wolfSSL Example
|
||||
|
||||
The Example contains of wolfSSL tls client demo.
|
||||
|
||||
1. `idf.py menuconfig` to config the project
|
||||
|
||||
1-1. Example Configuration ->
|
||||
|
||||
Target host ip address : the host that you want to connect to.(default is 127.0.0.1)
|
||||
|
||||
1-2. Example Connection Configuration ->
|
||||
|
||||
WIFI SSID: your own WIFI, which is connected to the Internet.(default is "myssid")
|
||||
WIFI Password: WIFI password, and default is "mypassword"
|
||||
|
||||
|
||||
Note: the example program uses 11111 port. If you want to use different port
|
||||
, you need to modify DEFAULT_PORT definition in the code.
|
||||
|
||||
When you want to test the wolfSSL client
|
||||
|
||||
1. `idf.py -p <PORT> flash` and then `idf.py monitor` to load the firmware and see the context
|
||||
2. You can use <wolfssl>/examples/server/server program for test.
|
||||
|
||||
e.g. Launch ./examples/server/server -v 4 -b -i -d
|
||||
|
||||
See the README.md file in the upper level 'examples' directory for more information about examples.
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.33027.164
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_client", "VisualGDB_wolfssl_client.vgdbproj", "{E903E9CC-1A23-4B00-8914-7E45EC21E351}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|VisualGDB = Debug|VisualGDB
|
||||
Release|VisualGDB = Release|VisualGDB
|
||||
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
|
||||
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D510376F-F313-4EF6-8EF5-248D1949DFEB}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,265 @@
|
||||
<?xml version="1.0"?>
|
||||
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Project xsi:type="com.visualgdb.project.external.esp-idf">
|
||||
<CustomSourceDirectories>
|
||||
<Directories />
|
||||
<PathStyle>Unknown</PathStyle>
|
||||
</CustomSourceDirectories>
|
||||
<AutoProgramSPIFFSPartition>true</AutoProgramSPIFFSPartition>
|
||||
<ProjectModeSettings>
|
||||
<ProjectGUID>bdbba681-1213-45f8-a44e-4652fe489fe3</ProjectGUID>
|
||||
<GroupSourcesByTypes>true</GroupSourcesByTypes>
|
||||
<GroupSourcesByPaths>true</GroupSourcesByPaths>
|
||||
<HeaderScanMode>SourceDirs</HeaderScanMode>
|
||||
</ProjectModeSettings>
|
||||
</Project>
|
||||
<Build xsi:type="com.visualgdb.build.cmake">
|
||||
<BuildLogMode xsi:nil="true" />
|
||||
<ToolchainID>
|
||||
<ID>com.visualgdb.xtensa-esp32-elf</ID>
|
||||
<Version>
|
||||
<GCC>8.4.0</GCC>
|
||||
<GDB>8.1.0</GDB>
|
||||
<Revision>9</Revision>
|
||||
</Version>
|
||||
</ToolchainID>
|
||||
<ConfigurationType>DEBUG</ConfigurationType>
|
||||
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
|
||||
<MakeCommandTemplate>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<Command>$(ToolchainNinja)</Command>
|
||||
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</MakeCommandTemplate>
|
||||
<CMakeCommand>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<Command>$(SYSPROGS_CMAKE_PATH)</Command>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</CMakeCommand>
|
||||
<UpdateSourcesInCMakeFile>true</UpdateSourcesInCMakeFile>
|
||||
<ExportCompileCommands>false</ExportCompileCommands>
|
||||
<DisableToolchainFile>false</DisableToolchainFile>
|
||||
<CMakeMakefileType>Ninja</CMakeMakefileType>
|
||||
<DeployAsRoot>false</DeployAsRoot>
|
||||
<CMakeCleanMode>RemoveBuildDirectory</CMakeCleanMode>
|
||||
<UseCCache>false</UseCCache>
|
||||
<ProjectModeSettings>
|
||||
<ProjectItemSettings>
|
||||
<GroupSourcesByTypes>true</GroupSourcesByTypes>
|
||||
<GroupSourcesByPaths>true</GroupSourcesByPaths>
|
||||
<GroupTargetsByPaths>true</GroupTargetsByPaths>
|
||||
<FollowCMakeSourceGroups>false</FollowCMakeSourceGroups>
|
||||
<AutoRefreshProject>true</AutoRefreshProject>
|
||||
<AlwaysConsiderOutdated>false</AlwaysConsiderOutdated>
|
||||
<SortTargetsByName>true</SortTargetsByName>
|
||||
<RedundantTargetMode>HideOuterProjectTargets</RedundantTargetMode>
|
||||
<SortSourcesByName>true</SortSourcesByName>
|
||||
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
|
||||
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
|
||||
</ProjectItemSettings>
|
||||
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
|
||||
<ProjectGUID>e903e9cc-1a23-4b00-8914-7e45ec21e351</ProjectGUID>
|
||||
<VirtualFolders />
|
||||
<ConfigurationNameCase>Upper</ConfigurationNameCase>
|
||||
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
|
||||
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Version>v4.4.2</Version>
|
||||
<Subdirectory>esp-idf/v4.4.2</Subdirectory>
|
||||
<Type>ESPIDF</Type>
|
||||
</IDFCheckout>
|
||||
<COMPort>COM20</COMPort>
|
||||
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
|
||||
<UseCCache>false</UseCCache>
|
||||
<DeviceID>ESP32</DeviceID>
|
||||
</ESPIDFExtension>
|
||||
</ProjectModeSettings>
|
||||
</Build>
|
||||
<CustomBuild>
|
||||
<PreSyncActions />
|
||||
<PreBuildActions />
|
||||
<PostBuildActions />
|
||||
<PreCleanActions />
|
||||
<PostCleanActions />
|
||||
</CustomBuild>
|
||||
<CustomDebug>
|
||||
<PreDebugActions />
|
||||
<PostDebugActions />
|
||||
<DebugStopActions />
|
||||
<BreakMode>Default</BreakMode>
|
||||
</CustomDebug>
|
||||
<DeviceTerminalSettings>
|
||||
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
|
||||
<ComPortName>COM20</ComPortName>
|
||||
<AdvancedSettings>
|
||||
<BaudRate>115200</BaudRate>
|
||||
<DataBits>8</DataBits>
|
||||
<Parity>None</Parity>
|
||||
<StopBits>One</StopBits>
|
||||
<FlowControl>None</FlowControl>
|
||||
</AdvancedSettings>
|
||||
</Connection>
|
||||
<LastConnectionTime>0</LastConnectionTime>
|
||||
<EchoTypedCharacters>false</EchoTypedCharacters>
|
||||
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
|
||||
<ReconnectAutomatically>false</ReconnectAutomatically>
|
||||
<DisplayMode>ASCII</DisplayMode>
|
||||
<Colors>
|
||||
<Background>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>0</Red>
|
||||
<Green>0</Green>
|
||||
<Blue>0</Blue>
|
||||
</Background>
|
||||
<Disconnected>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>169</Red>
|
||||
<Green>169</Green>
|
||||
<Blue>169</Blue>
|
||||
</Disconnected>
|
||||
<Text>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>211</Red>
|
||||
<Green>211</Green>
|
||||
<Blue>211</Blue>
|
||||
</Text>
|
||||
<Echo>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>144</Red>
|
||||
<Green>238</Green>
|
||||
<Blue>144</Blue>
|
||||
</Echo>
|
||||
<Inactive>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>169</Red>
|
||||
<Green>169</Green>
|
||||
<Blue>169</Blue>
|
||||
</Inactive>
|
||||
</Colors>
|
||||
<HexSettings>
|
||||
<MaximumBytesPerLine>16</MaximumBytesPerLine>
|
||||
<ShowTextView>true</ShowTextView>
|
||||
<BreaksAroundEcho>true</BreaksAroundEcho>
|
||||
<AutoSend>true</AutoSend>
|
||||
<SendAsHex>true</SendAsHex>
|
||||
<TimeoutForAutoBreak>0</TimeoutForAutoBreak>
|
||||
</HexSettings>
|
||||
<LineEnding>LF</LineEnding>
|
||||
<TreatLFAsCRLF>false</TreatLFAsCRLF>
|
||||
<KeepOpenAfterExit>false</KeepOpenAfterExit>
|
||||
<ShowAfterProgramming>false</ShowAfterProgramming>
|
||||
</DeviceTerminalSettings>
|
||||
<CustomShortcuts>
|
||||
<Shortcuts />
|
||||
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
|
||||
</CustomShortcuts>
|
||||
<UserDefinedVariables />
|
||||
<CodeSense>
|
||||
<Enabled>Unknown</Enabled>
|
||||
<ExtraSettings>
|
||||
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
|
||||
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
|
||||
<CheckForClangFormatFiles>true</CheckForClangFormatFiles>
|
||||
<FormattingEngine xsi:nil="true" />
|
||||
</ExtraSettings>
|
||||
<CodeAnalyzerSettings>
|
||||
<Enabled>false</Enabled>
|
||||
</CodeAnalyzerSettings>
|
||||
</CodeSense>
|
||||
<Configurations>
|
||||
<VisualGDBConfiguration>
|
||||
<Name>Debug</Name>
|
||||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
<VisualGDBConfiguration>
|
||||
<Name>Release</Name>
|
||||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
</Configurations>
|
||||
<Debug xsi:type="com.visualgdb.debug.embedded">
|
||||
<AdditionalStartupCommands />
|
||||
<AdditionalGDBSettings>
|
||||
<Features>
|
||||
<DisableAutoDetection>false</DisableAutoDetection>
|
||||
<UseFrameParameter>false</UseFrameParameter>
|
||||
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
|
||||
<ListLocalsSupported>false</ListLocalsSupported>
|
||||
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
|
||||
<ThreadInfoSupported>false</ThreadInfoSupported>
|
||||
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
|
||||
<SupportTargetCommand>false</SupportTargetCommand>
|
||||
<ReliableBreakpointNotifications>false</ReliableBreakpointNotifications>
|
||||
</Features>
|
||||
<EnableSmartStepping>false</EnableSmartStepping>
|
||||
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
|
||||
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
|
||||
<UseAppleExtensions>false</UseAppleExtensions>
|
||||
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
|
||||
<MakeLogFile>false</MakeLogFile>
|
||||
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
|
||||
<UseRelativePathsOnly>false</UseRelativePathsOnly>
|
||||
<ExitAction>None</ExitAction>
|
||||
<DisableDisassembly>false</DisableDisassembly>
|
||||
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
|
||||
<StepIntoNewInstanceEntry>app_main</StepIntoNewInstanceEntry>
|
||||
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
|
||||
<DisableSignals>false</DisableSignals>
|
||||
<EnableAsyncExecutionMode>false</EnableAsyncExecutionMode>
|
||||
<AsyncModeSupportsBreakpoints>true</AsyncModeSupportsBreakpoints>
|
||||
<TemporaryBreakConsolidationTimeout>0</TemporaryBreakConsolidationTimeout>
|
||||
<EnableNonStopMode>false</EnableNonStopMode>
|
||||
<MaxBreakpointLimit>0</MaxBreakpointLimit>
|
||||
<EnableVerboseMode>true</EnableVerboseMode>
|
||||
<EnablePrettyPrinters>false</EnablePrettyPrinters>
|
||||
</AdditionalGDBSettings>
|
||||
<DebugMethod>
|
||||
<ID>openocd</ID>
|
||||
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
|
||||
<CommandLine>-f interface/tigard.cfg -c "adapter_khz 3000" -f target/esp32.cfg</CommandLine>
|
||||
<ExtraParameters>
|
||||
<Frequency xsi:nil="true" />
|
||||
<BoostedFrequency xsi:nil="true" />
|
||||
<ConnectUnderReset>false</ConnectUnderReset>
|
||||
</ExtraParameters>
|
||||
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
|
||||
<ProgramMode>Enabled</ProgramMode>
|
||||
<StartupCommands>
|
||||
<string>set remotetimeout 60</string>
|
||||
<string>target remote :$$SYS:GDB_PORT$$</string>
|
||||
<string>mon gdb_breakpoint_override hard</string>
|
||||
<string>mon reset halt</string>
|
||||
<string>load</string>
|
||||
</StartupCommands>
|
||||
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
|
||||
<PreferredGDBPort>0</PreferredGDBPort>
|
||||
<PreferredTelnetPort>0</PreferredTelnetPort>
|
||||
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
|
||||
<SelectedCoreIndex xsi:nil="true" />
|
||||
<LiveMemoryTimeout>5000</LiveMemoryTimeout>
|
||||
<SuggestionLogicRevision>1</SuggestionLogicRevision>
|
||||
<CheckFLASHSize>true</CheckFLASHSize>
|
||||
<FLASHSettings>
|
||||
<Size>size2MB</Size>
|
||||
<Frequency>freq40M</Frequency>
|
||||
<Mode>DIO</Mode>
|
||||
</FLASHSettings>
|
||||
<PatchBootloader>true</PatchBootloader>
|
||||
</Configuration>
|
||||
</DebugMethod>
|
||||
<AutoDetectRTOS>true</AutoDetectRTOS>
|
||||
<SemihostingSupport>Auto</SemihostingSupport>
|
||||
<SemihostingPollingDelay>0</SemihostingPollingDelay>
|
||||
<StepIntoEntryPoint>false</StepIntoEntryPoint>
|
||||
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
|
||||
<ValidateEndOfStackAddress>true</ValidateEndOfStackAddress>
|
||||
<StopAtEntryPoint>false</StopAtEntryPoint>
|
||||
<EnableVirtualHalts>false</EnableVirtualHalts>
|
||||
<DynamicAnalysisSettings />
|
||||
<EndOfStackSymbol>_estack</EndOfStackSymbol>
|
||||
<TimestampProviderTicksPerSecond>0</TimestampProviderTicksPerSecond>
|
||||
<KeepConsoleAfterExit>false</KeepConsoleAfterExit>
|
||||
<UnusedStackFillPattern xsi:nil="true" />
|
||||
<CheckInterfaceDrivers>true</CheckInterfaceDrivers>
|
||||
</Debug>
|
||||
</VisualGDBProjectSettings2>
|
||||
10
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt
vendored
Normal file
10
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
#
|
||||
# wolfssl client test
|
||||
#
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
|
||||
set(COMPONENT_SRCS "client-tls.c" "wifi_connect.c")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS "." "./include")
|
||||
|
||||
register_component()
|
||||
9
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/Kconfig.projbuild
vendored
Normal file
9
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/Kconfig.projbuild
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
menu "Example Configuration"
|
||||
|
||||
config TARGET_HOST
|
||||
string "Target host"
|
||||
default "127.0.01.1"
|
||||
help
|
||||
host address for the example to connect
|
||||
|
||||
endmenu
|
||||
291
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c
vendored
Normal file
291
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c
vendored
Normal file
@@ -0,0 +1,291 @@
|
||||
/* client-tls-callback.c
|
||||
*
|
||||
* Copyright (C) 2006-2022 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
|
||||
*/
|
||||
/* the usual suspects */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* ESP specific */
|
||||
#include "wifi_connect.h"
|
||||
|
||||
/* socket includes */
|
||||
#include "lwip/netdb.h"
|
||||
#include "lwip/sockets.h"
|
||||
|
||||
/* wolfSSL */
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/ssl.h>
|
||||
#include <wolfssl/certs_test.h>
|
||||
|
||||
#ifdef WOLFSSL_TRACK_MEMORY
|
||||
#include <wolfssl/wolfcrypt/mem_track.h>
|
||||
#endif
|
||||
|
||||
static const char* const TAG = "tls_client";
|
||||
|
||||
#if defined(DEBUG_WOLFSSL)
|
||||
|
||||
static void ShowCiphers(void)
|
||||
{
|
||||
char ciphers[4096];
|
||||
|
||||
int ret = wolfSSL_get_ciphers(ciphers, (int)sizeof(ciphers));
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
printf("%s\n", ciphers);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
|
||||
&& defined(WOLFSSL_ATECC508A)
|
||||
|
||||
#include "wolfssl/wolfcrypt/port/atmel/atmel.h"
|
||||
|
||||
/* when you want to use custom slot allocation */
|
||||
/* enable the definition CUSTOM_SLOT_ALLOCATION.*/
|
||||
|
||||
#if defined(CUSTOM_SLOT_ALLOCATION)
|
||||
|
||||
static byte mSlotList[ATECC_MAX_SLOT];
|
||||
|
||||
int atmel_set_slot_allocator(atmel_slot_alloc_cb alloc,
|
||||
atmel_slot_dealloc_cb dealloc);
|
||||
/* initialize slot array */
|
||||
void my_atmel_slotInit()
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;i<ATECC_MAX_SLOT; i++) {
|
||||
mSlotList[i] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
/* allocate slot depending on slotType */
|
||||
int my_atmel_alloc(int slotType)
|
||||
{
|
||||
int i, slot = -1;
|
||||
|
||||
switch(slotType){
|
||||
case ATMEL_SLOT_ENCKEY:
|
||||
slot = 2;
|
||||
break;
|
||||
case ATMEL_SLOT_DEVICE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE_ENC:
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_ANY:
|
||||
for(i=0;i<ATECC_MAX_SLOT;i++){
|
||||
if(mSlotList[i] == ATECC_INVALID_SLOT){
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return slot;
|
||||
}
|
||||
/* free slot array */
|
||||
void my_atmel_free(int slotId)
|
||||
{
|
||||
if(slotId >= 0 && slotId < ATECC_MAX_SLOT){
|
||||
mSlotList[slotId] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
#endif /* CUSTOM_SLOT_ALLOCATION */
|
||||
#endif /* WOLFSSL_ESPWROOM32SE && HAVE_PK_CALLBACK && WOLFSSL_ATECC508A */
|
||||
|
||||
/* client task */
|
||||
void tls_smp_client_task()
|
||||
{
|
||||
int ret;
|
||||
int sockfd;
|
||||
int doPeerCheck;
|
||||
int sendGet;
|
||||
struct sockaddr_in servAddr;
|
||||
char buff[256];
|
||||
const char* ch = TLS_SMP_TARGET_HOST;
|
||||
size_t len;
|
||||
struct hostent *hp;
|
||||
struct ip4_addr *ip4_addr;
|
||||
const char sndMsg[] = "GET /index.html HTTP/1.0\r\n\r\n";
|
||||
|
||||
/* declare wolfSSL objects */
|
||||
WOLFSSL_CTX *ctx;
|
||||
WOLFSSL *ssl;
|
||||
|
||||
WOLFSSL_ENTER("tls_smp_client_task");
|
||||
|
||||
doPeerCheck = 0;
|
||||
sendGet = 0;
|
||||
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
WOLFSSL_MSG("Debug ON");
|
||||
wolfSSL_Debugging_ON();
|
||||
ShowCiphers();
|
||||
#endif
|
||||
/* Initialize wolfSSL */
|
||||
wolfSSL_Init();
|
||||
|
||||
/* Create a socket that uses an internet IPv4 address,
|
||||
* Sets the socket to be stream based (TCP),
|
||||
* 0 means choose the default protocol. */
|
||||
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to create the socket\n");
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "get target IP address");
|
||||
|
||||
hp = gethostbyname(TLS_SMP_TARGET_HOST);
|
||||
if (!hp) {
|
||||
ESP_LOGE(TAG, "Failed to get host name.");
|
||||
ip4_addr = NULL;
|
||||
} else {
|
||||
|
||||
ip4_addr = (struct ip4_addr *)hp->h_addr;
|
||||
ESP_LOGI(TAG, IPSTR, IP2STR(ip4_addr));
|
||||
}
|
||||
/* Create and initialize WOLFSSL_CTX */
|
||||
if ((ctx = wolfSSL_CTX_new(wolfSSLv23_client_method())) == NULL) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to create WOLFSSL_CTX\n");
|
||||
}
|
||||
WOLFSSL_MSG("Loading...cert");
|
||||
/* Load client certificates into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_load_verify_buffer(ctx, ca_cert_der_2048,
|
||||
sizeof_ca_cert_der_2048, WOLFSSL_FILETYPE_ASN1)) != SSL_SUCCESS) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to load %d, please check the file.\n",ret);
|
||||
}
|
||||
/* not peer check */
|
||||
if( doPeerCheck == 0 ){
|
||||
wolfSSL_CTX_set_verify(ctx, WOLFSSL_VERIFY_NONE, 0);
|
||||
} else {
|
||||
WOLFSSL_MSG("Loading... our cert");
|
||||
/* load our certificate */
|
||||
if ((ret = wolfSSL_CTX_use_certificate_chain_buffer_format(ctx, client_cert_der_2048,
|
||||
sizeof_client_cert_der_2048, WOLFSSL_FILETYPE_ASN1)) != SSL_SUCCESS) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to load chain %d, please check the file.\n",ret);
|
||||
}
|
||||
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_buffer(ctx, client_key_der_2048,
|
||||
sizeof_client_key_der_2048, WOLFSSL_FILETYPE_ASN1)) != SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx); ctx = NULL;
|
||||
ESP_LOGE(TAG,"ERROR: failed to load key %d, please check the file.\n", ret);
|
||||
}
|
||||
|
||||
wolfSSL_CTX_set_verify(ctx, WOLFSSL_VERIFY_PEER, 0);
|
||||
}
|
||||
|
||||
/* Initialize the server address struct with zeros */
|
||||
memset(&servAddr, 0, sizeof(servAddr));
|
||||
|
||||
/* Fill in the server address */
|
||||
servAddr.sin_family = AF_INET; /* using IPv4 */
|
||||
servAddr.sin_port = htons(DEFAULT_PORT); /* on DEFAULT_PORT */
|
||||
|
||||
if(*ch >= '1' && *ch <= '9') {
|
||||
/* Get the server IPv4 address from the command line call */
|
||||
WOLFSSL_MSG("inet_pton");
|
||||
if ((ret = inet_pton(AF_INET, TLS_SMP_TARGET_HOST,
|
||||
&servAddr.sin_addr)) != 1) {
|
||||
ESP_LOGE(TAG,"ERROR: invalid address ret=%d\n", ret);
|
||||
}
|
||||
} else {
|
||||
servAddr.sin_addr.s_addr = ip4_addr->addr;
|
||||
}
|
||||
|
||||
/* Connect to the server */
|
||||
sprintf(buff, "Connecting to server....%s(port:%d)", TLS_SMP_TARGET_HOST
|
||||
, DEFAULT_PORT);
|
||||
WOLFSSL_MSG(buff);
|
||||
printf("%s\n",buff);
|
||||
if ((ret = connect(sockfd, (struct sockaddr *)&servAddr,
|
||||
sizeof(servAddr))) == -1){
|
||||
ESP_LOGE(TAG,"ERROR: failed to connect ret=%d\n", ret);
|
||||
}
|
||||
|
||||
WOLFSSL_MSG("Create a WOLFSSL object");
|
||||
/* Create a WOLFSSL object */
|
||||
if ((ssl = wolfSSL_new(ctx)) == NULL) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to create WOLFSSL object\n");
|
||||
}
|
||||
|
||||
/* when using atecc608a on esp32-wroom-32se */
|
||||
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
|
||||
&& defined(WOLFSSL_ATECC508A)
|
||||
atcatls_set_callbacks(ctx);
|
||||
/* when using custom slot-allocation */
|
||||
#if defined(CUSTOM_SLOT_ALLOCATION)
|
||||
my_atmel_slotInit();
|
||||
atmel_set_slot_allocator(my_atmel_alloc, my_atmel_free);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Attach wolfSSL to the socket */
|
||||
wolfSSL_set_fd(ssl, sockfd);
|
||||
|
||||
WOLFSSL_MSG("Connect to wolfSSL on the server side");
|
||||
/* Connect to wolfSSL on the server side */
|
||||
if (wolfSSL_connect(ssl) != SSL_SUCCESS) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to connect to wolfSSL\n");
|
||||
}
|
||||
|
||||
/* Get a message for the server from stdin */
|
||||
WOLFSSL_MSG("Message for server: ");
|
||||
memset(buff, 0, sizeof(buff));
|
||||
|
||||
if(sendGet){
|
||||
printf("SSL connect ok, sending GET...\n");
|
||||
len = XSTRLEN(sndMsg);
|
||||
strncpy(buff, sndMsg, len);
|
||||
buff[len] = '\0';
|
||||
} else {
|
||||
sprintf(buff, "message from esp32 tls client\n");
|
||||
len = strnlen(buff, sizeof(buff));
|
||||
}
|
||||
/* Send the message to the server */
|
||||
if (wolfSSL_write(ssl, buff, len) != len) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to write\n");
|
||||
}
|
||||
|
||||
/* Read the server data into our buff array */
|
||||
memset(buff, 0, sizeof(buff));
|
||||
if (wolfSSL_read(ssl, buff, sizeof(buff) - 1) == -1) {
|
||||
ESP_LOGE(TAG,"ERROR: failed to read\n");
|
||||
}
|
||||
|
||||
/* Print to stdout any data the server sends */
|
||||
printf("Server:");
|
||||
printf("%s", buff);
|
||||
/* Cleanup and return */
|
||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
|
||||
close(sockfd); /* Close the connection to the server */
|
||||
|
||||
vTaskDelete(NULL);
|
||||
|
||||
return; /* Return reporting a success */
|
||||
}
|
||||
8
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/component.mk
vendored
Normal file
8
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/component.mk
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# Main component makefile.
|
||||
#
|
||||
# This Makefile can be left empty. By default, it will take the sources in the
|
||||
# src/ directory, compile them and link them into lib(subdirectory_name).a
|
||||
# in the build directory. This behaviour is entirely configurable,
|
||||
# please read the ESP-IDF documents if you need to do this.
|
||||
#
|
||||
43
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/wifi_connect.h
vendored
Normal file
43
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/wifi_connect.h
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/* user_settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2022 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 _TLS_WIFI_H_
|
||||
#define _TLS_WIFI_H_
|
||||
|
||||
#include "esp_idf_version.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_wifi.h"
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
#include "esp_event.h"
|
||||
#else
|
||||
#include "esp_event_loop.h"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define TLS_SMP_CLIENT_TASK_NAME "tls_client_example"
|
||||
#define TLS_SMP_CLIENT_TASK_WORDS 10240
|
||||
#define TLS_SMP_CLIENT_TASK_PRIORITY 8
|
||||
|
||||
#define TLS_SMP_WIFI_SSID CONFIG_WIFI_SSID
|
||||
#define TLS_SMP_WIFI_PASS CONFIG_WIFI_PASSWORD
|
||||
#define TLS_SMP_TARGET_HOST CONFIG_TARGET_HOST
|
||||
|
||||
#endif
|
||||
172
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c
vendored
Normal file
172
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
/* wifi_connect.c
|
||||
*
|
||||
* Copyright (C) 2006-2022 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
|
||||
*/
|
||||
/*ESP specific */
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/event_groups.h"
|
||||
#include "wifi_connect.h"
|
||||
#include "lwip/sockets.h"
|
||||
#include "lwip/netdb.h"
|
||||
#include "lwip/apps/sntp.h"
|
||||
#include "nvs_flash.h"
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
#include "protocol_examples_common.h"
|
||||
#endif
|
||||
|
||||
const static int CONNECTED_BIT = BIT0;
|
||||
static EventGroupHandle_t wifi_event_group;
|
||||
/* proto-type */
|
||||
extern void tls_smp_client_task();
|
||||
static void tls_smp_client_init();
|
||||
|
||||
const static char *TAG = "tls_client";
|
||||
|
||||
static EventGroupHandle_t wifi_event_group;
|
||||
extern void tls_smp_client_task();
|
||||
|
||||
static void set_time()
|
||||
{
|
||||
/* set dummy wallclock time. */
|
||||
struct timeval utctime;
|
||||
struct timezone tz;
|
||||
struct strftime_buf;
|
||||
time_t now;
|
||||
struct tm timeinfo;
|
||||
char strftime_buf[64];
|
||||
/* please update the time if seeing unknown failure when loading cert. */
|
||||
/* this could cause TLS communication failure due to time expiration */
|
||||
/* incleasing 31536000 seconds is close to spend 356 days. */
|
||||
utctime.tv_sec = 1645797600; /* dummy time: Fri 25 Feb 2022 02:00:00 2022 */
|
||||
utctime.tv_usec = 0;
|
||||
tz.tz_minuteswest = 0;
|
||||
tz.tz_dsttime = 0;
|
||||
|
||||
settimeofday(&utctime, &tz);
|
||||
|
||||
time(&now);
|
||||
localtime_r(&now, &timeinfo);
|
||||
|
||||
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
|
||||
ESP_LOGI(TAG, "The current date/time is: %s", strftime_buf);
|
||||
|
||||
#if ESP_IDF_VERSION_MAJOR < 4
|
||||
/* wait until wifi connect */
|
||||
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,
|
||||
false, true, portMAX_DELAY);
|
||||
#endif
|
||||
/* now we start client tasks. */
|
||||
tls_smp_client_init();
|
||||
}
|
||||
|
||||
/* create task */
|
||||
static void tls_smp_client_init(void)
|
||||
{
|
||||
int ret;
|
||||
xTaskHandle _handle;
|
||||
/* http://esp32.info/docs/esp_idf/html/dd/d3c/group__xTaskCreate.html */
|
||||
ret = xTaskCreate(tls_smp_client_task,
|
||||
TLS_SMP_CLIENT_TASK_NAME,
|
||||
TLS_SMP_CLIENT_TASK_WORDS,
|
||||
NULL,
|
||||
TLS_SMP_CLIENT_TASK_PRIORITY,
|
||||
&_handle);
|
||||
|
||||
if (ret != pdPASS) {
|
||||
ESP_LOGI(TAG, "create thread %s failed", TLS_SMP_CLIENT_TASK_NAME);
|
||||
}
|
||||
}
|
||||
/* event handler for wifi events */
|
||||
static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
||||
{
|
||||
switch (event->event_id)
|
||||
{
|
||||
case SYSTEM_EVENT_STA_START:
|
||||
esp_wifi_connect();
|
||||
break;
|
||||
case SYSTEM_EVENT_STA_GOT_IP:
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
ESP_LOGI(TAG, "got ip:" IPSTR "\n",
|
||||
IP2STR(&event->event_info.got_ip.ip_info.ip));
|
||||
#else
|
||||
ESP_LOGI(TAG, "got ip:%s",
|
||||
ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip));
|
||||
#endif
|
||||
/* http://esp32.info/docs/esp_idf/html/dd/d08/group__xEventGroupSetBits.html */
|
||||
xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
|
||||
break;
|
||||
case SYSTEM_EVENT_STA_DISCONNECTED:
|
||||
esp_wifi_connect();
|
||||
xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
/* entry point */
|
||||
void app_main(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "Start app_main...");
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
ESP_LOGI(TAG, "Initialize wifi");
|
||||
#if (ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1) || \
|
||||
(ESP_IDF_VERSION_MAJOR > 5)
|
||||
esp_netif_init();
|
||||
#else
|
||||
tcpip_adapter_init();
|
||||
#endif
|
||||
|
||||
/* */
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
(void) wifi_event_handler;
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
|
||||
* Read "Establishing Wi-Fi or Ethernet Connection" section in
|
||||
* examples/protocols/README.md for more information about this function.
|
||||
*/
|
||||
ESP_ERROR_CHECK(example_connect());
|
||||
#else
|
||||
wifi_event_group = xEventGroupCreate();
|
||||
ESP_ERROR_CHECK(esp_event_loop_init(wifi_event_handler, NULL));
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
|
||||
wifi_config_t wifi_config = {
|
||||
.sta = {
|
||||
.ssid = TLS_SMP_WIFI_SSID,
|
||||
.password = TLS_SMP_WIFI_PASS,
|
||||
},
|
||||
};
|
||||
/* WiFi station mode */
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||
/* Wifi Set the configuration of the ESP32 STA or AP */
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
||||
/* Start Wifi */
|
||||
ESP_ERROR_CHECK(esp_wifi_start() );
|
||||
|
||||
ESP_LOGI(TAG, "wifi_init_sta finished.");
|
||||
ESP_LOGI(TAG, "connect to ap SSID:%s password:%s",
|
||||
TLS_SMP_WIFI_SSID, TLS_SMP_WIFI_PASS);
|
||||
#endif
|
||||
ESP_LOGI(TAG, "Set dummy time...");
|
||||
set_time();
|
||||
}
|
||||
11
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/CMakeLists.txt
vendored
Normal file
11
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# (Not part of the boilerplate)
|
||||
# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
|
||||
# disable the following line if there isn't the directory
|
||||
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(wolfssl_server)
|
||||
22
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md
vendored
Normal file
22
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# wolfSSL Server Example
|
||||
|
||||
The Example contains a wolfSSL simple server.
|
||||
|
||||
1. `idf.py menuconfigure` to configure the project
|
||||
|
||||
1-1. Example Connection Configuration ->
|
||||
|
||||
WIFI SSID : your own WIFI, which is connected to the Internet.(default is "myssid")
|
||||
WIFI Password : WIFI password, and default is "mypassword"
|
||||
|
||||
When you want to test the wolfSSL simple server demo
|
||||
|
||||
1. `idf.py -p <PORT> flash` to compile the code and load the firmware
|
||||
2. `idf.py monitor` to see the context. The assigned IP address can be found in output message.
|
||||
3. Once the server connects to the wifi, it is waiting for client request.
|
||||
("Waiting for a connection..." message will be displayed.)
|
||||
|
||||
4. You can use <wolfssl>/examples/client to test the server
|
||||
e.g ./example/client/client -h xx.xx.xx
|
||||
|
||||
See the README.md file in the upper level 'examples' directory for more information about examples.
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.33027.164
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_server", "VisualGDB_wolfssl_server.vgdbproj", "{CD5A90CA-2D40-461A-A0C3-27654371BB00}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|VisualGDB = Debug|VisualGDB
|
||||
Release|VisualGDB = Release|VisualGDB
|
||||
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
|
||||
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {719A8CBE-E881-4B20-89F3-9910520E1067}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,269 @@
|
||||
<?xml version="1.0"?>
|
||||
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Project xsi:type="com.visualgdb.project.external.esp-idf">
|
||||
<CustomSourceDirectories>
|
||||
<Directories />
|
||||
<PathStyle>Unknown</PathStyle>
|
||||
</CustomSourceDirectories>
|
||||
<AutoProgramSPIFFSPartition>true</AutoProgramSPIFFSPartition>
|
||||
<ProjectModeSettings>
|
||||
<ProjectGUID>63883b8e-8fa2-4e2f-807c-31c07f619c51</ProjectGUID>
|
||||
<GroupSourcesByTypes>true</GroupSourcesByTypes>
|
||||
<GroupSourcesByPaths>true</GroupSourcesByPaths>
|
||||
<HeaderScanMode>SourceDirs</HeaderScanMode>
|
||||
</ProjectModeSettings>
|
||||
</Project>
|
||||
<Build xsi:type="com.visualgdb.build.cmake">
|
||||
<BuildLogMode xsi:nil="true" />
|
||||
<ToolchainID>
|
||||
<ID>com.visualgdb.xtensa-esp32-elf</ID>
|
||||
<Version>
|
||||
<GCC>8.4.0</GCC>
|
||||
<GDB>8.1.0</GDB>
|
||||
<Revision>9</Revision>
|
||||
</Version>
|
||||
</ToolchainID>
|
||||
<RelativeSourceDirectory />
|
||||
<ConfigurationType>DEBUG</ConfigurationType>
|
||||
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
|
||||
<MakeCommandTemplate>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<Command>$(ToolchainNinja)</Command>
|
||||
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</MakeCommandTemplate>
|
||||
<CMakeCommand>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<Command>$(SYSPROGS_CMAKE_PATH)</Command>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</CMakeCommand>
|
||||
<UpdateSourcesInCMakeFile>true</UpdateSourcesInCMakeFile>
|
||||
<ExportCompileCommands>false</ExportCompileCommands>
|
||||
<DisableToolchainFile>false</DisableToolchainFile>
|
||||
<CMakeMakefileType>Ninja</CMakeMakefileType>
|
||||
<DeployAsRoot>false</DeployAsRoot>
|
||||
<CMakeCleanMode>RemoveBuildDirectory</CMakeCleanMode>
|
||||
<UseCCache>false</UseCCache>
|
||||
<ProjectModeSettings>
|
||||
<ProjectItemSettings>
|
||||
<GroupSourcesByTypes>true</GroupSourcesByTypes>
|
||||
<GroupSourcesByPaths>true</GroupSourcesByPaths>
|
||||
<GroupTargetsByPaths>true</GroupTargetsByPaths>
|
||||
<FollowCMakeSourceGroups>false</FollowCMakeSourceGroups>
|
||||
<AutoRefreshProject>true</AutoRefreshProject>
|
||||
<AlwaysConsiderOutdated>false</AlwaysConsiderOutdated>
|
||||
<SortTargetsByName>true</SortTargetsByName>
|
||||
<RedundantTargetMode>HideOuterProjectTargets</RedundantTargetMode>
|
||||
<SortSourcesByName>true</SortSourcesByName>
|
||||
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
|
||||
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
|
||||
</ProjectItemSettings>
|
||||
<TargetSpecificSettings />
|
||||
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
|
||||
<ProjectGUID>cd5a90ca-2d40-461a-a0c3-27654371bb00</ProjectGUID>
|
||||
<VirtualFolders />
|
||||
<ConfigurationNameCase>Upper</ConfigurationNameCase>
|
||||
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
|
||||
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Version>v4.4.2</Version>
|
||||
<Subdirectory>esp-idf/v4.4.2</Subdirectory>
|
||||
<Type>ESPIDF</Type>
|
||||
</IDFCheckout>
|
||||
<COMPort>COM20</COMPort>
|
||||
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
|
||||
<UseCCache>false</UseCCache>
|
||||
<DeviceID>ESP32</DeviceID>
|
||||
</ESPIDFExtension>
|
||||
</ProjectModeSettings>
|
||||
</Build>
|
||||
<CustomBuild>
|
||||
<PreSyncActions />
|
||||
<PreBuildActions />
|
||||
<PostBuildActions />
|
||||
<PreCleanActions />
|
||||
<PostCleanActions />
|
||||
</CustomBuild>
|
||||
<CustomDebug>
|
||||
<PreDebugActions />
|
||||
<PostDebugActions />
|
||||
<DebugStopActions />
|
||||
<BreakMode>Default</BreakMode>
|
||||
</CustomDebug>
|
||||
<DeviceTerminalSettings>
|
||||
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
|
||||
<ComPortName>COM20</ComPortName>
|
||||
<AdvancedSettings>
|
||||
<BaudRate>115200</BaudRate>
|
||||
<DataBits>8</DataBits>
|
||||
<Parity>None</Parity>
|
||||
<StopBits>One</StopBits>
|
||||
<FlowControl>None</FlowControl>
|
||||
</AdvancedSettings>
|
||||
</Connection>
|
||||
<LastConnectionTime>0</LastConnectionTime>
|
||||
<EchoTypedCharacters>false</EchoTypedCharacters>
|
||||
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
|
||||
<ReconnectAutomatically>false</ReconnectAutomatically>
|
||||
<DisplayMode>ASCII</DisplayMode>
|
||||
<Colors>
|
||||
<Background>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>0</Red>
|
||||
<Green>0</Green>
|
||||
<Blue>0</Blue>
|
||||
</Background>
|
||||
<Disconnected>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>169</Red>
|
||||
<Green>169</Green>
|
||||
<Blue>169</Blue>
|
||||
</Disconnected>
|
||||
<Text>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>211</Red>
|
||||
<Green>211</Green>
|
||||
<Blue>211</Blue>
|
||||
</Text>
|
||||
<Echo>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>144</Red>
|
||||
<Green>238</Green>
|
||||
<Blue>144</Blue>
|
||||
</Echo>
|
||||
<Inactive>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>169</Red>
|
||||
<Green>169</Green>
|
||||
<Blue>169</Blue>
|
||||
</Inactive>
|
||||
</Colors>
|
||||
<HexSettings>
|
||||
<MaximumBytesPerLine>16</MaximumBytesPerLine>
|
||||
<ShowTextView>true</ShowTextView>
|
||||
<BreaksAroundEcho>true</BreaksAroundEcho>
|
||||
<AutoSend>true</AutoSend>
|
||||
<SendAsHex>true</SendAsHex>
|
||||
<TimeoutForAutoBreak>0</TimeoutForAutoBreak>
|
||||
</HexSettings>
|
||||
<LineEnding>LF</LineEnding>
|
||||
<TreatLFAsCRLF>false</TreatLFAsCRLF>
|
||||
<KeepOpenAfterExit>false</KeepOpenAfterExit>
|
||||
<ShowAfterProgramming>false</ShowAfterProgramming>
|
||||
</DeviceTerminalSettings>
|
||||
<CustomShortcuts>
|
||||
<Shortcuts />
|
||||
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
|
||||
</CustomShortcuts>
|
||||
<UserDefinedVariables />
|
||||
<ImportedPropertySheets />
|
||||
<CodeSense>
|
||||
<Enabled>Unknown</Enabled>
|
||||
<ExtraSettings>
|
||||
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
|
||||
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
|
||||
<CheckForClangFormatFiles>true</CheckForClangFormatFiles>
|
||||
<FormattingEngine xsi:nil="true" />
|
||||
</ExtraSettings>
|
||||
<CodeAnalyzerSettings>
|
||||
<Enabled>false</Enabled>
|
||||
</CodeAnalyzerSettings>
|
||||
</CodeSense>
|
||||
<Configurations>
|
||||
<VisualGDBConfiguration>
|
||||
<Name>Debug</Name>
|
||||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
<VisualGDBConfiguration>
|
||||
<Name>Release</Name>
|
||||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
</Configurations>
|
||||
<ProgramArgumentsSuggestions />
|
||||
<Debug xsi:type="com.visualgdb.debug.embedded">
|
||||
<AdditionalStartupCommands />
|
||||
<AdditionalGDBSettings>
|
||||
<Features>
|
||||
<DisableAutoDetection>false</DisableAutoDetection>
|
||||
<UseFrameParameter>false</UseFrameParameter>
|
||||
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
|
||||
<ListLocalsSupported>false</ListLocalsSupported>
|
||||
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
|
||||
<ThreadInfoSupported>false</ThreadInfoSupported>
|
||||
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
|
||||
<SupportTargetCommand>false</SupportTargetCommand>
|
||||
<ReliableBreakpointNotifications>false</ReliableBreakpointNotifications>
|
||||
</Features>
|
||||
<EnableSmartStepping>false</EnableSmartStepping>
|
||||
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
|
||||
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
|
||||
<UseAppleExtensions>false</UseAppleExtensions>
|
||||
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
|
||||
<MakeLogFile>false</MakeLogFile>
|
||||
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
|
||||
<UseRelativePathsOnly>false</UseRelativePathsOnly>
|
||||
<ExitAction>None</ExitAction>
|
||||
<DisableDisassembly>false</DisableDisassembly>
|
||||
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
|
||||
<StepIntoNewInstanceEntry>app_main</StepIntoNewInstanceEntry>
|
||||
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
|
||||
<DisableSignals>false</DisableSignals>
|
||||
<EnableAsyncExecutionMode>false</EnableAsyncExecutionMode>
|
||||
<AsyncModeSupportsBreakpoints>true</AsyncModeSupportsBreakpoints>
|
||||
<TemporaryBreakConsolidationTimeout>0</TemporaryBreakConsolidationTimeout>
|
||||
<EnableNonStopMode>false</EnableNonStopMode>
|
||||
<MaxBreakpointLimit>0</MaxBreakpointLimit>
|
||||
<EnableVerboseMode>true</EnableVerboseMode>
|
||||
<EnablePrettyPrinters>false</EnablePrettyPrinters>
|
||||
</AdditionalGDBSettings>
|
||||
<DebugMethod>
|
||||
<ID>openocd</ID>
|
||||
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
|
||||
<CommandLine>-f interface/tigard.cfg -c "adapter_khz 3000" -f target/esp32.cfg</CommandLine>
|
||||
<ExtraParameters>
|
||||
<Frequency xsi:nil="true" />
|
||||
<BoostedFrequency xsi:nil="true" />
|
||||
<ConnectUnderReset>false</ConnectUnderReset>
|
||||
</ExtraParameters>
|
||||
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
|
||||
<ProgramMode>Enabled</ProgramMode>
|
||||
<StartupCommands>
|
||||
<string>set remotetimeout 60</string>
|
||||
<string>target remote :$$SYS:GDB_PORT$$</string>
|
||||
<string>mon gdb_breakpoint_override hard</string>
|
||||
<string>mon reset halt</string>
|
||||
<string>load</string>
|
||||
</StartupCommands>
|
||||
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
|
||||
<PreferredGDBPort>0</PreferredGDBPort>
|
||||
<PreferredTelnetPort>0</PreferredTelnetPort>
|
||||
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
|
||||
<SelectedCoreIndex xsi:nil="true" />
|
||||
<LiveMemoryTimeout>5000</LiveMemoryTimeout>
|
||||
<SuggestionLogicRevision>1</SuggestionLogicRevision>
|
||||
<CheckFLASHSize>true</CheckFLASHSize>
|
||||
<FLASHSettings>
|
||||
<Size>size2MB</Size>
|
||||
<Frequency>freq40M</Frequency>
|
||||
<Mode>DIO</Mode>
|
||||
</FLASHSettings>
|
||||
<PatchBootloader>true</PatchBootloader>
|
||||
</Configuration>
|
||||
</DebugMethod>
|
||||
<AutoDetectRTOS>true</AutoDetectRTOS>
|
||||
<SemihostingSupport>Auto</SemihostingSupport>
|
||||
<SemihostingPollingDelay>0</SemihostingPollingDelay>
|
||||
<StepIntoEntryPoint>false</StepIntoEntryPoint>
|
||||
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
|
||||
<ValidateEndOfStackAddress>true</ValidateEndOfStackAddress>
|
||||
<StopAtEntryPoint>false</StopAtEntryPoint>
|
||||
<EnableVirtualHalts>false</EnableVirtualHalts>
|
||||
<DynamicAnalysisSettings />
|
||||
<EndOfStackSymbol>_estack</EndOfStackSymbol>
|
||||
<TimestampProviderTicksPerSecond>0</TimestampProviderTicksPerSecond>
|
||||
<KeepConsoleAfterExit>false</KeepConsoleAfterExit>
|
||||
<UnusedStackFillPattern xsi:nil="true" />
|
||||
<CheckInterfaceDrivers>true</CheckInterfaceDrivers>
|
||||
</Debug>
|
||||
</VisualGDBProjectSettings2>
|
||||
10
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt
vendored
Normal file
10
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
#
|
||||
# wolfssl server test
|
||||
#
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
|
||||
set(COMPONENT_SRCS "server-tls.c" "wifi_connect.c")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS "." "./include")
|
||||
|
||||
register_component()
|
||||
3
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/component.mk
vendored
Normal file
3
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/component.mk
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
# Main Makefile. This is basically the same as a component makefile.
|
||||
#
|
||||
42
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/include/wifi_connect.h
vendored
Normal file
42
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/include/wifi_connect.h
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/* wifi_connect.h
|
||||
*
|
||||
* Copyright (C) 2006-2022 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 _TLS_WIFI_H_
|
||||
#define _TLS_WIFI_H_
|
||||
|
||||
#include "esp_idf_version.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_wifi.h"
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
#include "esp_event.h"
|
||||
#else
|
||||
#include "esp_event_loop.h"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define TLS_SMP_SERVER_TASK_NAME "tls_sever_example"
|
||||
#define TLS_SMP_SERVER_TASK_WORDS 10240
|
||||
#define TLS_SMP_SERVER_TASK_PRIORITY 8
|
||||
|
||||
#define TLS_SMP_WIFI_SSID CONFIG_WIFI_SSID
|
||||
#define TLS_SMP_WIFI_PASS CONFIG_WIFI_PASSWORD
|
||||
|
||||
#endif
|
||||
267
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c
vendored
Normal file
267
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c
vendored
Normal file
@@ -0,0 +1,267 @@
|
||||
/* server-tls-callback.c
|
||||
*
|
||||
* Copyright (C) 2006-2022 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
|
||||
*/
|
||||
/* the usual suspects */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* socket includes */
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* wolfSSL */
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/ssl.h>
|
||||
#include <wolfssl/certs_test.h>
|
||||
|
||||
/* ESP specific */
|
||||
#include "wifi_connect.h"
|
||||
|
||||
#ifdef WOLFSSL_TRACK_MEMORY
|
||||
#include <wolfssl/wolfcrypt/mem_track.h>
|
||||
#endif
|
||||
|
||||
static const char* const TAG = "tls_server";
|
||||
|
||||
#if defined(DEBUG_WOLFSSL)
|
||||
|
||||
static void ShowCiphers(void)
|
||||
{
|
||||
char ciphers[4096];
|
||||
|
||||
int ret = wolfSSL_get_ciphers(ciphers, (int)sizeof(ciphers));
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
printf("%s\n", ciphers);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
|
||||
&& defined(WOLFSSL_ATECC508A)
|
||||
|
||||
#include "wolfssl/wolfcrypt/port/atmel/atmel.h"
|
||||
|
||||
/* when you want to use a custom slot allocation */
|
||||
/* enable the definition CUSTOM_SLOT_ALLOCATION. */
|
||||
|
||||
#if defined(CUSTOM_SLOT_ALLOCATION)
|
||||
|
||||
static byte mSlotList[ATECC_MAX_SLOT];
|
||||
|
||||
int atmel_set_slot_allocator(atmel_slot_alloc_cb alloc, atmel_slot_dealloc_cb dealloc);
|
||||
|
||||
/* initialize slot array */
|
||||
void my_atmel_slotInit()
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;i<ATECC_MAX_SLOT; i++) {
|
||||
mSlotList[i] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
|
||||
/* allocate slot depending on slotType */
|
||||
int my_atmel_alloc(int slotType)
|
||||
{
|
||||
int i, slot = -1;
|
||||
|
||||
switch(slotType){
|
||||
case ATMEL_SLOT_ENCKEY:
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_DEVICE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE_ENC:
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_ANY:
|
||||
for(i=0;i<ATECC_MAX_SLOT;i++){
|
||||
if(mSlotList[i] == ATECC_INVALID_SLOT){
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
/* free slot array */
|
||||
void my_atmel_free(int slotId)
|
||||
{
|
||||
if(slotId >= 0 && slotId < ATECC_MAX_SLOT){
|
||||
mSlotList[slotId] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
#endif /* CUSTOM_SLOT_ALLOCATION */
|
||||
#endif /* WOLFSSL_ESPWROOM32SE && HAVE_PK_CALLBACK && WOLFSSL_ATECC508A */
|
||||
|
||||
void tls_smp_server_task()
|
||||
{
|
||||
int sockfd;
|
||||
int connd;
|
||||
struct sockaddr_in servAddr;
|
||||
struct sockaddr_in clientAddr;
|
||||
socklen_t size = sizeof(clientAddr);
|
||||
char buff[256];
|
||||
size_t len;
|
||||
int shutdown = 0;
|
||||
int ret;
|
||||
const char msg[] = "I hear you fa shizzle!";
|
||||
|
||||
/* declare wolfSSL objects */
|
||||
WOLFSSL_CTX* ctx;
|
||||
WOLFSSL* ssl;
|
||||
|
||||
WOLFSSL_ENTER("tls_smp_server_task");
|
||||
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
WOLFSSL_MSG("Debug ON");
|
||||
wolfSSL_Debugging_ON();
|
||||
ShowCiphers();
|
||||
#endif
|
||||
|
||||
/* Initialize wolfSSL */
|
||||
WOLFSSL_MSG("Start wolfSSL_Init()");
|
||||
wolfSSL_Init();
|
||||
|
||||
/* Create a socket that uses an internet IPv4 address,
|
||||
* Sets the socket to be stream based (TCP),
|
||||
* 0 means choose the default protocol. */
|
||||
WOLFSSL_MSG( "start socket())");
|
||||
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to create the socket");
|
||||
}
|
||||
|
||||
/* Create and initialize WOLFSSL_CTX */
|
||||
WOLFSSL_MSG("Create and initialize WOLFSSL_CTX");
|
||||
if ((ctx = wolfSSL_CTX_new(wolfSSLv23_server_method())) == NULL) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to create WOLFSSL_CTX");
|
||||
}
|
||||
WOLFSSL_MSG("Loading certificate...");
|
||||
/* Load server certificates into WOLFSSL_CTX */
|
||||
|
||||
if ((ret = wolfSSL_CTX_use_certificate_buffer(ctx, server_cert_der_2048,
|
||||
sizeof_server_cert_der_2048,
|
||||
WOLFSSL_FILETYPE_ASN1)) != SSL_SUCCESS) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to load cert");
|
||||
}
|
||||
WOLFSSL_MSG("Loading key info...");
|
||||
/* Load server key into WOLFSSL_CTX */
|
||||
|
||||
if((ret=wolfSSL_CTX_use_PrivateKey_buffer(ctx,
|
||||
server_key_der_2048, sizeof_server_key_der_2048,
|
||||
WOLFSSL_FILETYPE_ASN1)) != SSL_SUCCESS) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to load privatekey");
|
||||
}
|
||||
|
||||
/* TO DO when using ECDSA, it loads the provisioned certificate and present it.*/
|
||||
/* TO DO when using ECDSA, it uses the generated key instead of loading key */
|
||||
|
||||
/* Initialize the server address struct with zeros */
|
||||
memset(&servAddr, 0, sizeof(servAddr));
|
||||
/* Fill in the server address */
|
||||
servAddr.sin_family = AF_INET; /* using IPv4 */
|
||||
servAddr.sin_port = htons(DEFAULT_PORT); /* on DEFAULT_PORT */
|
||||
servAddr.sin_addr.s_addr = INADDR_ANY; /* from anywhere */
|
||||
|
||||
/* Bind the server socket to our port */
|
||||
if (bind(sockfd, (struct sockaddr*)&servAddr, sizeof(servAddr)) == -1) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to bind");
|
||||
}
|
||||
|
||||
/* Listen for a new connection, allow 5 pending connections */
|
||||
if (listen(sockfd, 5) == -1) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to listen");
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
|
||||
&& defined(WOLFSSL_ATECC508A)
|
||||
atcatls_set_callbacks(ctx);
|
||||
/* when using a custom slot allocation */
|
||||
#if defined(CUSTOM_SLOT_ALLOCATION)
|
||||
my_atmel_slotInit();
|
||||
atmel_set_slot_allocator(my_atmel_alloc, my_atmel_free);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Continue to accept clients until shutdown is issued */
|
||||
while (!shutdown) {
|
||||
WOLFSSL_MSG("Waiting for a connection...");
|
||||
/* Accept client connections */
|
||||
if ((connd = accept(sockfd, (struct sockaddr*)&clientAddr, &size))
|
||||
== -1) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to accept the connection");
|
||||
}
|
||||
/* Create a WOLFSSL object */
|
||||
if ((ssl = wolfSSL_new(ctx)) == NULL) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to create WOLFSSL object");
|
||||
}
|
||||
/* Attach wolfSSL to the socket */
|
||||
wolfSSL_set_fd(ssl, connd);
|
||||
/* Establish TLS connection */
|
||||
ret = wolfSSL_accept(ssl);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
ESP_LOGE(TAG, "wolfSSL_accept error %d", wolfSSL_get_error(ssl, ret));
|
||||
}
|
||||
WOLFSSL_MSG("Client connected successfully");
|
||||
/* Read the client data into our buff array */
|
||||
memset(buff, 0, sizeof(buff));
|
||||
if (wolfSSL_read(ssl, buff, sizeof(buff)-1) == -1) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to read");
|
||||
}
|
||||
/* Print to stdout any data the client sends */
|
||||
WOLFSSL_MSG("Client sends:");
|
||||
WOLFSSL_MSG(buff);
|
||||
/* Check for server shutdown command */
|
||||
if (strncmp(buff, "shutdown", 8) == 0) {
|
||||
WOLFSSL_MSG("Shutdown command issued!");
|
||||
shutdown = 1;
|
||||
}
|
||||
/* Write our reply into buff */
|
||||
memset(buff, 0, sizeof(buff));
|
||||
memcpy(buff, msg, sizeof(msg));
|
||||
len = strnlen(buff, sizeof(buff));
|
||||
/* Reply back to the client */
|
||||
if (wolfSSL_write(ssl, buff, len) != len) {
|
||||
ESP_LOGE(TAG, "ERROR: failed to write");
|
||||
}
|
||||
/* Cleanup after this connection */
|
||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||
close(connd); /* Close the connection to the client */
|
||||
}
|
||||
/* Cleanup and return */
|
||||
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
|
||||
close(sockfd); /* Close the socket listening for clients */
|
||||
|
||||
vTaskDelete(NULL);
|
||||
|
||||
return; /* Return reporting a success */
|
||||
}
|
||||
169
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c
vendored
Normal file
169
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
/* wifi_connect.c
|
||||
*
|
||||
* Copyright (C) 2006-2022 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
|
||||
*/
|
||||
/*ESP specific */
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/event_groups.h"
|
||||
#include "wifi_connect.h"
|
||||
#include "lwip/sockets.h"
|
||||
#include "lwip/netdb.h"
|
||||
#include "lwip/apps/sntp.h"
|
||||
#include "nvs_flash.h"
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
#include "protocol_examples_common.h"
|
||||
#endif
|
||||
|
||||
const static int CONNECTED_BIT = BIT0;
|
||||
static EventGroupHandle_t wifi_event_group;
|
||||
/* prefix for logging */
|
||||
const static char *TAG = "tls_server";
|
||||
/* proto-type definition */
|
||||
extern void tls_smp_server_task();
|
||||
static void tls_smp_server_init();
|
||||
|
||||
static void set_time()
|
||||
{
|
||||
/* set dummy wallclock time. */
|
||||
struct timeval utctime;
|
||||
struct timezone tz;
|
||||
struct strftime_buf;
|
||||
time_t now;
|
||||
struct tm timeinfo;
|
||||
char strftime_buf[64];
|
||||
/* please update the time if seeing unknown failure when loading cert. */
|
||||
/* this could cause TLS communication failure due to time expiration */
|
||||
/* incleasing 31536000 seconds is close to spend 356 days. */
|
||||
utctime.tv_sec = 1645797600; /* dummy time: Fri 25 Feb 2022 02:00:00 2022 */
|
||||
utctime.tv_usec = 0;
|
||||
tz.tz_minuteswest = 0;
|
||||
tz.tz_dsttime = 0;
|
||||
|
||||
settimeofday(&utctime, &tz);
|
||||
|
||||
time(&now);
|
||||
localtime_r(&now, &timeinfo);
|
||||
|
||||
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
|
||||
ESP_LOGI(TAG, "The current date/time is: %s", strftime_buf);
|
||||
|
||||
#if ESP_IDF_VERSION_MAJOR < 4
|
||||
/* wait until wifi connect */
|
||||
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,
|
||||
false, true, portMAX_DELAY);
|
||||
#endif
|
||||
/* now we start client tasks. */
|
||||
tls_smp_server_init();
|
||||
}
|
||||
|
||||
/* create task */
|
||||
static void tls_smp_server_init(void)
|
||||
{
|
||||
int ret;
|
||||
xTaskHandle _handle;
|
||||
/* http://esp32.info/docs/esp_idf/html/dd/d3c/group__xTaskCreate.html */
|
||||
ret = xTaskCreate(tls_smp_server_task,
|
||||
TLS_SMP_SERVER_TASK_NAME,
|
||||
TLS_SMP_SERVER_TASK_WORDS,
|
||||
NULL,
|
||||
TLS_SMP_SERVER_TASK_PRIORITY,
|
||||
&_handle);
|
||||
|
||||
if (ret != pdPASS) {
|
||||
ESP_LOGI(TAG, "create thread %s failed", TLS_SMP_SERVER_TASK_NAME);
|
||||
}
|
||||
}
|
||||
/* event handler for wifi events */
|
||||
static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
||||
{
|
||||
switch (event->event_id)
|
||||
{
|
||||
case SYSTEM_EVENT_STA_START:
|
||||
esp_wifi_connect();
|
||||
break;
|
||||
case SYSTEM_EVENT_STA_GOT_IP:
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
ESP_LOGI(TAG, "got ip:" IPSTR "\n",
|
||||
IP2STR(&event->event_info.got_ip.ip_info.ip));
|
||||
#else
|
||||
ESP_LOGI(TAG, "got ip:%s",
|
||||
ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip));
|
||||
#endif
|
||||
/* http://esp32.info/docs/esp_idf/html/dd/d08/group__xEventGroupSetBits.html */
|
||||
xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
|
||||
break;
|
||||
case SYSTEM_EVENT_STA_DISCONNECTED:
|
||||
esp_wifi_connect();
|
||||
xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
/* entry point */
|
||||
void app_main(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "Start app_main...");
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
ESP_LOGI(TAG, "Initialize wifi");
|
||||
/* TCP/IP adapter initialization */
|
||||
#if (ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1) || \
|
||||
(ESP_IDF_VERSION_MAJOR > 5)
|
||||
esp_netif_init();
|
||||
#else
|
||||
tcpip_adapter_init();
|
||||
#endif
|
||||
/* */
|
||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||
(void) wifi_event_handler;
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
|
||||
* Read "Establishing Wi-Fi or Ethernet Connection" section in
|
||||
* examples/protocols/README.md for more information about this function.
|
||||
*/
|
||||
ESP_ERROR_CHECK(example_connect());
|
||||
#else
|
||||
wifi_event_group = xEventGroupCreate();
|
||||
ESP_ERROR_CHECK(esp_event_loop_init(wifi_event_handler, NULL));
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
|
||||
wifi_config_t wifi_config = {
|
||||
.sta = {
|
||||
.ssid = TLS_SMP_WIFI_SSID,
|
||||
.password = TLS_SMP_WIFI_PASS,
|
||||
},
|
||||
};
|
||||
/* WiFi station mode */
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||
/* Wifi Set the configuration of the ESP32 STA or AP */
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
||||
/* Start Wifi */
|
||||
ESP_ERROR_CHECK(esp_wifi_start() );
|
||||
|
||||
ESP_LOGI(TAG, "wifi_init_sta finished.");
|
||||
ESP_LOGI(TAG, "connect to ap SSID:%s password:%s",
|
||||
TLS_SMP_WIFI_SSID, TLS_SMP_WIFI_PASS);
|
||||
#endif
|
||||
ESP_LOGI(TAG, "Set dummy time...");
|
||||
set_time();
|
||||
}
|
||||
12
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/CMakeLists.txt
vendored
Normal file
12
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
set(COMPONENTS
|
||||
main
|
||||
wolfssl
|
||||
) # set components
|
||||
|
||||
project(wolfssl_test)
|
||||
142
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md
vendored
Normal file
142
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
# wolfSSL Crypt Test Example
|
||||
|
||||
The Example contains of wolfSSL benchmark program.
|
||||
|
||||
1. `idf.py menuconfig` to configure the program.
|
||||
1-1. Example Configuration ->
|
||||
|
||||
BENCH_ARG : argument that you want to use. Default is "-lng 0"
|
||||
The list of argument can be find in help.
|
||||
|
||||
When you want to run the benchmark program
|
||||
|
||||
1. `idf.py -p <PORT> flash` to compile and load the firmware
|
||||
2. `idf.py monitor` to see the message
|
||||
|
||||
See the README.md file in the upper level 'examples' directory for more information about examples.
|
||||
|
||||
Reminder than when building on WSL in `/mnt/c` there will be a noticeable performance degradation at compile time. Using `~/` will be faster at the cost of shared filesystems.
|
||||
|
||||
Example build on WSL, assuming `git clone` from `c:\workspace`:
|
||||
|
||||
```
|
||||
# Optionally install wolfSSL component
|
||||
# cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF
|
||||
./setup.sh
|
||||
|
||||
# switch to test example
|
||||
cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test
|
||||
|
||||
# Pick ESP-IDF install directory, this one for v4.4.2 in VisualGDB
|
||||
. /mnt/c/SysGCC/esp32/esp-idf/v4.4.2/export.sh
|
||||
|
||||
# build and flash, in this example to COM20
|
||||
idf.py build flash -p /dev/ttyS20 -b 921600 monitor
|
||||
```
|
||||
|
||||
## 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 921600 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
|
||||
```
|
||||
42
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test.sln
vendored
Normal file
42
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test.sln
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32802.440
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_test", "VisualGDB_wolfssl_test.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{35EEC1E7-13AB-4C74-BFCE-22142A10E1C1}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README.md = README.md
|
||||
sdkconfig = sdkconfig
|
||||
sdkconfig.defaults = sdkconfig.defaults
|
||||
build\config\sdkconfig.h = build\config\sdkconfig.h
|
||||
..\..\..\..\..\wolfcrypt\test\test.c = ..\..\..\..\..\wolfcrypt\test\test.c
|
||||
..\..\..\..\..\wolfcrypt\test\test.h = ..\..\..\..\..\wolfcrypt\test\test.h
|
||||
..\..\..\..\..\..\..\SysGCC\esp32\esp-idf\v4.4.1\components\wolfssl\include\user_settings.h = ..\..\..\..\..\..\..\SysGCC\esp32\esp-idf\v4.4.1\components\wolfssl\include\user_settings.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|VisualGDB = Debug|VisualGDB
|
||||
Release|VisualGDB = Release|VisualGDB
|
||||
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
|
||||
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A0AC9105-F2CF-44E7-8032-3CD9E77EC9F6}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
269
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test.vgdbproj
vendored
Normal file
269
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test.vgdbproj
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
<?xml version="1.0"?>
|
||||
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Project xsi:type="com.visualgdb.project.external.esp-idf">
|
||||
<CustomSourceDirectories>
|
||||
<Directories />
|
||||
<PathStyle>Unknown</PathStyle>
|
||||
</CustomSourceDirectories>
|
||||
<AutoProgramSPIFFSPartition>true</AutoProgramSPIFFSPartition>
|
||||
<ProjectModeSettings>
|
||||
<ProjectGUID>35e5525f-318a-466e-a8c7-36548547d801</ProjectGUID>
|
||||
<GroupSourcesByTypes>true</GroupSourcesByTypes>
|
||||
<GroupSourcesByPaths>true</GroupSourcesByPaths>
|
||||
<HeaderScanMode>SourceDirs</HeaderScanMode>
|
||||
</ProjectModeSettings>
|
||||
</Project>
|
||||
<Build xsi:type="com.visualgdb.build.cmake">
|
||||
<BuildLogMode xsi:nil="true" />
|
||||
<ToolchainID>
|
||||
<ID>com.visualgdb.xtensa-esp32-elf</ID>
|
||||
<Version>
|
||||
<GCC>8.4.0</GCC>
|
||||
<GDB>8.1.0</GDB>
|
||||
<Revision>9</Revision>
|
||||
</Version>
|
||||
</ToolchainID>
|
||||
<RelativeSourceDirectory />
|
||||
<ConfigurationType>DEBUG</ConfigurationType>
|
||||
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
|
||||
<MakeCommandTemplate>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<Command>$(ToolchainNinja)</Command>
|
||||
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</MakeCommandTemplate>
|
||||
<CMakeCommand>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<Command>$(SYSPROGS_CMAKE_PATH)</Command>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</CMakeCommand>
|
||||
<UpdateSourcesInCMakeFile>true</UpdateSourcesInCMakeFile>
|
||||
<ExportCompileCommands>false</ExportCompileCommands>
|
||||
<DisableToolchainFile>false</DisableToolchainFile>
|
||||
<CMakeMakefileType>Ninja</CMakeMakefileType>
|
||||
<DeployAsRoot>false</DeployAsRoot>
|
||||
<CMakeCleanMode>RemoveBuildDirectory</CMakeCleanMode>
|
||||
<UseCCache>false</UseCCache>
|
||||
<ProjectModeSettings>
|
||||
<ProjectItemSettings>
|
||||
<GroupSourcesByTypes>true</GroupSourcesByTypes>
|
||||
<GroupSourcesByPaths>true</GroupSourcesByPaths>
|
||||
<GroupTargetsByPaths>true</GroupTargetsByPaths>
|
||||
<FollowCMakeSourceGroups>false</FollowCMakeSourceGroups>
|
||||
<AutoRefreshProject>true</AutoRefreshProject>
|
||||
<AlwaysConsiderOutdated>false</AlwaysConsiderOutdated>
|
||||
<SortTargetsByName>true</SortTargetsByName>
|
||||
<RedundantTargetMode>HideOuterProjectTargets</RedundantTargetMode>
|
||||
<SortSourcesByName>true</SortSourcesByName>
|
||||
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
|
||||
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
|
||||
</ProjectItemSettings>
|
||||
<TargetSpecificSettings />
|
||||
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
|
||||
<ProjectGUID>eadcc9ab-72b3-4b51-a838-593e5d80ddf7</ProjectGUID>
|
||||
<VirtualFolders />
|
||||
<ConfigurationNameCase>Upper</ConfigurationNameCase>
|
||||
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
|
||||
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Version>v4.4.2</Version>
|
||||
<Subdirectory>esp-idf/v4.4.2</Subdirectory>
|
||||
<Type>ESPIDF</Type>
|
||||
</IDFCheckout>
|
||||
<COMPort>COM20</COMPort>
|
||||
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
|
||||
<UseCCache>false</UseCCache>
|
||||
<DeviceID>ESP32</DeviceID>
|
||||
</ESPIDFExtension>
|
||||
</ProjectModeSettings>
|
||||
</Build>
|
||||
<CustomBuild>
|
||||
<PreSyncActions />
|
||||
<PreBuildActions />
|
||||
<PostBuildActions />
|
||||
<PreCleanActions />
|
||||
<PostCleanActions />
|
||||
</CustomBuild>
|
||||
<CustomDebug>
|
||||
<PreDebugActions />
|
||||
<PostDebugActions />
|
||||
<DebugStopActions />
|
||||
<BreakMode>Default</BreakMode>
|
||||
</CustomDebug>
|
||||
<DeviceTerminalSettings>
|
||||
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
|
||||
<ComPortName>COM20</ComPortName>
|
||||
<AdvancedSettings>
|
||||
<BaudRate>115200</BaudRate>
|
||||
<DataBits>8</DataBits>
|
||||
<Parity>None</Parity>
|
||||
<StopBits>One</StopBits>
|
||||
<FlowControl>None</FlowControl>
|
||||
</AdvancedSettings>
|
||||
</Connection>
|
||||
<LastConnectionTime>0</LastConnectionTime>
|
||||
<EchoTypedCharacters>false</EchoTypedCharacters>
|
||||
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
|
||||
<ReconnectAutomatically>false</ReconnectAutomatically>
|
||||
<DisplayMode>ASCII</DisplayMode>
|
||||
<Colors>
|
||||
<Background>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>0</Red>
|
||||
<Green>0</Green>
|
||||
<Blue>0</Blue>
|
||||
</Background>
|
||||
<Disconnected>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>169</Red>
|
||||
<Green>169</Green>
|
||||
<Blue>169</Blue>
|
||||
</Disconnected>
|
||||
<Text>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>211</Red>
|
||||
<Green>211</Green>
|
||||
<Blue>211</Blue>
|
||||
</Text>
|
||||
<Echo>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>144</Red>
|
||||
<Green>238</Green>
|
||||
<Blue>144</Blue>
|
||||
</Echo>
|
||||
<Inactive>
|
||||
<Alpha>255</Alpha>
|
||||
<Red>169</Red>
|
||||
<Green>169</Green>
|
||||
<Blue>169</Blue>
|
||||
</Inactive>
|
||||
</Colors>
|
||||
<HexSettings>
|
||||
<MaximumBytesPerLine>16</MaximumBytesPerLine>
|
||||
<ShowTextView>true</ShowTextView>
|
||||
<BreaksAroundEcho>true</BreaksAroundEcho>
|
||||
<AutoSend>true</AutoSend>
|
||||
<SendAsHex>true</SendAsHex>
|
||||
<TimeoutForAutoBreak>0</TimeoutForAutoBreak>
|
||||
</HexSettings>
|
||||
<LineEnding>LF</LineEnding>
|
||||
<TreatLFAsCRLF>false</TreatLFAsCRLF>
|
||||
<KeepOpenAfterExit>false</KeepOpenAfterExit>
|
||||
<ShowAfterProgramming>false</ShowAfterProgramming>
|
||||
</DeviceTerminalSettings>
|
||||
<CustomShortcuts>
|
||||
<Shortcuts />
|
||||
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
|
||||
</CustomShortcuts>
|
||||
<UserDefinedVariables />
|
||||
<ImportedPropertySheets />
|
||||
<CodeSense>
|
||||
<Enabled>Unknown</Enabled>
|
||||
<ExtraSettings>
|
||||
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
|
||||
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
|
||||
<CheckForClangFormatFiles>true</CheckForClangFormatFiles>
|
||||
<FormattingEngine xsi:nil="true" />
|
||||
</ExtraSettings>
|
||||
<CodeAnalyzerSettings>
|
||||
<Enabled>false</Enabled>
|
||||
</CodeAnalyzerSettings>
|
||||
</CodeSense>
|
||||
<Configurations>
|
||||
<VisualGDBConfiguration>
|
||||
<Name>Debug</Name>
|
||||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
<VisualGDBConfiguration>
|
||||
<Name>Release</Name>
|
||||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
</Configurations>
|
||||
<ProgramArgumentsSuggestions />
|
||||
<Debug xsi:type="com.visualgdb.debug.embedded">
|
||||
<AdditionalStartupCommands />
|
||||
<AdditionalGDBSettings>
|
||||
<Features>
|
||||
<DisableAutoDetection>false</DisableAutoDetection>
|
||||
<UseFrameParameter>false</UseFrameParameter>
|
||||
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
|
||||
<ListLocalsSupported>false</ListLocalsSupported>
|
||||
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
|
||||
<ThreadInfoSupported>false</ThreadInfoSupported>
|
||||
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
|
||||
<SupportTargetCommand>false</SupportTargetCommand>
|
||||
<ReliableBreakpointNotifications>false</ReliableBreakpointNotifications>
|
||||
</Features>
|
||||
<EnableSmartStepping>false</EnableSmartStepping>
|
||||
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
|
||||
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
|
||||
<UseAppleExtensions>false</UseAppleExtensions>
|
||||
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
|
||||
<MakeLogFile>false</MakeLogFile>
|
||||
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
|
||||
<UseRelativePathsOnly>false</UseRelativePathsOnly>
|
||||
<ExitAction>None</ExitAction>
|
||||
<DisableDisassembly>false</DisableDisassembly>
|
||||
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
|
||||
<StepIntoNewInstanceEntry>app_main</StepIntoNewInstanceEntry>
|
||||
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
|
||||
<DisableSignals>false</DisableSignals>
|
||||
<EnableAsyncExecutionMode>false</EnableAsyncExecutionMode>
|
||||
<AsyncModeSupportsBreakpoints>true</AsyncModeSupportsBreakpoints>
|
||||
<TemporaryBreakConsolidationTimeout>0</TemporaryBreakConsolidationTimeout>
|
||||
<EnableNonStopMode>false</EnableNonStopMode>
|
||||
<MaxBreakpointLimit>0</MaxBreakpointLimit>
|
||||
<EnableVerboseMode>true</EnableVerboseMode>
|
||||
<EnablePrettyPrinters>false</EnablePrettyPrinters>
|
||||
</AdditionalGDBSettings>
|
||||
<DebugMethod>
|
||||
<ID>openocd</ID>
|
||||
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
|
||||
<CommandLine>-f interface/tigard.cfg -c "adapter_khz 3000" -f target/esp32.cfg</CommandLine>
|
||||
<ExtraParameters>
|
||||
<Frequency xsi:nil="true" />
|
||||
<BoostedFrequency xsi:nil="true" />
|
||||
<ConnectUnderReset>false</ConnectUnderReset>
|
||||
</ExtraParameters>
|
||||
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
|
||||
<ProgramMode>Enabled</ProgramMode>
|
||||
<StartupCommands>
|
||||
<string>set remotetimeout 60</string>
|
||||
<string>target remote :$$SYS:GDB_PORT$$</string>
|
||||
<string>mon gdb_breakpoint_override hard</string>
|
||||
<string>mon reset halt</string>
|
||||
<string>load</string>
|
||||
</StartupCommands>
|
||||
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
|
||||
<PreferredGDBPort>0</PreferredGDBPort>
|
||||
<PreferredTelnetPort>0</PreferredTelnetPort>
|
||||
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
|
||||
<SelectedCoreIndex xsi:nil="true" />
|
||||
<LiveMemoryTimeout>5000</LiveMemoryTimeout>
|
||||
<SuggestionLogicRevision>1</SuggestionLogicRevision>
|
||||
<CheckFLASHSize>true</CheckFLASHSize>
|
||||
<FLASHSettings>
|
||||
<Size>size2MB</Size>
|
||||
<Frequency>freq40M</Frequency>
|
||||
<Mode>DIO</Mode>
|
||||
</FLASHSettings>
|
||||
<PatchBootloader>true</PatchBootloader>
|
||||
</Configuration>
|
||||
</DebugMethod>
|
||||
<AutoDetectRTOS>true</AutoDetectRTOS>
|
||||
<SemihostingSupport>Auto</SemihostingSupport>
|
||||
<SemihostingPollingDelay>0</SemihostingPollingDelay>
|
||||
<StepIntoEntryPoint>false</StepIntoEntryPoint>
|
||||
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
|
||||
<ValidateEndOfStackAddress>true</ValidateEndOfStackAddress>
|
||||
<StopAtEntryPoint>false</StopAtEntryPoint>
|
||||
<EnableVirtualHalts>false</EnableVirtualHalts>
|
||||
<DynamicAnalysisSettings />
|
||||
<EndOfStackSymbol>_estack</EndOfStackSymbol>
|
||||
<TimestampProviderTicksPerSecond>0</TimestampProviderTicksPerSecond>
|
||||
<KeepConsoleAfterExit>false</KeepConsoleAfterExit>
|
||||
<UnusedStackFillPattern xsi:nil="true" />
|
||||
<CheckInterfaceDrivers>true</CheckInterfaceDrivers>
|
||||
</Debug>
|
||||
</VisualGDBProjectSettings2>
|
||||
14
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt
vendored
Normal file
14
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
#
|
||||
# wolfssl crypt test
|
||||
#
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
|
||||
set(COMPONENT_SRCS "main.c")
|
||||
|
||||
# when using time helper:
|
||||
# set(COMPONENT_SRCS "main.c" "time_helper.c")
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
register_component()
|
||||
29
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/Kconfig.projbuild
vendored
Normal file
29
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/Kconfig.projbuild
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
menu "Example Configuration"
|
||||
|
||||
config BENCH_ARGV
|
||||
string "Arguments for benchmark test"
|
||||
default "-lng 0"
|
||||
help
|
||||
-? <num> Help, print this usage
|
||||
0: English, 1: Japanese
|
||||
-csv Print terminal output in csv format
|
||||
-base10 Display bytes as power of 10 (eg 1 kB = 1000 Bytes)
|
||||
-no_aad No additional authentication data passed.
|
||||
-dgst_full Full digest operation performed.
|
||||
-rsa_sign Measure RSA sign/verify instead of encrypt/decrypt.
|
||||
-<alg> Algorithm to benchmark. Available algorithms include:
|
||||
cipher aes-cbc aes-gcm chacha20 chacha20-poly1305
|
||||
digest md5 poly1305 sha sha2 sha224 sha256 sha384 sha512 sha3
|
||||
sha3-224 sha3-256 sha3-384 sha3-512
|
||||
mac hmac hmac-md5 hmac-sha hmac-sha224 hmac-sha256 hmac-sha384
|
||||
hmac-sha512
|
||||
asym rsa rsa-sz dh ecc-kg ecc
|
||||
other rng
|
||||
-lng <num> Display benchmark result by specified language.
|
||||
0: English, 1: Japanese
|
||||
<num> Size of block in bytes
|
||||
|
||||
e.g -lng 1
|
||||
e.g sha
|
||||
|
||||
endmenu
|
||||
3
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/component.mk
vendored
Normal file
3
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/component.mk
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
# Main Makefile. This is basically the same as a component makefile.
|
||||
#
|
||||
172
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/main.c
vendored
Normal file
172
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/main.c
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
/* main.c
|
||||
*
|
||||
* Copyright (C) 2006-2022 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
|
||||
*/
|
||||
|
||||
/* ESP-IDF */
|
||||
#include <esp_log.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/* wolfSSL */
|
||||
#include <user_settings.h>
|
||||
#ifndef WOLFSSL_ESPIDF
|
||||
#warning "problem with wolfSSL user settings. Check components/wolfssl/include"
|
||||
#endif
|
||||
|
||||
#include <wolfcrypt/test/test.h>
|
||||
|
||||
/*
|
||||
** the wolfssl component can be installed in either:
|
||||
**
|
||||
** - the ESP-IDF component directory
|
||||
**
|
||||
** ** OR **
|
||||
**
|
||||
** - the local project component directory
|
||||
**
|
||||
** it is not recommended to install in both.
|
||||
**
|
||||
*/
|
||||
|
||||
/*
|
||||
** although the wolfcrypt/test includes a default time setting,
|
||||
** see the enclosed optional time helper for adding NNTP.
|
||||
** be sure to add "time_helper.c" in main/CMakeLists.txt
|
||||
*/
|
||||
#undef WOLFSSL_USE_TIME_HELPER
|
||||
#if defined(WOLFSSL_USE_TIME_HELPER)
|
||||
#include "time_helper.h" */
|
||||
#endif
|
||||
|
||||
/* see wolfssl/wolfcrypt/test/test.h */
|
||||
extern void wolf_crypt_task();
|
||||
|
||||
|
||||
static const char* const TAG = "wolfssl_test";
|
||||
|
||||
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
|
||||
&& defined(WOLFSSL_ATECC508A)
|
||||
|
||||
#include "wolfssl/wolfcrypt/port/atmel/atmel.h"
|
||||
|
||||
/* when you need to use a custom slot allocation, */
|
||||
/* enable the definition CUSTOM_SLOT_ALLOCAION. */
|
||||
#if defined(CUSTOM_SLOT_ALLOCATION)
|
||||
|
||||
static byte mSlotList[ATECC_MAX_SLOT];
|
||||
|
||||
/* initialize slot array */
|
||||
void my_atmel_slotInit()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ATECC_MAX_SLOT; i++) {
|
||||
mSlotList[i] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
|
||||
/* allocate slot depending on slotType */
|
||||
int my_atmel_alloc(int slotType)
|
||||
{
|
||||
int i, slot = ATECC_INVALID_SLOT;
|
||||
|
||||
switch (slotType) {
|
||||
case ATMEL_SLOT_ENCKEY:
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_DEVICE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE:
|
||||
slot = 0;
|
||||
break;
|
||||
case ATMEL_SLOT_ECDHE_ENC:
|
||||
slot = 4;
|
||||
break;
|
||||
case ATMEL_SLOT_ANY:
|
||||
for (i = 0; i < ATECC_MAX_SLOT; i++) {
|
||||
if (mSlotList[i] == ATECC_INVALID_SLOT) {
|
||||
slot = i;
|
||||
break;
|
||||
} /* if */
|
||||
} /* for */
|
||||
} /* switch */
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
/* free slot array */
|
||||
void my_atmel_free(int slotId)
|
||||
{
|
||||
if (slotId >= 0 && slotId < ATECC_MAX_SLOT) {
|
||||
mSlotList[slotId] = ATECC_INVALID_SLOT;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CUSTOM_SLOT_ALLOCATION */
|
||||
#endif /* WOLFSSL_ESPWROOM32SE && HAVE_PK_CALLBACK && WOLFSSL_ATECC508A */
|
||||
|
||||
|
||||
/* entry point */
|
||||
void app_main(void)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
#if defined (WOLFSSL_USE_TIME_HELPER)
|
||||
set_time();
|
||||
#endif
|
||||
|
||||
/* when using atecc608a on esp32-wroom-32se */
|
||||
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
|
||||
&& defined(WOLFSSL_ATECC508A)
|
||||
#if defined(CUSTOM_SLOT_ALLOCATION)
|
||||
my_atmel_slotInit();
|
||||
/* to register the callback, it needs to be initialized. */
|
||||
if ((wolfCrypt_Init()) != 0) {
|
||||
ESP_LOGE(TAG, "wolfCrypt_Init failed");
|
||||
return;
|
||||
}
|
||||
atmel_set_slot_allocator(my_atmel_alloc, my_atmel_free);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NO_CRYPT_TEST
|
||||
ESP_LOGI(TAG, "NO_CRYPT_TEST defined, skipping wolf_test_task");
|
||||
#else
|
||||
/* Although wolfCrypt_Init() may be explicitly called above,
|
||||
** Note it is still always called in wolf_test_task.
|
||||
*/
|
||||
rc = wolf_test_task();
|
||||
/* note wolfCrypt_Cleanup() should always be called when finished.
|
||||
** This is called at the end of wolf_test_task();
|
||||
*/
|
||||
|
||||
if (rc == 0) {
|
||||
ESP_LOGI(TAG, "wolf_test_task complete success result code = %d", rc);
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG, "wolf_test_task FAIL result code = %d", rc);
|
||||
/* see wolfssl/wolfcrypt/error-crypt.h */
|
||||
}
|
||||
|
||||
/* after the test, we'll just wait */
|
||||
while (1) {
|
||||
/* nothing */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
119
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/time_helper.c
vendored
Normal file
119
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/time_helper.c
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
/* time_helper.c
|
||||
*
|
||||
* Copyright (C) 2006-2022 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 <string.h>
|
||||
#include <lwip/apps/sntp.h>
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#include "time_helper.h"
|
||||
|
||||
const static char* TAG = "Time Helper";
|
||||
|
||||
#define TIME_ZONE "PST-8"
|
||||
/* NELEMS(x) number of elements
|
||||
* To determine the number of elements in the array, we can divide the total size of
|
||||
* the array by the size of the array element
|
||||
* See https://stackoverflow.com/questions/37538/how-do-i-determine-the-size-of-my-array-in-c
|
||||
**/
|
||||
#define NELEMS(x) ( (int)(sizeof(x) / sizeof((x)[0])) )
|
||||
#define NTP_SERVER_LIST ( (char*[]) { \
|
||||
"pool.ntp.org", \
|
||||
"time.nist.gov", \
|
||||
"utcnist.colorado.edu" \
|
||||
} \
|
||||
)
|
||||
/* #define NTP_SERVER_COUNT using NELEMS:
|
||||
*
|
||||
* (int)(sizeof(NTP_SERVER_LIST) / sizeof(NTP_SERVER_LIST[0]))
|
||||
*/
|
||||
#define NTP_SERVER_COUNT NELEMS(NTP_SERVER_LIST)
|
||||
char* ntpServerList[NTP_SERVER_COUNT] = NTP_SERVER_LIST;
|
||||
|
||||
/* our NTP server list is global info */
|
||||
extern char* ntpServerList[NTP_SERVER_COUNT];
|
||||
|
||||
|
||||
int set_time(void)
|
||||
{
|
||||
/* we'll also return a result code of zero */
|
||||
int res = 0;
|
||||
int i = 0; /* counter for time servers */
|
||||
time_t interim_time;
|
||||
|
||||
/* ideally, we'd like to set time from network,
|
||||
* but let's set a default time, just in case */
|
||||
struct tm timeinfo = {
|
||||
.tm_year = 2022 - 1900,
|
||||
.tm_mon = 11,
|
||||
.tm_mday = 15,
|
||||
.tm_hour = 3,
|
||||
.tm_min = 25,
|
||||
.tm_sec = 0
|
||||
};
|
||||
struct timeval now;
|
||||
|
||||
#ifndef NTP_SERVER_COUNT
|
||||
#define NTP_SERVER_COUNT 0
|
||||
char* ntpServerList[NTP_SERVER_COUNT];
|
||||
#endif /* not defined: NTP_SERVER_COUNT */
|
||||
|
||||
#ifndef TIME_ZONE
|
||||
#define TIME_ZONE "PST-8"
|
||||
#endif /* not defined: TIME_ZONE */
|
||||
|
||||
|
||||
/* set interim static time */
|
||||
interim_time = mktime(&timeinfo);
|
||||
now = (struct timeval){ .tv_sec = interim_time };
|
||||
settimeofday(&now, NULL);
|
||||
|
||||
|
||||
/* set timezone */
|
||||
setenv("TZ", TIME_ZONE, 1);
|
||||
tzset();
|
||||
|
||||
if (NTP_SERVER_COUNT) {
|
||||
/* next, let's setup NTP time servers
|
||||
*
|
||||
* see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#sntp-time-synchronization
|
||||
*/
|
||||
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||
|
||||
ESP_LOGI(TAG, "sntp_setservername:");
|
||||
for (i = 0; i < NTP_SERVER_COUNT; i++) {
|
||||
const char* thisServer = ntpServerList[i];
|
||||
if (strncmp(thisServer, "\x00", 1) == 0) {
|
||||
/* just in case we run out of NTP servers */
|
||||
break;
|
||||
}
|
||||
ESP_LOGI(TAG, "%s", thisServer);
|
||||
sntp_setservername(i, thisServer);
|
||||
}
|
||||
sntp_init();
|
||||
ESP_LOGI(TAG, "sntp_init done.");
|
||||
}
|
||||
else {
|
||||
ESP_LOGI(TAG, "No sntp time servers found.");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
32
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/time_helper.h
vendored
Normal file
32
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/time_helper.h
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef _TIME_HELPER_H
|
||||
/*
|
||||
* Copyright (C) 2006-2022 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
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int set_time(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef _TIME_HELPER_H */
|
||||
27
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/sdkconfig.defaults
vendored
Normal file
27
android/extern/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/sdkconfig.defaults
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# Default main stack size
|
||||
#
|
||||
# This is typically way bigger than needed for stack size. See user_settings.h
|
||||
#
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE=55000
|
||||
|
||||
# Legacy stack size for older ESP-IDF versions
|
||||
CONFIG_MAIN_TASK_STACK_SIZE=11000
|
||||
|
||||
#
|
||||
# Watchdog Timers
|
||||
#
|
||||
# We don't want to have the watchdog timeout during tests
|
||||
#
|
||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
|
||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n
|
||||
|
||||
#
|
||||
# Compiler options
|
||||
#
|
||||
CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
|
||||
CONFIG_COMPILER_HIDE_PATHS_MACROS=y
|
||||
CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y
|
||||
CONFIG_COMPILER_STACK_CHECK=y
|
||||
89
android/extern/wolfssl/IDE/Espressif/ESP-IDF/libs/CMakeLists.txt
vendored
Normal file
89
android/extern/wolfssl/IDE/Espressif/ESP-IDF/libs/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
#
|
||||
# Copyright (C) 2006-2022 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
|
||||
#
|
||||
# cmake for wolfssl
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
|
||||
|
||||
set(CMAKE_CURRENT_SOURCE_DIR ".")
|
||||
set(WOLFSSL_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(INCLUDE_PATH ${WOLFSSL_ROOT})
|
||||
|
||||
set(COMPONENT_SRCDIRS "./src/"
|
||||
"./wolfcrypt/src/"
|
||||
"./wolfcrypt/src/port/Espressif/"
|
||||
"./wolfcrypt/src/port/atmel/"
|
||||
"./wolfcrypt/benchmark/"
|
||||
"./wolfcrypt/test/"
|
||||
# "$ENV{IDF_PATH}/components/soc/esp32s3/include/soc"
|
||||
)
|
||||
|
||||
set(COMPONENT_REQUIRES lwip)
|
||||
|
||||
|
||||
# RTOS_IDF_PATH is typically:
|
||||
# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
|
||||
# depending on the environment, we may need to swap backslashes with forward slashes
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
|
||||
# ESP-IDF after version 4.4x has a different RTOS directory structure
|
||||
string(REPLACE "\\" "/" RTOS_IDF_PATH5 "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/)
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"."
|
||||
"./include"
|
||||
"${RTOS_IDF_PATH5}"
|
||||
"${WOLFSSL_ROOT}"
|
||||
)
|
||||
else()
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS
|
||||
"."
|
||||
"./include"
|
||||
"${RTOS_IDF_PATH}"
|
||||
"${WOLFSSL_ROOT}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
|
||||
endif()
|
||||
|
||||
set(COMPONENT_SRCEXCLUDE
|
||||
"./src/bio.c"
|
||||
"./src/conf.c"
|
||||
"./src/misc.c"
|
||||
"./src/pk.c"
|
||||
"./src/ssl_misc.c" # included by ssl.c
|
||||
"./src/x509.c"
|
||||
"./src/x509_str.c"
|
||||
"./wolfcrypt/src/evp.c"
|
||||
"./wolfcrypt/src/misc.c"
|
||||
)
|
||||
|
||||
register_component()
|
||||
|
||||
# check to see if there's both a local copy and EDP-IDF copy of the wolfssl components
|
||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
|
||||
message(STATUS "")
|
||||
message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
# end multiple component check
|
||||
7
android/extern/wolfssl/IDE/Espressif/ESP-IDF/libs/README.md
vendored
Normal file
7
android/extern/wolfssl/IDE/Espressif/ESP-IDF/libs/README.md
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Files in IDE\Espressif\ESP-IDF\libs:
|
||||
|
||||
`CMakeLists.txt` used in ESP-IDF `wolfssl` component directory
|
||||
|
||||
`component.mk` used in ESP-IDF `wolfssl` component directory
|
||||
|
||||
`tigard.cfg` Tigard JTAG config file
|
||||
40
android/extern/wolfssl/IDE/Espressif/ESP-IDF/libs/component.mk
vendored
Normal file
40
android/extern/wolfssl/IDE/Espressif/ESP-IDF/libs/component.mk
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (C) 2006-2022 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
|
||||
#
|
||||
#
|
||||
# Component Makefile
|
||||
#
|
||||
|
||||
COMPONENT_ADD_INCLUDEDIRS := . ./include
|
||||
|
||||
COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/components/freertos/include/freertos"
|
||||
# COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/soc/esp32s3/include/soc"
|
||||
|
||||
COMPONENT_SRCDIRS := src wolfcrypt/src
|
||||
COMPONENT_SRCDIRS += wolfcrypt/src/port/Espressif
|
||||
COMPONENT_SRCDIRS += wolfcrypt/src/port/atmel
|
||||
COMPONENT_SRCDIRS += wolfcrypt/benchmark
|
||||
COMPONENT_SRCDIRS += wolfcrypt/test
|
||||
|
||||
CFLAGS +=-DWOLFSSL_USER_SETTINGS
|
||||
|
||||
COMPONENT_OBJEXCLUDE := wolfcrypt/src/aes_asm.o
|
||||
COMPONENT_OBJEXCLUDE += wolfcrypt/src/evp.o
|
||||
COMPONENT_OBJEXCLUDE += wolfcrypt/src/misc.o
|
||||
COMPONENT_OBJEXCLUDE += src/bio.o
|
||||
8
android/extern/wolfssl/IDE/Espressif/ESP-IDF/libs/tigard.cfg
vendored
Normal file
8
android/extern/wolfssl/IDE/Espressif/ESP-IDF/libs/tigard.cfg
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
adapter driver ftdi
|
||||
ftdi vid_pid 0x0403 0x6010
|
||||
ftdi channel 1
|
||||
adapter speed 29500
|
||||
ftdi layout_init 0x0038 0x003b
|
||||
ftdi layout_signal nTRST -data 0x0010
|
||||
ftdi layout_signal nSRST -data 0x0020
|
||||
transport select jtag
|
||||
162
android/extern/wolfssl/IDE/Espressif/ESP-IDF/setup.sh
vendored
Normal file
162
android/extern/wolfssl/IDE/Espressif/ESP-IDF/setup.sh
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
#!/bin/bash
|
||||
|
||||
# check if IDF_PATH is set
|
||||
if [ -z "$IDF_PATH" ]; then
|
||||
echo "Please follows the instruction of ESP-IDF installation and set IDF_PATH."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RMDCMD='/bin/rm -rf'
|
||||
MKDCMD='/bin/mkdir'
|
||||
CPDCMD='/bin/cp'
|
||||
|
||||
SCRIPTDIR=`dirname $0`
|
||||
SCRIPTDIR=`cd $SCRIPTDIR && pwd -P`
|
||||
WOLFSSL_ESPIDFDIR=${SCRIPTDIR}
|
||||
WOLFSSL_ESPIDFDIR=`cd $WOLFSSL_ESPIDFDIR && pwd -P`
|
||||
BASEDIR=${SCRIPTDIR}/../../../
|
||||
BASEDIR=`cd ${BASEDIR} && pwd -P`
|
||||
|
||||
# echo $WOLFSSL_ESPIDFDIR
|
||||
|
||||
WOLFSSLLIB_TRG_DIR=${IDF_PATH}/components/wolfssl
|
||||
WOLFSSLEXP_TRG_DIR=${IDF_PATH}/examples/protocols
|
||||
|
||||
if [ "$1" == "--verbose" ]; then
|
||||
WOLFSSL_SETUP_VERBOSE=true
|
||||
fi
|
||||
|
||||
if [ "${WOLFSSL_SETUP_VERBOSE}" == "true" ]; then
|
||||
echo Verbose mode on!
|
||||
echo BASEDIR=${BASEDIR}
|
||||
echo SCRIPTDIR=${SCRIPTDIR}
|
||||
echo WOLFSSL_ESPIDFDIR=${WOLFSSL_ESPIDFDIR}
|
||||
echo WOLFSSLLIB_TRG_DIR=${WOLFSSLLIB_TRG_DIR}
|
||||
echo WOLFSSLEXP_TRG_DIR=${WOLFSSLEXP_TRG_DIR}
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ ! -d $IDF_PATH ]; then
|
||||
echo "ESP-IDF Development Framework doesn't exist.: $IDF_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy files into ESP-IDF development framework
|
||||
pushd $IDF_PATH > /dev/null
|
||||
|
||||
echo "Copy files into $IDF_PATH"
|
||||
|
||||
# Remove/Create directories
|
||||
if [ "${WOLFSSL_SETUP_VERBOSE}" == "true" ]; then
|
||||
echo "Remove/Create directories..."
|
||||
fi
|
||||
|
||||
${RMDCMD} ${WOLFSSLLIB_TRG_DIR}/
|
||||
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/
|
||||
|
||||
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/src
|
||||
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt
|
||||
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src
|
||||
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfssl
|
||||
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfssl/openssl
|
||||
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/test
|
||||
${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/include
|
||||
|
||||
popd > /dev/null # $WOLFSSL_ESPIDFDIR
|
||||
pushd ${BASEDIR} > /dev/null # WOLFSSL TOP DIR
|
||||
|
||||
# copying ... files in src/ into $WOLFSSLLIB_TRG_DIR/src
|
||||
|
||||
if [ "${WOLFSSL_SETUP_VERBOSE}" == "true" ]; then
|
||||
echo "Copying ... files in src/ into \$WOLFSSLLIB_TRG_DIR/srcs ..."
|
||||
fi
|
||||
|
||||
${CPDCMD} ./src/*.c ${WOLFSSLLIB_TRG_DIR}/src/
|
||||
|
||||
|
||||
${CPDCMD} -r ./wolfcrypt/src/*.{c,i} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src/
|
||||
${CPDCMD} -r ./wolfcrypt/src/port ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src/port/
|
||||
${CPDCMD} -r ./wolfcrypt/test ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/
|
||||
# Copy dummy test_paths.h to handle the case configure hasn't yet executed
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/dummy_test_paths.h ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/test/test_paths.h
|
||||
${CPDCMD} -r ./wolfcrypt/benchmark ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/
|
||||
|
||||
${CPDCMD} -r ./wolfssl/*.h ${WOLFSSLLIB_TRG_DIR}/wolfssl/
|
||||
${CPDCMD} -r ./wolfssl/openssl/*.h ${WOLFSSLLIB_TRG_DIR}/wolfssl/openssl/
|
||||
${CPDCMD} -r ./wolfssl/wolfcrypt ${WOLFSSLLIB_TRG_DIR}/wolfssl/
|
||||
|
||||
# user_settings.h
|
||||
if [ "${WOLFSSL_SETUP_VERBOSE}" == "true" ]; then
|
||||
echo "Copying user_settings.h to ${WOLFSSLLIB_TRG_DIR}/include/"
|
||||
fi
|
||||
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/user_settings.h ${WOLFSSLLIB_TRG_DIR}/include/
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/dummy_config_h ${WOLFSSLLIB_TRG_DIR}/include/config.h
|
||||
|
||||
# unit test app
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/test/* ${WOLFSSLLIB_TRG_DIR}/test/
|
||||
|
||||
popd > /dev/null #
|
||||
|
||||
${CPDCMD} ./libs/CMakeLists.txt ${WOLFSSLLIB_TRG_DIR}/
|
||||
${CPDCMD} ./libs/component.mk ${WOLFSSLLIB_TRG_DIR}/
|
||||
|
||||
pushd ${BASEDIR} > /dev/null # WOLFSSL TOP DIR
|
||||
|
||||
# Benchmark program
|
||||
if [ "${WOLFSSL_SETUP_VERBOSE}" == "true" ]; then
|
||||
echo ""
|
||||
fi
|
||||
${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/
|
||||
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/
|
||||
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/
|
||||
|
||||
${CPDCMD} -r ./wolfcrypt/benchmark/benchmark.c ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_benchmark/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_benchmark/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/
|
||||
|
||||
# Crypt Test program
|
||||
if [ "${WOLFSSL_SETUP_VERBOSE}" == "true" ]; then
|
||||
echo "Copying wolfssl_test to ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/"
|
||||
fi
|
||||
${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/
|
||||
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/
|
||||
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/
|
||||
|
||||
${CPDCMD} -r ./wolfcrypt/test/test.c ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_test/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_test/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/
|
||||
|
||||
# TLS Client program
|
||||
if [ "${WOLFSSL_SETUP_VERBOSE}" == "true" ]; then
|
||||
echo "Copying TLS Client program to ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/..."
|
||||
fi
|
||||
${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/
|
||||
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/
|
||||
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/main/
|
||||
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/main/include
|
||||
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_client/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_client/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/main/
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_client/main/include/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/main/include/
|
||||
|
||||
# TLS Server program
|
||||
if [ "${WOLFSSL_SETUP_VERBOSE}" == "true" ]; then
|
||||
echo "Copying TLS Server program to ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/..."
|
||||
fi
|
||||
${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/
|
||||
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/
|
||||
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/main/
|
||||
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/main/include
|
||||
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_server/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_server/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/main/
|
||||
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_server/main/include/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/main/include/
|
||||
|
||||
popd > /dev/null #
|
||||
|
||||
if [ "${WOLFSSL_SETUP_VERBOSE}" == "true" ]; then
|
||||
echo "Copy complete!"
|
||||
fi
|
||||
|
||||
exit 1
|
||||
393
android/extern/wolfssl/IDE/Espressif/ESP-IDF/setup_win.bat
vendored
Normal file
393
android/extern/wolfssl/IDE/Espressif/ESP-IDF/setup_win.bat
vendored
Normal file
@@ -0,0 +1,393 @@
|
||||
@echo off
|
||||
REM Expect the script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
|
||||
|
||||
::******************************************************************************************************
|
||||
::******************************************************************************************************
|
||||
echo;
|
||||
echo wolfSSL Windows Setup. Version 1.0a
|
||||
echo;
|
||||
echo This utility will copy a static snapshot of wolfSSL files to the ESP32-IDF component directory.
|
||||
echo;
|
||||
echo If you wish to keep your component library fresh with git pull, consider hard link with mklink.
|
||||
echo;
|
||||
echo "mklink [[/d] | [/h] | [/j]] <link> <target>"
|
||||
echo;
|
||||
::******************************************************************************************************
|
||||
::******************************************************************************************************
|
||||
SET COPYERROR=false
|
||||
|
||||
:: if there's a setup.sh, we are probably starting in the right place.
|
||||
if NOT EXIST "setup.sh" (
|
||||
echo Please run this script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
|
||||
goto :ERR
|
||||
)
|
||||
|
||||
:: if there's also a default user_settings.h, we are very likely starting in the right place.
|
||||
if NOT EXIST "user_settings.h" (
|
||||
echo Please run this script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
|
||||
goto :ERR
|
||||
)
|
||||
|
||||
:: see if there was a parameter passed for a specific EDP-IDF directory
|
||||
:: this may be different than the standard ESP-IDF environment (e.g. VisualGDB)
|
||||
if not "%1" == "" (
|
||||
if not exist "%1" (
|
||||
echo "ERROR: optional directory was specified, but not found: %1"
|
||||
goto :ERR
|
||||
)
|
||||
|
||||
SET IDF_PATH=%1
|
||||
echo Using specified IDF_PATH: %IDF_PATH%
|
||||
)
|
||||
|
||||
:: if no IDF_PATH is found, we don't know what to do. Go exit with error.
|
||||
if "%IDF_PATH%" == "" (
|
||||
echo Please launch the script from ESP-IDF command prompt,
|
||||
echo or set your desired IDF_PATH environment variable,
|
||||
echo or pass a parameter to your directory, such as for VisualGDB with ESP-IDF 4.4:
|
||||
echo;
|
||||
echo .\setup_win.bat C:\SysGCC\esp32\esp-idf\v4.4
|
||||
echo;
|
||||
goto :ERR
|
||||
)
|
||||
|
||||
:: Here we go!
|
||||
:: setup some path variables
|
||||
echo;
|
||||
|
||||
set SCRIPTDIR=%CD%
|
||||
set BASEDIR=%SCRIPTDIR%\..\..\..
|
||||
set WOLFSSL_ESPIDFDIR=%BASEDIR%\IDE\Espressif\ESP-IDF
|
||||
set WOLFSSLLIB_TRG_DIR=%IDF_PATH%\components\wolfssl
|
||||
set WOLFSSLEXP_TRG_DIR=%IDF_PATH%\examples\protocols
|
||||
|
||||
echo Using SCRIPTDIR = %SCRIPTDIR%
|
||||
echo Using BASEDIR = %BASEDIR%
|
||||
echo Using WOLFSSL_ESPIDFDIR = %WOLFSSL_ESPIDFDIR%
|
||||
echo Using WOLFSSLLIB_TRG_DIR = %WOLFSSLLIB_TRG_DIR%
|
||||
echo Using WOLFSSLEXP_TRG_DIR = %WOLFSSLEXP_TRG_DIR%
|
||||
|
||||
echo;
|
||||
echo Equivalalent destination path:
|
||||
dir %WOLFSSL_ESPIDFDIR%\*.xyzzy 2> nul | findstr \
|
||||
|
||||
echo;
|
||||
echo Equivalalent source directory paths:
|
||||
:: show the path of the equivalent %VALUE% (search for files that don't exist, supress error, and look for string with "\")
|
||||
dir %BASEDIR%\*.xyzzy 2> nul | findstr \
|
||||
dir %WOLFSSLLIB_TRG_DIR%\*.xyzzy 2> nul | findstr \
|
||||
dir %WOLFSSLEXP_TRG_DIR%\*.xyzzy 2> nul | findstr \
|
||||
|
||||
:: set the FileStamp variable to the current date: YYMMYY_HHMMSS
|
||||
:: the simplest method, to use existing TIME ad DATE variables:
|
||||
:: date = Thu 09/17/2015
|
||||
:: time = 11:13:15.47
|
||||
:: 012345678901234567890
|
||||
::
|
||||
:: There is no leading zero for single digit hours (e.g. 9:00am), so we need to manually include the zero
|
||||
:: here |
|
||||
if "%TIME:~0,1%" == " " set FileStamp=%DATE:~12,2%%DATE:~7,2%%DATE:~4,2%_0%TIME:~1,1%%TIME:~3,2%%TIME:~6,2%
|
||||
|
||||
:: otherwise, if a space not found before the digit, it is a 2 digit hour, so no extract zero is needed
|
||||
if NOT "%TIME:~0,1%" == " " set FileStamp=%DATE:~12,2%%DATE:~7,2%%DATE:~4,2%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
|
||||
|
||||
:: Backup existing user settings
|
||||
if exist %WOLFSSLLIB_TRG_DIR%\include\config.h (
|
||||
echo;
|
||||
echo Saving: %WOLFSSLLIB_TRG_DIR%\include\config.h
|
||||
echo to: %SCRIPTDIR%\config_h_%FileStamp%.bak
|
||||
copy %WOLFSSLLIB_TRG_DIR%\include\config.h %SCRIPTDIR%\config_h_%FileStamp%.bak
|
||||
echo;
|
||||
)
|
||||
|
||||
if exist %WOLFSSL_ESPIDFDIR%\user_settings.h (
|
||||
echo Saving: %WOLFSSLLIB_TRG_DIR%\include\user_settings.h
|
||||
echo to: %SCRIPTDIR%\user_settings_h_%FileStamp%.bak
|
||||
copy %WOLFSSLLIB_TRG_DIR%\include\user_settings.h %SCRIPTDIR%\user_settings_h_%FileStamp%.bak
|
||||
echo;
|
||||
)
|
||||
|
||||
|
||||
::******************************************************************************************************
|
||||
:: check if there's already an existing %WOLFSSLLIB_TRG_DIR% and confirm removal
|
||||
::******************************************************************************************************
|
||||
if exist %WOLFSSLLIB_TRG_DIR% (
|
||||
echo;
|
||||
echo WARNING: Existing files found in %WOLFSSLLIB_TRG_DIR%
|
||||
echo;
|
||||
|
||||
:: clear any prior errorlevel
|
||||
call;
|
||||
choice /c YN /m "Delete files and proceed with install in %WOLFSSLLIB_TRG_DIR% "
|
||||
if errorlevel 2 GOTO :NODELETE
|
||||
GOTO :PURGE
|
||||
|
||||
|
||||
echo;
|
||||
echo Ready to copy files into %IDF_PATH%
|
||||
|
||||
|
||||
::******************************************************************************************************
|
||||
:NODELETE
|
||||
::******************************************************************************************************
|
||||
:: clear any prior errorlevel
|
||||
echo;
|
||||
call;
|
||||
choice /c YN /m "Refresh files %WOLFSSLLIB_TRG_DIR% (there will be a prompt to keep or overwrite user_settings and config) "
|
||||
if errorlevel 2 GOTO :NOCOPY
|
||||
GOTO :REFRESH
|
||||
)
|
||||
|
||||
|
||||
::******************************************************************************************************
|
||||
:PURGE
|
||||
::******************************************************************************************************
|
||||
:: purge existing directory
|
||||
|
||||
if exist %WOLFSSLLIB_TRG_DIR% (
|
||||
echo;
|
||||
echo Removing %WOLFSSLLIB_TRG_DIR%
|
||||
rmdir %WOLFSSLLIB_TRG_DIR% /S /Q
|
||||
if exist %WOLFSSLLIB_TRG_DIR% (
|
||||
SET COPYERROR=true
|
||||
echo;
|
||||
echo WARNING: Failed to remove %WOLFSSLLIB_TRG_DIR%
|
||||
echo;
|
||||
echo Check permissions, open files, read-only attributes, etc.
|
||||
echo;
|
||||
)
|
||||
echo;
|
||||
) else (
|
||||
echo;
|
||||
echo Prior %WOLFSSLLIB_TRG_DIR% not found, installing fresh.
|
||||
echo;
|
||||
)
|
||||
|
||||
::******************************************************************************************************
|
||||
:REFRESH
|
||||
::******************************************************************************************************
|
||||
if not exist %WOLFSSLLIB_TRG_DIR% mkdir %WOLFSSLLIB_TRG_DIR%
|
||||
if not exist %WOLFSSLLIB_TRG_DIR%\src mkdir %WOLFSSLLIB_TRG_DIR%\src
|
||||
if not exist %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src mkdir %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
|
||||
if not exist %WOLFSSLLIB_TRG_DIR%\wolfssl mkdir %WOLFSSLLIB_TRG_DIR%\wolfssl
|
||||
if not exist %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl mkdir %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl
|
||||
if not exist %WOLFSSLLIB_TRG_DIR%\test mkdir %WOLFSSLLIB_TRG_DIR%\test
|
||||
if not exist %WOLFSSLLIB_TRG_DIR%\include mkdir %WOLFSSLLIB_TRG_DIR%\include
|
||||
|
||||
|
||||
rem copying ... files in src/ into $WOLFSSLLIB_TRG_DIR%/src
|
||||
echo;
|
||||
echo Copying files to %WOLFSSLLIB_TRG_DIR%\src\
|
||||
xcopy %BASEDIR%\src\*.c %WOLFSSLLIB_TRG_DIR%\src\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
echo;
|
||||
echo Copying src\*.c files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
|
||||
xcopy %BASEDIR%\wolfcrypt\src\*.c %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
echo;
|
||||
echo Copying src\*.i files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
|
||||
xcopy %BASEDIR%\wolfcrypt\src\*.i %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
echo;
|
||||
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\
|
||||
xcopy %BASEDIR%\wolfcrypt\src\port %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
echo;
|
||||
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\
|
||||
xcopy %BASEDIR%\wolfcrypt\test %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
:: Copy dummy test_paths.h to handle the case configure hasn't yet executed
|
||||
echo;
|
||||
echo Copying dummy_test_paths.h to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h
|
||||
echo new config > %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
echo;
|
||||
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\
|
||||
xcopy %BASEDIR%\wolfcrypt\benchmark %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
echo;
|
||||
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\
|
||||
xcopy %BASEDIR%\wolfssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
echo;
|
||||
echo Copying files to%WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\
|
||||
xcopy %BASEDIR%\wolfssl\openssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
echo;
|
||||
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\
|
||||
xcopy %BASEDIR%\wolfssl\wolfcrypt %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
|
||||
::******************************************************************************************************
|
||||
:: user_settings and config defaults
|
||||
::******************************************************************************************************
|
||||
:: user_settings.h (default, may be overwritten by prior file)
|
||||
echo;
|
||||
echo Copying default user_settings.h to %WOLFSSLLIB_TRG_DIR%\include\
|
||||
xcopy %WOLFSSL_ESPIDFDIR%\user_settings.h %WOLFSSLLIB_TRG_DIR%\include\ /F
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
:: echo Creating new config file: %WOLFSSLLIB_TRG_DIR%\include\config.h (default, may be overwritten by prior file)
|
||||
echo new config > %WOLFSSLLIB_TRG_DIR%\include\config.h
|
||||
xcopy %WOLFSSL_ESPIDFDIR%\dummy_config_h. %WOLFSSLLIB_TRG_DIR%\include\config.h /F /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
|
||||
:: Check if operator wants to keep prior config.h
|
||||
if EXIST config_h_%FileStamp%.bak (
|
||||
echo;
|
||||
:: clear any prior errorlevel
|
||||
call;
|
||||
choice /c YN /m "Use your prior config.h "
|
||||
if errorlevel 2 GOTO :NO_CONFIG_RESTORE
|
||||
xcopy config_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\config.h /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
) else (
|
||||
echo;
|
||||
echo Prior config.h not found. Using default file.
|
||||
)
|
||||
::******************************************************************************************************
|
||||
:NO_CONFIG_RESTORE
|
||||
::******************************************************************************************************
|
||||
|
||||
:: Check if operator wants to keep prior config.h
|
||||
if EXIST user_settings_h_%FileStamp%.bak (
|
||||
echo;
|
||||
:: clear any prior errorlevel
|
||||
call;
|
||||
choice /c YN /m "User your prior user_settings.h "
|
||||
if errorlevel 2 GOTO :NO_USER_SETTINGS_RESTORE
|
||||
xcopy user_settings_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\user_settings.h /Y
|
||||
if %errorlevel% NEQ 0 SET COPYERROR=true
|
||||
|
||||
) else (
|
||||
echo;
|
||||
echo Prior user_settings.h not found. Using default file.
|
||||
)
|
||||
|
||||
::******************************************************************************************************
|
||||
:NO_USER_SETTINGS_RESTORE
|
||||
::******************************************************************************************************
|
||||
|
||||
|
||||
:: unit test app
|
||||
echo;
|
||||
echo Copying unit files to %WOLFSSLLIB_TRG_DIR%\test\
|
||||
xcopy %WOLFSSL_ESPIDFDIR%\test %WOLFSSLLIB_TRG_DIR%\test\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 GOTO :COPYERR
|
||||
|
||||
echo;
|
||||
echo Copying CMakeLists.txt to %WOLFSSLLIB_TRG_DIR%\
|
||||
xcopy %WOLFSSL_ESPIDFDIR%\libs\CMakeLists.txt %WOLFSSLLIB_TRG_DIR%\ /F
|
||||
if %errorlevel% NEQ 0 GOTO :COPYERR
|
||||
|
||||
echo;
|
||||
echo Copying component.mk to %WOLFSSLLIB_TRG_DIR%\
|
||||
xcopy %WOLFSSL_ESPIDFDIR%\libs\component.mk %WOLFSSLLIB_TRG_DIR%\ /F
|
||||
if %errorlevel% NEQ 0 GOTO :COPYERR
|
||||
|
||||
:: Benchmark program
|
||||
echo;
|
||||
echo Removing %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
|
||||
rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /S /Q
|
||||
if %errorlevel% NEQ 0 GOTO :COPYERR
|
||||
|
||||
echo;
|
||||
echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
|
||||
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
|
||||
|
||||
xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\ /F /Y
|
||||
if %errorlevel% NEQ 0 GOTO :COPYERR
|
||||
|
||||
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_benchmark %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /Q /Y
|
||||
if %errorlevel% NEQ 0 GOTO :COPYERR
|
||||
|
||||
:: Crypt Test program
|
||||
echo;
|
||||
echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_test\
|
||||
rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ /S /Q
|
||||
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\
|
||||
|
||||
xcopy %BASEDIR%\wolfcrypt\test\test.c %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 GOTO :COPYERR
|
||||
|
||||
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_test %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 GOTO :COPYERR
|
||||
|
||||
:: TLS Client program
|
||||
echo;
|
||||
echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_client\
|
||||
rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\ /S /Q
|
||||
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\main\
|
||||
|
||||
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_client %WOLFSSLEXP_TRG_DIR%\wolfssl_client\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 GOTO :COPYERR
|
||||
|
||||
:: TLS Server program
|
||||
echo;
|
||||
echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_server\
|
||||
rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\ /S /Q
|
||||
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\main\
|
||||
|
||||
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_server %WOLFSSLEXP_TRG_DIR%\wolfssl_server\ /S /E /Q /Y
|
||||
if %errorlevel% NEQ 0 GOTO :COPYERR
|
||||
|
||||
goto :DONE
|
||||
|
||||
:: error during copy encountered
|
||||
::******************************************************************************************************
|
||||
:COPYERR
|
||||
::******************************************************************************************************
|
||||
echo;
|
||||
echo Error during copy.
|
||||
echo
|
||||
echo Please ensure none of the target files are flagged as read-only, open, etc.
|
||||
goto :ERR
|
||||
|
||||
:: abort at user request
|
||||
::******************************************************************************************************
|
||||
:NOCOPY
|
||||
::******************************************************************************************************
|
||||
echo;
|
||||
echo Setup did not copy any files.
|
||||
goto :ERR
|
||||
|
||||
:: ERROR
|
||||
::******************************************************************************************************
|
||||
:ERR
|
||||
::******************************************************************************************************
|
||||
exit /B 1
|
||||
|
||||
:: Success
|
||||
::******************************************************************************************************
|
||||
:DONE
|
||||
::******************************************************************************************************
|
||||
echo;
|
||||
echo;
|
||||
echo Edit config file in "%WOLFSSLLIB_TRG_DIR%\include\user_settings.h" before trying to compile.
|
||||
echo;
|
||||
echo See Component files for wolfSSL in %WOLFSSLLIB_TRG_DIR%
|
||||
echo;
|
||||
echo See additional examples at https://github.com/wolfSSL/wolfssl-examples
|
||||
echo;
|
||||
echo REMINDER: Ensure any wolfSSL #include definitions occur BEFORE include files in your source code.
|
||||
echo;
|
||||
if "%COPYERROR%" == "true" (
|
||||
echo;
|
||||
echo WARNING: Copy completed with errors! Check for files in use, permissions, symbolic links, etc.
|
||||
echo;
|
||||
)
|
||||
echo setup_win.bat for ESP-IDF completed.
|
||||
8
android/extern/wolfssl/IDE/Espressif/ESP-IDF/test/CMakeLists.txt
vendored
Normal file
8
android/extern/wolfssl/IDE/Espressif/ESP-IDF/test/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_MAIN_DRIVER -DWOLFSSL_USER_SETTINGS")
|
||||
|
||||
set(COMPONENT_SRCS "test_wolfssl.c" "../wolfcrypt/test/test.c")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
set(COMPONENT_REQUIRES unity test_utils wolfssl)
|
||||
|
||||
register_component()
|
||||
10
android/extern/wolfssl/IDE/Espressif/ESP-IDF/test/README.md
vendored
Normal file
10
android/extern/wolfssl/IDE/Espressif/ESP-IDF/test/README.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
# wolfSSL unit-test app
|
||||
|
||||
The test contains of wolfSSL unit-test app on Unity.
|
||||
|
||||
When you want to run the app
|
||||
1. Go to /esp-idf/tools/unit-test-app/ folder
|
||||
2. `idf.py menuconfig` to configure unit test app.
|
||||
3. `idf.py -T wolfssl build` to build wolfssl unit test app.
|
||||
|
||||
See [https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/unit-tests.html] for more information about unit test app.
|
||||
10
android/extern/wolfssl/IDE/Espressif/ESP-IDF/test/component.mk
vendored
Normal file
10
android/extern/wolfssl/IDE/Espressif/ESP-IDF/test/component.mk
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#
|
||||
#Component Makefile
|
||||
#
|
||||
|
||||
#CFLAGS := -v
|
||||
CFLAGS += -DNO_MAIN_DRIVER
|
||||
CFLAGS += -DWOLFSSL_USER_SETTINGS
|
||||
#CFLAGS += -DWOLFSSL_ESP32WROOM32_CRYPT_DEBUG
|
||||
|
||||
COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive
|
||||
1140
android/extern/wolfssl/IDE/Espressif/ESP-IDF/test/test_wolfssl.c
vendored
Normal file
1140
android/extern/wolfssl/IDE/Espressif/ESP-IDF/test/test_wolfssl.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
117
android/extern/wolfssl/IDE/Espressif/ESP-IDF/user_settings.h
vendored
Normal file
117
android/extern/wolfssl/IDE/Espressif/ESP-IDF/user_settings.h
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
/* user_settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2022 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
|
||||
*/
|
||||
#undef WOLFSSL_ESPIDF
|
||||
#undef WOLFSSL_ESPWROOM32
|
||||
#undef WOLFSSL_ESPWROOM32SE
|
||||
#undef WOLFSSL_ESPWROOM32
|
||||
#undef WOLFSSL_ESP8266
|
||||
|
||||
#define WOLFSSL_ESPIDF
|
||||
|
||||
/*
|
||||
* choose ONE of these Espressif chips to define:
|
||||
*
|
||||
* WOLFSSL_ESPWROOM32
|
||||
* WOLFSSL_ESPWROOM32SE
|
||||
* WOLFSSL_ESP8266
|
||||
*/
|
||||
|
||||
#define WOLFSSL_ESPWROOM32
|
||||
|
||||
/* #define DEBUG_WOLFSSL_VERBOSE */
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
|
||||
/* TLS 1.3 */
|
||||
#define WOLFSSL_TLS13
|
||||
#define HAVE_TLS_EXTENSIONS
|
||||
#define WC_RSA_PSS
|
||||
#define HAVE_HKDF
|
||||
#define HAVE_AEAD
|
||||
#define HAVE_SUPPORTED_CURVES
|
||||
|
||||
/* when you want to use SINGLE THREAD */
|
||||
/* #define SINGLE_THREADED */
|
||||
#define NO_FILESYSTEM
|
||||
|
||||
#define HAVE_AESGCM
|
||||
/* when you want to use SHA384 */
|
||||
/* #define WOLFSSL_SHA384 */
|
||||
#define WOLFSSL_SHA512
|
||||
#define HAVE_ECC
|
||||
#define HAVE_CURVE25519
|
||||
#define CURVE25519_SMALL
|
||||
#define HAVE_ED25519
|
||||
|
||||
/* when you want to use pkcs7 */
|
||||
/* #define HAVE_PKCS7 */
|
||||
|
||||
#if defined(HAVE_PKCS7)
|
||||
#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
|
||||
|
||||
/* rsa primitive specific definition */
|
||||
#if defined(WOLFSSL_ESPWROOM32) || defined(WOLFSSL_ESPWROOM32SE)
|
||||
/* Define USE_FAST_MATH and SMALL_STACK */
|
||||
#define ESP32_USE_RSA_PRIMITIVE
|
||||
/* threshold for performance adjustment for hw primitive use */
|
||||
/* X bits of G^X mod P greater than */
|
||||
#define EPS_RSA_EXPT_XBTIS 36
|
||||
/* X and Y of X * Y mod P greater than */
|
||||
#define ESP_RSA_MULM_BITS 2000
|
||||
#endif
|
||||
|
||||
/* debug options */
|
||||
/* #define DEBUG_WOLFSSL */
|
||||
/* #define WOLFSSL_ESP32WROOM32_CRYPT_DEBUG */
|
||||
/* #define WOLFSSL_ATECC508A_DEBUG */
|
||||
|
||||
/* date/time */
|
||||
/* if it cannot adjust time in the device, */
|
||||
/* enable macro below */
|
||||
/* #define NO_ASN_TIME */
|
||||
/* #define XTIME time */
|
||||
|
||||
/* when you want not to use HW acceleration */
|
||||
/* #define NO_ESP32WROOM32_CRYPT */
|
||||
/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH*/
|
||||
/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_AES */
|
||||
/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_RSA_PRI */
|
||||
|
||||
/* adjust wait-timeout count if you see timeout in rsa hw acceleration */
|
||||
#define ESP_RSA_TIMEOUT_CNT 0x249F00
|
||||
Reference in New Issue
Block a user