LoRaMAC  4.5.2
Documentation of the API
LoRaMacCrypto.h
Go to the documentation of this file.
1 
37 #ifndef __LORAMAC_CRYPTO_H__
38 #define __LORAMAC_CRYPTO_H__
39 
40 #ifdef __cplusplus
41 extern "C"
42 {
43 #endif
44 
45 #include <stdlib.h>
46 #include <stdint.h>
47 #include <stdbool.h>
48 #include "utilities.h"
49 #include "LoRaMacTypes.h"
50 #include "LoRaMacMessageTypes.h"
51 #include "LoRaMacCryptoNvm.h"
52 
56 #define USE_LRWAN_1_1_X_CRYPTO 0
57 
61 #define USE_RANDOM_DEV_NONCE 0
62 
66 #define USE_JOIN_NONCE_COUNTER_CHECK 0
67 
71 #define FCNT_DOWN_INITAL_VALUE 0xFFFFFFFF
72 
76 typedef enum eLoRaMacCryptoStatus
77 {
155 
162 typedef void ( *LoRaMacCryptoNvmEvent )( void );
163 
173 
184 
193 LoRaMacCryptoStatus_t LoRaMacCryptoGetFCntDown( FCntIdentifier_t fCntID, uint32_t frameFcnt, uint32_t* currentDown );
194 
201 LoRaMacCryptoStatus_t LoRaMacCryptoGetFCntUp( uint32_t* currentUp );
202 
211 
220 
229 
238 
247 
258 
268 LoRaMacCryptoStatus_t LoRaMacCryptoSecureMessage( uint32_t fCntUp, uint8_t txDr, uint8_t txCh, LoRaMacMessageData_t* macMsg );
269 
280 LoRaMacCryptoStatus_t LoRaMacCryptoUnsecureMessage( AddressIdentifier_t addrID, uint32_t address, FCntIdentifier_t fCntID, uint32_t fCntDown, LoRaMacMessageData_t* macMsg );
281 
296 
306 
318 
321 #ifdef __cplusplus
322 }
323 #endif
324 
325 #endif // __LORAMAC_CRYPTO_H__
LORAMAC_CRYPTO_ERROR_SERIALIZER
Definition: LoRaMacCrypto.h:145
LoRaMacMessageReJoinType0or2_t
Definition: LoRaMacMessageTypes.h:125
LORAMAC_CRYPTO_ERROR_NPE
Definition: LoRaMacCrypto.h:117
LORAMAC_CRYPTO_ERROR_INVALID_ADDR_ID
Definition: LoRaMacCrypto.h:125
LoRaMacCryptoSetKey
LoRaMacCryptoStatus_t LoRaMacCryptoSetKey(KeyIdentifier_t keyID, uint8_t *key)
LORAMAC_CRYPTO_SUCCESS
Definition: LoRaMacCrypto.h:81
LORAMAC_CRYPTO_FAIL_ADDRESS
Definition: LoRaMacCrypto.h:89
LORAMAC_CRYPTO_FAIL_MIC
Definition: LoRaMacCrypto.h:85
LORAMAC_CRYPTO_ERROR_BUF_SIZE
Definition: LoRaMacCrypto.h:133
LoRaMacTypes.h
LoRa MAC layer internal types definition. Please do not include in application sources.
LORAMAC_CRYPTO_FAIL_PARAM
Definition: LoRaMacCrypto.h:113
JoinReqIdentifier_t
JoinReqIdentifier_t
Definition: LoRaMacTypes.h:940
LoRaMacCryptoNvmEvent
void(* LoRaMacCryptoNvmEvent)(void)
Definition: LoRaMacCrypto.h:162
LoRaMacCryptoSetMulticastReference
LoRaMacCryptoStatus_t LoRaMacCryptoSetMulticastReference(MulticastCtx_t *multicastList)
LORAMAC_CRYPTO_ERROR
Definition: LoRaMacCrypto.h:153
LORAMAC_CRYPTO_FAIL_FCNT_SMALLER
Definition: LoRaMacCrypto.h:105
LoRaMacCryptoGetFCntUp
LoRaMacCryptoStatus_t LoRaMacCryptoGetFCntUp(uint32_t *currentUp)
LoRaMacMessageTypes.h
LoRa MAC layer message type definitions.
LORAMAC_CRYPTO_FAIL_RJCOUNT0_OVERFLOW
Definition: LoRaMacCrypto.h:97
LoRaMacCryptoNvm.h
LoRa MAC layer cryptographic NVM data.
LORAMAC_CRYPTO_ERROR_PARSER
Definition: LoRaMacCrypto.h:141
LORAMAC_CRYPTO_ERROR_INVALID_VERSION
Definition: LoRaMacCrypto.h:129
LORAMAC_CRYPTO_ERROR_INVALID_KEY_ID
Definition: LoRaMacCrypto.h:121
LORAMAC_CRYPTO_FAIL_JOIN_NONCE
Definition: LoRaMacCrypto.h:93
LORAMAC_CRYPTO_ERROR_RJCOUNT1_OVERFLOW
Definition: LoRaMacCrypto.h:149
MulticastCtx_t
Definition: LoRaMacTypes.h:901
LoRaMacMessageReJoinType1_t
Definition: LoRaMacMessageTypes.h:86
LoRaMacCryptoSecureMessage
LoRaMacCryptoStatus_t LoRaMacCryptoSecureMessage(uint32_t fCntUp, uint8_t txDr, uint8_t txCh, LoRaMacMessageData_t *macMsg)
LoRaMacCryptoPrepareJoinRequest
LoRaMacCryptoStatus_t LoRaMacCryptoPrepareJoinRequest(LoRaMacMessageJoinRequest_t *macMsg)
LoRaMacCryptoDeriveMcRootKey
LoRaMacCryptoStatus_t LoRaMacCryptoDeriveMcRootKey(uint8_t versionMinor, KeyIdentifier_t keyID)
LoRaMacCryptoNvmData_t
Definition: LoRaMacCryptoNvm.h:85
LoRaMacCryptoDeriveMcSessionKeyPair
LoRaMacCryptoStatus_t LoRaMacCryptoDeriveMcSessionKeyPair(AddressIdentifier_t addrID, uint32_t mcAddr)
LoRaMacCryptoHandleJoinAccept
LoRaMacCryptoStatus_t LoRaMacCryptoHandleJoinAccept(JoinReqIdentifier_t joinReqType, uint8_t *joinEUI, LoRaMacMessageJoinAccept_t *macMsg)
AddressIdentifier_t
AddressIdentifier_t
Definition: LoRaMacTypes.h:775
LoRaMacMessageJoinRequest_t
Definition: LoRaMacMessageTypes.h:51
LoRaMacMessageData_t
Definition: LoRaMacMessageTypes.h:213
LORAMAC_CRYPTO_FAIL_FCNT_DUPLICATED
Definition: LoRaMacCrypto.h:109
FCntIdentifier_t
FCntIdentifier_t
Definition: LoRaMacTypes.h:630
KeyIdentifier_t
KeyIdentifier_t
Definition: LoRaMacTypes.h:672
LORAMAC_CRYPTO_FAIL_FCNT_ID
Definition: LoRaMacCrypto.h:101
LoRaMacCryptoDeriveMcKEKey
LoRaMacCryptoStatus_t LoRaMacCryptoDeriveMcKEKey(KeyIdentifier_t keyID)
LoRaMacCryptoStatus_t
LoRaMacCryptoStatus_t
Definition: LoRaMacCrypto.h:76
LoRaMacCryptoPrepareReJoinType1
LoRaMacCryptoStatus_t LoRaMacCryptoPrepareReJoinType1(LoRaMacMessageReJoinType1_t *macMsg)
LoRaMacCryptoSetLrWanVersion
LoRaMacCryptoStatus_t LoRaMacCryptoSetLrWanVersion(Version_t version)
LoRaMacCryptoGetFCntDown
LoRaMacCryptoStatus_t LoRaMacCryptoGetFCntDown(FCntIdentifier_t fCntID, uint32_t frameFcnt, uint32_t *currentDown)
LoRaMacCryptoPrepareReJoinType0or2
LoRaMacCryptoStatus_t LoRaMacCryptoPrepareReJoinType0or2(LoRaMacMessageReJoinType0or2_t *macMsg)
LoRaMacCryptoInit
LoRaMacCryptoStatus_t LoRaMacCryptoInit(LoRaMacCryptoNvmData_t *nvm)
LORAMAC_CRYPTO_ERROR_SECURE_ELEMENT_FUNC
Definition: LoRaMacCrypto.h:137
LoRaMacCryptoUnsecureMessage
LoRaMacCryptoStatus_t LoRaMacCryptoUnsecureMessage(AddressIdentifier_t addrID, uint32_t address, FCntIdentifier_t fCntID, uint32_t fCntDown, LoRaMacMessageData_t *macMsg)
LoRaMacMessageJoinAccept_t
Definition: LoRaMacMessageTypes.h:164