llsec: Permit dynamic security levels
This commit is contained in:
parent
0379af3624
commit
10d8b05bc6
22 changed files with 137 additions and 122 deletions
|
@ -39,22 +39,36 @@
|
|||
#include "net/mac/tsch/tsch-asn.h"
|
||||
#include "net/mac/tsch/tsch-private.h"
|
||||
#include "net/mac/frame802154.h"
|
||||
#include "net/llsec/llsec802154.h"
|
||||
#include "net/mac/frame802154e-ie.h"
|
||||
|
||||
/******** Configuration *******/
|
||||
|
||||
/* To enable TSCH security:
|
||||
* - set LLSEC802154_CONF_SECURITY_LEVEL
|
||||
* - set LLSEC802154_CONF_ENABLED
|
||||
* - set TSCH_SECURITY_CONF_LEVEL
|
||||
* - set LLSEC802154_CONF_USES_EXPLICIT_KEYS
|
||||
* - unset LLSEC802154_CONF_USES_FRAME_COUNTER
|
||||
* */
|
||||
#define TSCH_SECURITY_ENABLED (LLSEC802154_CONF_SECURITY_LEVEL != 0)
|
||||
#if TSCH_SECURITY_ENABLED && !LLSEC802154_CONF_USES_EXPLICIT_KEYS
|
||||
#error TSCH_SECURITY_ENABLED set but LLSEC802154_CONF_USES_EXPLICIT_KEYS unset
|
||||
#endif /* TSCH_SECURITY_ENABLED */
|
||||
#if TSCH_SECURITY_ENABLED && LLSEC802154_CONF_USES_FRAME_COUNTER
|
||||
#error TSCH_SECURITY_ENABLED set but LLSEC802154_CONF_USES_FRAME_COUNTER set
|
||||
#endif /* TSCH_SECURITY_ENABLED */
|
||||
|
||||
#ifdef TSCH_SECURITY_CONF_LEVEL
|
||||
#define TSCH_SECURITY_LEVEL TSCH_SECURITY_CONF_LEVEL
|
||||
#else /* TSCH_SECURITY_CONF_LEVEL */
|
||||
#define TSCH_SECURITY_LEVEL FRAME802154_SECURITY_LEVEL_NONE
|
||||
#endif /* TSCH_SECURITY_CONF_LEVEL */
|
||||
|
||||
#if LLSEC802154_ENABLED && !TSCH_SECURITY_LEVEL
|
||||
#error LLSEC802154_ENABLED set but TSCH_SECURITY_LEVEL unset
|
||||
#endif /* LLSEC802154_ENABLED */
|
||||
#if !LLSEC802154_ENABLED && TSCH_SECURITY_LEVEL
|
||||
#error TSCH_SECURITY_LEVEL set but LLSEC802154_ENABLED unset
|
||||
#endif /* LLSEC802154_ENABLED */
|
||||
#if LLSEC802154_ENABLED && !LLSEC802154_USES_EXPLICIT_KEYS
|
||||
#error LLSEC802154_ENABLED set but LLSEC802154_USES_EXPLICIT_KEYS unset
|
||||
#endif /* LLSEC802154_ENABLED */
|
||||
#if LLSEC802154_ENABLED && LLSEC802154_USES_FRAME_COUNTER
|
||||
#error LLSEC802154_ENABLED set but LLSEC802154_USES_FRAME_COUNTER set
|
||||
#endif /* LLSEC802154_ENABLED */
|
||||
|
||||
/* K1, defined in 6TiSCH minimal, is well-known (offers no security) and used for EBs only */
|
||||
#ifdef TSCH_SECURITY_CONF_K1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue