mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-28 23:50:06 +00:00
Pkc fix (#7722)
This commit is contained in:
parent
5136c8ba24
commit
915f882e1f
@ -529,8 +529,9 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
|
|||||||
#endif
|
#endif
|
||||||
// Don't use PKC with Ham mode
|
// Don't use PKC with Ham mode
|
||||||
!owner.is_licensed &&
|
!owner.is_licensed &&
|
||||||
// Don't use PKC if it's not explicitly requested and a non-primary channel is requested
|
// Don't use PKC on 'serial' or 'gpio' channels unless explicitly requested
|
||||||
!(p->pki_encrypted != true && p->channel > 0) &&
|
!(p->pki_encrypted != true && (strcasecmp(channels.getName(chIndex), Channels::serialChannel) == 0 ||
|
||||||
|
strcasecmp(channels.getName(chIndex), Channels::gpioChannel) == 0)) &&
|
||||||
// Check for valid keys and single node destination
|
// Check for valid keys and single node destination
|
||||||
config.security.private_key.size == 32 && !isBroadcast(p->to) && node != nullptr &&
|
config.security.private_key.size == 32 && !isBroadcast(p->to) && node != nullptr &&
|
||||||
// Check for a known public key for the destination
|
// Check for a known public key for the destination
|
||||||
|
@ -505,7 +505,9 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
if (mp.decoded.want_response && !myReply) {
|
if (mp.decoded.want_response && !myReply) {
|
||||||
myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp);
|
myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp);
|
||||||
}
|
}
|
||||||
|
if (mp.pki_encrypted) {
|
||||||
|
myReply->pki_encrypted = true;
|
||||||
|
}
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -941,6 +943,9 @@ void AdminModule::handleGetOwner(const meshtastic_MeshPacket &req)
|
|||||||
res.which_payload_variant = meshtastic_AdminMessage_get_owner_response_tag;
|
res.which_payload_variant = meshtastic_AdminMessage_get_owner_response_tag;
|
||||||
setPassKey(&res);
|
setPassKey(&res);
|
||||||
myReply = allocDataProtobuf(res);
|
myReply = allocDataProtobuf(res);
|
||||||
|
if (req.pki_encrypted) {
|
||||||
|
myReply->pki_encrypted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1012,6 +1017,9 @@ void AdminModule::handleGetConfig(const meshtastic_MeshPacket &req, const uint32
|
|||||||
res.which_payload_variant = meshtastic_AdminMessage_get_config_response_tag;
|
res.which_payload_variant = meshtastic_AdminMessage_get_config_response_tag;
|
||||||
setPassKey(&res);
|
setPassKey(&res);
|
||||||
myReply = allocDataProtobuf(res);
|
myReply = allocDataProtobuf(res);
|
||||||
|
if (req.pki_encrypted) {
|
||||||
|
myReply->pki_encrypted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1099,6 +1107,9 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const
|
|||||||
res.which_payload_variant = meshtastic_AdminMessage_get_module_config_response_tag;
|
res.which_payload_variant = meshtastic_AdminMessage_get_module_config_response_tag;
|
||||||
setPassKey(&res);
|
setPassKey(&res);
|
||||||
myReply = allocDataProtobuf(res);
|
myReply = allocDataProtobuf(res);
|
||||||
|
if (req.pki_encrypted) {
|
||||||
|
myReply->pki_encrypted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1123,6 +1134,9 @@ void AdminModule::handleGetNodeRemoteHardwarePins(const meshtastic_MeshPacket &r
|
|||||||
}
|
}
|
||||||
setPassKey(&r);
|
setPassKey(&r);
|
||||||
myReply = allocDataProtobuf(r);
|
myReply = allocDataProtobuf(r);
|
||||||
|
if (req.pki_encrypted) {
|
||||||
|
myReply->pki_encrypted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdminModule::handleGetDeviceMetadata(const meshtastic_MeshPacket &req)
|
void AdminModule::handleGetDeviceMetadata(const meshtastic_MeshPacket &req)
|
||||||
@ -1132,6 +1146,9 @@ void AdminModule::handleGetDeviceMetadata(const meshtastic_MeshPacket &req)
|
|||||||
r.which_payload_variant = meshtastic_AdminMessage_get_device_metadata_response_tag;
|
r.which_payload_variant = meshtastic_AdminMessage_get_device_metadata_response_tag;
|
||||||
setPassKey(&r);
|
setPassKey(&r);
|
||||||
myReply = allocDataProtobuf(r);
|
myReply = allocDataProtobuf(r);
|
||||||
|
if (req.pki_encrypted) {
|
||||||
|
myReply->pki_encrypted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &req)
|
void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &req)
|
||||||
@ -1200,6 +1217,9 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r
|
|||||||
r.which_payload_variant = meshtastic_AdminMessage_get_device_connection_status_response_tag;
|
r.which_payload_variant = meshtastic_AdminMessage_get_device_connection_status_response_tag;
|
||||||
setPassKey(&r);
|
setPassKey(&r);
|
||||||
myReply = allocDataProtobuf(r);
|
myReply = allocDataProtobuf(r);
|
||||||
|
if (req.pki_encrypted) {
|
||||||
|
myReply->pki_encrypted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdminModule::handleGetChannel(const meshtastic_MeshPacket &req, uint32_t channelIndex)
|
void AdminModule::handleGetChannel(const meshtastic_MeshPacket &req, uint32_t channelIndex)
|
||||||
@ -1211,6 +1231,9 @@ void AdminModule::handleGetChannel(const meshtastic_MeshPacket &req, uint32_t ch
|
|||||||
r.which_payload_variant = meshtastic_AdminMessage_get_channel_response_tag;
|
r.which_payload_variant = meshtastic_AdminMessage_get_channel_response_tag;
|
||||||
setPassKey(&r);
|
setPassKey(&r);
|
||||||
myReply = allocDataProtobuf(r);
|
myReply = allocDataProtobuf(r);
|
||||||
|
if (req.pki_encrypted) {
|
||||||
|
myReply->pki_encrypted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1220,6 +1243,9 @@ void AdminModule::handleGetDeviceUIConfig(const meshtastic_MeshPacket &req)
|
|||||||
r.which_payload_variant = meshtastic_AdminMessage_get_ui_config_response_tag;
|
r.which_payload_variant = meshtastic_AdminMessage_get_ui_config_response_tag;
|
||||||
r.get_ui_config_response = uiconfig;
|
r.get_ui_config_response = uiconfig;
|
||||||
myReply = allocDataProtobuf(r);
|
myReply = allocDataProtobuf(r);
|
||||||
|
if (req.pki_encrypted) {
|
||||||
|
myReply->pki_encrypted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdminModule::reboot(int32_t seconds)
|
void AdminModule::reboot(int32_t seconds)
|
||||||
|
Loading…
Reference in New Issue
Block a user