From c7e44a2301e4cb8f6bb0dcf0ee14187c68f4036a Mon Sep 17 00:00:00 2001 From: "Jason B. Cox" Date: Thu, 3 Apr 2025 09:37:32 -0700 Subject: [PATCH] Use the shared secret cache in PKC ops --- src/mesh/CryptoEngine.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mesh/CryptoEngine.cpp b/src/mesh/CryptoEngine.cpp index 73ffdf40e..5624f0cbc 100644 --- a/src/mesh/CryptoEngine.cpp +++ b/src/mesh/CryptoEngine.cpp @@ -79,10 +79,9 @@ bool CryptoEngine::encryptCurve25519(uint32_t toNode, uint32_t fromNode, meshtas LOG_DEBUG("Node %d or their public_key not found", toNode); return false; } - if (!setDHPublicKey(remotePublic.bytes)) { + if (!setCryptoSharedSecret(remotePublic)) { return false; } - hash(shared_key, 32); initNonce(fromNode, packetNum, extraNonceTmp); // Calculate the shared secret with the destination node and encrypt @@ -121,10 +120,9 @@ bool CryptoEngine::decryptCurve25519(uint32_t fromNode, meshtastic_UserLite_publ } // Calculate the shared secret with the sending node and decrypt - if (!setDHPublicKey(remotePublic.bytes)) { + if (!setCryptoSharedSecret(remotePublic)) { return false; } - hash(shared_key, 32); initNonce(fromNode, packetNum, extraNonce); printBytes("Attempt decrypt with nonce: ", nonce, 13);