Contiki 2.6

cc2420-aes.c File Reference

AES encryption functions. More...

#include "contiki.h"
#include "dev/cc2420.h"
#include "dev/cc2420-aes.h"
#include "dev/spi.h"

Go to the source code of this file.

Functions

void cc2420_aes_set_key (const uint8_t *key, int index)
 Setup an AES key.
void cc2420_aes_cipher (uint8_t *data, int len, int key_index)
 Encrypt/decrypt data with AES.

Detailed Description

AES encryption functions.

Author:
Adam Dunkels <adam@sics.se>

Definition in file cc2420-aes.c.


Function Documentation

void cc2420_aes_cipher ( uint8_t *  data,
int  len,
int  key_index 
)

Encrypt/decrypt data with AES.

Parameters:
dataA pointer to the data to be encrypted/decrypted
lenThe length of the data to be encrypted/decrypted
key_indexThe key to use. The key must have previously been set up with cc2420_aes_set_key().

This function encrypts/decrypts data with AES. A pointer to the data is passed as a parameter, and the function overwrites the data with the encrypted data.

Definition at line 96 of file cc2420-aes.c.

void cc2420_aes_set_key ( const uint8_t *  key,
int  index 
)

Setup an AES key.

Parameters:
keyA pointer to a 16-byte AES key
indexThe key index: either 0 or 1.

This function sets up an AES key with the CC2420 chip. The AES key can later be used with the cc2420_aes_cipher() function to encrypt or decrypt data.

The CC2420 can store two separate keys in its memory. The keys are indexed as 0 or 1 and the key index is given by the 'index' parameter.

Definition at line 66 of file cc2420-aes.c.