More meshtastik-like behavior

Can decode default channel (primary channel) with default password.

Revamped serial output.
This commit is contained in:
tuxphone
2024-04-30 20:01:13 +02:00
parent 84c10253e6
commit 9e9ae92849
54 changed files with 9150 additions and 92 deletions

View File

@ -0,0 +1,38 @@
// This is the CryptoEngine for STM32WL, it works also for CubeCell
#include "CryptoEngine.h"
#include "aes.hpp"
#include "configuration.h"
class STM32WLCryptoEngine : public CryptoEngine
{
public:
STM32WLCryptoEngine() {}
~STM32WLCryptoEngine() {}
/**
* Encrypt a packet
*
* @param bytes is updated in place
*/
virtual void encrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override
{
if (key.length > 0) {
AES_ctx ctx;
initNonce(fromNode, packetNum);
AES_init_ctx_iv(&ctx, key.bytes, nonce);
AES_CTR_xcrypt_buffer(&ctx, bytes, numBytes);
}
}
virtual void decrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override
{
// For CTR, the implementation is the same
encrypt(fromNode, packetNum, numBytes, bytes);
}
private:
};
CryptoEngine *crypto = new STM32WLCryptoEngine();