Yoshihiro TSUBOI / BLE_API_Native_IRC

Dependents:   BLE_Health_Thermometer_IRC BLE_RCBController_micono_test BLE_konashi_PIO_test BLE_ADT7410_TMP102_Sample ... more

Fork of BLE_API_Native_blog by Donal Morrissey

Committer:
ktownsend
Date:
Fri Feb 07 16:04:09 2014 +0000
Revision:
4:2f1f20c755ed
Parent:
0:4c3097c65247
Added nordic_global.h to solve conditional compilation issues

Who changed what in which revision?

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