Audit of the XEdDSA packet-signing implementation (#10478) surfaced several issues in when unsigned packets are accepted on receive or emitted on send. This fixes them and adds regression coverage. - Unicast NodeInfo exchange no longer breaks against signer nodes: the NodeInfoModule downgrade drop is gated to broadcasts, since senders never sign unicast (want_response replies, directed exchanges). - Replace the payload-size sign heuristic with an exact encoded-size gate (signedDataFits) and mirror it on the receive side, removing a dead band where 167-168 B broadcasts were signed then failed TOO_LARGE. - Extract the receive policy into checkXeddsaReceivePolicy() and apply it to plaintext-MQTT decoded downlink, which previously skipped signature verification and downgrade protection entirely. - Reject signatures whose length is neither 0 nor 64 as malformed, so a crafted partial signature can't inflate the size estimate and dodge the unsigned-downgrade drop. - Hold cryptLock on the MQTT verify path (shared Ed25519 key cache). - Clear any client-preset signature on packets we originate, on all builds. - Randomized (hedged) signing per the Signal XEdDSA spec: bump the meshtastic/Crypto pin to the build where XEdDSA::sign mixes 32 bytes of caller randomness into the nonce as Z (meshtastic/Crypto#3), and seed those bytes in xeddsa_sign from HardwareRNG (checked, with a seeded-CSPRNG fallback). test_crypto pins that repeated signs differ and both verify. Adds test coverage: test_packet_signing groups A-E (receive matrix, send policy, NodeInfo backstop, encoding invariants, decoded-ingress policy), test_mqtt end-to-end downlink cases, and a test_crypto randomization check.
60 lines
2.8 KiB
INI
60 lines
2.8 KiB
INI
; Common settings for ESP32 OG (without suffix)
|
|
; See 'esp32_common' for common ESP32-family settings
|
|
[esp32_base]
|
|
extends = esp32_common
|
|
custom_esp32_kind = esp32
|
|
|
|
build_src_filter =
|
|
${esp32_common.build_src_filter}
|
|
-<modules/esp32/PaxcounterModule.cpp>
|
|
-<mesh/http/>
|
|
|
|
build_flags =
|
|
${esp32_common.build_flags}
|
|
-mtext-section-literals
|
|
-D ESP32_FORCE_IRAM_MEMSET
|
|
-Wl,--wrap=memset
|
|
-Wl,--wrap=memcpy
|
|
-DMESHTASTIC_EXCLUDE_AUDIO=1
|
|
-DMESHTASTIC_EXCLUDE_ACCELEROMETER=1
|
|
-DMESHTASTIC_EXCLUDE_PAXCOUNTER=1
|
|
-DMESHTASTIC_EXCLUDE_WEBSERVER=1
|
|
-DMESHTASTIC_EXCLUDE_RANGETEST=1
|
|
; HACK HACK HACK this is just a proof of concept ESP32+NimBLE but these
|
|
; includes need to be done properly somehow
|
|
-I${platformio.packages_dir}/framework-espidf/components/bt/host/nimble/nimble/nimble/host/include
|
|
-I${platformio.packages_dir}/framework-espidf/components/bt/host/nimble/nimble/nimble/include
|
|
-I${platformio.packages_dir}/framework-espidf/components/bt/host/nimble/nimble/porting/nimble/include
|
|
-I${platformio.packages_dir}/framework-espidf/components/bt/host/nimble/port/include
|
|
-I${platformio.packages_dir}/framework-espidf/components/bt/host/nimble/nimble/porting/npl/freertos/include
|
|
-I${platformio.packages_dir}/framework-espidf/components/bt/host/nimble/nimble/nimble/transport/include
|
|
-I${platformio.packages_dir}/framework-espidf/components/bt/host/nimble/nimble/nimble/host/services/gap/include
|
|
-I${platformio.packages_dir}/framework-espidf/components/bt/host/nimble/esp-hci/include
|
|
-I${platformio.packages_dir}/framework-espidf/components/bt/host/nimble/nimble/nimble/host/services/gatt/include
|
|
-I${platformio.packages_dir}/framework-espidf/components/bt/host/nimble/nimble/nimble/host/util/include
|
|
|
|
custom_sdkconfig =
|
|
${esp32_common.custom_sdkconfig}
|
|
CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
|
|
'# CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set'
|
|
'# CONFIG_BTDM_CTRL_MODE_BTDM is not set'
|
|
'# CONFIG_BT_BLUEDROID_ENABLED is not set'
|
|
CONFIG_BT_NIMBLE_ENABLED=y
|
|
CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP=y
|
|
|
|
; Override lib_deps to use environmental_extra_no_bsec instead of environmental_extra
|
|
; BSEC library uses ~3.5KB DRAM which causes overflow on original ESP32 targets
|
|
lib_deps =
|
|
${arduino_base.lib_deps}
|
|
${networking_base.lib_deps}
|
|
${networking_extra.lib_deps}
|
|
${radiolib_base.lib_deps}
|
|
${environmental_base.lib_deps}
|
|
${environmental_extra_no_bsec.lib_deps}
|
|
# TODO renovate
|
|
https://github.com/mverch67/libpax/archive/6f52ee989301cdabaeef00bcbf93bff55708ce2f.zip
|
|
# renovate: datasource=custom.pio depName=XPowersLib packageName=lewisxhe/library/XPowersLib
|
|
lewisxhe/XPowersLib@0.3.3
|
|
# renovate: datasource=git-refs depName=meshtastic/Crypto packageName=https://github.com/meshtastic/Crypto gitBranch=master
|
|
https://github.com/meshtastic/Crypto/archive/591ff9a690e8168ccb7a36abde8d7783e448d395.zip
|