Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions
LoRaMacCrypto Class Reference

#include <LoRaMacCrypto.h>

Public Member Functions

 LoRaMacCrypto ()
 Constructor. More...
 
 ~LoRaMacCrypto ()
 Destructor. More...
 
int compute_mic (const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t key_length, uint32_t address, uint8_t dir, uint32_t seq_counter, uint32_t *mic)
 Computes the LoRaMAC frame MIC field. More...
 
int encrypt_payload (const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t key_length, uint32_t address, uint8_t dir, uint32_t seq_counter, uint8_t *enc_buffer)
 Performs payload encryption. More...
 
int decrypt_payload (const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t key_length, uint32_t address, uint8_t dir, uint32_t seq_counter, uint8_t *dec_buffer)
 Performs payload decryption. More...
 
int compute_join_frame_mic (const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t key_length, uint32_t *mic)
 Computes the LoRaMAC Join Request frame MIC field. More...
 
int decrypt_join_frame (const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t key_length, uint8_t *dec_buffer)
 Computes the LoRaMAC join frame decryption. More...
 
int compute_skeys_for_join_frame (const uint8_t *key, uint32_t key_length, const uint8_t *app_nonce, uint16_t dev_nonce, uint8_t *nwk_skey, uint8_t *app_skey)
 Computes the LoRaMAC join frame decryption. More...
 

Detailed Description

/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
___ _____ _ ___ _ _____ ___ ___ ___ ___
/ __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
\__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
|___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
embedded.connectivity.solutions===============

Description: LoRa MAC Crypto implementation

License: Revised BSD License, see LICENSE.TXT file include in the project

Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )

Copyright (c) 2017, Arm Limited and affiliates.

SPDX-License-Identifier: BSD-3-Clause

Definition at line 38 of file LoRaMacCrypto.h.

Constructor & Destructor Documentation

Constructor.

Destructor.

Member Function Documentation

int compute_join_frame_mic ( const uint8_t *  buffer,
uint16_t  size,
const uint8_t *  key,
uint32_t  key_length,
uint32_t *  mic 
)

Computes the LoRaMAC Join Request frame MIC field.

Parameters
[in]buffer- Data buffer
[in]size- Data buffer size
[in]key- AES key to be used
[in]key_length- Length of the key (bits)
[out]mic- Computed MIC field
Returns
0 if successful, or a cipher specific error code
int compute_mic ( const uint8_t *  buffer,
uint16_t  size,
const uint8_t *  key,
uint32_t  key_length,
uint32_t  address,
uint8_t  dir,
uint32_t  seq_counter,
uint32_t *  mic 
)

Computes the LoRaMAC frame MIC field.

Parameters
[in]buffer- Data buffer
[in]size- Data buffer size
[in]key- AES key to be used
[in]key_length- Length of the key (bits)
[in]address- Frame address
[in]dir- Frame direction [0: uplink, 1: downlink]
[in]seq_counter- Frame sequence counter
[out]mic- Computed MIC field
Returns
0 if successful, or a cipher specific error code
int compute_skeys_for_join_frame ( const uint8_t *  key,
uint32_t  key_length,
const uint8_t *  app_nonce,
uint16_t  dev_nonce,
uint8_t *  nwk_skey,
uint8_t *  app_skey 
)

Computes the LoRaMAC join frame decryption.

Parameters
[in]key- AES key to be used
[in]key_length- Length of the key (bits)
[in]app_nonce- Application nonce
[in]dev_nonce- Device nonce
[out]nwk_skey- Network session key
[out]app_skey- Application session key
Returns
0 if successful, or a cipher specific error code
int decrypt_join_frame ( const uint8_t *  buffer,
uint16_t  size,
const uint8_t *  key,
uint32_t  key_length,
uint8_t *  dec_buffer 
)

Computes the LoRaMAC join frame decryption.

Parameters
[in]buffer- Data buffer
[in]size- Data buffer size
[in]key- AES key to be used
[in]key_length- Length of the key (bits)
[out]dec_buffer- Decrypted buffer
Returns
0 if successful, or a cipher specific error code
int decrypt_payload ( const uint8_t *  buffer,
uint16_t  size,
const uint8_t *  key,
uint32_t  key_length,
uint32_t  address,
uint8_t  dir,
uint32_t  seq_counter,
uint8_t *  dec_buffer 
)

Performs payload decryption.

Parameters
[in]buffer- Data buffer
[in]size- Data buffer size
[in]key- AES key to be used
[in]key_length- Length of the key (bits)
[in]address- Frame address
[in]dir- Frame direction [0: uplink, 1: downlink]
[in]seq_counter- Frame sequence counter
[out]dec_buffer- Decrypted buffer
Returns
0 if successful, or a cipher specific error code
int encrypt_payload ( const uint8_t *  buffer,
uint16_t  size,
const uint8_t *  key,
uint32_t  key_length,
uint32_t  address,
uint8_t  dir,
uint32_t  seq_counter,
uint8_t *  enc_buffer 
)

Performs payload encryption.

Parameters
[in]buffer- Data buffer
[in]size- Data buffer size
[in]key- AES key to be used
[in]key_length- Length of the key (bits)
[in]address- Frame address
[in]dir- Frame direction [0: uplink, 1: downlink]
[in]seq_counter- Frame sequence counter
[out]enc_buffer- Encrypted buffer
Returns
0 if successful, or a cipher specific error code
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.