Ejemplo n.º 1
0
/*---------------------------------------------------------------------------*/
void
cc2420_aes_set_key(const uint8_t *key, int index)
{
    switch(index) {
    case 0:
        CC2420_WRITE_RAM_REV(key, CC2420RAM_KEY0, KEYLEN);
        break;
    case 1:
        CC2420_WRITE_RAM_REV(key, CC2420RAM_KEY1, KEYLEN);
        break;
    }
}
Ejemplo n.º 2
0
/*-----------------------------------------------------------------------------------*/
static void
set_security_data(uint8_t *buf)
{
	/* write network key to cc2420 reg */
	CC2420_WRITE_RAM_REV(&buf[0], CC2420RAM_KEY0, KEY_SIZE);

	/* Set sensor key and security app data */
	devices[0].key_freshness = 0x03;
	devices[0].msg_cntr = 0;
	devices[0].nonce_cntr = 1;
	memcpy(&devices[0].remote_device_id.u8[0], &buf[APPLAYER_OFFSET], 16);
	memcpy(&devices[0].session_key[0], &buf[APPLAYER_OFFSET+16], KEY_SIZE);
}