From 7221fc4d4b1f66dd1bc1f52bcbeec888b59b8ddd Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn Date: Sat, 24 Jan 2026 12:19:19 +0100 Subject: [PATCH] Delete unused code (#9350) * Delete unused code CryptoEngine::clearKeys() is not used in the code base, therefore this cleanup removes the code. It might give casual reviewers the impression, that keys are wiped. Since the code uses memset() which might be optimized away by the compiler, using the code might not even cause the memory to be wiped. * Update CryptoEngine.cpp Fix stray newline, this is the only thing that I can come up with that might confuse the linter. --------- Co-authored-by: Jason P --- src/mesh/CryptoEngine.cpp | 5 ----- src/mesh/CryptoEngine.h | 1 - 2 files changed, 6 deletions(-) diff --git a/src/mesh/CryptoEngine.cpp b/src/mesh/CryptoEngine.cpp index 9ca16878d..0f4d64113 100644 --- a/src/mesh/CryptoEngine.cpp +++ b/src/mesh/CryptoEngine.cpp @@ -61,11 +61,6 @@ bool CryptoEngine::regeneratePublicKey(uint8_t *pubKey, uint8_t *privKey) return true; } #endif -void CryptoEngine::clearKeys() -{ - memset(public_key, 0, sizeof(public_key)); - memset(private_key, 0, sizeof(private_key)); -} /** * Encrypt a packet's payload using a key generated with Curve25519 and SHA256 diff --git a/src/mesh/CryptoEngine.h b/src/mesh/CryptoEngine.h index 6bbcb3b8a..7689006ab 100644 --- a/src/mesh/CryptoEngine.h +++ b/src/mesh/CryptoEngine.h @@ -37,7 +37,6 @@ class CryptoEngine virtual bool regeneratePublicKey(uint8_t *pubKey, uint8_t *privKey); #endif - void clearKeys(); void setDHPrivateKey(uint8_t *_private_key); virtual bool encryptCurve25519(uint32_t toNode, uint32_t fromNode, meshtastic_UserLite_public_key_t remotePublic, uint64_t packetNum, size_t numBytes, const uint8_t *bytes, uint8_t *bytesOut);