mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-21 02:02:23 +00:00
remove newline from logging statements. (#5022)
remove newline from logging statements in code. The LOG_* functions will now magically add it at the end. --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -175,31 +175,31 @@ CryptoKey Channels::getKey(ChannelIndex chIndex)
|
||||
k.length = channelSettings.psk.size;
|
||||
if (k.length == 0) {
|
||||
if (ch.role == meshtastic_Channel_Role_SECONDARY) {
|
||||
LOG_DEBUG("Unset PSK for secondary channel %s. using primary key\n", ch.settings.name);
|
||||
LOG_DEBUG("Unset PSK for secondary channel %s. using primary key", ch.settings.name);
|
||||
k = getKey(primaryIndex);
|
||||
} else {
|
||||
LOG_WARN("User disabled encryption\n");
|
||||
LOG_WARN("User disabled encryption");
|
||||
}
|
||||
} else if (k.length == 1) {
|
||||
// Convert the short single byte variants of psk into variant that can be used more generally
|
||||
|
||||
uint8_t pskIndex = k.bytes[0];
|
||||
LOG_DEBUG("Expanding short PSK #%d\n", pskIndex);
|
||||
LOG_DEBUG("Expanding short PSK #%d", pskIndex);
|
||||
if (pskIndex == 0)
|
||||
k.length = 0; // Turn off encryption
|
||||
else if (oemStore.oem_aes_key.size > 1) {
|
||||
// Use the OEM key
|
||||
LOG_DEBUG("Using OEM Key with %d bytes\n", oemStore.oem_aes_key.size);
|
||||
LOG_DEBUG("Using OEM Key with %d bytes", oemStore.oem_aes_key.size);
|
||||
memcpy(k.bytes, oemStore.oem_aes_key.bytes, oemStore.oem_aes_key.size);
|
||||
k.length = oemStore.oem_aes_key.size;
|
||||
// Bump up the last byte of PSK as needed
|
||||
uint8_t *last = k.bytes + oemStore.oem_aes_key.size - 1;
|
||||
*last = *last + pskIndex - 1; // index of 1 means no change vs defaultPSK
|
||||
if (k.length < 16) {
|
||||
LOG_WARN("OEM provided a too short AES128 key - padding\n");
|
||||
LOG_WARN("OEM provided a too short AES128 key - padding");
|
||||
k.length = 16;
|
||||
} else if (k.length < 32 && k.length != 16) {
|
||||
LOG_WARN("OEM provided a too short AES256 key - padding\n");
|
||||
LOG_WARN("OEM provided a too short AES256 key - padding");
|
||||
k.length = 32;
|
||||
}
|
||||
} else {
|
||||
@@ -212,12 +212,12 @@ CryptoKey Channels::getKey(ChannelIndex chIndex)
|
||||
} else if (k.length < 16) {
|
||||
// Error! The user specified only the first few bits of an AES128 key. So by convention we just pad the rest of the
|
||||
// key with zeros
|
||||
LOG_WARN("User provided a too short AES128 key - padding\n");
|
||||
LOG_WARN("User provided a too short AES128 key - padding");
|
||||
k.length = 16;
|
||||
} else if (k.length < 32 && k.length != 16) {
|
||||
// Error! The user specified only the first few bits of an AES256 key. So by convention we just pad the rest of the
|
||||
// key with zeros
|
||||
LOG_WARN("User provided a too short AES256 key - padding\n");
|
||||
LOG_WARN("User provided a too short AES256 key - padding");
|
||||
k.length = 32;
|
||||
}
|
||||
}
|
||||
@@ -267,7 +267,7 @@ void Channels::onConfigChanged()
|
||||
}
|
||||
#if !MESHTASTIC_EXCLUDE_MQTT
|
||||
if (channels.anyMqttEnabled() && mqtt && !mqtt->isEnabled()) {
|
||||
LOG_DEBUG("MQTT is enabled on at least one channel, so set MQTT thread to run immediately\n");
|
||||
LOG_DEBUG("MQTT is enabled on at least one channel, so set MQTT thread to run immediately");
|
||||
mqtt->start();
|
||||
}
|
||||
#endif
|
||||
@@ -280,7 +280,7 @@ meshtastic_Channel &Channels::getByIndex(ChannelIndex chIndex)
|
||||
meshtastic_Channel *ch = channelFile.channels + chIndex;
|
||||
return *ch;
|
||||
} else {
|
||||
LOG_ERROR("Invalid channel index %d > %d, malformed packet received?\n", chIndex, channelFile.channels_count);
|
||||
LOG_ERROR("Invalid channel index %d > %d, malformed packet received?", chIndex, channelFile.channels_count);
|
||||
|
||||
static meshtastic_Channel *ch = (meshtastic_Channel *)malloc(sizeof(meshtastic_Channel));
|
||||
memset(ch, 0, sizeof(meshtastic_Channel));
|
||||
@@ -384,11 +384,11 @@ bool Channels::hasDefaultChannel()
|
||||
bool Channels::decryptForHash(ChannelIndex chIndex, ChannelHash channelHash)
|
||||
{
|
||||
if (chIndex > getNumChannels() || getHash(chIndex) != channelHash) {
|
||||
// LOG_DEBUG("Skipping channel %d (hash %x) due to invalid hash/index, want=%x\n", chIndex, getHash(chIndex),
|
||||
// LOG_DEBUG("Skipping channel %d (hash %x) due to invalid hash/index, want=%x", chIndex, getHash(chIndex),
|
||||
// channelHash);
|
||||
return false;
|
||||
} else {
|
||||
LOG_DEBUG("Using channel %d (hash 0x%x)\n", chIndex, channelHash);
|
||||
LOG_DEBUG("Using channel %d (hash 0x%x)", chIndex, channelHash);
|
||||
setCrypto(chIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user