From 94ecbad90442428a1ecf8a15b8c3d15a4bade060 Mon Sep 17 00:00:00 2001 From: Mictronics Date: Mon, 7 Oct 2024 19:44:21 +0200 Subject: [PATCH] Fix storage of admin key when installing default config. (#4995) * Fix LED pinout for T-Echo board marked v1.0, date 2021-6-28 * Merge PR #420 * Fixed double and missing Default class. * Use correct format specifier and fixed typo. * Removed duplicate code. * Fix error: #if with no expression * Fix warning: extra tokens at end of #endif directive. * Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board. * Fix deprecated macros. * Set RP2040 in dormant mode when deep sleep is triggered. * Fix array out of bounds read. * Admin key count needs to be set otherwise the key will be zero loaded after reset. * Don't reset the admin key size when loading defaults. Preserve an existing key in config if possible. --------- Co-authored-by: Ben Meadors --- src/mesh/NodeDB.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 639e8109b..97ded5a50 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -317,8 +317,7 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) #ifdef USERPREFS_USE_ADMIN_KEY memcpy(config.security.admin_key[0].bytes, USERPREFS_ADMIN_KEY, 32); config.security.admin_key[0].size = 32; -#else - config.security.admin_key[0].size = 0; + config.security.admin_key_count = 1; #endif if (shouldPreserveKey) { config.security.private_key.size = 32;