A very easy to understand LoRaWAN-node code.
Dependencies: LoRaWAN-lib SX1272Lib X_NUCLEO_IKS01A1 mbed
Important parameters:
• In comissioning.h: DevEUI, AppEUI, AppKEY, DevADR, NwksKEY, AppsKEY, OTAA and public network. Frequency and channel block to use, confirmed or unconfirmed messages, app port, app data size and OTAA and Tx duty cycles.
• In LoRaMac.h: Maximum payload and MAC commands length, receive delays, max FCNT, adr ack limit, timeout and delay, max ack retries, rssi threshold and sync words.
• In LoRaMac.cpp: Maximum payload, MAC commands and FRMpayload length.
• In LoRaMac-board.h: Tx power, data rates and band settings.
NOTE: Please refer to LoRaWAN regional parameters (page 12 for US band) to know which parameters you can modify.
system/crypto/cmac.h@0:60ff878b27b8, 2018-04-03 (annotated)
- Committer:
- dgabino
- Date:
- Tue Apr 03 17:09:34 2018 +0000
- Revision:
- 0:60ff878b27b8
A simpler way to customize your LoRaWAN payload
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dgabino | 0:60ff878b27b8 | 1 | /************************************************************************** |
dgabino | 0:60ff878b27b8 | 2 | Copyright (C) 2009 Lander Casado, Philippas Tsigas |
dgabino | 0:60ff878b27b8 | 3 | |
dgabino | 0:60ff878b27b8 | 4 | All rights reserved. |
dgabino | 0:60ff878b27b8 | 5 | |
dgabino | 0:60ff878b27b8 | 6 | Permission is hereby granted, free of charge, to any person obtaining |
dgabino | 0:60ff878b27b8 | 7 | a copy of this software and associated documentation files |
dgabino | 0:60ff878b27b8 | 8 | (the "Software"), to deal with the Software without restriction, including |
dgabino | 0:60ff878b27b8 | 9 | without limitation the rights to use, copy, modify, merge, publish, |
dgabino | 0:60ff878b27b8 | 10 | distribute, sublicense, and/or sell copies of the Software, and to |
dgabino | 0:60ff878b27b8 | 11 | permit persons to whom the Software is furnished to do so, subject to |
dgabino | 0:60ff878b27b8 | 12 | the following conditions: |
dgabino | 0:60ff878b27b8 | 13 | |
dgabino | 0:60ff878b27b8 | 14 | Redistributions of source code must retain the above copyright notice, |
dgabino | 0:60ff878b27b8 | 15 | this list of conditions and the following disclaimers. Redistributions in |
dgabino | 0:60ff878b27b8 | 16 | binary form must reproduce the above copyright notice, this list of |
dgabino | 0:60ff878b27b8 | 17 | conditions and the following disclaimers in the documentation and/or |
dgabino | 0:60ff878b27b8 | 18 | other materials provided with the distribution. |
dgabino | 0:60ff878b27b8 | 19 | |
dgabino | 0:60ff878b27b8 | 20 | In no event shall the authors or copyright holders be liable for any special, |
dgabino | 0:60ff878b27b8 | 21 | incidental, indirect or consequential damages of any kind, or any damages |
dgabino | 0:60ff878b27b8 | 22 | whatsoever resulting from loss of use, data or profits, whether or not |
dgabino | 0:60ff878b27b8 | 23 | advised of the possibility of damage, and on any theory of liability, |
dgabino | 0:60ff878b27b8 | 24 | arising out of or in connection with the use or performance of this software. |
dgabino | 0:60ff878b27b8 | 25 | |
dgabino | 0:60ff878b27b8 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
dgabino | 0:60ff878b27b8 | 27 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
dgabino | 0:60ff878b27b8 | 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
dgabino | 0:60ff878b27b8 | 29 | CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
dgabino | 0:60ff878b27b8 | 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
dgabino | 0:60ff878b27b8 | 31 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
dgabino | 0:60ff878b27b8 | 32 | DEALINGS WITH THE SOFTWARE |
dgabino | 0:60ff878b27b8 | 33 | |
dgabino | 0:60ff878b27b8 | 34 | *****************************************************************************/ |
dgabino | 0:60ff878b27b8 | 35 | |
dgabino | 0:60ff878b27b8 | 36 | #ifndef _CMAC_H_ |
dgabino | 0:60ff878b27b8 | 37 | #define _CMAC_H_ |
dgabino | 0:60ff878b27b8 | 38 | |
dgabino | 0:60ff878b27b8 | 39 | #include "aes.h" |
dgabino | 0:60ff878b27b8 | 40 | |
dgabino | 0:60ff878b27b8 | 41 | #define AES_CMAC_KEY_LENGTH 16 |
dgabino | 0:60ff878b27b8 | 42 | #define AES_CMAC_DIGEST_LENGTH 16 |
dgabino | 0:60ff878b27b8 | 43 | |
dgabino | 0:60ff878b27b8 | 44 | typedef struct _AES_CMAC_CTX { |
dgabino | 0:60ff878b27b8 | 45 | aes_context rijndael; |
dgabino | 0:60ff878b27b8 | 46 | uint8_t X[16]; |
dgabino | 0:60ff878b27b8 | 47 | uint8_t M_last[16]; |
dgabino | 0:60ff878b27b8 | 48 | uint32_t M_n; |
dgabino | 0:60ff878b27b8 | 49 | } AES_CMAC_CTX; |
dgabino | 0:60ff878b27b8 | 50 | |
dgabino | 0:60ff878b27b8 | 51 | //#include <sys/cdefs.h> |
dgabino | 0:60ff878b27b8 | 52 | |
dgabino | 0:60ff878b27b8 | 53 | //__BEGIN_DECLS |
dgabino | 0:60ff878b27b8 | 54 | void AES_CMAC_Init(AES_CMAC_CTX * ctx); |
dgabino | 0:60ff878b27b8 | 55 | void AES_CMAC_SetKey(AES_CMAC_CTX * ctx, const uint8_t key[AES_CMAC_KEY_LENGTH]); |
dgabino | 0:60ff878b27b8 | 56 | void AES_CMAC_Update(AES_CMAC_CTX * ctx, const uint8_t * data, uint32_t len); |
dgabino | 0:60ff878b27b8 | 57 | // __attribute__((__bounded__(__string__,2,3))); |
dgabino | 0:60ff878b27b8 | 58 | void AES_CMAC_Final(uint8_t digest[AES_CMAC_DIGEST_LENGTH], AES_CMAC_CTX * ctx); |
dgabino | 0:60ff878b27b8 | 59 | // __attribute__((__bounded__(__minbytes__,1,AES_CMAC_DIGEST_LENGTH))); |
dgabino | 0:60ff878b27b8 | 60 | //__END_DECLS |
dgabino | 0:60ff878b27b8 | 61 | |
dgabino | 0:60ff878b27b8 | 62 | #endif /* _CMAC_H_ */ |
dgabino | 0:60ff878b27b8 | 63 |