To implement hardware encryption on my telosb's CC2420 I'm using code from
seluge project (
http://discovery.csc.ncsu.edu/software/Seluge/index.html#Seluge)

I'm desperate to get some form of symmetric key encryption working on my
telosb motes in tinyos1.x, so any feedback would be appreciated.

I'll even settle for ridicule :/

here goes!

If I have a piece of code like:              ( this code goes in the
CC2420RadioM file)

atomic{
  bSpiAvail = FALSE;
  TOSH_CLR_CC_CS_PIN();                     //enable chip select

  outp( ((  0x08b & 0x7F) | 0x80),SPDR);    //ls address  and set RAM/Reg
flagbit;
  while (!(inp(SPSR) & 0x80)){};            //wait for spi xfr to complete
  status = inp(SPDR);

  outp(  ((0x08b >> 1) & 0xC0) | 0x20,SPDR);    //ms address
  while (!(inp(SPSR) & 0x80)){};            //wait for spi xfr to complete
  status = inp(SPDR);

  outp( 0 ,SPDR);
  while (!(inp(SPSR) & 0x80)){};            //wait for spi xfr to complete

  sender = inp(SPDR);

  nonce[8] = (uint8_t)(sender & 0x00ff);    //source address

  TOSH_SET_CC_CS_PIN();
  bSpiAvail = TRUE;
}

And I want to port it to MSP430 (telosb) I think it should look something
like this:


 if (call BusArbitration.getBus() == SUCCESS) {

      TOSH_CLR_RADIO_CSN_PIN();

      call USARTControl.isTxIntrPending();
      call USARTControl.rx(); //isRxIntrPending();

      call USARTControl.tx(0x08b & 0x7F) | 0x80);
      while(!(call USARTControl.isRxIntrPending())) ;
      status = adjustStatusByte(call USARTControl.rx());

      call USARTControl.tx((0x08b >> 1) & 0xC0) | 0x20);
      while(f.enabled && !(call USARTControl.isRxIntrPending())) ;
      status = adjustStatusByte(call USARTControl.rx());

      call USARTControl.tx(0);
      while( !(call USARTControl.isRxIntrPending())) ;
      sender = (call USARTControl.rx());

      TOSH_SET_RADIO_CSN_PIN();
      atomic f.busy = FALSE;
      call BusArbitration.releaseBus();
}

Does this look even remotely like it could work?

Jacques.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to