Disable unencrypted receive by default. also add meshkey

This commit is contained in:
Stefan `Sec` Zehl 2011-08-03 21:57:09 +02:00
parent 7170789b3e
commit 0c7afe0eb1
2 changed files with 5 additions and 6 deletions

View File

@ -12,7 +12,7 @@ char meshincctr=0; // Generation
MPKT meshbuffer[MESHBUFSIZE];
uint32_t const meshkey[4] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000
0x00000042, 0x000005ec, 0x00000023, 0x00000005
};
struct NRF_CFG oldconfig;

View File

@ -153,13 +153,12 @@ int nrf_rcv_pkt_poll_dec(int maxsize, uint8_t * pkt, uint32_t const key[4]){
return len;
cmpcrc=crc16(pkt,len-2);
if(cmpcrc != (pkt[len-2] <<8 | pkt[len-1])) {
if(key!=NULL)
xxtea_decode_words((uint32_t*)pkt,len/4,key);
cmpcrc=crc16(pkt,len-2);
if(cmpcrc != (pkt[len-2] <<8 | pkt[len-1])) {
return -3; // CRC failed
};
cmpcrc=crc16(pkt,len-2);
if(cmpcrc != (pkt[len-2] <<8 | pkt[len-1])) {
return -3; // CRC failed
};
return len;
};