nes-proj/core/net/llsec/noncoresec
Benoît Thébaudeau 8fd7719c07 noncoresec: Fix build errors with DEBUG set to 1
Fix these build errors, which are generated if DEBUG is set to 1:

../../core/net/llsec/noncoresec/noncoresec.c: In function 'parse':
../../core/net/llsec/noncoresec/noncoresec.c:198:54: error: expected ')' before 'PRIu32'
     PRINTF("noncoresec: received unauthentic frame %"PRIu32"\n",
                                                      ^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
 #define PRINTF(...) printf(__VA_ARGS__)
                            ^
../../core/net/llsec/noncoresec/noncoresec.c:198:12: warning: spurious trailing '%' in format [-Wformat=]
     PRINTF("noncoresec: received unauthentic frame %"PRIu32"\n",
            ^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
 #define PRINTF(...) printf(__VA_ARGS__)
                            ^
../../core/net/llsec/noncoresec/noncoresec.c:198:12: warning: spurious trailing '%' in format [-Wformat=]
     PRINTF("noncoresec: received unauthentic frame %"PRIu32"\n",
            ^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
 #define PRINTF(...) printf(__VA_ARGS__)
                            ^
../../core/net/llsec/noncoresec/noncoresec.c:231:54: error: expected ')' before 'PRIu32'
        PRINTF("noncoresec: received replayed frame %"PRIu32"\n",
                                                      ^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
 #define PRINTF(...) printf(__VA_ARGS__)
                            ^
../../core/net/llsec/noncoresec/noncoresec.c:231:15: warning: spurious trailing '%' in format [-Wformat=]
        PRINTF("noncoresec: received replayed frame %"PRIu32"\n",
               ^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
 #define PRINTF(...) printf(__VA_ARGS__)
                            ^
../../core/net/llsec/noncoresec/noncoresec.c:231:15: warning: spurious trailing '%' in format [-Wformat=]
        PRINTF("noncoresec: received replayed frame %"PRIu32"\n",
               ^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
 #define PRINTF(...) printf(__VA_ARGS__)
                            ^

PRIu32 is not defined, so replace it with a standard format directive.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-06-23 22:10:43 +02:00
..
noncoresec.c noncoresec: Fix build errors with DEBUG set to 1 2016-06-23 22:10:43 +02:00
noncoresec.h llsec: Let llsec_drivers define their own framer 2015-10-14 08:21:40 -07:00
README.md llsec: Added READMEs 2016-04-13 09:16:07 -07:00

noncoresec is a noncompromise-resilient 802.15.4 security implementation, which uses a network-wide key. Add these lines to your project_conf.h to enable noncoresec:

#undef LLSEC802154_CONF_ENABLED
#define LLSEC802154_CONF_ENABLED          1
#undef NETSTACK_CONF_FRAMER
#define NETSTACK_CONF_FRAMER              noncoresec_framer
#undef NETSTACK_CONF_LLSEC
#define NETSTACK_CONF_LLSEC               noncoresec_driver
#undef NONCORESEC_CONF_SEC_LVL
#define NONCORESEC_CONF_SEC_LVL           1

NONCORESEC_CONF_SEC_LVL defines the length of MICs and whether encryption is enabled or not.

Setting the network-wide key works as follows:

#define NONCORESEC_CONF_KEY { 0x00 , 0x01 , 0x02 , 0x03 , \
                              0x04 , 0x05 , 0x06 , 0x07 , \ 
                              0x08 , 0x09 , 0x0A , 0x0B , \ 
                              0x0C , 0x0D , 0x0E , 0x0F }