mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-13 08:32:08 +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();
|
long extraNonceTmp = random();
|
||||||
auth = bytesOut + numBytes;
|
auth = bytesOut + numBytes;
|
||||||
extraNonce = (uint32_t *)(auth + 8);
|
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);
|
LOG_INFO("Random nonce value: %d\n", extraNonceTmp);
|
||||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(toNode);
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(toNode);
|
||||||
if (node->num < 1 || node->user.public_key.size == 0) {
|
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);
|
printBytes("Attempting encrypt using shared_key starting with: ", shared_key, 8);
|
||||||
aes_ccm_ae(shared_key, 32, nonce, 8, bytes, numBytes, nullptr, 0, bytesOut,
|
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
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,11 +101,11 @@ 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)
|
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
|
uint32_t extraNonce; // pointer was not really used
|
||||||
auth = bytes + numBytes - 12;
|
auth = bytes + numBytes - 12;
|
||||||
#ifndef PIO_UNIT_TESTING
|
#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);
|
LOG_INFO("Random nonce value: %d\n", extraNonce);
|
||||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(fromNode);
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(fromNode);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user