Commit Graph
100 Commits
Author SHA1 Message Date
Jonathan Bennett d21087f639 Update platform-native to pick up portduino crash fix (#4807) 2024-09-21 16:17:30 -05:00
Jonathan Bennett 0f3450ad44 Mark package workflows for gh hosted runners 2024-09-19 18:21:30 -05:00
Jonathan Bennett 114df8cb1b Pin sensorlib version 2024-09-19 13:29:17 -05:00
Jonathan Bennett d3a293a0d8 Flag semgrep to not run on self-hosted
The semgrep action runs inside a docker container, and docker in podman just doesn't work.
2024-09-19 12:10:39 -05:00
Jonathan Bennett c6196b2260 Update build_esp32.yml -- less CI fun 2024-09-18 01:11:08 -05:00
Jonathan Bennett 3eebdcefa4 More CI fun 2024-09-18 00:28:54 -05:00
Jonathan Bennett 4289cb089b Update package_raspbian.yml to build on self-hosted (#4761)
* Update package_raspbian.yml to build on self-hosted

* Update package_raspbian_armv7l.yml to use self hosted
2024-09-18 00:17:48 -05:00
Jonathan BennettandBen Meadors 2d52803dbd Add new admin error types (#4750)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2024-09-17 21:09:24 -05:00
Jonathan Bennett c78302a2ee Add hasPKC to deviceMetadata (#4755) 2024-09-17 19:34:05 -05:00
Jonathan Bennett a967dd52f3 More useful PKC logging (#4742) 2024-09-17 06:31:39 -05:00
Jonathan Bennett ff8baa1c85 Don't use PKC on a non-primary channel unless specifically requested (#4715)
* Don't use PKC on a non-primary channel unless specifically requested

* Don't change from channel 0 if we can send a PKC packet.
2024-09-15 09:26:43 -05:00
Jonathan Bennett 3a10a27851 Actually restrict remote hardware to gpio channel (#4717) 2024-09-15 06:27:59 -05:00
Jonathan BennettandBen Meadors 1ab5bf4355 Use the time.age() value to correct stale GPS times (#4705)
* Use the time.age() value to correct stale GPS times

* Trunk

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2024-09-14 07:44:40 -05:00
Jonathan BennettandGUVWAF 4e850296b6 Fix repeatedly getting new NodeNum and add more debug (#4674)
* All the debug

* Change `memccpy()` to `memcpy()`

* Brint all the bytes of the MAC Address from the NodeDB

* Check for blank MAC Address in ourown NodeDB entry

* One more `memccpy()`

* Clean-up debug log

---------

Co-authored-by: GUVWAF <thijs@havinga.eu>
2024-09-10 13:24:57 -05:00
Jonathan BennettandBen Meadors bf34329033 Adds the data bitfield and ok_to_mqtt bit (#4643)
* Don't filter PKI packets just for being encrypted.

* Add ok_to_mqtt config and bit

* Bitfield

* Adjust dontmqttmebro logic.

* Manipulate bitfield only in router.cpp

* Want_ack is not want_response

* Bitfield macros

* Use new Bitfield macro in MQTT.cpp

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2024-09-07 18:21:59 -05:00
Jonathan Bennett b71e12c5e5 Phone admin work (#4599)
* Don't throw an error on the sessionkey admin tag

* Throw an error on packet sent to 0
2024-08-31 15:04:35 -05:00
Jonathan Bennett 2b0113ae82 Consider an admin timestamp to be higher quality than from net (#4589) 2024-08-30 06:02:48 -05:00
Jonathan Bennett 5bc17a9911 Key regen and MQTT fix (#4585)
* Add public key regen

* Properly label and handle PKI MQTT packets

* Extra debug message to indicate PKI_UNKNOWN_PUBKEY

* Ternary!

* Don't call non-existant function on stm32

* Actually fix STM32 compilation
2024-08-29 16:28:03 -05:00
Jonathan Bennett 92eae39a1b Move Time set from system to main (#4583) 2024-08-29 05:39:30 -05:00
Jonathan BennettandBen Meadors e3ce3a3a4f Don't compare nodeDB macaddr to owner.macaddr, because in rare cases that may be unset. (#4562)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2024-08-28 11:25:54 -07:00
Jonathan Bennett 3c4d964334 Mask out random bits when doing queue ordering (#4561)
* Mask out random bits when doing queue ordering

* Parenthesis
2024-08-28 11:25:54 -07:00
Jonathan Bennett 574124aee5 Deal with admin_key being repeated (#4558) 2024-08-28 11:25:54 -07:00
Jonathan Bennett 9b2ef971c2 Fix copyPasta in NodeDB (#4538) 2024-08-28 11:25:54 -07:00
Jonathan Bennett 710fdbd4e5 Adds has_x bools to position packet. (#4540) 2024-08-28 11:25:54 -07:00
Jonathan BennettandBen Meadors ada61ae178 Don't compare nodeDB macaddr to owner.macaddr, because in rare cases that may be unset. (#4562)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2024-08-27 14:49:58 -05:00
Jonathan Bennett b9a8683a4b Mask out random bits when doing queue ordering (#4561)
* Mask out random bits when doing queue ordering

* Parenthesis
2024-08-26 15:48:47 -05:00
Jonathan Bennett 5824a8f4c1 Deal with admin_key being repeated (#4558) 2024-08-26 12:29:44 -05:00
Jonathan Bennett 00ea9182a4 Fix copyPasta in NodeDB (#4538) 2024-08-23 06:26:19 -05:00
Jonathan Bennett 601ae29fe9 Adds has_x bools to position packet. (#4540) 2024-08-23 06:25:40 -05:00
Jonathan BennettandBen Meadors ab7de7f6a0 Add handling for sessionkey config (#4513)
* Add handling for sessionkey config

* Protos

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2024-08-20 13:36:24 -05:00
Jonathan Bennett e20d57f3ad Merge pull request #4431 from meshtastic/2.5-changes
2.5 Changes
2024-08-19 18:18:51 -05:00
Jonathan Bennett 48dc222b75 Merge branch 'master' into 2.5-changes 2024-08-19 11:28:20 -05:00
Jonathan Bennett ab9268cba9 Admin session key debugging messages 2024-08-19 11:12:42 -05:00
Jonathan Bennett 273beef148 Re-set the extra-nonce value 2024-08-18 22:25:08 -05:00
Jonathan Bennett 94d5ee9fe6 Deal with adminModule session_time of 0 2024-08-18 22:22:21 -05:00
Jonathan Bennett 7b64c4a5bf Merge branch 'master' into 2.5-changes 2024-08-18 19:14:21 -05:00
Jonathan Bennett ecb4fb72db Don't break EXCLUDE_PKI 2024-08-18 15:51:43 -05:00
Jonathan Bennett f439081674 Don't segfault on PKI from unknown nodes 2024-08-18 14:11:39 -05:00
Jonathan Bennett bfbc4bf93a Set the private_key in crypto when changed by admin 2024-08-18 14:11:17 -05:00
Jonathan Bennett 22e129e716 bluetooth != security; security = security 2024-08-18 13:00:52 -05:00
Jonathan Bennett 23e3e6db92 Add 4 bytes of random nonce to PKI (#4493) 2024-08-18 07:23:56 -05:00
Jonathan Bennett c7c620ac69 Merge branch 'master' into 2.5-changes 2024-08-17 17:38:39 -05:00
Jonathan Bennett 1bbc273ba6 Don't reject network time updates unintentionally (#4489) 2024-08-17 17:35:05 -05:00
Jonathan Bennett 578ac6711b Merge branch 'master' into 2.5-changes 2024-08-17 15:39:41 -05:00
Jonathan Bennett daddaf7146 Merge branch 'master' into 2.5-changes 2024-08-17 12:24:19 -05:00
Jonathan Bennett 0b010b4fd8 Get STM32 building again by disabling admin module 2024-08-17 11:06:00 -05:00
Jonathan Bennett f86dde3c40 AdminModule session_passkey (#4478)
* Protobuf

* Adds session_passkey for remote admin changes
2024-08-17 08:41:12 -05:00
Jonathan Bennett 7cbae56e6c Merge branch 'master' into 2.5-changes 2024-08-16 19:39:10 -05:00
Jonathan Bennett 6eabbaf432 Add PKI logiv to KNOWN_ONLY and LOCAL_ONLY routing modes. 2024-08-16 19:37:28 -05:00
Jonathan Bennett cec8233cd1 Don't attempt PKI decryption on broadcast packets 2024-08-16 19:33:06 -05:00
Jonathan Bennett b0c1b7b7b5 MQTT PKI fixes 2024-08-16 10:10:08 -05:00
Jonathan Bennett ef56fae976 Merge branch 'master' into 2.5-changes 2024-08-15 11:21:25 -05:00
Jonathan Bennett ced87596cb Add PKI channel for MQTT (#4464)
* Add PKI channel for MQTT
2024-08-14 19:32:45 -05:00
Jonathan Bennett 1be635a797 Merge remote-tracking branch 'origin/master' into 2.5-changes 2024-08-14 19:01:06 -05:00
Jonathan Bennett 36f1a62b0b Merge remote-tracking branch 'origin/2.5-changes' into 2.5-changes 2024-08-14 18:56:41 -05:00
Jonathan Bennett 8ef72a5c08 Shorter nodeinfo timeout redux (#4458)
* Add shorterTimeout bool to sendOurNodeInfo

* Respond to likely PKI decode errors with a quick nodeinfo

* Protbufs

* Move to PKI_UNKNOWN_PUBKEY for PKI decode error
2024-08-14 17:17:53 -05:00
Jonathan Bennett 8ce1c07c4e Check for blank key coming from client 2024-08-13 22:34:21 -05:00
Jonathan Bennett 2661fc694f sync protobufs 2024-08-13 20:06:36 -05:00
Jonathan Bennett b528290fde Failure returns PKI_FAILED message if client requested PKI 2024-08-13 18:45:40 -05:00
Jonathan Bennett ff89dca5b3 Add PKI indicator to printPacket 2024-08-13 18:45:40 -05:00
Jonathan Bennett 80fd121d87 Add meshtastic_Routing_Error_NO_CHANNEL 2024-08-13 18:45:40 -05:00
Jonathan Bennett f3fa8daedf Revert "Add Routing_Error_NONE"
This reverts commit e1985fa0f90db0cbc346db18cecbf3604f6973c1.
2024-08-13 18:45:40 -05:00
Jonathan Bennett bcd77c4523 Cleanup public_keys (#4450) 2024-08-13 18:45:40 -05:00
Jonathan Bennett 308c0a6bb8 Add Routing_Error_NONE 2024-08-13 18:45:40 -05:00
Jonathan Bennett 754db3f2bc Finish fixing config migrate 2024-08-13 18:45:40 -05:00
Jonathan Bennett c16f20de21 Make "Alloc an error" a LOG_WARN 2024-08-13 18:45:40 -05:00
Jonathan Bennett b4cbea1b3d Move security migrate to if has_security 2024-08-13 18:45:40 -05:00
Jonathan Bennett b91d66b436 Don't forget public_key.size in converting back 2024-08-13 18:44:27 -05:00
Jonathan Bennett 7537b55586 Ungoober oldestBoring 2024-08-13 18:44:27 -05:00
Jonathan Bennett 2d18130235 Don't goober public_key in Userlite conversion 2024-08-13 18:44:27 -05:00
Jonathan Bennett 67ddae2851 Add logic to nodeDB to prefer evicting boring nodes (#4441) 2024-08-13 18:44:27 -05:00
Jonathan Bennett e7dfabc20f Exclude position packets from PKI (at least for now) 2024-08-13 18:43:19 -05:00
Jonathan Bennett 185eb318ad Manual protobuf update 2024-08-13 18:43:19 -05:00
Jonathan Bennett c86a3200f0 Add missed function rename. (Thanks VSCode) 2024-08-13 18:43:19 -05:00
Jonathan Bennett c3aa56ef30 Refactor platform cryptography, add tests 2024-08-13 18:43:19 -05:00
Jonathan Bennett 192af05a25 Fix compile on STM32 2024-08-13 18:43:19 -05:00
Jonathan Bennett 26d0b2b477 Add DH25519 unit test 2024-08-13 18:43:19 -05:00
Jonathan BennettandBen Meadors 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
Jonathan Bennett 9bd293a941 Don't forget public_key.size in converting back 2024-08-12 16:20:07 -05:00
Jonathan Bennett bc69621c3e Ungoober oldestBoring 2024-08-12 11:37:50 -05:00
Jonathan Bennett 2ee53d1500 Don't goober public_key in Userlite conversion 2024-08-12 11:27:05 -05:00
Jonathan Bennett bee959150b Add logic to nodeDB to prefer evicting boring nodes (#4441) 2024-08-12 06:43:54 -05:00
Jonathan Bennett 0bd17e6da6 Merge branch 'master' into 2.5-changes 2024-08-11 16:28:43 -05:00
Jonathan Bennett 9bc2224164 Exclude position packets from PKI (at least for now) 2024-08-11 14:18:33 -05:00
Jonathan Bennett e1b4b226c9 Manual protobuf update 2024-08-11 14:12:20 -05:00
Jonathan Bennett 54a2e14e35 Add missed function rename. (Thanks VSCode) 2024-08-10 23:11:04 -05:00
Jonathan Bennett 1cfd5d12d2 Refactor platform cryptography, add tests 2024-08-10 22:38:05 -05:00
Jonathan Bennett b573e0eacc Fix compile on STM32 2024-08-10 20:04:38 -05:00
Jonathan Bennett 8ca884bafd Add DH25519 unit test 2024-08-10 15:45:29 -05:00
Jonathan BennettandBen Meadors 74afd13171 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-10 13:45:41 -05:00
Jonathan Bennett c6a9edf8c7 Move printBytes to meshUtils (#4424) 2024-08-09 01:43:13 -05:00
Jonathan Bennett a7da3537e2 Adds MESHTASTIC_EXCLUDE_TZ option (#4423) 2024-08-09 00:52:31 -05:00
Jonathan BennettandBen Meadors 789e8f02bf Add more exclude options to save program ram/flash (#4408)
* Add PowerFSM Exclude option

* Add TEXTMESSAGE module exclude option

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2024-08-06 18:48:55 -05:00
Jonathan Bennett 7d00e1cef9 Output more useful log message when the NodeDB is full (#4389) 2024-08-04 18:52:10 -05:00
Jonathan Bennett 5453c495e2 Actually set the rand() seed for Portduino (#4380) 2024-08-03 13:12:22 -05:00
Jonathan Bennett d2ea430a3e Make SPI frequency and TOPHONE queue size configurable on Native (#4369)
* Make SPI frequency configurable on Native

* Make the tophone queue size configurable for Portduino

* The modified SPISettings must be configured in setup(), after config.yaml is processed

* make MeshService a pointer, so we can configure MAX_RX_TOPHONE at run time

* Got a little over excited with refactoring

* Silence a warning
2024-08-01 19:29:49 -05:00
Jonathan BennettandBen Meadors 1a1d545c38 Adds a userPrefs.h file, default blank, used for default settings for custom builds (#4325)
* add a userPrefs.h file, default blank, which can be used to easily set defaults on custom builds.

* Add Splash Screen to userPrefs

* Add channel 0 defaults to userPrefs.h

* CONFIG_LORA_IGNORE_MQTT_DEFAULT

* Unify naming for USERPREFS defines

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2024-07-28 14:12:30 -05:00
Jonathan BennettandBen Meadors 300c3d32aa Just a bit of security hygiene. (#4313)
* Make sure to call randomSeed() on esp32

* Randomize the top 22 bits of the Message ID

* Make it clear that we are not calling randomSeed() on purpose

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2024-07-23 11:52:14 -05:00
Jonathan Bennett e59e50af0e Update build_raspbian_armv7l.yml --fix-missing 2024-07-10 14:42:29 -05:00
Jonathan Bennett 51d54a7d99 Update trunk.yaml 2024-07-10 14:39:41 -05:00