Commit Graph

30 Commits

Author SHA1 Message Date
Thomas Göttgens
e6c7c80b3f Raspberry Pico2 - needs protos 2024-09-21 14:50:19 +02:00
Jonathan Bennett
b726792efd Re-implement PKI from #1509 (#4379)
* Re-implement PKI from #1509
co-authored-by: edinnen <ethanjdinnen@protonmail.com>

* Set the key lengnth to actually make PKI work.

* Remove unused variable and initialize keys to null

* move printBytes() to meshUtils

* Don't reset PKI key son reboot unless needed.

* Remove double encryption for PKI messages

* Cleanup encrypt logic

* Add the MESHTASTIC_EXCLUDE_PKI option, and set it for minimal builds. Required for STM32 targets for now.

* Use SHA-256 for PKI key hashing, and add MESHTASTIC_EXCLUDE_PKI_KEYGEN for STM32

* Fix a crash when node is null

* Don't send PKI encrypted packets while licensed

* use chIndex 8 for PKI

* Don't be so clever, that you corrupt incoming packets

* Pass on channel 8 for now

* Typo

* Lock keys once non-zero

* We in fact need 2 scratch buffers, to store the encrypted bytes, unencrypted bytes, and decoded protobuf.

* Lighter approach to retaining known key

* Attach the public key to PKI decrypted packets in device memory

* Turn PKI back off for STM32 :(

* Don't just memcp over a protobuf

* Don't PKI encrypt nodeinfo packets

* Add a bit more memory logging around nodeDB

* Use the proper macro to refer to NODENUM_BROADCAST

* Typo fix

* Don't PKI encrypt ROUTING (naks and acks)

* Adds SecurityConfig protobuf

* Add admin messages over PKI

* Disable PKI for the WIO-e5

* Add MINIMUM_SAFE_FREE_HEAP macro and set to safe 1.5k

* Add missed "has_security"

* Add the admin_channel_enabled option

* STM32 again

* add missed configuration.h at the top of files

* Add EXCLUDE_TZ and RTC

* Enable PKI build on STM32 once again

* Attempt 1 at moving PKI to aes-ccm

* Fix buffers for encrypt/decrypt

* Eliminate unused aes variable

* Add debugging lines

* Set hash to 0 for PKI

* Fix debug lines so they don't print pointers.

* logic fix and more debug

* Rather important typo

* Check for short packets before attempting decrypt

* Don't forget to give cryptoEngine the keys!

* Use the right scratch buffer

* Cleanup

* moar cleanups

* Minor hardening

* Remove some in-progress stuff

* Turn PKI back off on STM32

* Return false

* 2.5 protos

* Sync up protos

* Add initial cryptography test vector tests

* re-add MINIMUM_SAFE_FREE_HEAP

* Housekeeping and comment fixes

* Add explanatory comment about weak dh25519 keys

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2024-08-13 18:43:19 -05:00
geeksville
62a0321c7d
Fixes for #4395: nrf52 flash filesystem reliability (#4406)
* bug #4184: fix config file loss due to filesystem write errors
* Use SafeFile for atomic file writing (with xor checksum readback)
* Write db.proto last because it could be the largest file on the FS (and less critical)
* Don't keep a tmp file around while writing db.proto (because too big to fit two files in the filesystem)
* generate a new critial fault if we encounter errors writing to flash
either CriticalErrorCode_FLASH_CORRUPTION_RECOVERABLE or CriticalErrorCode_FLASH_CORRUPTION_UNRECOVERABLE
(depending on if the second write attempt worked)
* reformat the filesystem if we detect it is corrupted (then rewrite our config files) (only on nrf52 - not sure
yet if we should bother on ESP32)
* If we have to format the FS, make sure to preserve the oem.proto if it exists

* add logLegacy() so old C code in libs can log via our logging

* move filesList() to a better location (used only in developer builds)

* Reformat with "trunk fmt" to match our coding conventions

* for #4395: don't use .exists() to before attempting file open
If a LFS filesystem is corrupted, .exists() can fail when a mere .open()
attempt would have succeeded.  Therefore better to do the .open() in hopes that
we can read the file (in case we need to reformat to fix the FS).
(Seen and confirmed in stress testing)

* for #4395 more fixes, see below for details:
* check for LFS assertion failures during file operations (needs customized lfs_util.h to provide suitable hooks)
* Remove fsCheck() because checking filesystem by writing to it is very high risk, it makes likelyhood that we will
be able to read the config protobufs quite low.
* Update the LFS inside of adafruitnrf52 to 1.7.2 (from their old 1.6.1) to get the following fix:
97d8d5e96a

* use disable_adafruit_usb.py now that we are (temporarily?) using a forked adafruit lib
We need to reach inside the adafruit project and turn off USE_TINYUSB, just doing that
from platformio.ini is no longer sufficient.

Tested on a wio-sdk-wm1110 board (which is the only board that had this problem)

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2024-08-13 06:45:39 -05:00
geeksville
d1ff160256
Generalize SWD debugging stuff so it works on all nrf52 targets. (#4377)
* add bootloader install script for wio tracker 1110 board
Mostly for documentation purposes for future devs.

* Generalize nrf52 hw debugging support so it works on all nrf52 targets
2024-08-03 07:41:35 -05:00
Ben Meadors
b1cf5778b4
Update nrf52 platform to 10.5.0 (#4113) 2024-06-15 09:46:31 -05:00
Thomas Göttgens
c6f028a5f3
Merge branch 'master' into master 2024-05-11 11:58:43 +02:00
Ben Meadors
f06c56a51b Removing release build type due to huge amount of flash utilization 2024-05-10 07:14:28 -05:00
lewisxhe
8c3b9a6139 Move LFS_NO_ASSERT to nrf52.ini 2024-05-08 08:46:08 +08:00
tuxphone
70712d859c
Enable compiling with gccnoneeabi 12.3.1 for nRF52 targets, additional small fixes (#3778)
* Fix type of nodeNum

Type of nodeNum is NodeNum, not uint

* typo

fixed typo "resumeAdverising()"

* fix missing #include "time.h"

Missing include breaks compilation with gccnoneeabi 12.3.1 for nrf52 targets on windows hosts.

* change type uint to unsigned int

uint is not a standard type. Using uint breaks compilation with gccnoneeabi 12.3.1 for nRF52 targets on windows hosts.

* fix type of channel_num

Type of channel_num should be uint32_t (as this is the type of hash() and numChannels).

Using uint non-standard type uint breaks compilation with gccnoneeabi 12.3.1 for nRF52 targets on windows hosts.

* Update nrf52.ini

Default build type should be "release" as this is the default of platformio.

* Update GPS.cpp

uint to unsigned int
2024-05-03 15:49:22 -05:00
Ben Meadors
2efe436102
Update nrf52 platform and consolidate Adafruit Bus IO (#3393) 2024-03-13 07:20:51 -05:00
Jonathan Bennett
e174328de3
Native Webserver (#3343)
* Added WebServer/WebServices for Native Linux Meshtastic and web gui

* Fix bug in login functionality

* Added customized config of portdunio.ini with LovyannGFX from marelab repro

* Compile Problem resolved with developer version of LovyanGFX.git

* Compile against dev version

* Fixes to fit into main branch

* Update variant.h, main.cpp, .gitignore, WebServer.cpp, esp32s2.ini, WebServer.h, ContentHandler.cpp, rp2040.ini, nrf52.ini, ContentHelper.cpp, Dockerfile, ContentHandler.h, esp32.ini, stm32wl5e.ini

* Added linux pi std /usr/include dir

* Adding /usr/innclude for Linux compile against native libs that are not hadled by platformio

* Review log level changes & translation

* Update Dockerfile

* Fix Typo & VFS ref. Part1

* Fix Typo & VFS ref.

* Dev Version for ulfius web lib

* Update platformio.ini

* Free VFS path string

* Remove unintended changes

* More unintentional changes

* Make the HTTP server optional on native

* Tune-up for Native web defaults

* Don't modify build system yet

* Remove more unneeded changes

---------

Co-authored-by: marc hammermann <marchammermann@googlemail.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-03-06 16:23:04 -06:00
Thomas Göttgens
72b4fe51b1 radiolib is stable
just use one definition for all targets
2023-12-04 11:33:32 +01:00
GUVWAF
6ff61b3e04
Pico W: Initial Wi-Fi support (#2980)
* Pico W: Initial WiFi support: connects, but freezes after a while

* Update arduino-pico core to fix hang with Wi-Fi

* Add `picow` to workflow since it's different from `pico` now
2023-12-02 14:47:52 -06:00
Thomas Göttgens
5df7f07f95 unpin radiolib 2023-11-30 11:53:47 +01:00
Jonathan Bennett
bd2675caf1 Temporarily Pin RadioLib to 6.2.0 2023-11-29 20:19:10 -06:00
Ben Meadors
04bbdc6b8a
Platform / dep updates (#2684)
* Update nordic platform

* Update sensor libs
2023-08-06 10:06:08 -05:00
Jonathan Bennett
06a6a992c2
GPS Fixes for nrf52 (#2675)
Expands board serial buffer from 64 (!) to 1024
Adds some debugging messages when problems are detected.
2023-08-02 10:08:59 -05:00
Ben Meadors
6e96216ba3
MQTT client proxying (#2587)
* WIP on MQTT proxy message queue

* Fix copy paste goof

* Progress on uplink

* Has packets

* Avoid trying to connect if we're proxying

* Pointer correctly

* Remove wifi guards

* Client proxy subscribe

* Fixed method that got bababababorked somehow... personally I blame CoPilot

* Short circuit logic

* Remove canned settings

* Missed some stuff in the move

* Guard pubsub client for non-networked variants

* Has networking guard

* else

* Return statement for fall-thru

* More gaurd removals

* Removed source filters. No wonder I was confused

* Bounding

* Scope guard around else and fix return

* Portduino

* Defs instead

* Move macro up to actually fix portduino

* Size_t

* Unsigned int

* Thread interval

* Protos

* Protobufs ref
2023-07-08 20:37:04 -05:00
Ben Meadors
97606cd382
New platform updates (#2593) 2023-07-07 18:58:49 -05:00
Ben Meadors
9e2b86b92c
Bump RadioLib to 6.1.0 (#2577)
* Bump RadioLib to 6.1.0

* RP2040

* More excludes

* Jan added a lot of stuff apparently

* Stay back a version on portduino for now

* It wasn't this. I need to remove the docker build from ci
2023-06-27 07:08:32 -05:00
Ben Meadors
7711b03bd8
Update nrf and esp32 platform versions (#2486) 2023-05-12 08:38:53 -05:00
Thomas Göttgens
1d90096cba rearrange pio build system dependencies
also update trunk
2023-05-08 14:40:10 +02:00
Ben Meadors
e737a22120
Platform updates (#2340)
* 6.1.0

* Update libs

* Update nrf52 while we're at it

* Remove temporary heltec platform packages

* Update install scripts to flash s3 ota partition bin
2023-03-09 12:45:38 -06:00
Thomas Göttgens
5fd00b2538 - make a template class for API Server
- Skip a lot of duplicate code
- add a hexDump output - might come in handy
- refactor directory names
- remove unused debugOut that was generating template errors
2023-01-09 17:03:52 +01:00
Thomas Göttgens
103c82bc2c only build on vanilla RAK4631 for now. 2022-10-22 16:42:36 +02:00
Thomas Göttgens
f8982ddaf8 Best Practise Platformio 6.x dependency definitions 2022-10-10 15:42:05 +02:00
Thomas Göttgens
b5adb7babc
Update nrf52840.ini 2022-10-10 15:09:31 +02:00
Thomas Göttgens
63ced7da7c use upstream nRF52 toolkit. (TEST)
also RTC Lib 1.0.1 is finally out.
2022-10-07 20:28:20 +02:00
Thomas Göttgens
b2ff628cec add versioning to all lib depends (compatible upgrade allowed) and move as many as possible off github and into PIO registry.
Also add a script to check for lib updates (maybe in CI?)
2022-10-04 08:40:39 +02:00
Thomas Göttgens
eac2613743 make platformio.ini even more modular 2022-09-12 14:02:21 +02:00