nRF51 SDK: AES ECB encryption

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
AES ECB encryption
Peripheral Drivers

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

## Functions

bool | nrf_ecb_init (void)
bool | nrf_ecb_crypt (uint8_t *dst, const uint8_t *src)
void | nrf_ecb_set_key (const uint8_t *key)

## Detailed Description

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

In order to encrypt and decrypt data the peripheral must be powered on using nrf_ecb_init() and then the key set using nrf_ecb_set_key.

## Function Documentation

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

Encrypt/decrypt 16-byte data using current key.

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

Parameters

  dst | Result of encryption/decryption. 16 bytes will be written.
  src | Source with 16-byte data to be encrypted/decrypted.

Return values

  true | If the encryption operation completed.
  false | If the encryption operation did not complete.

bool nrf_ecb_init | ( | void |  | ) |

Initialize and power on the ECB peripheral.

Allocates memory for the ECBDATAPTR.

Return values

  true | Initialization was successful.
  false | Powering up failed.

void nrf_ecb_set_key | ( | const uint8_t * | key | ) |

Set the key to be used for encryption/decryption.

Parameters

  key | Pointer to key. 16 bytes will be read.