Adding support for India ISM Band.
Fork of LoRaWAN-lib by
Diff: LoRaMacCrypto.h
- Revision:
- 2:14a5d6ad92d5
- Parent:
- 0:91d1a7783bb9
--- a/LoRaMacCrypto.h Mon Nov 23 10:09:43 2015 +0000 +++ b/LoRaMacCrypto.h Tue Jan 05 16:41:54 2016 +0000 @@ -1,99 +1,111 @@ -/* - / _____) _ | | -( (____ _____ ____ _| |_ _____ ____| |__ - \____ \| ___ | (_ _) ___ |/ ___) _ \ - _____) ) ____| | | || |_| ____( (___| | | | -(______/|_____)_|_|_| \__)_____)\____)_| |_| - (C)2013 Semtech - -Description: LoRa MAC layer implementation - -License: Revised BSD License, see LICENSE.TXT file include in the project - -Maintainer: Miguel Luis and Gregory Cristian -*/ +/*! + * \file LoRaMacCrypto.h + * + * \brief LoRa MAC layer cryptography implementation + * + * \copyright Revised BSD License, see section \ref LICENSE. + * + * \code + * ______ _ + * / _____) _ | | + * ( (____ _____ ____ _| |_ _____ ____| |__ + * \____ \| ___ | (_ _) ___ |/ ___) _ \ + * _____) ) ____| | | || |_| ____( (___| | | | + * (______/|_____)_|_|_| \__)_____)\____)_| |_| + * (C)2013 Semtech + * + * ___ _____ _ ___ _ _____ ___ ___ ___ ___ + * / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __| + * \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _| + * |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___| + * embedded.connectivity.solutions=============== + * + * \endcode + * + * \author Miguel Luis ( Semtech ) + * + * \author Gregory Cristian ( Semtech ) + * + * \author Daniel Jäckle ( STACKFORCE ) + * + * \defgroup LORAMAC_CRYPTO LoRa MAC layer cryptography implementation + * This module covers the implementation of cryptographic functions + * of the LoRaMAC layer. + * \{ + */ #ifndef __LORAMAC_CRYPTO_H__ #define __LORAMAC_CRYPTO_H__ /*! - * Copies size elements of src array to dst array - * - * \remark STM32 Standard memcpy function only works on pointers that are aligned + * Computes the LoRaMAC frame MIC field * - * \param [IN] src Source array - * \param [OUT] dst Destination array - * \param [IN] size Number of bytes to be copied - */ -#define LoRaMacMemCpy( src, dst, size ) memcpy1( dst, src, size ) - -/*! - * Computes the LoRaMAC frame MIC field - * - * \param [IN] buffer Data buffer - * \param [IN] size Data buffer size - * \param [IN] key AES key to be used - * \param [IN] address Frame address - * \param [IN] dir Frame direction [0: uplink, 1: downlink] - * \param [IN] sequenceCounter Frame sequence counter - * \param [OUT] mic Computed MIC field + * \param [IN] buffer - Data buffer + * \param [IN] size - Data buffer size + * \param [IN] key - AES key to be used + * \param [IN] address - Frame address + * \param [IN] dir - Frame direction [0: uplink, 1: downlink] + * \param [IN] sequenceCounter - Frame sequence counter + * \param [OUT] mic - Computed MIC field */ 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 payload encryption + * Computes the LoRaMAC payload encryption * - * \param [IN] buffer Data buffer - * \param [IN] size Data buffer size - * \param [IN] key AES key to be used - * \param [IN] address Frame address - * \param [IN] dir Frame direction [0: uplink, 1: downlink] - * \param [IN] sequenceCounter Frame sequence counter - * \param [OUT] encBuffer Encrypted buffer + * \param [IN] buffer - Data buffer + * \param [IN] size - Data buffer size + * \param [IN] key - AES key to be used + * \param [IN] address - Frame address + * \param [IN] dir - Frame direction [0: uplink, 1: downlink] + * \param [IN] sequenceCounter - Frame sequence counter + * \param [OUT] encBuffer - Encrypted buffer */ 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 decryption + * Computes the LoRaMAC payload decryption * - * \param [IN] buffer Data buffer - * \param [IN] size Data buffer size - * \param [IN] key AES key to be used - * \param [IN] address Frame address - * \param [IN] dir Frame direction [0: uplink, 1: downlink] - * \param [IN] sequenceCounter Frame sequence counter - * \param [OUT] decBuffer Decrypted buffer + * \param [IN] buffer - Data buffer + * \param [IN] size - Data buffer size + * \param [IN] key - AES key to be used + * \param [IN] address - Frame address + * \param [IN] dir - Frame direction [0: uplink, 1: downlink] + * \param [IN] sequenceCounter - Frame sequence counter + * \param [OUT] decBuffer - Decrypted buffer */ 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 Join Request frame MIC field + * Computes the LoRaMAC Join Request frame MIC field * - * \param [IN] buffer Data buffer - * \param [IN] size Data buffer size - * \param [IN] key AES key to be used - * \param [OUT] mic Computed MIC field + * \param [IN] buffer - Data buffer + * \param [IN] size - Data buffer size + * \param [IN] key - AES key to be used + * \param [OUT] mic - Computed MIC field */ void LoRaMacJoinComputeMic( const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t *mic ); /*! - * Computes the LoRaMAC join frame decryption + * Computes the LoRaMAC join frame decryption * - * \param [IN] buffer Data buffer - * \param [IN] size Data buffer size - * \param [IN] key AES key to be used - * \param [OUT] decBuffer Decrypted buffer + * \param [IN] buffer - Data buffer + * \param [IN] size - Data buffer size + * \param [IN] key - AES key to be used + * \param [OUT] decBuffer - Decrypted buffer */ void LoRaMacJoinDecrypt( const uint8_t *buffer, uint16_t size, const uint8_t *key, uint8_t *decBuffer ); /*! - * Computes the LoRaMAC join frame decryption + * Computes the LoRaMAC join frame decryption * - * \param [IN] key AES key to be used - * \param [IN] appNonce Application nonce - * \param [IN] devNonce Device nonce - * \param [OUT] nwkSKey Network session key - * \param [OUT] appSKey Application session key + * \param [IN] key - AES key to be used + * \param [IN] appNonce - Application nonce + * \param [IN] devNonce - Device nonce + * \param [OUT] nwkSKey - Network session key + * \param [OUT] appSKey - Application session key */ void LoRaMacJoinComputeSKeys( const uint8_t *key, const uint8_t *appNonce, uint16_t devNonce, uint8_t *nwkSKey, uint8_t *appSKey ); +/*! \} defgroup LORAMAC */ + #endif // __LORAMAC_CRYPTO_H__