Signature key resolution and a send-path leak (#11283)
* Verify signatures against authoritative keys only * Release the packet on the unset-variant send error
This commit is contained in:
co-authored by
GitHub
parent
daf1213580
commit
9c260ad792
+5
-1
@@ -465,6 +465,8 @@ ErrorCode Router::send(meshtastic_MeshPacket *p)
|
||||
|
||||
if (!(p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag ||
|
||||
p->which_payload_variant == meshtastic_MeshPacket_decoded_tag)) {
|
||||
// Error returns from here own the packet, as the position-precision path below does.
|
||||
packetPool.release(p);
|
||||
return meshtastic_Routing_Error_BAD_REQUEST;
|
||||
}
|
||||
|
||||
@@ -633,7 +635,9 @@ bool checkXeddsaReceivePolicy(meshtastic_MeshPacket *p)
|
||||
if (p->decoded.xeddsa_signature.size == XEDDSA_SIGNATURE_SIZE) {
|
||||
meshtastic_NodeInfoLite_public_key_t senderKey = {0, {0}};
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(p->from);
|
||||
if (nodeDB->copyPublicKey(p->from, senderKey)) {
|
||||
// Authoritative keys only: verifying against an opportunistic cache key would let a planted
|
||||
// key mark its own node a signer, the trust loop #11116 closed on the decrypt path.
|
||||
if (nodeDB->copyPublicKeyAuthoritative(p->from, senderKey)) {
|
||||
p->xeddsa_signed =
|
||||
crypto->xeddsa_verify(senderKey.bytes, p->from, p->id, p->decoded.portnum, p->decoded.payload.bytes,
|
||||
p->decoded.payload.size, p->decoded.xeddsa_signature.bytes);
|
||||
|
||||
Reference in New Issue
Block a user