mirror of
https://github.com/meshtastic/firmware.git
synced 2026-06-16 04:30:18 -04:00
* Test commit for XEdDSA support * Update to Crypto lib in Meshtatic org * Generate a new node identity on key generation (#7628) * Generate a new node identity on key generation * Fixes * Fixes * Fixes * Messed up * Fixes * Update src/modules/AdminModule.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/mesh/NodeDB.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Figured it out! * Cleanup * Update src/mesh/NodeDB.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/mesh/NodeDB.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/modules/AdminModule.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update crypto commit hash * Some fixes for xeddsa pr (#9610) * fix: add null check for getMeshNode() in NodeInfoModule getMeshNode() can return nullptr for unknown nodes. Dereferencing without a check crashes the firmware when receiving NodeInfo from a node not yet in the database. * fix: enforce XEdDSA signature verification and prevent stripping Previously, failed signature verification still allowed the packet through, making signatures purely cosmetic. Now: - Failed verification drops the packet (DECODE_FAILURE) - Successfully verified nodes get HAS_XEDDSA_SIGNED bitfield set - Unsigned packets from previously-signing nodes are rejected - Log levels reduced from WARN/ERROR to DEBUG/WARN as appropriate * fix: include packet metadata in XEdDSA signature The signature now covers [fromNode | packetId | portnum | payload] instead of just the payload bytes. This prevents: - Replay attacks (different packetId fails verification) - Reattribution (different fromNode fails verification) - Portnum redirection (different portnum fails verification) Also adds a key initialization check to xeddsa_sign (returns false if XEdDSA keys are all zeros) and checks the return value in the encode path. * fix: handle existing key pair in AdminModule security config When a user provides both a valid private key and public key via admin config, the crypto engine's DH private key and owner public key were never loaded. DMs and XEdDSA signing would silently break. Add an else branch to load both keys into the crypto engine. * perf: cache Ed25519 public key conversion in xeddsa_verify curve_to_ed_pub() performs field element parsing, inversion, and multiplication on every call. Since packets from the same node tend to arrive in bursts, a single-entry cache avoids repeating this expensive conversion for consecutive packets from one sender. * fix: skip identity cleanup when node number is unchanged createNewIdentity() was called on every generateCryptoKeyPair(), including normal boots where the same key is regenerated. This caused unnecessary NodeDB writes and old-node cleanup logic to run when the node number hadn't actually changed. Also fixes only zeroing byte[0] of the old node's public key instead of clearing the entire array. * fix: replace hardcoded 120 with derived XEDDSA_SIGNATURE_SIZE constant The payload size check for XEdDSA signing used a magic number (120). Replace with a derivation from DATA_PAYLOAD_LEN and XEDDSA_SIGNATURE_SIZE so the limit adjusts automatically if constants change. This also increases the max signable payload from 120 to 169 bytes, which is still safe since the actual encoded size is checked after pb_encode. * fix: add const qualifiers to XEdDSA verify and curve_to_ed_pub inputs pubKey, payload, and signature parameters in xeddsa_verify are input-only and should not be modified. Same for curve_pubkey in curve_to_ed_pub. * chore: remove commented-out old Crypto dependency in portduino.ini * Leave out the admin module change for now --------- Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz> * trunk * protobuf re-update * Protobufs * Merge resolution fix * Put XEDDSA on the right bit * NodeDB update to new nodeInfoLite accessors, etc * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Refine unsigned packet rejection logic in Router (#10534) * use hardware random to fill the first 32 signature bytes with entropy prior to signing. * Add XEdDSA packet-signing policy tests and update dependencies for macos * Minor fixes * integrate XEdDSA support and update dependencies across multiple modules --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Wessel <github@weebl.me> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
248 lines
10 KiB
INI
248 lines
10 KiB
INI
[native_base]
|
|
extends = portduino_base
|
|
build_flags = ${portduino_base.build_flags} -I variants/native/portduino
|
|
-I /usr/include
|
|
board = cross_platform
|
|
board_level = extra
|
|
lib_deps =
|
|
${portduino_base.lib_deps}
|
|
# renovate: datasource=custom.pio depName=Melopero RV3028 packageName=melopero/library/Melopero RV3028
|
|
melopero/Melopero RV3028@1.2.0
|
|
|
|
build_src_filter = ${portduino_base.build_src_filter}
|
|
|
|
[env:native]
|
|
extends = native_base
|
|
; The pkg-config commands below optionally add link flags.
|
|
; the || : is just a "or run the null command" to avoid returning an error code
|
|
build_flags = ${native_base.build_flags}
|
|
!pkg-config --libs libulfius --silence-errors || :
|
|
!pkg-config --libs openssl --silence-errors || :
|
|
!pkg-config --cflags --libs sdl2 --silence-errors || :
|
|
!pkg-config --cflags --libs libbsd-overlay --silence-errors || :
|
|
|
|
[env:native-tft]
|
|
extends = native_base
|
|
build_type = release
|
|
lib_deps =
|
|
${native_base.lib_deps}
|
|
${device-ui_base.lib_deps}
|
|
build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunction-sections -fdata-sections -Wl,--gc-sections
|
|
-D RAM_SIZE=16384
|
|
-D USE_X11=1
|
|
-D HAS_TFT=1
|
|
-D HAS_SCREEN=1
|
|
-D LV_CACHE_DEF_SIZE=6291456
|
|
-D LV_BUILD_TEST=0
|
|
-D LV_USE_LIBINPUT=1
|
|
-D LV_LVGL_H_INCLUDE_SIMPLE
|
|
-D LV_CONF_INCLUDE_SIMPLE
|
|
-D LV_COMP_CONF_INCLUDE_SIMPLE
|
|
-D USE_LOG_DEBUG
|
|
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
|
|
-D USE_PACKET_API
|
|
-D VIEW_320x240
|
|
!pkg-config --libs libulfius --silence-errors || :
|
|
!pkg-config --libs openssl --silence-errors || :
|
|
!pkg-config --cflags --libs sdl2 --silence-errors || :
|
|
!pkg-config --cflags --libs libbsd-overlay --silence-errors || :
|
|
build_src_filter =
|
|
${native_base.build_src_filter}
|
|
|
|
[env:native-fb]
|
|
extends = native_base
|
|
build_type = release
|
|
lib_deps =
|
|
${native_base.lib_deps}
|
|
${device-ui_base.lib_deps}
|
|
build_flags = ${native_base.build_flags} -Os -ffunction-sections -fdata-sections -Wl,--gc-sections
|
|
-D RAM_SIZE=8192
|
|
-D USE_FRAMEBUFFER=1
|
|
-D LV_COLOR_DEPTH=32
|
|
-D HAS_TFT=1
|
|
-D HAS_SCREEN=1
|
|
-D LV_BUILD_TEST=0
|
|
-D LV_USE_LOG=0
|
|
-D LV_USE_EVDEV=1
|
|
-D LV_LVGL_H_INCLUDE_SIMPLE
|
|
-D LV_CONF_INCLUDE_SIMPLE
|
|
-D LV_COMP_CONF_INCLUDE_SIMPLE
|
|
-D USE_LOG_DEBUG
|
|
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
|
|
-D USE_PACKET_API
|
|
-D VIEW_320x240
|
|
-D MAP_FULL_REDRAW
|
|
!pkg-config --libs libulfius --silence-errors || :
|
|
!pkg-config --libs openssl --silence-errors || :
|
|
!pkg-config --cflags --libs libbsd-overlay --silence-errors || :
|
|
build_src_filter =
|
|
${native_base.build_src_filter}
|
|
|
|
[env:native-tft-debug]
|
|
extends = native_base
|
|
build_type = debug
|
|
lib_deps =
|
|
${native_base.lib_deps}
|
|
${device-ui_base.lib_deps}
|
|
build_flags = ${native_base.build_flags} -O0 -fsanitize=address -lX11 -linput -lxkbcommon
|
|
-D DEBUG_HEAP
|
|
-D RAM_SIZE=16384
|
|
-D USE_X11=1
|
|
-D HAS_TFT=1
|
|
-D HAS_SCREEN=0
|
|
-D LV_CACHE_DEF_SIZE=6291456
|
|
-D LV_BUILD_TEST=0
|
|
-D LV_USE_LOG=1
|
|
-D LV_USE_SYSMON=1
|
|
-D LV_USE_PERF_MONITOR=1
|
|
-D LV_USE_MEM_MONITOR=0
|
|
-D LV_USE_PROFILER=0
|
|
-D LV_USE_LIBINPUT=1
|
|
-D LV_LVGL_H_INCLUDE_SIMPLE
|
|
-D LV_CONF_INCLUDE_SIMPLE
|
|
-D LV_COMP_CONF_INCLUDE_SIMPLE
|
|
-D USE_LOG_DEBUG
|
|
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
|
|
-D USE_PACKET_API
|
|
-D VIEW_320x240
|
|
!pkg-config --libs libulfius --silence-errors || :
|
|
!pkg-config --libs openssl --silence-errors || :
|
|
!pkg-config --cflags --libs libbsd-overlay --silence-errors || :
|
|
build_src_filter = ${env:native-tft.build_src_filter}
|
|
|
|
[env:coverage]
|
|
extends = env:native
|
|
build_flags = -lgcov --coverage -fprofile-abs-path -fsanitize=address ${env:native.build_flags}
|
|
; https://docs.platformio.org/en/latest/projectconf/sections/env/options/test/test_testing_command.html
|
|
test_testing_command =
|
|
${platformio.build_dir}/${this.__env__}/meshtasticd
|
|
-s
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; Native build for macOS (Darwin / arm64 + x86_64). Headless meshtasticd that
|
|
; runs in SimRadio mode (`-s`) or against real LoRa hardware via a CH341
|
|
; USB-SPI bridge. No BlueZ, libgpiod, or Linux I2C — those require Linux.
|
|
;
|
|
; Prerequisites (Homebrew):
|
|
; brew install platformio yaml-cpp libuv openssl@3 libusb argp-standalone pkg-config jsoncpp
|
|
; # Optional: enable the HTTP API (PiWebServer) on macOS:
|
|
; brew install ulfius
|
|
;
|
|
; The macOS-side patches now live upstream:
|
|
; * meshtastic/platform-native — `String.h`-shadow shim, `-Wno-enum-constexpr-conversion`,
|
|
; empty-variant-dir guard. Pulled via `portduino_base.platform` zip pin.
|
|
; * meshtastic/framework-portduino — LinuxHardwareI2C macOS stubs, AsyncUDP
|
|
; SOCK_NONBLOCK fallback, Common.h __APPLE__ guard, WiFiServer.cpp extern-C
|
|
; fix, package.json URL refresh. Pulled by platform-native at its pinned commit.
|
|
; This env therefore only carries the firmware-side build flags and src filter.
|
|
;
|
|
; Real LoRa hardware on macOS:
|
|
; The same lib_dep `pine64/libch341-spi-userspace` used on Linux works on
|
|
; macOS as-is — its `libusb_detach_kernel_driver()` call is `__linux__`-
|
|
; guarded, but on macOS the kernel doesn't bind a driver to a CH341A SPI
|
|
; bridge (PID 0x5512; bDeviceClass=0xff vendor-specific) by default, so
|
|
; no detach is needed. Apple's bundled CH34x driver targets the CH340
|
|
; *UART* variant (PID 0x7523) — different product. libusb opens the device
|
|
; and claims interface 0 directly via IOUSBHostInterface.
|
|
;
|
|
; To use, point `meshtasticd` at any of the existing `bin/config.d/lora-*.yaml`
|
|
; files that specify `spidev: ch341` — they're platform-agnostic. Example:
|
|
; pio run -e native-macos
|
|
; mkdir -p ~/.meshtasticd && cp bin/config-dist.yaml ~/.meshtasticd/config.yaml
|
|
; # Edit ~/.meshtasticd/config.yaml: ConfigDirectory: ./config.d/
|
|
; mkdir ~/.meshtasticd/config.d && cp bin/config.d/lora-meshstick-1262.yaml ~/.meshtasticd/config.d/
|
|
; cd ~/.meshtasticd && /path/to/firmware/.pio/build/native-macos/meshtasticd
|
|
;
|
|
; The MAC address auto-derives from the CH341's USB serial + product string
|
|
; (PortduinoGlue.cpp ~497-518); on Linux a BlueZ HCI socket is the fallback
|
|
; when that path isn't taken, but BlueZ is `__linux__`-guarded so the
|
|
; serial-derivation path is mandatory on macOS. Override with
|
|
; `MACAddress: AA:BB:CC:DD:EE:FF` in config.yaml's `General:` section if
|
|
; the device's serial isn't 8 hex chars.
|
|
;
|
|
; Diagnosing CH341 issues on macOS:
|
|
; ioreg -p IOUSB -l -w 0 | grep -B2 -A30 0x5512
|
|
; Children should be `IOUSBHostInterface`. If a vendor driver class
|
|
; (e.g. `com.wch.CH34xVCPDriver` from a third-party WCH installer)
|
|
; claims interface 0, libusb will fail with LIBUSB_ERROR_BUSY.
|
|
; Workaround: `sudo kmutil unload -b <bundleID>`.
|
|
; LIBUSB_DEBUG=4 .pio/build/native-macos/meshtasticd
|
|
; Verbose libusb trace — useful when claim_interface fails.
|
|
; ---------------------------------------------------------------------------
|
|
[env:native-macos]
|
|
extends = native_base
|
|
; Apple's ld doesn't accept GNU ld's `-Wl,-Map,<file>` syntax (inherited from
|
|
; the top-level platformio.ini). Strip it; the linker map isn't useful for
|
|
; the macOS dev loop anyway, and Apple ld's equivalent (`-Wl,-map,<file>`)
|
|
; uses different argument shape.
|
|
build_unflags = -Wl,-Map,"${platformio.build_dir}"/output.map
|
|
; libi2c is Linux-only but build_flags_common carries -li2c (also duplicated in the Linux-only
|
|
; build_flags); macOS has no libi2c, so strip it here to let the link succeed.
|
|
-li2c
|
|
build_flags = ${portduino_base.build_flags_common}
|
|
-I variants/native/portduino
|
|
-I/opt/homebrew/include
|
|
-I/opt/homebrew/opt/argp-standalone/include
|
|
-I/opt/homebrew/opt/yaml-cpp/include
|
|
-L/opt/homebrew/lib
|
|
-L/opt/homebrew/opt/argp-standalone/lib
|
|
-L/opt/homebrew/opt/yaml-cpp/lib
|
|
-largp
|
|
-DPORTDUINO_DARWIN
|
|
; Headless build — variants/native/portduino/variant.h would otherwise
|
|
; default HAS_SCREEN to 1 and pull in screen-renderer source that uses
|
|
; VLA-with-initializer (a GNU/GCC extension Apple Clang rejects).
|
|
; MESHTASTIC_EXCLUDE_SCREEN gates the optional `screen->setHeading(...)`-
|
|
; style screen-driver hooks scattered through sensor sources.
|
|
-DHAS_SCREEN=0
|
|
-DMESHTASTIC_EXCLUDE_SCREEN=1
|
|
; openssl@3 is the keg-only Homebrew formula; --cflags is required so the
|
|
; compiler finds <openssl/*.h> in the Homebrew prefix (not just the linker).
|
|
!pkg-config --cflags --libs openssl --silence-errors || :
|
|
; PiWebServer (src/mesh/raspihttp/PiWebServer.cpp) auto-engages when ulfius
|
|
; headers are reachable via `#if __has_include(<ulfius.h>)`. The `|| :`
|
|
; tail keeps the build green when the user hasn't run `brew install ulfius`
|
|
; — they just don't get the HTTP API in that case.
|
|
!pkg-config --cflags --libs liborcania --silence-errors || :
|
|
!pkg-config --cflags --libs libyder --silence-errors || :
|
|
!pkg-config --cflags --libs libulfius --silence-errors || :
|
|
; src/input/Linux*.{cpp,h} drive evdev (`<linux/input.h>`) which doesn't exist
|
|
; on macOS. graphics/Panel_sdl.* and graphics/TFTDisplay.cpp pull LovyanGFX
|
|
; (which we lib_ignore on macOS for the <malloc.h> issue). Neither is needed
|
|
; for the headless build.
|
|
build_src_filter = ${native_base.build_src_filter}
|
|
-<input/LinuxInput.cpp>
|
|
-<input/LinuxInputImpl.cpp>
|
|
-<graphics/Panel_sdl.cpp>
|
|
-<graphics/TFTDisplay.cpp>
|
|
; LovyanGFX includes <malloc.h> (Linux-only) and is only needed by TFT
|
|
; variants — not relevant for the headless macOS build.
|
|
lib_ignore =
|
|
${portduino_base.lib_ignore}
|
|
LovyanGFX
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; Same as [env:native-macos] but built with AddressSanitizer for catching
|
|
; use-after-free, leaks, and OOB access during local development. Headless
|
|
; (no SDL/X11/libinput) so it stays cheap to build. Mirrors the shape of
|
|
; [env:native-tft-debug] but without the TFT/X11 dependencies.
|
|
;
|
|
; pio run -e native-macos-debug
|
|
; .pio/build/native-macos-debug/meshtasticd -s
|
|
;
|
|
; ASan runtime tuning (set in the shell before launching):
|
|
; ASAN_OPTIONS=detect_leaks=1:halt_on_error=0:abort_on_error=1
|
|
; MallocStackLogging=1 # macOS: nicer stack traces in malloc reports
|
|
; ---------------------------------------------------------------------------
|
|
[env:native-macos-debug]
|
|
extends = native_base
|
|
build_type = debug
|
|
build_unflags = ${env:native-macos.build_unflags}
|
|
build_flags = ${env:native-macos.build_flags}
|
|
-O0
|
|
-g
|
|
-fsanitize=address
|
|
-fno-omit-frame-pointer
|
|
build_src_filter = ${env:native-macos.build_src_filter}
|
|
lib_ignore = ${env:native-macos.lib_ignore}
|