SX126x-Arduino  1.2.1
Macros | Functions | Variables
LoRaMacCrypto.cpp File Reference
#include <stdlib.h>
#include <stdint.h>
#include "system/utilities.h"
#include "system/crypto/aes.h"
#include "system/crypto/cmac.h"
#include "LoRaMacCrypto.h"

Macros

#define LORAMAC_MIC_BLOCK_B0_SIZE   16
 

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)
 

Variables

static uint8_t MicBlockB0 []
 
static uint8_t Mic [16]
 
static uint8_t aBlock []
 
static uint8_t sBlock []
 
static lora_aes_context AesContext
 
static AES_CMAC_CTX AesCmacCtx [1]
 

Macro Definition Documentation

◆ LORAMAC_MIC_BLOCK_B0_SIZE

#define LORAMAC_MIC_BLOCK_B0_SIZE   16

CMAC/AES Message Integrity Code (MIC) Block B0 size

Variable Documentation

◆ MicBlockB0

uint8_t MicBlockB0[]
static
Initial value:
= {0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

MIC field computation initial data

◆ Mic

uint8_t Mic[16]
static

Contains the computed MIC field.

Remarks
Only the 4 first bytes are used

◆ aBlock

uint8_t aBlock[]
static
Initial value:
= {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

Encryption aBlock and sBlock

◆ sBlock

uint8_t sBlock[]
static
Initial value:
= {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

◆ AesContext

lora_aes_context AesContext
static

AES computation context variable

◆ AesCmacCtx

AES_CMAC_CTX AesCmacCtx[1]
static

CMAC computation context variable