boards/esp32c3-devkit: add Dropbear SSH server configuration#19062
Draft
FelipeMdeO wants to merge 1 commit into
Draft
boards/esp32c3-devkit: add Dropbear SSH server configuration#19062FelipeMdeO wants to merge 1 commit into
FelipeMdeO wants to merge 1 commit into
Conversation
Add a new `dropbear` defconfig for the ESP32-C3 DevKit board that brings up an SSH server over Wi-Fi using the Dropbear application, and expose the ChaCha20 stream-cipher helpers required by Dropbear's chacha20-poly1305@openssh.com cipher. boards/risc-v/esp32c3/esp32c3-devkit/configs/dropbear: - Enable Wi-Fi STA mode with DHCP client; include WAPI tooling so the link comes up at boot. - Mount SPIFFS on SPI flash at /data to persist the ECDSA host key (/data/dropbear_ecdsa_host_key) and the password database (FSUTILS_PASSWD at /data/passwd). - Autostart the dropbear task from NSH on every boot. - Enable PTY support and Ctrl-C signal delivery for interactive sessions. - Pin CONFIG_NETUTILS_DROPBEAR_STACKSIZE to 65536; the 32 KiB default overflows during key exchange on this RISC-V target. - Set CONFIG_NETUTILS_DROPBEAR_LISTEN_RETRY_MAX=120 so the daemon retries until the Wi-Fi link is fully up. crypto/chachapoly: add struct chacha20_stream_ctx and three helpers (chacha20_stream_setkey, chacha20_stream_ivctr64, chacha20_stream_crypt) that wrap the existing chacha_* primitives to provide a stateful, multi-call stream interface. No new algorithm code is introduced.
Contributor
|
Very cool! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds two related changes that together bring up an SSH server
on the ESP32-C3 DevKit board using the Dropbear application:
boards/risc-v/esp32c3/esp32c3-devkit/configs/dropbear
A new
dropbeardefconfig is introduced for the ESP32-C3 DevKit board.It wires up the Dropbear SSH server application together with:
bring-up at boot).
/datamountpoint) to persist the host key andthe password database.
FSUTILS_PASSWDpointing to/data/passwdas the credential store,replacing a previous Dropbear-specific password-file path.
/data/dropbear_ecdsa_host_key.dropbeartask on every boot.sessions.
CONFIG_NETUTILS_DROPBEAR_STACKSIZEpinned to 65536 bytes; thedefault 32 KiB overflows during key exchange on this RISC-V target.
CONFIG_NETUTILS_DROPBEAR_LISTEN_RETRY_MAX=120so the daemon keepsretrying until the Wi-Fi link is fully up.
Wi-Fi credentials (
myssid/mypasswd) - Please remember give some connectivity to board.crypto: expose ChaCha20 stream helpers
Dropbear uses the
chacha20-poly1305@openssh.comcipher, which requiresa stateful, multi-call ChaCha20 stream interface rather than the single-
block interface currently exposed by
crypto/chachapoly.c. Three helpersand a context struct are added:
struct chacha20_stream_ctx— opaque wrapper aroundchacha_ctx.chacha20_stream_setkey()— initialise the key.chacha20_stream_ivctr64()— set IV and 64-bit counter.chacha20_stream_crypt()— encrypt/decrypt an arbitrary-length buffer.All three functions are thin wrappers over the existing
chacha_*primitives; no new algorithm code is introduced.
Impact
dropbeardefconfig is additive anddoes not affect any existing configuration.
include/crypto/chachapoly.h. The change is purely additive; existingusers of
chacha20_setkey/chacha20_cryptare unaffected.CONFIG_NETUTILS_DROPBEAR.under
/data; they are generated at first run and persist acrossreboots. Wi-Fi credentials must be provisioned by the user before
flashing.
Testing
Host: Linux x86_64, GCC RISC-V toolchain
Board: ESP32-C3 DevKit (rev 0.4)
Build:
Boot log shows Dropbear listening after Wi-Fi association:
SSH connection from the host: