mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-27 18:31:37 +00:00
ah feck
This commit is contained in:
parent
d8b85f9a09
commit
3a8ffe7ac2
@ -42,13 +42,12 @@ class ESP32CryptoEngine : public CryptoEngine
|
|||||||
virtual void encrypt(uint32_t fromNode, uint64_t packetId, size_t numBytes, uint8_t *bytes) override
|
virtual void encrypt(uint32_t fromNode, uint64_t packetId, size_t numBytes, uint8_t *bytes) override
|
||||||
{
|
{
|
||||||
if (key.length > 0) {
|
if (key.length > 0) {
|
||||||
uint8_t stream_block[16];
|
|
||||||
size_t nc_off = 0;
|
|
||||||
|
|
||||||
LOG_DEBUG("ESP32 crypt fr=%x, num=%x, numBytes=%d!\n", fromNode, (uint32_t) packetId, numBytes);
|
LOG_DEBUG("ESP32 crypt fr=%x, num=%x, numBytes=%d!\n", fromNode, (uint32_t) packetId, numBytes);
|
||||||
initNonce(fromNode, packetId);
|
initNonce(fromNode, packetId);
|
||||||
if (numBytes <= MAX_BLOCKSIZE) {
|
if (numBytes <= MAX_BLOCKSIZE) {
|
||||||
static uint8_t scratch[MAX_BLOCKSIZE];
|
static uint8_t scratch[MAX_BLOCKSIZE];
|
||||||
|
uint8_t stream_block[16];
|
||||||
|
size_t nc_off = 0;
|
||||||
memcpy(scratch, bytes, numBytes);
|
memcpy(scratch, bytes, numBytes);
|
||||||
memset(scratch + numBytes, 0,
|
memset(scratch + numBytes, 0,
|
||||||
sizeof(scratch) - numBytes); // Fill rest of buffer with zero (in case cypher looks at it)
|
sizeof(scratch) - numBytes); // Fill rest of buffer with zero (in case cypher looks at it)
|
||||||
|
Loading…
Reference in New Issue
Block a user