mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-29 22:20:37 +00:00
More reduction (#5256)
* Now with even fewer ings * Ye * Mo * QMA6100PSensor
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
void CryptoEngine::generateKeyPair(uint8_t *pubKey, uint8_t *privKey)
|
||||
{
|
||||
LOG_DEBUG("Generating Curve25519 keypair");
|
||||
LOG_DEBUG("Generate Curve25519 keypair");
|
||||
Curve25519::dh1(public_key, private_key);
|
||||
memcpy(pubKey, public_key, sizeof(public_key));
|
||||
memcpy(privKey, private_key, sizeof(private_key));
|
||||
@@ -80,8 +80,8 @@ bool CryptoEngine::encryptCurve25519(uint32_t toNode, uint32_t fromNode, meshtas
|
||||
initNonce(fromNode, packetNum, extraNonceTmp);
|
||||
|
||||
// Calculate the shared secret with the destination node and encrypt
|
||||
printBytes("Attempt encrypt using nonce: ", nonce, 13);
|
||||
printBytes("Attempt encrypt using shared_key starting with: ", shared_key, 8);
|
||||
printBytes("Attempt encrypt with nonce: ", nonce, 13);
|
||||
printBytes("Attempt encrypt with shared_key starting with: ", shared_key, 8);
|
||||
aes_ccm_ae(shared_key, 32, nonce, 8, bytes, numBytes, nullptr, 0, bytesOut,
|
||||
auth); // this can write up to 15 bytes longer than numbytes past bytesOut
|
||||
memcpy((uint8_t *)(auth + 8), &extraNonceTmp,
|
||||
@@ -117,8 +117,8 @@ bool CryptoEngine::decryptCurve25519(uint32_t fromNode, meshtastic_UserLite_publ
|
||||
crypto->hash(shared_key, 32);
|
||||
|
||||
initNonce(fromNode, packetNum, extraNonce);
|
||||
printBytes("Attempt decrypt using nonce: ", nonce, 13);
|
||||
printBytes("Attempt decrypt using shared_key starting with: ", shared_key, 8);
|
||||
printBytes("Attempt decrypt with nonce: ", nonce, 13);
|
||||
printBytes("Attempt decrypt with shared_key starting with: ", shared_key, 8);
|
||||
return aes_ccm_ad(shared_key, 32, nonce, 8, bytes, numBytes - 12, nullptr, 0, auth, bytesOut);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user