|
| uint8_t | rf24ccm::xtime (uint8_t x) |
| uint8_t | rf24ccm::rotl8 (uint8_t x, uint8_t shift) |
| const uint8_t * | rf24ccm::sbox () |
| void | rf24ccm::aesExpandKey (const uint8_t key[16], uint8_t roundKeys[176]) |
| void | rf24ccm::aesEncryptBlock (const uint8_t roundKeys[176], const uint8_t in[16], uint8_t out[16]) |
| void | rf24ccm::ccmMac (const uint8_t roundKeys[176], const uint8_t *nonce, uint8_t nonceLen, const uint8_t *aad, size_t aadLen, const uint8_t *msg, size_t msgLen, uint8_t micLen, uint8_t mac[16]) |
| void | rf24ccm::ccmCtr (const uint8_t roundKeys[176], const uint8_t *nonce, uint8_t nonceLen, const uint8_t *in, size_t len, uint8_t *out, uint8_t s0[16]) |
| void | rf24ccm::ccmEncrypt (const uint8_t roundKeys[176], const uint8_t *nonce, uint8_t nonceLen, const uint8_t *aad, size_t aadLen, const uint8_t *in, size_t len, uint8_t *out, uint8_t *mic, uint8_t micLen) |
| bool | rf24ccm::ccmDecrypt (const uint8_t roundKeys[176], const uint8_t *nonce, uint8_t nonceLen, const uint8_t *aad, size_t aadLen, const uint8_t *in, size_t len, const uint8_t *mic, uint8_t micLen, uint8_t *out) |
An RF24 radio wrapper that encrypts and authenticates every radio frame with AES-128 CCM, using the same over-the-air format as the nrf_to_nrf library's CCM encryption. This lets Linux nodes (RF24Network, RF24Mesh and RF24Gateway) communicate with nRF52840 nodes that have radio.enableEncryption = true.
Frame format (the dynamic payload as seen by an nRF24L01):
| IV (5 bytes) | packet counter (3 bytes, little endian) | ciphertext | MIC (4 bytes) |
The nonce follows the Bluetooth LE CCM layout used by the nRF52 CCM peripheral: packet counter (5 bytes, little endian, direction bit 0) followed by the 8 byte IV (5 transmitted bytes, 3 zero bytes). The additional authenticated data is a single 0x00 byte.
Every frame carries 12 bytes of overhead, so an encrypted 32 byte frame holds 20 bytes of RF24Network data: an 8 byte header plus 12 bytes of payload.