R1 code for micro:bit based train controller code, requires second micro:bit running rx code to operate - see https://meanderingpi.wordpress.com/ for more information

Fork of nrf51-sdk by Lancaster University

Embed: (wiki syntax)

« Back to documentation index

AES ECB encryption

AES ECB encryption

Driver for the AES Electronic Code Book (ECB) peripheral. More...

Functions

bool nrf_ecb_init (void)
 Function for initializing and powering on the ECB peripheral.
bool nrf_ecb_crypt (uint8_t *dst, const uint8_t *src)
 Function for encrypting and decrypting 16-byte data using current key.
void nrf_ecb_set_key (const uint8_t *key)
 Function for setting the key to be used for encryption and decryption.

Detailed Description

Driver for the AES Electronic Code Book (ECB) peripheral.

To encrypt and decrypt data, the peripheral must first be powered on using nrf_ecb_init. Next, the key must be set using nrf_ecb_set_key.


Function Documentation

bool nrf_ecb_crypt ( uint8_t *  dst,
const uint8_t *  src 
)

Function for encrypting and decrypting 16-byte data using current key.

This function avoids unnecessary copying of data if the parameters point to the correct locations in the ECB data structure.

Parameters:
dstResult of encryption/decryption. 16 bytes will be written.
srcSource with 16-byte data to be encrypted/decrypted.
Return values:
trueIf the encryption operation completed.
falseIf the encryption operation did not complete.

Definition at line 63 of file nrf_ecb.c.

bool nrf_ecb_init ( void   )

Function for initializing and powering on the ECB peripheral.

This function allocates memory for the ECBDATAPTR.

Return values:
trueIf initialization was successful.
falseIf powering on failed.

Definition at line 52 of file nrf_ecb.c.

void nrf_ecb_set_key ( const uint8_t *  key )

Function for setting the key to be used for encryption and decryption.

Parameters:
keyPointer to the key. 16 bytes will be read.

Definition at line 88 of file nrf_ecb.c.