changes for the test harness

Fork of LoRaWAN-lib by Bill VerSteeg

Committer:
mluis
Date:
Tue Oct 20 13:21:26 2015 +0000
Revision:
0:91d1a7783bb9
Child:
2:14a5d6ad92d5
Library creation synchronized with GitHub LoRaMac-node v3.4 (https://github.com/Lora-net/LoRaMac-node)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mluis 0:91d1a7783bb9 1 /*
mluis 0:91d1a7783bb9 2 / _____) _ | |
mluis 0:91d1a7783bb9 3 ( (____ _____ ____ _| |_ _____ ____| |__
mluis 0:91d1a7783bb9 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
mluis 0:91d1a7783bb9 5 _____) ) ____| | | || |_| ____( (___| | | |
mluis 0:91d1a7783bb9 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
mluis 0:91d1a7783bb9 7 (C)2013 Semtech
mluis 0:91d1a7783bb9 8
mluis 0:91d1a7783bb9 9 Description: LoRa MAC layer implementation
mluis 0:91d1a7783bb9 10
mluis 0:91d1a7783bb9 11 License: Revised BSD License, see LICENSE.TXT file include in the project
mluis 0:91d1a7783bb9 12
mluis 0:91d1a7783bb9 13 Maintainer: Miguel Luis and Gregory Cristian
mluis 0:91d1a7783bb9 14 */
mluis 0:91d1a7783bb9 15 #ifndef __LORAMAC_CRYPTO_H__
mluis 0:91d1a7783bb9 16 #define __LORAMAC_CRYPTO_H__
mluis 0:91d1a7783bb9 17
mluis 0:91d1a7783bb9 18 /*!
mluis 0:91d1a7783bb9 19 * Copies size elements of src array to dst array
mluis 0:91d1a7783bb9 20 *
mluis 0:91d1a7783bb9 21 * \remark STM32 Standard memcpy function only works on pointers that are aligned
mluis 0:91d1a7783bb9 22 *
mluis 0:91d1a7783bb9 23 * \param [IN] src Source array
mluis 0:91d1a7783bb9 24 * \param [OUT] dst Destination array
mluis 0:91d1a7783bb9 25 * \param [IN] size Number of bytes to be copied
mluis 0:91d1a7783bb9 26 */
mluis 0:91d1a7783bb9 27 #define LoRaMacMemCpy( src, dst, size ) memcpy1( dst, src, size )
mluis 0:91d1a7783bb9 28
mluis 0:91d1a7783bb9 29 /*!
mluis 0:91d1a7783bb9 30 * Computes the LoRaMAC frame MIC field
mluis 0:91d1a7783bb9 31 *
mluis 0:91d1a7783bb9 32 * \param [IN] buffer Data buffer
mluis 0:91d1a7783bb9 33 * \param [IN] size Data buffer size
mluis 0:91d1a7783bb9 34 * \param [IN] key AES key to be used
mluis 0:91d1a7783bb9 35 * \param [IN] address Frame address
mluis 0:91d1a7783bb9 36 * \param [IN] dir Frame direction [0: uplink, 1: downlink]
mluis 0:91d1a7783bb9 37 * \param [IN] sequenceCounter Frame sequence counter
mluis 0:91d1a7783bb9 38 * \param [OUT] mic Computed MIC field
mluis 0:91d1a7783bb9 39 */
mluis 0:91d1a7783bb9 40 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 );
mluis 0:91d1a7783bb9 41
mluis 0:91d1a7783bb9 42 /*!
mluis 0:91d1a7783bb9 43 * Computes the LoRaMAC payload encryption
mluis 0:91d1a7783bb9 44 *
mluis 0:91d1a7783bb9 45 * \param [IN] buffer Data buffer
mluis 0:91d1a7783bb9 46 * \param [IN] size Data buffer size
mluis 0:91d1a7783bb9 47 * \param [IN] key AES key to be used
mluis 0:91d1a7783bb9 48 * \param [IN] address Frame address
mluis 0:91d1a7783bb9 49 * \param [IN] dir Frame direction [0: uplink, 1: downlink]
mluis 0:91d1a7783bb9 50 * \param [IN] sequenceCounter Frame sequence counter
mluis 0:91d1a7783bb9 51 * \param [OUT] encBuffer Encrypted buffer
mluis 0:91d1a7783bb9 52 */
mluis 0:91d1a7783bb9 53 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 );
mluis 0:91d1a7783bb9 54
mluis 0:91d1a7783bb9 55 /*!
mluis 0:91d1a7783bb9 56 * Computes the LoRaMAC payload decryption
mluis 0:91d1a7783bb9 57 *
mluis 0:91d1a7783bb9 58 * \param [IN] buffer Data buffer
mluis 0:91d1a7783bb9 59 * \param [IN] size Data buffer size
mluis 0:91d1a7783bb9 60 * \param [IN] key AES key to be used
mluis 0:91d1a7783bb9 61 * \param [IN] address Frame address
mluis 0:91d1a7783bb9 62 * \param [IN] dir Frame direction [0: uplink, 1: downlink]
mluis 0:91d1a7783bb9 63 * \param [IN] sequenceCounter Frame sequence counter
mluis 0:91d1a7783bb9 64 * \param [OUT] decBuffer Decrypted buffer
mluis 0:91d1a7783bb9 65 */
mluis 0:91d1a7783bb9 66 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 );
mluis 0:91d1a7783bb9 67
mluis 0:91d1a7783bb9 68 /*!
mluis 0:91d1a7783bb9 69 * Computes the LoRaMAC Join Request frame MIC field
mluis 0:91d1a7783bb9 70 *
mluis 0:91d1a7783bb9 71 * \param [IN] buffer Data buffer
mluis 0:91d1a7783bb9 72 * \param [IN] size Data buffer size
mluis 0:91d1a7783bb9 73 * \param [IN] key AES key to be used
mluis 0:91d1a7783bb9 74 * \param [OUT] mic Computed MIC field
mluis 0:91d1a7783bb9 75 */
mluis 0:91d1a7783bb9 76 void LoRaMacJoinComputeMic( const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t *mic );
mluis 0:91d1a7783bb9 77
mluis 0:91d1a7783bb9 78 /*!
mluis 0:91d1a7783bb9 79 * Computes the LoRaMAC join frame decryption
mluis 0:91d1a7783bb9 80 *
mluis 0:91d1a7783bb9 81 * \param [IN] buffer Data buffer
mluis 0:91d1a7783bb9 82 * \param [IN] size Data buffer size
mluis 0:91d1a7783bb9 83 * \param [IN] key AES key to be used
mluis 0:91d1a7783bb9 84 * \param [OUT] decBuffer Decrypted buffer
mluis 0:91d1a7783bb9 85 */
mluis 0:91d1a7783bb9 86 void LoRaMacJoinDecrypt( const uint8_t *buffer, uint16_t size, const uint8_t *key, uint8_t *decBuffer );
mluis 0:91d1a7783bb9 87
mluis 0:91d1a7783bb9 88 /*!
mluis 0:91d1a7783bb9 89 * Computes the LoRaMAC join frame decryption
mluis 0:91d1a7783bb9 90 *
mluis 0:91d1a7783bb9 91 * \param [IN] key AES key to be used
mluis 0:91d1a7783bb9 92 * \param [IN] appNonce Application nonce
mluis 0:91d1a7783bb9 93 * \param [IN] devNonce Device nonce
mluis 0:91d1a7783bb9 94 * \param [OUT] nwkSKey Network session key
mluis 0:91d1a7783bb9 95 * \param [OUT] appSKey Application session key
mluis 0:91d1a7783bb9 96 */
mluis 0:91d1a7783bb9 97 void LoRaMacJoinComputeSKeys( const uint8_t *key, const uint8_t *appNonce, uint16_t devNonce, uint8_t *nwkSKey, uint8_t *appSKey );
mluis 0:91d1a7783bb9 98
mluis 0:91d1a7783bb9 99 #endif // __LORAMAC_CRYPTO_H__