Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/esp_idf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: ESP-IDF v5.1.2 build esp32s3
- name: ESP-IDF v5.4 build esp32s3
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.1.2
esp_idf_version: v5.4
target: esp32s3
command: 'idf.py set-target esp32s3 build'
2 changes: 1 addition & 1 deletion components/LibSSH-ESP32
Submodule LibSSH-ESP32 updated 94 files
+1 −9 CMakeLists.txt
+17 −17 README.md
+11 −1 examples/exec/exec.ino
+14 −0 examples/keygen2/argp.c
+2 −2 examples/keygen2/argp.h
+47 −31 examples/keygen2/keygen2.ino
+13 −3 examples/libssh_scp/libssh_scp.ino
+1 −1 examples/samplesshd-kbdint/argp-ba.c
+1 −1 examples/samplesshd-kbdint/argp-pv.c
+14 −0 examples/samplesshd-kbdint/argp.c
+2 −2 examples/samplesshd-kbdint/argp.h
+15 −20 examples/samplesshd-kbdint/samplesshd-kbdint.ino
+2 −2 idf_component.yml
+2 −2 library.properties
+14 −16 src/agent.c
+402 −115 src/auth.c
+125 −121 src/base64.c
+2 −8 src/bignum.c
+113 −136 src/bind.c
+20 −20 src/bind_config.c
+8 −7 src/buffer.c
+9 −0 src/callbacks.c
+533 −366 src/channels.c
+68 −24 src/client.c
+328 −69 src/config.c
+16 −6 src/config_parser.c
+23 −12 src/connect.c
+7 −7 src/curve25519.c
+22 −24 src/dh-gex.c
+1 −1 src/ecdh_mbedcrypto.c
+2 −2 src/error.c
+2 −5 src/external/blowfish.c
+271 −0 src/external/curve25519_ref.c
+222 −0 src/external/ed25519.c
+418 −0 src/external/fe25519.c
+369 −0 src/external/ge25519.c
+858 −0 src/external/ge25519_base.data
+375 −0 src/external/sc25519.c
+140 −46 src/kex.c
+6 −13 src/knownhosts.c
+49 −69 src/libmbedcrypto.c
+0 −2 src/libssh/bind.h
+2 −5 src/libssh/blf.h
+0 −4 src/libssh/buffer.h
+98 −1 src/libssh/callbacks.h
+6 −1 src/libssh/channels.h
+24 −3 src/libssh/config_parser.h
+4 −8 src/libssh/crypto.h
+76 −0 src/libssh/fe25519.h
+51 −0 src/libssh/ge25519.h
+33 −0 src/libssh/gssapi.h
+4 −0 src/libssh/kex.h
+0 −14 src/libssh/keys.h
+11 −1 src/libssh/libcrypto.h
+2 −0 src/libssh/libgcrypt.h
+6 −3 src/libssh/libmbedcrypto.h
+106 −63 src/libssh/libssh.h
+22 −28 src/libssh/libssh_esp32_config.h
+2 −2 src/libssh/libssh_version.h
+32 −2 src/libssh/misc.h
+4 −1 src/libssh/options.h
+18 −32 src/libssh/pki.h
+4 −16 src/libssh/pki_priv.h
+34 −6 src/libssh/priv.h
+82 −0 src/libssh/sc25519.h
+27 −23 src/libssh/server.h
+22 −6 src/libssh/session.h
+2 −1 src/libssh/socket.h
+5 −0 src/libssh/token.h
+1 −1 src/libssh_esp32.cpp
+1 −1 src/libssh_esp32.h
+1 −1 src/libssh_esp32_compat.c
+1 −5 src/libssh_esp32_compat.h
+22 −28 src/libssh_esp32_config.h
+6 −0 src/log.c
+428 −0 src/match.c
+0 −5 src/mbedcrypto-compat.h
+3 −3 src/mbedcrypto_missing.c
+297 −186 src/messages.c
+222 −54 src/misc.c
+744 −364 src/options.c
+17 −17 src/packet.c
+160 −137 src/packet_cb.c
+315 −245 src/pki.c
+43 −82 src/pki_container_openssh.c
+42 −11 src/pki_ed25519_common.c
+249 −159 src/pki_mbedcrypto.c
+27 −9 src/scp.c
+23 −28 src/server.c
+97 −32 src/session.c
+314 −23 src/socket.c
+137 −4 src/token.c
+457 −0 src/ttyopts.c
+6 −13 src/wrapper.c
10 changes: 7 additions & 3 deletions components/ssh/src/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,22 @@ ListenError Server::Listen(const HandlerCallback& handler)

ESP_LOGI(TAG, "[%s] new connection from: %s", sessInfo.Id.c_str(), sessInfo.ClientIP.c_str());

ESP_LOGD(TAG, "[%s] starts key exchange...", sessInfo.Id.c_str());
ESP_LOGI(TAG, "[%s] starts key exchange...", sessInfo.Id.c_str());
rc = ssh_handle_key_exchange(sshSession);
if (rc != SSH_OK) {
ESP_LOGW(TAG, "[%s] key exchange failed: %s", sessInfo.Id.c_str(), ssh_get_error(sshSession));
return ListenError::Accept;
}

ESP_LOGD(TAG, "[%s] auth client...", sessInfo.Id.c_str());
ESP_LOGI(TAG, "[%s] auth client...", sessInfo.Id.c_str());
auto userInfo = authenticate(sshSession, sessInfo);
if (!userInfo) {
ESP_LOGW(TAG, "[%s] auth failed, abort", sessInfo.Id.c_str());
return ListenError::Auth;
}
sessInfo.User = std::move(userInfo.value());

ESP_LOGD(TAG, "[%s] wait for a channel session...", sessInfo.Id.c_str());
ESP_LOGI(TAG, "[%s] wait for a channel session...", sessInfo.Id.c_str());
ssh_message message = nullptr;
ssh_channel chan = nullptr;
do {
Expand Down Expand Up @@ -227,6 +227,10 @@ ListenError Server::Listen(const HandlerCallback& handler)
}

if (ssh_message_subtype(message) != SSH_CHANNEL_REQUEST_EXEC) {
if (ssh_message_subtype(message) != SSH_CHANNEL_REQUEST_ENV) {
ESP_LOGW(TAG, "[%s] requested invalid channel %d:%d", sessInfo.Id.c_str(), ssh_message_type(message), ssh_message_subtype(message));
};

ssh_message_reply_default(message);
ssh_message_free(message);
continue;
Expand Down
1 change: 0 additions & 1 deletion components/ui/src/button.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <sdkconfig.h>
#include "ui/button.h"
#include "config.h"


using namespace UI;
Expand Down
86 changes: 63 additions & 23 deletions dependencies.lock
Original file line number Diff line number Diff line change
@@ -1,51 +1,91 @@
dependencies:
bblanchon/arduinojson:
component_hash: 463812931f99cb7a554d64311288f537b43daaca3eed2427557b907af393447c
component_hash: 21b41e6cce335cefc142c457ceb50eb45621ff9ea6fd0a0ee349a642e48a47a3
dependencies: []
source:
service_url: https://api.components.espressif.com/
registry_url: https://components.espressif.com/
type: service
version: 6.21.5
version: 7.3.0
espressif/esp_lcd_touch:
component_hash: d4d8f2dc33205797169a97a02e0d89a8982f59fe0509129b54422052b8522f59
component_hash: 779b4ba2464a3ae85681e4b860caa5fdc35801458c23f3039ee761bae7f442a4
dependencies:
- name: idf
require: private
version: '>=4.4.2'
source:
service_url: https://api.components.espressif.com/
registry_url: https://components.espressif.com
type: service
version: 1.1.1
version: 1.1.2
espressif/esp_lcd_touch_cst816s:
component_hash: 270bd7df3a2a5cffa3a626c4709fc03237d83fd9daa6fb70c833a2f1875f0f68
dependencies:
- name: idf
require: private
version: '>=4.4.2'
- name: espressif/esp_lcd_touch
registry_url: https://components.espressif.com
require: public
version: ^1.0.4
source:
service_url: https://api.components.espressif.com/
registry_url: https://components.espressif.com/
type: service
version: 1.0.3
espressif/esp_tinyusb:
component_hash: 43d73c626724054db083ad2a537e8af223e3bca7a915fc38a9d9c6c7f2920a69
component_hash: fe1135e7a419b0c6034117aea46d4ad8048618de50f3ae774b1526ae571f1ec6
dependencies:
- name: idf
require: private
version: '>=5.0'
- name: espressif/tinyusb
registry_url: https://components.espressif.com
require: public
version: '>=0.14.2'
source:
service_url: https://api.components.espressif.com/
registry_url: https://components.espressif.com/
type: service
version: 1.4.3
version: 1.7.1
espressif/libsodium:
component_hash: f6e982479a2389cb6868e8fb761cf23aba6c355a8090b3e906299807775f58a3
component_hash: 25b968723c584a2742ca36cebe5a7ef049c6767e059f7b1e1eec69946019025d
dependencies:
- name: idf
require: private
version: '>=4.2'
source:
service_url: https://api.components.espressif.com/
registry_url: https://components.espressif.com/
type: service
version: 1.0.20~1
version: 1.0.20~2
espressif/tinyusb:
component_hash: a11195d4c7c385aa2b1430009486dd4007920307d13b7db474a62ff040907d8f
component_hash: 0f96faa5e29d5a04553ba7050b9051c1f6b549b9340681eb7afdda419a8dff2e
dependencies:
- name: idf
require: private
version: '>=5.0'
source:
service_url: https://api.components.espressif.com/
registry_url: https://components.espressif.com
type: service
version: 0.15.0~4
targets:
- esp32s2
- esp32s3
- esp32p4
version: 0.18.0~1
idf:
component_hash: null
source:
type: idf
version: 5.1.2
version: 5.4.0
lvgl/lvgl:
component_hash: 948bff879a345149b83065535bbc4a026ce9f47498a22881e432a264b9098015
component_hash: d7c1ac037ae6e85d94897f807d6e7ba0946a83e720074fc95a4f6241da9f9f53
dependencies: []
source:
service_url: https://api.components.espressif.com/
registry_url: https://components.espressif.com/
type: service
version: 8.3.11
manifest_hash: 274d2cea5a7bbaa200ff3e38c33582d8878030d2b62013f54b7efa6c84f1440c
version: 8.4.0
direct_dependencies:
- bblanchon/arduinojson
- espressif/esp_lcd_touch_cst816s
- espressif/esp_tinyusb
- espressif/libsodium
- idf
- lvgl/lvgl
manifest_hash: 86a1bbad848f6e431c9b1d1fc6f00c1fa63de16ee067779dc86b801507d06fab
target: esp32s3
version: 1.0.0
version: 2.0.0
4 changes: 0 additions & 4 deletions main/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ menu "BoundBox Runtime"
int "SSHD task stack size"
default 32768

config COMMAND_BUFFER_SIZE
int "Command buffer size"
default 16384

config SHUTDOWN_ON_ASSERT
bool "Use shutdown instead of assert (board will be available after manual rst)"
default false
Expand Down
14 changes: 7 additions & 7 deletions main/commands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ namespace
bool HandleSecretsStore(Secrets* secrets, const SSH::SessionInfo& sessInfo, const JsonObjectConst& req, JsonObject& rsp)
{
JsonObjectConst secretsJson = req["secrets"].as<JsonObjectConst>();
if (!secretsJson.containsKey("host_key")) {
if (!secretsJson["host_key"].is<std::string>()) {
rsp["error_code"] = CMD_ERR_CODE_SECRETS_STORE_INVALID_HOST_KEY;
rsp["error_msg"] = "empty host key";
rsp["error_msg"] = "invalid or empty host key";
return false;
}

if (!secretsJson.containsKey("secret_key")) {
if (!secretsJson["secret_key"].is<std::string>()) {
rsp["error_code"] = CMD_ERR_CODE_SECRETS_STORE_INVALID_SECRET_KEY;
rsp["error_msg"] = "empty host key";
return false;
Expand Down Expand Up @@ -172,14 +172,14 @@ Error Commands::Initialize(Authenticator* auth, Secrets* secrets)
Error Commands::Dispatch(const SSH::SessionInfo& sessInfo, std::string_view cmdName, SSH::Stream& stream)
{
ESP_LOGI(TAG, "[%s] called command: %s", sessInfo.Id.c_str(), cmdName.cbegin());
DynamicJsonDocument req(CONFIG_COMMAND_BUFFER_SIZE);
JsonDocument req;
DeserializationError jsonErr = deserializeJson(req, stream);
if (jsonErr && jsonErr != DeserializationError::Code::EmptyInput) {
ESP_LOGE(TAG, "[%s] unable to read request: %s", sessInfo.Id.c_str(), jsonErr.c_str());
return Error::CommandFailed;
}

DynamicJsonDocument rspDoc(CONFIG_COMMAND_BUFFER_SIZE);
JsonDocument rspDoc;
JsonObject rsp = rspDoc.to<JsonObject>();

bool ok = Handle(sessInfo, cmdName, req.as<JsonObjectConst>(), rsp);
Expand Down Expand Up @@ -247,13 +247,13 @@ bool Commands::Handle(const SSH::SessionInfo& sessInfo, std::string_view cmdName
};

if (cmdName == "/help") {
JsonArray jsonCommands = rsp.createNestedArray("commands");
JsonArray jsonCommands = rsp["commands"].to<JsonArray>();
for (const auto& cmd : commands) {
if (!cmd.UsedAllowed && sessInfo.User.Role != SSH::UserRole::SysOp) {
continue;
}

JsonObject jsonCmd = jsonCommands.createNestedObject();
JsonObject jsonCmd = jsonCommands.add<JsonObject>();
jsonCmd["command"] = cmd.Name;
jsonCmd["description"] = cmd.Help;
}
Expand Down
4 changes: 2 additions & 2 deletions main/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dependencies:
idf: "^5.1.0"
idf: "^5.4.0"
lvgl/lvgl: "^8.3.11"
bblanchon/arduinojson: "^6.21.4"
bblanchon/arduinojson: "^7.3.0"
2 changes: 1 addition & 1 deletion main/secrets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Error Secrets::Erase()

Error Secrets::FromJson(const JsonObjectConst& obj) noexcept
{
if (!obj.containsKey("host_key") || !obj.containsKey("secret_key")) {
if (!obj["host_key"].is<std::string>() || !obj["secret_key"].is<std::string>()) {
return Error::ShitHappens;
}

Expand Down
2 changes: 0 additions & 2 deletions sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT=y
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="16MB"
Expand Down Expand Up @@ -34,7 +33,6 @@ CONFIG_TINYUSB_DESC_SERIAL_STRING="31337"

CONFIG_LWIP_LOCAL_HOSTNAME="BoundBox"
CONFIG_ETH_SPI_ETHERNET_W5500=y
CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n

CONFIG_ESP_MAIN_TASK_STACK_SIZE=7168

Expand Down