Nordic nrf51 sdk sources. Mirrored from https://github.com/ARMmbed/nrf51-sdk.

Dependents:   nRF51822 nRF51822

Committer:
vcoubard
Date:
Thu Apr 07 17:37:40 2016 +0100
Revision:
19:47192cb9def7
Parent:
10:233fefd8162b
Child:
20:a90c48eb1d30
Synchronized with git rev 9251259f
Author: Liyou Zhou
Copy over coresponding files from nordic-sdk 9.0.0

Who changed what in which revision?

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