mirror of https://github.com/wolfSSL/wolfssh.git
Update Espressif examples for Managed Component publish
parent
702e0ee890
commit
45a857b960
|
@ -1,4 +1,4 @@
|
||||||
# wolfSSL Server Project
|
# wolfSSH Server Project
|
||||||
|
|
||||||
This is an example wolfSSH Server based on the minimally viable wolfSSL [template](../wolfssh_template/README.md)
|
This is an example wolfSSH Server based on the minimally viable wolfSSL [template](../wolfssh_template/README.md)
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@ and the instructions in [wolfssh README.md](https://github.com/wolfSSL/wolfssh#r
|
||||||
To connect:
|
To connect:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
TODO
|
|
||||||
|
|
||||||
ssh -p 22222 jack@192.168.1.32
|
ssh -p 22222 jack@192.168.1.32
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#
|
#
|
||||||
# cmake for wolfssl Espressif projects
|
# cmake for wolfssl Espressif projects
|
||||||
#
|
#
|
||||||
# Version 5.6.4.016 for improved manual setting of WOLFSSL_ROOT + ESP8266 support; optional esp-timer / driver components
|
# Version 5.7.0 template update + THIS_IDF_PATH
|
||||||
#
|
#
|
||||||
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html
|
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html
|
||||||
#
|
#
|
||||||
|
@ -34,11 +34,18 @@ set(CMAKE_CURRENT_SOURCE_DIR ".")
|
||||||
# set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component
|
# set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component
|
||||||
|
|
||||||
# Optionally set your source to wolfSSL in your project CMakeLists.txt like this:
|
# Optionally set your source to wolfSSL in your project CMakeLists.txt like this:
|
||||||
# set(WOLFSSL_ROOT "c:/test/blogtest/wolfssl" )
|
# set(WOLFSSL_ROOT "c:/test/my_wolfssl" )
|
||||||
|
|
||||||
if ( "${WOLFSSL_ROOT}" STREQUAL "")
|
if ( "${WOLFSSL_ROOT}" STREQUAL "")
|
||||||
set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" )
|
set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if( "$ENV{IDF_PATH}" STREQUAL "" )
|
||||||
|
message(FATAL_ERROR "IDF_PATH Environment variable not set!")
|
||||||
|
else()
|
||||||
|
string(REPLACE "\\" "/" THIS_IDF_PATH "$ENV{IDF_PATH}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Optional compiler definitions to help with system name detection (typically printed by app diagnostics)
|
# Optional compiler definitions to help with system name detection (typically printed by app diagnostics)
|
||||||
if(VERBOSE_COMPONENT_MESSAGES)
|
if(VERBOSE_COMPONENT_MESSAGES)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@ -194,16 +201,47 @@ function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Maintain CURRENT_SEARCH_DIR, but check various suffixes with CURRENT_SEARCH_DIR_ALT
|
||||||
if( THIS_USER )
|
if( THIS_USER )
|
||||||
# Check for "wolfssl-[username]" subdirectory as we recurse up the directory tree
|
# Check for "wolfssl-[username]" subdirectory as we recurse up the directory tree
|
||||||
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-${THIS_USER})
|
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-${THIS_USER})
|
||||||
message(STATUS "Looking in ${CURRENT_SEARCH_DIR}")
|
message(STATUS "Looking in ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
|
||||||
#if(EXISTS ${CURRENT_SEARCH_DIR_ALT} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR_ALT} AND EXISTS "${CURRENT_SEARCH_DIR_ALT}/wolfcrypt/src")
|
|
||||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||||
if ( FOUND_WOLFSSL )
|
if ( FOUND_WOLFSSL )
|
||||||
message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR_ALT} PARENT_SCOPE)
|
set(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if ( FOUND_WOLFSSL )
|
||||||
|
# if we already found the source, skip attempt of "wolfssl-master"
|
||||||
|
else()
|
||||||
|
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-master)
|
||||||
|
message(STATUS "Looking in ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
|
||||||
|
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||||
|
if ( FOUND_WOLFSSL )
|
||||||
|
message(STATUS "Found wolfssl in master-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
set(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if ( FOUND_WOLFSSL )
|
||||||
|
# if we already found the source, skip attempt of "wolfssl"
|
||||||
|
else()
|
||||||
|
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl)
|
||||||
|
message(STATUS "Looking in ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
|
||||||
|
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||||
|
if ( FOUND_WOLFSSL )
|
||||||
|
message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
set(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -223,7 +261,8 @@ function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY)
|
||||||
get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
|
get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
|
||||||
message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||||
if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
|
if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
|
||||||
# when the search directory is empty, we'll give up
|
# When the parent is current directory, cannot go any further. We didn't find wolfssl.
|
||||||
|
# When the search directory is empty, we'll give up.
|
||||||
set(CURRENT_SEARCH_DIR "")
|
set(CURRENT_SEARCH_DIR "")
|
||||||
endif()
|
endif()
|
||||||
endwhile()
|
endwhile()
|
||||||
|
@ -239,13 +278,42 @@ endfunction()
|
||||||
# FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
|
# FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
|
||||||
#
|
#
|
||||||
|
|
||||||
|
message(STATUS "CONFIG_TARGET_PLATFORM = ${CONFIG_TARGET_PLATFORM}")
|
||||||
|
|
||||||
|
if (0)
|
||||||
|
get_cmake_property(_variableNames VARIABLES)
|
||||||
|
list (SORT _variableNames)
|
||||||
|
message(STATUS "")
|
||||||
|
message(STATUS "ALL VARIABLES BEGIN")
|
||||||
|
message(STATUS "")
|
||||||
|
foreach (_variableName ${_variableNames})
|
||||||
|
message(STATUS "${_variableName}=${${_variableName}}")
|
||||||
|
endforeach()
|
||||||
|
message(STATUS "")
|
||||||
|
message(STATUS "ALL VARIABLES END")
|
||||||
|
message(STATUS "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if ( ("${CONFIG_TARGET_PLATFORM}" STREQUAL "esp8266") OR ("${IDF_TARGET}" STREQUAL "esp8266") )
|
||||||
|
# There's no esp_timer, no driver components for the ESP8266
|
||||||
|
message(STATUS "Early expansion EXCLUDES esp_timer: ${THIS_INCLUDE_TIMER}")
|
||||||
|
message(STATUS "Early expansion EXCLUDES driver: ${THIS_INCLUDE_DRIVER}")
|
||||||
|
set(THIS_INCLUDE_TIMER "")
|
||||||
|
set(THIS_INCLUDE_DRIVER "")
|
||||||
|
else()
|
||||||
|
message(STATUS "Early expansion includes esp_timer: ${THIS_INCLUDE_TIMER}")
|
||||||
|
message(STATUS "Early expansion includes driver: ${THIS_INCLUDE_DRIVER}")
|
||||||
|
set(THIS_INCLUDE_TIMER "esp_timer")
|
||||||
|
set(THIS_INCLUDE_DRIVER "driver")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_BUILD_EARLY_EXPANSION)
|
if(CMAKE_BUILD_EARLY_EXPANSION)
|
||||||
message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:")
|
message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:")
|
||||||
idf_component_register(
|
idf_component_register(
|
||||||
REQUIRES "${COMPONENT_REQUIRES}"
|
REQUIRES "${COMPONENT_REQUIRES}"
|
||||||
PRIV_REQUIRES # esp_hw_support
|
PRIV_REQUIRES # esp_hw_support
|
||||||
"${THIS_INCLUDE_TIMER}"
|
${THIS_INCLUDE_TIMER}
|
||||||
"${THIS_INCLUDE_DRIVER}" # this will typically only be needed for wolfSSL benchmark
|
${THIS_INCLUDE_DRIVER} # this will typically only be needed for wolfSSL benchmark
|
||||||
)
|
)
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
@ -254,18 +322,8 @@ else()
|
||||||
message(STATUS "wolfssl component config:")
|
message(STATUS "wolfssl component config:")
|
||||||
message(STATUS "************************************************************************************************")
|
message(STATUS "************************************************************************************************")
|
||||||
|
|
||||||
if ( "${CONFIG_TARGET_PLATFORM}" STREQUAL "esp8266")
|
|
||||||
# There's no esp_timer, no driver components for the ESP8266
|
|
||||||
set(THIS_INCLUDE_TIMER "")
|
|
||||||
set(THIS_INCLUDE_DRIVER "")
|
|
||||||
else()
|
|
||||||
set(THIS_INCLUDE_TIMER "esp_timer")
|
|
||||||
set(THIS_INCLUDE_DRIVER "driver")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# search for wolfSSL
|
# search for wolfSSL
|
||||||
# TODO allow for cmake prior def
|
FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
|
||||||
|
|
||||||
if(WOLFSSL_ROOT)
|
if(WOLFSSL_ROOT)
|
||||||
IS_WOLFSSL_SOURCE("${WOLFSSL_ROOT}" FOUND_WOLFSSL)
|
IS_WOLFSSL_SOURCE("${WOLFSSL_ROOT}" FOUND_WOLFSSL)
|
||||||
if(FOUND_WOLFSSL)
|
if(FOUND_WOLFSSL)
|
||||||
|
@ -287,8 +345,8 @@ else()
|
||||||
else()
|
else()
|
||||||
message(STATUS "Failed: wolfssl directory not found.")
|
message(STATUS "Failed: wolfssl directory not found.")
|
||||||
# Abort. We need wolfssl _somewhere_.
|
# Abort. We need wolfssl _somewhere_.
|
||||||
message(FATAL_ERROR "Could not find wolfssl in ${WOLFSSL_ROOT}.\n"
|
message(FATAL_ERROR "Could not find wolfssl in any parent directory named wolfssl-${THIS_USER}, wolfssl-master, or wolfssl.\n"
|
||||||
"Try setting WOLFSSL_ROOT environment variable or git clone.")
|
"Try setting WOLFSSL_ROOT environment variable, cmake variable in project, copy source, or use managed components.")
|
||||||
# Abort CMake after fatal error.
|
# Abort CMake after fatal error.
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -326,6 +384,7 @@ else()
|
||||||
|
|
||||||
# wolfSSL user_settings.h is in the local project.
|
# wolfSSL user_settings.h is in the local project.
|
||||||
set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl")
|
set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl")
|
||||||
|
# add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||||
|
|
||||||
string(REPLACE "/" "//" STR_WOLFSSL_PROJECT_DIR "${WOLFSSL_PROJECT_DIR}")
|
string(REPLACE "/" "//" STR_WOLFSSL_PROJECT_DIR "${WOLFSSL_PROJECT_DIR}")
|
||||||
add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}//include//user_settings.h")
|
add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}//include//user_settings.h")
|
||||||
|
@ -484,10 +543,10 @@ else()
|
||||||
message(STATUS "Could not find RTOS path")
|
message(STATUS "Could not find RTOS path")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
message(STATUS "THIS_IDF_PATH = $THIS_IDF_PATH")
|
||||||
# wolfSSL-specific include directories
|
# wolfSSL-specific include directories
|
||||||
set(COMPONENT_ADD_INCLUDEDIRS
|
set(COMPONENT_ADD_INCLUDEDIRS
|
||||||
"./include" # this is the location of local project wolfssl user_settings.h
|
"./include" # this is the location of wolfssl user_settings.h
|
||||||
"\"${WOLFSSL_ROOT}/\""
|
"\"${WOLFSSL_ROOT}/\""
|
||||||
"\"${WOLFSSL_ROOT}/wolfssl/\""
|
"\"${WOLFSSL_ROOT}/wolfssl/\""
|
||||||
"\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\""
|
"\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\""
|
||||||
|
@ -514,9 +573,14 @@ else()
|
||||||
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
|
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
|
||||||
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
|
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
|
||||||
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
|
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
|
||||||
|
"\"${WOLFSSL_ROOT}/src/ssl_load.c\"" # included by ssl.c
|
||||||
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
|
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
|
||||||
|
"\"${WOLFSSL_ROOT}/src/ssl_p7p12.c\"" # included by ssl.c
|
||||||
|
"\"${WOLFSSL_ROOT}/src/ssl_sess.c\"" # included by ssl.c
|
||||||
"\"${WOLFSSL_ROOT}/src/x509.c\""
|
"\"${WOLFSSL_ROOT}/src/x509.c\""
|
||||||
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
|
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
|
||||||
|
"\"${WOLFSSL_ROOT}/wolfcrypt/src/ext_kyber.c\"" # external Kyber disabled by default
|
||||||
|
"\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/ext_kyber.h\"" # external Kyber disabled by default
|
||||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
|
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
|
||||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c\""
|
"\"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c\""
|
||||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm32.c\""
|
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm32.c\""
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
#ifndef WOLFSSH_THREAD
|
#ifndef WOLFSSH_THREAD
|
||||||
#define WOLFSSH_THREAD
|
#define WOLFSSH_THREAD WOLFSSL_THREAD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
THREAD_RETURN WOLFSSH_THREAD echoserver_test(void* args);
|
THREAD_RETURN WOLFSSH_THREAD echoserver_test(void* args);
|
||||||
|
|
|
@ -34,16 +34,18 @@
|
||||||
#warning "Check components/wolfssl/include"
|
#warning "Check components/wolfssl/include"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* wolfSSH */
|
||||||
|
#include <wolfssh/test.h>
|
||||||
|
|
||||||
/* this project */
|
/* this project */
|
||||||
#include "wifi_connect.h"
|
#include "wifi_connect.h"
|
||||||
#include "time_helper.h"
|
#include "time_helper.h"
|
||||||
|
|
||||||
static const char* const TAG = "My Project";
|
static const char* const TAG = "My Project";
|
||||||
|
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
void* args = {0};
|
func_args args = {0};
|
||||||
int ret = ESP_OK;
|
int ret = ESP_OK;
|
||||||
|
|
||||||
ESP_LOGI(TAG, "------------ wolfSSL wolfSSH template Example ----------");
|
ESP_LOGI(TAG, "------------ wolfSSL wolfSSH template Example ----------");
|
||||||
|
@ -157,6 +159,7 @@ void app_main(void)
|
||||||
/* TODO: Consider pulling in wolfSSH server.c example source automatically:
|
/* TODO: Consider pulling in wolfSSH server.c example source automatically:
|
||||||
* Keep in mind the nature of this example as an Espressif Component.
|
* Keep in mind the nature of this example as an Espressif Component.
|
||||||
* See https://github.com/wolfSSL/wolfssh/tree/master/examples/server */
|
* See https://github.com/wolfSSL/wolfssh/tree/master/examples/server */
|
||||||
|
memset(&args, 0, sizeof(func_args));
|
||||||
echoserver_test(&args);
|
echoserver_test(&args);
|
||||||
|
|
||||||
ESP_LOGI(TAG, "\n\nDone!"
|
ESP_LOGI(TAG, "\n\nDone!"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#
|
#
|
||||||
# cmake for wolfssl Espressif projects
|
# cmake for wolfssl Espressif projects
|
||||||
#
|
#
|
||||||
# Version 5.6.4.016 for improved manual setting of WOLFSSL_ROOT + ESP8266 support; optional esp-timer / driver components
|
# Version 5.7.0 template update + THIS_IDF_PATH
|
||||||
#
|
#
|
||||||
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html
|
# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html
|
||||||
#
|
#
|
||||||
|
@ -34,11 +34,18 @@ set(CMAKE_CURRENT_SOURCE_DIR ".")
|
||||||
# set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component
|
# set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component
|
||||||
|
|
||||||
# Optionally set your source to wolfSSL in your project CMakeLists.txt like this:
|
# Optionally set your source to wolfSSL in your project CMakeLists.txt like this:
|
||||||
# set(WOLFSSL_ROOT "c:/test/blogtest/wolfssl" )
|
# set(WOLFSSL_ROOT "c:/test/my_wolfssl" )
|
||||||
|
|
||||||
if ( "${WOLFSSL_ROOT}" STREQUAL "")
|
if ( "${WOLFSSL_ROOT}" STREQUAL "")
|
||||||
set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" )
|
set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if( "$ENV{IDF_PATH}" STREQUAL "" )
|
||||||
|
message(FATAL_ERROR "IDF_PATH Environment variable not set!")
|
||||||
|
else()
|
||||||
|
string(REPLACE "\\" "/" THIS_IDF_PATH "$ENV{IDF_PATH}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Optional compiler definitions to help with system name detection (typically printed by app diagnostics)
|
# Optional compiler definitions to help with system name detection (typically printed by app diagnostics)
|
||||||
if(VERBOSE_COMPONENT_MESSAGES)
|
if(VERBOSE_COMPONENT_MESSAGES)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@ -194,16 +201,47 @@ function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Maintain CURRENT_SEARCH_DIR, but check various suffixes with CURRENT_SEARCH_DIR_ALT
|
||||||
if( THIS_USER )
|
if( THIS_USER )
|
||||||
# Check for "wolfssl-[username]" subdirectory as we recurse up the directory tree
|
# Check for "wolfssl-[username]" subdirectory as we recurse up the directory tree
|
||||||
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-${THIS_USER})
|
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-${THIS_USER})
|
||||||
message(STATUS "Looking in ${CURRENT_SEARCH_DIR}")
|
message(STATUS "Looking in ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
|
||||||
#if(EXISTS ${CURRENT_SEARCH_DIR_ALT} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR_ALT} AND EXISTS "${CURRENT_SEARCH_DIR_ALT}/wolfcrypt/src")
|
|
||||||
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||||
if ( FOUND_WOLFSSL )
|
if ( FOUND_WOLFSSL )
|
||||||
message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR_ALT} PARENT_SCOPE)
|
set(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if ( FOUND_WOLFSSL )
|
||||||
|
# if we already found the source, skip attempt of "wolfssl-master"
|
||||||
|
else()
|
||||||
|
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-master)
|
||||||
|
message(STATUS "Looking in ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
|
||||||
|
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||||
|
if ( FOUND_WOLFSSL )
|
||||||
|
message(STATUS "Found wolfssl in master-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
set(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if ( FOUND_WOLFSSL )
|
||||||
|
# if we already found the source, skip attempt of "wolfssl"
|
||||||
|
else()
|
||||||
|
set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl)
|
||||||
|
message(STATUS "Looking in ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
|
||||||
|
IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
|
||||||
|
if ( FOUND_WOLFSSL )
|
||||||
|
message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
set(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR_ALT}")
|
||||||
|
set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -223,7 +261,8 @@ function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY)
|
||||||
get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
|
get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
|
||||||
message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
|
||||||
if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
|
if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
|
||||||
# when the search directory is empty, we'll give up
|
# When the parent is current directory, cannot go any further. We didn't find wolfssl.
|
||||||
|
# When the search directory is empty, we'll give up.
|
||||||
set(CURRENT_SEARCH_DIR "")
|
set(CURRENT_SEARCH_DIR "")
|
||||||
endif()
|
endif()
|
||||||
endwhile()
|
endwhile()
|
||||||
|
@ -239,13 +278,42 @@ endfunction()
|
||||||
# FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
|
# FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
|
||||||
#
|
#
|
||||||
|
|
||||||
|
message(STATUS "CONFIG_TARGET_PLATFORM = ${CONFIG_TARGET_PLATFORM}")
|
||||||
|
|
||||||
|
if (0)
|
||||||
|
get_cmake_property(_variableNames VARIABLES)
|
||||||
|
list (SORT _variableNames)
|
||||||
|
message(STATUS "")
|
||||||
|
message(STATUS "ALL VARIABLES BEGIN")
|
||||||
|
message(STATUS "")
|
||||||
|
foreach (_variableName ${_variableNames})
|
||||||
|
message(STATUS "${_variableName}=${${_variableName}}")
|
||||||
|
endforeach()
|
||||||
|
message(STATUS "")
|
||||||
|
message(STATUS "ALL VARIABLES END")
|
||||||
|
message(STATUS "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if ( ("${CONFIG_TARGET_PLATFORM}" STREQUAL "esp8266") OR ("${IDF_TARGET}" STREQUAL "esp8266") )
|
||||||
|
# There's no esp_timer, no driver components for the ESP8266
|
||||||
|
message(STATUS "Early expansion EXCLUDES esp_timer: ${THIS_INCLUDE_TIMER}")
|
||||||
|
message(STATUS "Early expansion EXCLUDES driver: ${THIS_INCLUDE_DRIVER}")
|
||||||
|
set(THIS_INCLUDE_TIMER "")
|
||||||
|
set(THIS_INCLUDE_DRIVER "")
|
||||||
|
else()
|
||||||
|
message(STATUS "Early expansion includes esp_timer: ${THIS_INCLUDE_TIMER}")
|
||||||
|
message(STATUS "Early expansion includes driver: ${THIS_INCLUDE_DRIVER}")
|
||||||
|
set(THIS_INCLUDE_TIMER "esp_timer")
|
||||||
|
set(THIS_INCLUDE_DRIVER "driver")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_BUILD_EARLY_EXPANSION)
|
if(CMAKE_BUILD_EARLY_EXPANSION)
|
||||||
message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:")
|
message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:")
|
||||||
idf_component_register(
|
idf_component_register(
|
||||||
REQUIRES "${COMPONENT_REQUIRES}"
|
REQUIRES "${COMPONENT_REQUIRES}"
|
||||||
PRIV_REQUIRES # esp_hw_support
|
PRIV_REQUIRES # esp_hw_support
|
||||||
"${THIS_INCLUDE_TIMER}"
|
${THIS_INCLUDE_TIMER}
|
||||||
"${THIS_INCLUDE_DRIVER}" # this will typically only be needed for wolfSSL benchmark
|
${THIS_INCLUDE_DRIVER} # this will typically only be needed for wolfSSL benchmark
|
||||||
)
|
)
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
@ -254,18 +322,8 @@ else()
|
||||||
message(STATUS "wolfssl component config:")
|
message(STATUS "wolfssl component config:")
|
||||||
message(STATUS "************************************************************************************************")
|
message(STATUS "************************************************************************************************")
|
||||||
|
|
||||||
if ( "${CONFIG_TARGET_PLATFORM}" STREQUAL "esp8266")
|
|
||||||
# There's no esp_timer, no driver components for the ESP8266
|
|
||||||
set(THIS_INCLUDE_TIMER "")
|
|
||||||
set(THIS_INCLUDE_DRIVER "")
|
|
||||||
else()
|
|
||||||
set(THIS_INCLUDE_TIMER "esp_timer")
|
|
||||||
set(THIS_INCLUDE_DRIVER "driver")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# search for wolfSSL
|
# search for wolfSSL
|
||||||
# TODO allow for cmake prior def
|
FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
|
||||||
|
|
||||||
if(WOLFSSL_ROOT)
|
if(WOLFSSL_ROOT)
|
||||||
IS_WOLFSSL_SOURCE("${WOLFSSL_ROOT}" FOUND_WOLFSSL)
|
IS_WOLFSSL_SOURCE("${WOLFSSL_ROOT}" FOUND_WOLFSSL)
|
||||||
if(FOUND_WOLFSSL)
|
if(FOUND_WOLFSSL)
|
||||||
|
@ -287,8 +345,8 @@ else()
|
||||||
else()
|
else()
|
||||||
message(STATUS "Failed: wolfssl directory not found.")
|
message(STATUS "Failed: wolfssl directory not found.")
|
||||||
# Abort. We need wolfssl _somewhere_.
|
# Abort. We need wolfssl _somewhere_.
|
||||||
message(FATAL_ERROR "Could not find wolfssl in ${WOLFSSL_ROOT}.\n"
|
message(FATAL_ERROR "Could not find wolfssl in any parent directory named wolfssl-${THIS_USER}, wolfssl-master, or wolfssl.\n"
|
||||||
"Try setting WOLFSSL_ROOT environment variable or git clone.")
|
"Try setting WOLFSSL_ROOT environment variable, cmake variable in project, copy source, or use managed components.")
|
||||||
# Abort CMake after fatal error.
|
# Abort CMake after fatal error.
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -326,6 +384,7 @@ else()
|
||||||
|
|
||||||
# wolfSSL user_settings.h is in the local project.
|
# wolfSSL user_settings.h is in the local project.
|
||||||
set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl")
|
set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl")
|
||||||
|
# add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
|
||||||
|
|
||||||
string(REPLACE "/" "//" STR_WOLFSSL_PROJECT_DIR "${WOLFSSL_PROJECT_DIR}")
|
string(REPLACE "/" "//" STR_WOLFSSL_PROJECT_DIR "${WOLFSSL_PROJECT_DIR}")
|
||||||
add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}//include//user_settings.h")
|
add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${STR_WOLFSSL_PROJECT_DIR}//include//user_settings.h")
|
||||||
|
@ -484,10 +543,10 @@ else()
|
||||||
message(STATUS "Could not find RTOS path")
|
message(STATUS "Could not find RTOS path")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
message(STATUS "THIS_IDF_PATH = $THIS_IDF_PATH")
|
||||||
# wolfSSL-specific include directories
|
# wolfSSL-specific include directories
|
||||||
set(COMPONENT_ADD_INCLUDEDIRS
|
set(COMPONENT_ADD_INCLUDEDIRS
|
||||||
"./include" # this is the location of local project wolfssl user_settings.h
|
"./include" # this is the location of wolfssl user_settings.h
|
||||||
"\"${WOLFSSL_ROOT}/\""
|
"\"${WOLFSSL_ROOT}/\""
|
||||||
"\"${WOLFSSL_ROOT}/wolfssl/\""
|
"\"${WOLFSSL_ROOT}/wolfssl/\""
|
||||||
"\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\""
|
"\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\""
|
||||||
|
@ -514,9 +573,14 @@ else()
|
||||||
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
|
"\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
|
||||||
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
|
"\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
|
||||||
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
|
"\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
|
||||||
|
"\"${WOLFSSL_ROOT}/src/ssl_load.c\"" # included by ssl.c
|
||||||
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
|
"\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
|
||||||
|
"\"${WOLFSSL_ROOT}/src/ssl_p7p12.c\"" # included by ssl.c
|
||||||
|
"\"${WOLFSSL_ROOT}/src/ssl_sess.c\"" # included by ssl.c
|
||||||
"\"${WOLFSSL_ROOT}/src/x509.c\""
|
"\"${WOLFSSL_ROOT}/src/x509.c\""
|
||||||
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
|
"\"${WOLFSSL_ROOT}/src/x509_str.c\""
|
||||||
|
"\"${WOLFSSL_ROOT}/wolfcrypt/src/ext_kyber.c\"" # external Kyber disabled by default
|
||||||
|
"\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/ext_kyber.h\"" # external Kyber disabled by default
|
||||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
|
"\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
|
||||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c\""
|
"\"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c\""
|
||||||
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm32.c\""
|
"\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm32.c\""
|
||||||
|
|
|
@ -933,7 +933,9 @@ static INLINE void WaitTcpReady(tcp_ready* ready)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define WOLFSSH_THREAD WOLFSSL_THREAD
|
#ifndef WOLFSSH_THREAD
|
||||||
|
#define WOLFSSH_THREAD WOLFSSL_THREAD
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (LIBWOLFSSL_VERSION_HEX < WOLFSSL_V5_6_4) \
|
#if (LIBWOLFSSL_VERSION_HEX < WOLFSSL_V5_6_4) \
|
||||||
|
|
Loading…
Reference in New Issue