mediCAL's first BLE project

Dependents:   BLE_mediCAL

Fork of nRF51822 by Nordic Semiconductor

Committer:
bogdanm
Date:
Wed Mar 26 14:38:17 2014 +0000
Revision:
0:eff01767de02
Child:
37:c29c330d942c
Initial import of the nRF51822 code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 0:eff01767de02 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
bogdanm 0:eff01767de02 2 *
bogdanm 0:eff01767de02 3 * The information contained herein is confidential property of Nordic
bogdanm 0:eff01767de02 4 * Semiconductor ASA.Terms and conditions of usage are described in detail
bogdanm 0:eff01767de02 5 * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
bogdanm 0:eff01767de02 6 *
bogdanm 0:eff01767de02 7 * Licensees are granted free, non-transferable use of the information. NO
bogdanm 0:eff01767de02 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
bogdanm 0:eff01767de02 9 * the file.
bogdanm 0:eff01767de02 10 *
bogdanm 0:eff01767de02 11 * $LastChangedRevision: 13999 $
bogdanm 0:eff01767de02 12 */
bogdanm 0:eff01767de02 13
bogdanm 0:eff01767de02 14 /**
bogdanm 0:eff01767de02 15 * @file
bogdanm 0:eff01767de02 16 * @brief ECB driver API.
bogdanm 0:eff01767de02 17 */
bogdanm 0:eff01767de02 18
bogdanm 0:eff01767de02 19 #ifndef NRF_ECB_H__
bogdanm 0:eff01767de02 20 #define NRF_ECB_H__
bogdanm 0:eff01767de02 21
bogdanm 0:eff01767de02 22 /**
bogdanm 0:eff01767de02 23 * @defgroup nrf_ecb AES ECB encryption
bogdanm 0:eff01767de02 24 * @{
bogdanm 0:eff01767de02 25 * @ingroup nrf_drivers
bogdanm 0:eff01767de02 26 * @brief Driver for the nRF51 AES Electronic Code Book (ECB) peripheral.
bogdanm 0:eff01767de02 27 *
bogdanm 0:eff01767de02 28 * In order to encrypt and decrypt data the peripheral must be powered on
bogdanm 0:eff01767de02 29 * using nrf_ecb_init() and then the key set using nrf_ecb_set_key.
bogdanm 0:eff01767de02 30 */
bogdanm 0:eff01767de02 31
bogdanm 0:eff01767de02 32 #include <stdint.h>
bogdanm 0:eff01767de02 33 #include "nordic_global.h"
bogdanm 0:eff01767de02 34
bogdanm 0:eff01767de02 35 /**
bogdanm 0:eff01767de02 36 * Initialize and power on the ECB peripheral.
bogdanm 0:eff01767de02 37 *
bogdanm 0:eff01767de02 38 * Allocates memory for the ECBDATAPTR.
bogdanm 0:eff01767de02 39 * @retval true Initialization was successful.
bogdanm 0:eff01767de02 40 * @retval false Powering up failed.
bogdanm 0:eff01767de02 41 */
bogdanm 0:eff01767de02 42 bool nrf_ecb_init(void);
bogdanm 0:eff01767de02 43
bogdanm 0:eff01767de02 44 /**
bogdanm 0:eff01767de02 45 * Encrypt/decrypt 16-byte data using current key.
bogdanm 0:eff01767de02 46 *
bogdanm 0:eff01767de02 47 * The function avoids unnecessary copying of data if the point to the
bogdanm 0:eff01767de02 48 * correct locations in the ECB data structure.
bogdanm 0:eff01767de02 49 *
bogdanm 0:eff01767de02 50 * @param dst Result of encryption/decryption. 16 bytes will be written.
bogdanm 0:eff01767de02 51 * @param src Source with 16-byte data to be encrypted/decrypted.
bogdanm 0:eff01767de02 52 *
bogdanm 0:eff01767de02 53 * @retval true If the encryption operation completed.
bogdanm 0:eff01767de02 54 * @retval false If the encryption operation did not complete.
bogdanm 0:eff01767de02 55 */
bogdanm 0:eff01767de02 56 bool nrf_ecb_crypt(uint8_t * dst, const uint8_t * src);
bogdanm 0:eff01767de02 57
bogdanm 0:eff01767de02 58 /**
bogdanm 0:eff01767de02 59 * Set the key to be used for encryption/decryption.
bogdanm 0:eff01767de02 60 *
bogdanm 0:eff01767de02 61 * @param key Pointer to key. 16 bytes will be read.
bogdanm 0:eff01767de02 62 */
bogdanm 0:eff01767de02 63 void nrf_ecb_set_key(const uint8_t * key);
bogdanm 0:eff01767de02 64
bogdanm 0:eff01767de02 65 #endif // NRF_ECB_H__
bogdanm 0:eff01767de02 66
bogdanm 0:eff01767de02 67 /** @} */