Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0fc095e
add watchdog to rp2xx0
cvaldess Apr 6, 2026
b8ecb3a
feat(eth-api): phase 0 skeleton — HTTP API server on TCP/80 (503 only)
cvaldess May 27, 2026
23b9755
feat(eth-api): phase 1 — implement /api/v1/{fromradio,toradio} with P…
cvaldess May 27, 2026
6fac312
fix(eth-api): move accept loop to dedicated OSThread (20ms tick)
cvaldess May 27, 2026
ac2da2f
refactor(eth-api): extract handlers to shared module via IStreamReadW…
cvaldess May 27, 2026
eb41751
feat(eth-tls): ECDSA P-256 self-signed cert generation for HTTPS API
cvaldess May 27, 2026
b7a637a
feat(eth-tls-api): phase 2.2 — HTTPS server on TCP/443 reusing handlers
cvaldess May 28, 2026
b2ae6de
fix(eth-tls): add KeyUsage + EKU serverAuth and cap TLS 1.2 for brows…
cvaldess May 28, 2026
5f70a47
perf(eth-api): HTTP/1.1 keep-alive — one handshake per session, not p…
cvaldess May 28, 2026
8f889e9
fix(eth-tls): watchdog + Chrome compat — handshake stability across b…
cvaldess May 28, 2026
4399955
chore(eth-tls): drop verbose debug logs from cert + TLS init paths
cvaldess May 28, 2026
fe9d836
Merge branch 'develop' into feature/eth-tls-api
cvaldess May 29, 2026
56f3840
Merge remote-tracking branch 'upstream/develop' into feature/eth-tls-api
cvaldess May 31, 2026
13f1159
Merge remote-tracking branch 'upstream/develop' into feature/eth-tls-api
cvaldess Jun 1, 2026
ba19b21
Merge remote-tracking branch 'upstream/develop' into feature/eth-tls-api
cvaldess Jun 2, 2026
c46d5f9
Merge branch 'develop' into feature/eth-tls-api
thebentern Jun 3, 2026
1259c20
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 3, 2026
08745c8
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 4, 2026
732181b
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 4, 2026
30a6f67
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 5, 2026
6f1d827
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 5, 2026
1be0aee
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 5, 2026
d15ab7a
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 6, 2026
d57149d
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 7, 2026
cdb61c6
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 8, 2026
5ae16f0
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 8, 2026
cdf0a35
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 8, 2026
d5a6b25
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 9, 2026
6dfe862
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 9, 2026
3695c99
Merge remote-tracking branch 'upstream/develop' into feature/eth-tls-api
cvaldess Jun 10, 2026
2bb20b5
Merge remote-tracking branch 'upstream/develop' into feature/eth-tls-api
cvaldess Jun 10, 2026
c57eb94
Merge remote-tracking branch 'upstream/develop' into feature/eth-tls-api
cvaldess Jun 10, 2026
cdab373
Merge remote-tracking branch 'upstream/develop' into feature/eth-tls-api
cvaldess Jun 10, 2026
8e4c54d
Merge remote-tracking branch 'upstream/develop' into feature/eth-tls-api
cvaldess Jun 10, 2026
bc7effb
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 11, 2026
e7b886b
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 11, 2026
1ada2f2
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 13, 2026
d38cc2d
Merge branch 'develop' into feature/eth-tls-api
cvaldess Jun 14, 2026
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
45 changes: 45 additions & 0 deletions scripts/add_mbedtls_sources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Pulls all mbedTLS sources from arduino-pico's pico-sdk into the build so the
# firmware can call mbedtls_* APIs (the precompiled arduino-pico libs only
# expose BearSSL; mbedTLS is shipped as source under lib/mbedtls/library/*.c).
#
# Wired in via `extra_scripts = pre:scripts/add_mbedtls_sources.py` on the
# variants that define HAS_ETHERNET_TLS_API. POSIX-only code paths inside
# mbedtls are neutralized by src/mbedtls_user_config.h (referenced via the
# variant's -DMBEDTLS_USER_CONFIG_FILE build flag). Unused symbols are dropped
# at link time, so non-TLS envs that pull this script in pay nothing.

Import("env")

import glob
import os

framework_dir = env.PioPlatform().get_package_dir("framework-arduinopico")
if not framework_dir:
print("[add_mbedtls_sources] framework-arduinopico package not found — skipping")
Return()

mbedtls_root = os.path.join(framework_dir, "pico-sdk", "lib", "mbedtls")
include_dir = os.path.join(mbedtls_root, "include")
src_dir = os.path.join(mbedtls_root, "library")

if not os.path.isdir(src_dir):
print(f"[add_mbedtls_sources] mbedtls library dir not found at {src_dir}")
Return()

# mbedtls headers + project src (where mbedtls_user_config.h lives) must be on
# the include path when the .c files compile.
env.Append(CPPPATH=[include_dir, env["PROJECT_SRC_DIR"]])

# Inject the user-config define through CPPDEFINES so SCons handles the
# embedded quotes correctly. The build_flags shell parser drops/corrupts the
# value when the same is expressed as -D 'MBEDTLS_USER_CONFIG_FILE="..."'.
env.Append(CPPDEFINES=[("MBEDTLS_USER_CONFIG_FILE", '\\"mbedtls_user_config.h\\"')])

sources = sorted(glob.glob(os.path.join(src_dir, "*.c")))
print(f"[add_mbedtls_sources] Adding {len(sources)} mbedTLS source files from {src_dir}")

env.BuildSources(
os.path.join("$BUILD_DIR", "mbedtls_pico"),
src_dir,
src_filter=["+<*.c>"],
)
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,9 @@ void loop()
#endif
#ifdef ARCH_NRF54L15
nrf54l15Loop();
#endif
#ifdef ARCH_RP2040
rp2040Loop();
#endif
power->powerCommandsCheck();

Expand Down
2 changes: 1 addition & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ extern bool runASAP;

extern bool pauseBluetoothLogging;

void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(), rp2040Setup(), clearBonds(), enterDfuMode();
void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(), rp2040Setup(), rp2040Loop(), clearBonds(), enterDfuMode();

meshtastic_DeviceMetadata getDeviceMetadata();
#if !MESHTASTIC_EXCLUDE_I2C
Expand Down
53 changes: 53 additions & 0 deletions src/mbedtls_user_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// User-provided mbedTLS config — pulled in AFTER the default mbedtls_config.h
// via -DMBEDTLS_USER_CONFIG_FILE in the variant's platformio.ini.
//
// We compile mbedtls source files straight out of pico-sdk on bare metal, so
// every option that needs POSIX (time, sockets, filesystem) is disabled here.
// Without this, sources like net_sockets.c, timing.c, platform_util.c, etc.
// abort with #error or #include <sys/socket.h>.
//
// Code paths that touch these symbols are gated by the same MBEDTLS_* macros,
// so the linker simply drops the unreachable branches — no manual file
// exclusion in the build script.

#pragma once

// Entropy: entropy_poll.c does a hard `#error` on non-POSIX/non-Windows
// platforms. Tell it to skip the platform-specific entropy plumbing — our
// cert module passes a custom f_rng (picoRand → get_rand_64) directly into
// every mbedtls call that needs randomness, so we never invoke entropy_poll.
#define MBEDTLS_NO_PLATFORM_ENTROPY

// Time: pico-sdk mbedtls only knows clock_gettime() (POSIX) and GetTickCount64()
// (Win32). Neither exists here. We don't need calendar time on the server side
// (cert validity check at TLS init is the only user of MBEDTLS_HAVE_TIME_DATE
// and our self-signed cert is dated 2024-2034 so the client decides validity).
#undef MBEDTLS_HAVE_TIME
#undef MBEDTLS_HAVE_TIME_DATE
#undef MBEDTLS_TIMING_C

// Networking: net_sockets.c uses POSIX sockets. We wrap EthernetClient
// ourselves with mbedtls_ssl_set_bio() callbacks.
#undef MBEDTLS_NET_C

// Filesystem: cert/key load happens via our own LittleFS code, not via
// mbedtls_x509_crt_parse_file()/fopen().
#undef MBEDTLS_FS_IO

// PSA persistent storage: requires POSIX fopen. Unused.
#undef MBEDTLS_PSA_ITS_FILE_C
#undef MBEDTLS_PSA_CRYPTO_STORAGE_C

// Compile out TLS 1.3 entirely. pico-sdk's mbedtls_config defines
// MBEDTLS_SSL_PROTO_TLS1_3 but the server-side 1.3 plumbing in this
// vendored build is fragile: capping max_tls_version=TLS1_2 at runtime
// is enough for Firefox / openssl-3 (they downgrade cleanly), but
// Chrome's ClientHello carries TLS 1.3 extensions (post-quantum key
// shares, Encrypted ClientHello, etc.) that mbedtls tries to *parse*
// during the initial ClientHello processing before deciding to
// downgrade — and that parse crashes the board (no handshake state log
// ever fires, the crash is inside the first mbedtls_ssl_handshake()
// call). Removing the 1.3 code from the build sidesteps the parsers
// entirely; mbedtls will tell Chrome "TLS 1.2 only" via the
// ServerHello and ignore the 1.3 extensions.
#undef MBEDTLS_SSL_PROTO_TLS1_3
Loading