Sluice: Secure Dissemination of Code Updates in Sensor NetworksSource codeAuthor's research website0. Install Moteiv’s Tmote Tools from
http://www.moteiv.com/1. Extract file "sluice-tinyos.tgz" and move sub-directory "contrib" to "C:\cygwin\opt\tinyos-1.x\contrib"
2. Change file "/opt/tinyos-1.x/contrib/cmu/tools/java/jars/bcprov-jdk15-130.jar" to latest version if you need from
here. (I use "bcprov-jdk16-137.jar" for this note.)
3. Set up environment variables as follows:
[code]export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
export TOSROOT="/opt/tinyos-1.x"
export TOSDIR="$TOSROOT/tos"
export MAKERULES="$TOSROOT/tools/make/Makerules"
export CLASSPATH="`$TOSROOT/tools/java/javapath`;C:\\\\cygwin\\\\opt\\\\tinyos-1.x\\\\contrib\\\\cmu\\\\tools\\\\java;C:\\\\cygwin\\\\opt\\\\tinyos-1.x\\\\contrib\\\\cmu\\\\tools\\\\java\\\\jars\\\\bcprov-jdk16-137.jar"
export SLUICE_PRIV_KEYFILE="c:\\\\cygwin\\\\opt\\\\tinyos-1.x\\\\contrib\\\\cmu\\\\tools\\\\java\\\\eccPrivate.key"[/code]
4. Modify files "/opt/tinyos-1.x/contrib/cmu/tos/lib/Sluice/DelugePageTransferC.nc" and "/opt/tinyos-1.x/contrib/cmu/tos/lib/Sluice/DelugePageTransferM.nc" about token "SharedMsgBufTX" and "SharedMsgBufRX" by refer to files " /opt/moteiv/tos/lib/Deluge/DelugePageTransferC.nc" and "/opt/moteiv/tos/lib/Deluge/DelugePageTransferM.nc"
5. Modify files "/opt/tinyos-1.x/contrib/cmu/tos/lib/Sluice/VerifierM.nc" as follows:
...
command uint8_t Verifier.verify(uint8_t *msg_ptr, uint16_t msg_len, NN_DIGIT *r_ptr, NN_DIGIT *s_ptr) {
...
if (post VerifyTask()) {
-#if 1
+#if PLATFORM_PC
dbg(DBG_USR2, "[Verifier.verify] info: posted VerifyTask\n");
dbg_clear(DBG_USR2, "\tr: 0x");
print_nn(r, DBG_USR2);
dbg_clear(DBG_USR2, "\n\ts: 0x");
print_nn(s, DBG_USR2);
dbg_clear(DBG_USR2, "\n");
#endif
return SUCCESS;
} else {
...
}
}
...
6. Change to directory "/opt/tinyos-1.x/contrib/cmu/apps/Sluice" and make as follows:
[code]make tmote install[/code]
7. Change to directory "/opt/tinyos-1.x/contrib/cmu/tools/java/net/tinyos/sluice" and "/opt/tinyos-1.x/contrib/cmu/tools/java/net/tinyos/tools" and complie all java files
8. Set up environment variables of "MOTECOM" for the Tmote Sky. for example:
[code]export MOTECOM=serial@COM6:tmote[/code]
9. Now, you can run "java net.tinyos.tools.Sluice" for testing.
Note: the source seems only implement function "inject".
for a example:
10. Change to directory "/opt/moteiv/apps/Count/CountLed" and Modify
file "/opt/moteiv/apps/Count/CountLed/Makefile" as follows:
COMPONENT ?= CountLedsC
CFLAGS += -I..
+PFLAGS += -DVERIFY_TIME=25 -I$(TOSROOT)/contrib/cmu/tos/lib/Sluice -I$(TOSROOT)/contrib/cmu/tos/lib/SHA1 -I$(TOSROOT)/contrib/ncsu/tos/lib/TinyECC
+TINYOS_NP ?= BNP
include $(MAKERULES)
11. And then make as follows:
[code]make tmote[/code]
12. Change to directory "/opt/moteiv/apps/Count/CountLeds/build/tmote" and "inject to image 1" as follows:
[code]java net.tinyos.tools.Sluice -i -in=1 -ti=tos_image.xml[/code]