SX126x-Arduino
Functions
LoRa MAC layer cryptography implementation

This module covers the implementation of cryptographic functions of the LoRaMAC layer. More...

Functions

void LoRaMacComputeMic (const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t address, uint8_t dir, uint32_t sequenceCounter, uint32_t *mic)
 
void LoRaMacPayloadEncrypt (const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t address, uint8_t dir, uint32_t sequenceCounter, uint8_t *encBuffer)
 
void LoRaMacPayloadDecrypt (const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t address, uint8_t dir, uint32_t sequenceCounter, uint8_t *decBuffer)
 
void LoRaMacJoinComputeMic (const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t *mic)
 
void LoRaMacJoinDecrypt (const uint8_t *buffer, uint16_t size, const uint8_t *key, uint8_t *decBuffer)
 
void LoRaMacJoinComputeSKeys (const uint8_t *key, const uint8_t *appNonce, uint16_t devNonce, uint8_t *nwkSKey, uint8_t *appSKey)
 

Detailed Description

This module covers the implementation of cryptographic functions of the LoRaMAC layer.

Function Documentation

◆ LoRaMacComputeMic()

void LoRaMacComputeMic ( const uint8_t *  buffer,
uint16_t  size,
const uint8_t *  key,
uint32_t  address,
uint8_t  dir,
uint32_t  sequenceCounter,
uint32_t *  mic 
)

Computes the LoRaMAC frame MIC field

Parameters
buffer- Data buffer
size- Data buffer size
key- AES key to be used
address- Frame address
dir- Frame direction [0: uplink, 1: downlink]
sequenceCounter- Frame sequence counter
mic- Computed MIC field

◆ LoRaMacPayloadEncrypt()

void LoRaMacPayloadEncrypt ( const uint8_t *  buffer,
uint16_t  size,
const uint8_t *  key,
uint32_t  address,
uint8_t  dir,
uint32_t  sequenceCounter,
uint8_t *  encBuffer 
)

Computes the LoRaMAC payload encryption

Parameters
buffer- Data buffer
size- Data buffer size
key- AES key to be used
address- Frame address
dir- Frame direction [0: uplink, 1: downlink]
sequenceCounter- Frame sequence counter
encBuffer- Encrypted buffer

◆ LoRaMacPayloadDecrypt()

void LoRaMacPayloadDecrypt ( const uint8_t *  buffer,
uint16_t  size,
const uint8_t *  key,
uint32_t  address,
uint8_t  dir,
uint32_t  sequenceCounter,
uint8_t *  decBuffer 
)

Computes the LoRaMAC payload decryption

Parameters
buffer- Data buffer
size- Data buffer size
key- AES key to be used
address- Frame address
dir- Frame direction [0: uplink, 1: downlink]
sequenceCounter- Frame sequence counter
decBuffer- Decrypted buffer

◆ LoRaMacJoinComputeMic()

void LoRaMacJoinComputeMic ( const uint8_t *  buffer,
uint16_t  size,
const uint8_t *  key,
uint32_t *  mic 
)

Computes the LoRaMAC Join Request frame MIC field

Parameters
buffer- Data buffer
size- Data buffer size
key- AES key to be used
mic- Computed MIC field

◆ LoRaMacJoinDecrypt()

void LoRaMacJoinDecrypt ( const uint8_t *  buffer,
uint16_t  size,
const uint8_t *  key,
uint8_t *  decBuffer 
)

Computes the LoRaMAC join frame decryption

Parameters
buffer- Data buffer
size- Data buffer size
key- AES key to be used
decBuffer- Decrypted buffer

◆ LoRaMacJoinComputeSKeys()

void LoRaMacJoinComputeSKeys ( const uint8_t *  key,
const uint8_t *  appNonce,
uint16_t  devNonce,
uint8_t *  nwkSKey,
uint8_t *  appSKey 
)

Computes the LoRaMAC join frame decryption

Parameters
key- AES key to be used
appNonce- Application nonce
devNonce- Device nonce
nwkSKey- Network session key
appSKey- Application session key