LoRaMAC  4.4.5
Documentation of the API
secure-element.h
Go to the documentation of this file.
1 
38 #ifndef __SECURE_ELEMENT_H__
39 #define __SECURE_ELEMENT_H__
40 
41 #ifdef __cplusplus
42 extern "C"
43 {
44 #endif
45 
46 #include <stdint.h>
47 #include "LoRaMacCrypto.h"
48 
52 #define SE_KEY_SIZE 16
53 
57 #define SE_EUI_SIZE 8
58 
62 #define SE_PIN_SIZE 4
63 
67 typedef enum eSecureElementStatus
68 {
102 
108 typedef void ( *SecureElementNvmEvent )( void );
109 
118 
126 
133 void* SecureElementGetNvmCtx( size_t* seNvmCtxSize );
134 
143 
154 SecureElementStatus_t SecureElementComputeAesCmac( uint8_t* micBxBuffer, uint8_t* buffer, uint16_t size, KeyIdentifier_t keyID, uint32_t* cmac );
155 
165 SecureElementStatus_t SecureElementVerifyAesCmac( uint8_t* buffer, uint16_t size, uint32_t expectedCmac, KeyIdentifier_t keyID );
166 
176 SecureElementStatus_t SecureElementAesEncrypt( uint8_t* buffer, uint16_t size, KeyIdentifier_t keyID, uint8_t* encBuffer );
177 
187 
200  uint16_t devNonce, uint8_t* encJoinAccept,
201  uint8_t encJoinAcceptSize, uint8_t* decJoinAccept,
202  uint8_t* versionMinor );
203 
210 SecureElementStatus_t SecureElementRandomNumber( uint32_t* randomNum );
211 
219 
225 uint8_t* SecureElementGetDevEui( void );
226 
234 
240 uint8_t* SecureElementGetJoinEui( void );
241 
249 
255 uint8_t* SecureElementGetPin( void );
256 
259 #ifdef __cplusplus
260 }
261 #endif
262 
263 #endif // __SECURE_ELEMENT_H__
SECURE_ELEMENT_ERROR_BUF_SIZE
Definition: secure-element.h:92
SecureElementDeriveAndStoreKey
SecureElementStatus_t SecureElementDeriveAndStoreKey(uint8_t *input, KeyIdentifier_t rootKeyID, KeyIdentifier_t targetKeyID)
SECURE_ELEMENT_ERROR
Definition: secure-element.h:96
SecureElementRestoreNvmCtx
SecureElementStatus_t SecureElementRestoreNvmCtx(void *seNvmCtx)
SecureElementAesEncrypt
SecureElementStatus_t SecureElementAesEncrypt(uint8_t *buffer, uint16_t size, KeyIdentifier_t keyID, uint8_t *encBuffer)
SECURE_ELEMENT_ERROR_NPE
Definition: secure-element.h:80
SecureElementInit
SecureElementStatus_t SecureElementInit(SecureElementNvmEvent seNvmCtxChanged)
SecureElementNvmEvent
void(* SecureElementNvmEvent)(void)
Definition: secure-element.h:108
SECURE_ELEMENT_ERROR_INVALID_LORAWAM_SPEC_VERSION
Definition: secure-element.h:88
JoinReqIdentifier_t
JoinReqIdentifier_t
Definition: LoRaMacTypes.h:433
SecureElementStatus_t
SecureElementStatus_t
Definition: secure-element.h:67
SECURE_ELEMENT_FAIL_ENCRYPT
Definition: secure-element.h:100
SecureElementSetJoinEui
SecureElementStatus_t SecureElementSetJoinEui(uint8_t *joinEui)
SecureElementRandomNumber
SecureElementStatus_t SecureElementRandomNumber(uint32_t *randomNum)
SecureElementGetPin
uint8_t * SecureElementGetPin(void)
SECURE_ELEMENT_SUCCESS
Definition: secure-element.h:72
LoRaMacCrypto.h
LoRa MAC layer cryptographic functionality implementation.
SecureElementGetNvmCtx
void * SecureElementGetNvmCtx(size_t *seNvmCtxSize)
SecureElementProcessJoinAccept
SecureElementStatus_t SecureElementProcessJoinAccept(JoinReqIdentifier_t joinReqType, uint8_t *joinEui, uint16_t devNonce, uint8_t *encJoinAccept, uint8_t encJoinAcceptSize, uint8_t *decJoinAccept, uint8_t *versionMinor)
SECURE_ELEMENT_FAIL_CMAC
Definition: secure-element.h:76
SecureElementGetJoinEui
uint8_t * SecureElementGetJoinEui(void)
SecureElementSetKey
SecureElementStatus_t SecureElementSetKey(KeyIdentifier_t keyID, uint8_t *key)
SecureElementSetDevEui
SecureElementStatus_t SecureElementSetDevEui(uint8_t *devEui)
KeyIdentifier_t
KeyIdentifier_t
Definition: LoRaMacTypes.h:169
SecureElementGetDevEui
uint8_t * SecureElementGetDevEui(void)
SecureElementComputeAesCmac
SecureElementStatus_t SecureElementComputeAesCmac(uint8_t *micBxBuffer, uint8_t *buffer, uint16_t size, KeyIdentifier_t keyID, uint32_t *cmac)
SecureElementSetPin
SecureElementStatus_t SecureElementSetPin(uint8_t *pin)
SECURE_ELEMENT_ERROR_INVALID_KEY_ID
Definition: secure-element.h:84
SecureElementVerifyAesCmac
SecureElementStatus_t SecureElementVerifyAesCmac(uint8_t *buffer, uint16_t size, uint32_t expectedCmac, KeyIdentifier_t keyID)