37 lines
973 B
C
37 lines
973 B
C
#ifndef MESHCORE_FRAME_HEADER
|
|
#define MESHCORE_FRAME_HEADER
|
|
|
|
#include "stddef.h"
|
|
#include "stdint.h"
|
|
#include "lib/cifra/aes.h"
|
|
#include "lib/cifra/hmac.h"
|
|
#include "packetstructs.h"
|
|
|
|
|
|
#define KEY_SIZE 16 // 128-bit AES
|
|
#define HMAC_SIZE 2 // meshcore size
|
|
#define MAX_FLOOD_TTL 64
|
|
|
|
int ReadFrame (FrameStruct *frame, int8_t *rssiPacket, int8_t *snrPacket, int8_t *rawSnr);
|
|
|
|
void LoRaTransmit (const FrameStruct *frame);
|
|
|
|
/*
|
|
FrameStruct decodeFrame (unsigned char *data, unsigned char dataLen);
|
|
|
|
void sendFrame (const FrameStruct * frame);
|
|
*/
|
|
|
|
void printFrameHeader (const FrameStruct *frame);
|
|
|
|
// CALL LAST, PATH GETS MODIFIED
|
|
void retransmitFrame (FrameStruct *frame);
|
|
|
|
// Verify MAC + Decrypt
|
|
|
|
int encrypt_then_mac (const uint8_t *aes_key, const uint8_t keySize, const uint8_t *plaintext, size_t plen, uint8_t *output, size_t *olen);
|
|
|
|
int mac_then_decrypt (const uint8_t *aes_key, const uint8_t keySize, const uint8_t *input, size_t ilen, uint8_t *plaintext);
|
|
|
|
|
|
#endif |