I'm trying to encrypt my "hello" messages in a simulation in Contiki 3.0
I'm doing the software implementation of LLSEC (link-layer security) layer as advised in this question's answers.
The example I'm using for my simulation is the IPV6 rpl-udp udp-client.c and udp-server which can be seen here.
I have followed the instructions as per documentation here and created a project-conf.h file and have the Make file referring to it as seen below:
project-conf.h
#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 0x07
#define NONCORESEC_CONF_KEY { 0x00 , 0x01 , 0x02 , 0x03 , \
0x04 , 0x05 , 0x06 , 0x07 , \
0x08 , 0x09 , 0x0A , 0x0B , \
0x0C , 0x0D , 0x0E , 0x0F }
The Makefile
all: udp-client udp-server
APPS=servreg-hack
CONTIKI=../../..
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
ifdef WITH_COMPOWER
APPS+=powertrace
CFLAGS+= -DCONTIKIMAC_CONF_COMPOWER=1 -DWITH_COMPOWER=1 -DQUEUEBUF_CONF_NUM=4
endif
#linker optimizations
SMALL=1
ifdef SERVER_REPLY
CFLAGS+=-DSERVER_REPLY=$(SERVER_REPLY)
endif
ifdef PERIOD
CFLAGS+=-DPERIOD=$(PERIOD)
endif
CONTIKI_WITH_IPV6 = 1
include $(CONTIKI)/Makefile.include
The period and file sizes of the hello messages are set as:
#ifndef PERIOD
#define PERIOD 20
#endif
#define START_INTERVAL (10 * CLOCK_SECOND)
#define SEND_INTERVAL (PERIOD * CLOCK_SECOND)
#define SEND_TIME (random_rand() % (SEND_INTERVAL))
#define MAX_PAYLOAD_LEN 50
I'm using a python code that processes the log file output to give me the delay between nodes based on the "hello" messages sent from one node to another. I run the simulation for 2 minutes each time.
Below you can see 2 examples:
The first run of the log is where the llsec settings are off and the second run is with the llsec settings on and as you can see there is no delay difference making me believe that the llsec configurations are not working properly or perhaps not enabled at all.
Very little documentation exists on this and I'm posting here as a last resort. Any suggestions?