mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-10 07:02:11 +00:00
Retroactive trunkinate
This commit is contained in:
parent
5f6d9c3e27
commit
30356dcd97
@ -70,7 +70,8 @@ bool CryptoEngine::encryptCurve25519(uint32_t toNode, uint32_t fromNode, uint64_
|
||||
long extraNonceTmp = random();
|
||||
auth = bytesOut + numBytes;
|
||||
extraNonce = (uint32_t *)(auth + 8);
|
||||
memcpy(extraNonce, &extraNonceTmp, 4); // do not use dereference on potential non aligned pointers : *extraNonce = extraNonceTmp;
|
||||
memcpy(extraNonce, &extraNonceTmp,
|
||||
4); // do not use dereference on potential non aligned pointers : *extraNonce = extraNonceTmp;
|
||||
LOG_INFO("Random nonce value: %d\n", extraNonceTmp);
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(toNode);
|
||||
if (node->num < 1 || node->user.public_key.size == 0) {
|
||||
@ -87,7 +88,8 @@ bool CryptoEngine::encryptCurve25519(uint32_t toNode, uint32_t fromNode, uint64_
|
||||
printBytes("Attempting encrypt using 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(extraNonce, &extraNonceTmp, 4); // do not use dereference on potential non aligned pointers : *extraNonce = extraNonceTmp;
|
||||
memcpy(extraNonce, &extraNonceTmp,
|
||||
4); // do not use dereference on potential non aligned pointers : *extraNonce = extraNonceTmp;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -99,14 +101,14 @@ bool CryptoEngine::encryptCurve25519(uint32_t toNode, uint32_t fromNode, uint64_
|
||||
*/
|
||||
bool CryptoEngine::decryptCurve25519(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes, uint8_t *bytesOut)
|
||||
{
|
||||
uint8_t *auth; // set to last 8 bytes of text?
|
||||
uint8_t *auth; // set to last 8 bytes of text?
|
||||
uint32_t extraNonce; // pointer was not really used
|
||||
auth = bytes + numBytes - 12;
|
||||
#ifndef PIO_UNIT_TESTING
|
||||
memcpy(&extraNonce, auth +8, 4); // do not use dereference on potential non aligned pointers : (uint32_t *)(auth + 8);
|
||||
memcpy(&extraNonce, auth + 8, 4); // do not use dereference on potential non aligned pointers : (uint32_t *)(auth + 8);
|
||||
LOG_INFO("Random nonce value: %d\n", extraNonce);
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(fromNode);
|
||||
|
||||
|
||||
if (node == nullptr || node->num < 1 || node->user.public_key.size == 0) {
|
||||
LOG_DEBUG("Node or its public key not found in database\n");
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user