Example Application: TinyECC
TinyECC is a software package providing Elliptic Curve Cryptography (ECC) operations on TinyOS. It supports all elliptic curve operations over Fp, including point addition, point doubling and scalar point multiplication, as well as ECDSA operations over Fp (signature generation and verification). We plan to include other ECC schemes (e.g. ECDH, ECAES) in this package in the future.
http://discovery.csc.ncsu.edu/software/TinyECC/
#include "gen/cTinyECC_TinyOSModule.h" #include "gen/cTinyECC_Main.h" cTinyECC_Main *m = new cTinyECC_Main(this,main,"Main",getIndex()); m->StdControl_init(); m->StdControl_start(); |
NesCT is going to build all the classes in gen directory.
Replace "cp" with "copy" and slash (/) with backslash (\) for
windows operating system at the following instructions.
[root@sinan tictoc]# cd components/
[root@sinan components]# cp TinyECC.nc ../Application.nc
[root@sinan components]# cd ..
[root@sinan tictoc]# ./nesct.exe -DTOSH_DATA_LENGTH=102
Application.nc
done.
Type "make" to build the binary.
[root@sinan tictoc]# make
g++ -c -g -fpermissive -fPIC -DWITH_NETBUILDER -w
-DTOSNODES=1000 -DLINUX -DPLATFORM_OMNETPP -I./include
-I/root/projects/tinyos-1.x/tos/interfaces -I./include_tos
-I/opt/omnetpp-3.2/include simstart.cc
g++ tictoc1_n.o debug.o simstart.o tinyos.o tinyosmain.o
tossim.o txc1.o -g -L/opt/omnetpp-3.2/lib -lenvir -lcmdenv
-lsim_std -lnedxml -lxml2 -ldl -lstdc++ -lpthread -o tictoc
echo>.tstamp
Let's enable all debug options for demonstration purposes. Use "export" keyword for linux and "set" keyword for windows to change environment variable. You should see an output similar to this in TK window.
[root@sinan tictoc]# export DBG=all
[root@sinan tictoc]# ./tictoc
[0] 0:0:0.97656250:signature generated
[0] 0:0:0.97656250:verify passed
[0] 0:0:0.97656250:TinyECCM_test_ec() start
[1] 0:0:0.97656250:signature generated
[1] 0:0:0.97656250:verify passed
[1] 0:0:0.97656250:TinyECCM_test_ec() start
[2] 0:0:0.97656250:signature generated
[2] 0:0:0.97656250:verify passed
[2] 0:0:0.97656250:TinyECCM_test_ec() start