CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

MRF24J40MA Security issue

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
goranst



Joined: 13 Mar 2011
Posts: 4
Location: Skopje, Macedonia

View user's profile Send private message Visit poster's website

MRF24J40MA Security issue
PostPosted: Tue Feb 28, 2012 5:35 pm     Reply with quote

Hi all.

I am working on a universal home automation board base on pic 18f14k50 and MRF24J40MA. The communication works like a charm, I have no problems.

Anyway, when I try to encrypt the messages, It simply does not work.

I follow the MRF24J40MA data sheet and implement all the necessary steps. This is my TX_normal routine:

Code:
void write_TX_normal_FIFO(void){
   int i = 0;
int8 temp;

   data_TX_normal_FIFO[0]  = HEADER_LENGHT;
   data_TX_normal_FIFO[1]  = HEADER_LENGHT + DATA_LENGHT;
   data_TX_normal_FIFO[2]  = 0x01;                        // control frame
   data_TX_normal_FIFO[3]  = 0x88;
   //data_TX_normal_FIFO[4]  = SEQ_NUMBER;                // sequence number
   data_TX_normal_FIFO[5]  = PAN_ID_2[1];                 // destinatoin pan
   data_TX_normal_FIFO[6]  = PAN_ID_2[0];
   data_TX_normal_FIFO[7]  = ADDRESS_short_2[0];          // destination address 
   data_TX_normal_FIFO[8]  = ADDRESS_short_2[1]; 
   data_TX_normal_FIFO[9]  = PAN_ID_1[0];                 // source pan
   data_TX_normal_FIFO[10] = PAN_ID_1[1];
   data_TX_normal_FIFO[11] = ADDRESS_short_1[0];          // source address
   data_TX_normal_FIFO[12] = ADDRESS_short_1[1];

   data_TX_normal_FIFO[13] = DATA_TX[0];                  // data
   data_TX_normal_FIFO[14] = DATA_TX[1];
   data_TX_normal_FIFO[15] = DATA_TX[2];
   data_TX_normal_FIFO[16] = DATA_TX[3];                 
   data_TX_normal_FIFO[17] = DATA_TX[4];
   data_TX_normal_FIFO[18] = DATA_TX[5];
   data_TX_normal_FIFO[19] = DATA_TX[6];                 
   data_TX_normal_FIFO[20] = DATA_TX[7];

   for(i = 0; i < (HEADER_LENGHT + DATA_LENGHT + 2); i++)
   {
    write_ZIGBEE_long(address_TX_normal_FIFO + i, data_TX_normal_FIFO[i]); // write frame into normal FIFO
   }

//2.
   for(i = 0; i < 13; i++)
   {
    write_ZIGBEE_long(UPNONCE0+i, NONCEkey[i]); // write NONCE security key normal FIFO
   }

//3.
   for(i = 0; i < 16; i++)
   {
    write_ZIGBEE_long(SECKTXNFIFO + i, key[i]); // write security key normal FIFO
   }

//3.
  temp = read_ZIGBEE_short(SECCON0);
  temp = temp | 0x05;                   
  temp = temp & 0xFD;                   
  write_ZIGBEE_short(SECCON0, temp);   // write Security Suite (AES-CBC-MAC-128)

//4.
  write_ZIGBEE_short(SECCR2, read_ZIGBEE_short(SECCR2)|0x40);   

  //5.
  temp = read_ZIGBEE_short(TXNCON);
  temp = temp | 0x02;                   // mask for set encrypt
  write_ZIGBEE_short(TXNCON, temp);

  //6.
  temp = read_ZIGBEE_short(TXNCON);
  temp = temp | 0x01;                // mask for start transmit
  write_ZIGBEE_short(TXNCON, temp);

}


Did someone had similar problems? has someone developed a encryption routine that is tested and works?

Thanks for the help in advance
_________________
Goran Stojanovski

www.atronika.com
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group