Added XTEA and Pearson Hashing.

Improved message encryption for RF24.
This commit is contained in:
2018-09-22 22:05:53 +02:00
committed by matzman
parent 15351cdd5b
commit b37cd045d5
12 changed files with 270 additions and 7 deletions
+16
View File
@@ -36,9 +36,16 @@
#include <stdint.h>
#endif
#define PROTOCOL_VERSION (2u) //!< The version of the protocol
#define MAX_MESSAGE_LENGTH (32u) //!< The maximum size of a message (including header)
#if (defined (MY_MESSAGE_ENABLE_HASH) && defined(MY_MESSAGE_ENABLE_NONCE))
#define HEADER_SIZE (11u) //!< The size of the header
#elif (defined (MY_MESSAGE_ENABLE_HASH) || defined(MY_MESSAGE_ENABLE_NONCE))
#define HEADER_SIZE (9u) //!< The size of the header
#else
#define HEADER_SIZE (7u) //!< The size of the header
#endif
#define MAX_PAYLOAD (MAX_MESSAGE_LENGTH - HEADER_SIZE) //!< The maximum size of a payload depends on #MAX_MESSAGE_LENGTH and #HEADER_SIZE
/// @brief The command field (message-type) defines the overall properties of a message
@@ -495,6 +502,15 @@ typedef union {
* 3 bit - Payload data type
*/
uint8_t command_ack_payload;
#if defined (MY_MESSAGE_ENABLE_NONCE)
// The salt/nonce need to be in the first XTEA block
uint16_t _nounce; // 16 bit - nounce
#endif
#if defined (MY_MESSAGE_ENABLE_HASH)
uint16_t _hash; // 16 bit - CRC16 checksum
#endif
uint8_t type; ///< 8 bit - Type varies depending on command
uint8_t sensor; ///< 8 bit - Id of sensor that this message concerns.