-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Espressif wolfssh server and template examples
- Loading branch information
Showing
29 changed files
with
5,101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# wolfSSL Espressif Managed Component examples | ||
|
||
|
||
wolfssh [server](./wolfssh_server/README.md) | ||
|
||
wolfssl [template](./wolfssh_template/README.md) |
68 changes: 68 additions & 0 deletions
68
ide/Espressif/ESP-IDF/examples/wolfssh_server/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# 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) | ||
|
||
# enable wolfssl user_settings.h project-wide | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") | ||
|
||
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSH_TERM") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDEBUG_WOLFSSH") | ||
|
||
# set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source") | ||
|
||
# Optional WOLFSSL_CMAKE_SYSTEM_NAME detection to find | ||
# USE_MY_PRIVATE_CONFIG path for my_private_config.h | ||
# | ||
if(WIN32) | ||
# Windows-specific configuration here | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") | ||
message("Detected Windows") | ||
endif() | ||
if(CMAKE_HOST_UNIX) | ||
message("Detected UNIX") | ||
endif() | ||
if(APPLE) | ||
message("Detected APPLE") | ||
endif() | ||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop") | ||
# Windows-specific configuration here | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL") | ||
message("Detected WSL") | ||
endif() | ||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32)) | ||
# Windows-specific configuration here | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX") | ||
message("Detected Linux") | ||
endif() | ||
if(APPLE) | ||
# Windows-specific configuration here | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE") | ||
message("Detected Apple") | ||
endif() | ||
# End optional WOLFSSL_CMAKE_SYSTEM_NAME | ||
|
||
# Check that there are not conflicting wolfSSL components | ||
# The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl | ||
# The local component wolfSSL directory will be in ./components/wolfssl | ||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" ) | ||
# These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake' | ||
# add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL) | ||
# add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl/include" EXCLUDE_FROM_ALL) | ||
# So we'll error out and let the user decide how to proceed: | ||
message(WARNING "\nFound wolfSSL components in\n" | ||
"./managed_components/wolfssl__wolfssl\n" | ||
"and\n" | ||
"./components/wolfssl\n" | ||
"in project directory: \n" | ||
"${CMAKE_HOME_DIRECTORY}") | ||
message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n" | ||
"If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove " | ||
"or rename the idf_component.yml file typically found in ./main/") | ||
else() | ||
message(STATUS "No conflicting wolfSSL components found.") | ||
endif() | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
|
||
project(wolfssh_server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# wolfSSL Server Project | ||
|
||
This is an example wolfSSH Server based on the minimally viable wolfSSL [template](../wolfssh_template/README.md) | ||
|
||
See the [command line example client](https://github.com/wolfSSL/wolfssh/tree/master/examples/client) | ||
and the instructions in [wolfssh README.md](https://github.com/wolfSSL/wolfssh#readme) | ||
|
||
To connect: | ||
|
||
```bash | ||
TODO | ||
|
||
ssh -p 22222 [email protected] | ||
``` | ||
|
||
### Prerequisites | ||
|
||
It is assumed the [ESP-IDF environment](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/) has been installed. | ||
|
||
### Files Included | ||
|
||
- [main.c](./main/main.c) with a simple call to an Espressif library (`ESP_LOGI`) and a call to a wolfSSL library (`esp_ShowExtendedSystemInfo`) . | ||
|
||
- See [components/wolfssl/include](./components/wolfssl/include/user_settings.h) directory to edit the wolfSSL `user_settings.h`. | ||
|
||
- Edit [main/CMakeLists.txt](./main/CMakeLists.txt) to add/remove source files. | ||
|
||
- The [components/wolfssl/CMakeLists.txt](./components/wolfssl/CMakeLists.txt) typically does not need to be changed. | ||
|
||
- Optional [VisualGDB Project](./VisualGDB/wolfssl_template_IDF_v5.1_ESP32.vgdbproj) for Visual Studio using ESP32 and ESP-IDF v5.1. | ||
|
||
- Edit the project [CMakeLists.txt](./CMakeLists.txt) to optionally point this project's wolfSSL component source code at a different directory: | ||
|
||
``` | ||
set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source") | ||
``` | ||
|
||
|
||
## Getting Started: | ||
|
||
Here's an example using the command-line [idf.py](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-py.html). | ||
|
||
Edit your `WRK_IDF_PATH`to point to your ESP-IDF install directory. | ||
|
||
``` | ||
WRK_IDF_PATH=/mnt/c/SysGCC/esp32/esp-idf/v5.1 | ||
echo "Run export.sh from ${WRK_IDF_PATH}" | ||
. ${WRK_IDF_PATH}/export.sh | ||
# build the example: | ||
idf.py build | ||
# flash the code onto the serial device at /dev/ttyS19 | ||
idf.py flash -p /dev/ttyS19 -b 115200 | ||
# build, flash, and view UART output with one command: | ||
idf.py flash -p /dev/ttyS19 -b 115200 monitor | ||
``` | ||
|
||
Press `Ctrl+]` to exit `idf.py monitor`. See [additional monitor keyboard commands](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-monitor.html). | ||
|
||
## Other Examples: | ||
|
||
For examples, see: | ||
|
||
- [TLS Client](../wolfssl_client/README.md) | ||
- [TLS Server](../wolfssl_server/README.md) | ||
- [Benchmark](../wolfssl_benchmark/README.md) | ||
- [Test](../wolfssl_test/README.md) | ||
- [wolfssl-examples](https://github.com/wolfSSL/wolfssl-examples/tree/master/ESP32) | ||
- [wolfssh-examples](https://github.com/wolfSSL/wolfssh-examples/tree/main/Espressif) | ||
|
||
|
||
|
36 changes: 36 additions & 0 deletions
36
ide/Espressif/ESP-IDF/examples/wolfssh_server/VisualGDB/wolfssh_server_IDF_v5.1_ESP32.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.7.34031.279 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "wolfssh_server_IDF_v5.1_ESP32", "wolfssh_server_IDF_v5.1_ESP32.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{510C1DEE-DFFB-4C38-864E-DCE7A172ABB7}" | ||
ProjectSection(SolutionItems) = preProject | ||
..\README.md = ..\README.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 = {C3DD3774-E396-475C-B78D-604D7CD9B732} | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.