Skip to content

Commit

Permalink
Update NodeDB.cpp
Browse files Browse the repository at this point in the history
Trunk
  • Loading branch information
gjelsoe committed Nov 16, 2024
1 parent 90974f3 commit dbab5d7
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/mesh/NodeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,26 +410,26 @@ void NodeDB::installDefaultConfig(bool preserveKey = false)
// Initialize admin_key_count to zero
byte numAdminKeys = 0;

// Check if USERPREFS_ADMIN_KEY_0 is non-empty
if (sizeof(USERPREFS_ADMIN_KEY_0) > 0) {
memcpy(config.security.admin_key[numAdminKeys].bytes, USERPREFS_ADMIN_KEY_0, 32);
config.security.admin_key[numAdminKeys].size = 32;
numAdminKeys++;
}
// Check if USERPREFS_ADMIN_KEY_0 is non-empty
if (sizeof(USERPREFS_ADMIN_KEY_0) > 0) {
memcpy(config.security.admin_key[numAdminKeys].bytes, USERPREFS_ADMIN_KEY_0, 32);
config.security.admin_key[numAdminKeys].size = 32;
numAdminKeys++;
}

// Check if USERPREFS_ADMIN_KEY_1 is non-empty
if (sizeof(USERPREFS_ADMIN_KEY_1) > 0) {
memcpy(config.security.admin_key[numAdminKeys].bytes, USERPREFS_ADMIN_KEY_1, 32);
config.security.admin_key[numAdminKeys].size = 32;
numAdminKeys++;
}
// Check if USERPREFS_ADMIN_KEY_1 is non-empty
if (sizeof(USERPREFS_ADMIN_KEY_1) > 0) {
memcpy(config.security.admin_key[numAdminKeys].bytes, USERPREFS_ADMIN_KEY_1, 32);
config.security.admin_key[numAdminKeys].size = 32;
numAdminKeys++;
}

// Check if USERPREFS_ADMIN_KEY_2 is non-empty
if (sizeof(USERPREFS_ADMIN_KEY_2) > 0) {
memcpy(config.security.admin_key[config.security.admin_key_count].bytes, USERPREFS_ADMIN_KEY_2, 32);
config.security.admin_key[config.security.admin_key_count].size = 32;
numAdminKeys++;
}
// Check if USERPREFS_ADMIN_KEY_2 is non-empty
if (sizeof(USERPREFS_ADMIN_KEY_2) > 0) {
memcpy(config.security.admin_key[config.security.admin_key_count].bytes, USERPREFS_ADMIN_KEY_2, 32);
config.security.admin_key[config.security.admin_key_count].size = 32;
numAdminKeys++;
}
config.security.admin_key_count = numAdminKeys;
#endif
if (shouldPreserveKey) {
Expand Down

0 comments on commit dbab5d7

Please sign in to comment.