SG RFID nRF51822 fork
Fork of nRF51822 by
nordic/nrf-sdk/nrf_ecb.h@37:c29c330d942c, 2014-07-07 (annotated)
- Committer:
- Rohit Grover
- Date:
- Mon Jul 07 13:43:31 2014 +0100
- Revision:
- 37:c29c330d942c
- Parent:
- 0:eff01767de02
changes required to upgrade to V7 of the soft-device
Who changed what in which revision?
User | Revision | Line number | New 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 | |
bogdanm | 0:eff01767de02 | 34 | /** |
bogdanm | 0:eff01767de02 | 35 | * Initialize and power on the ECB peripheral. |
bogdanm | 0:eff01767de02 | 36 | * |
bogdanm | 0:eff01767de02 | 37 | * Allocates memory for the ECBDATAPTR. |
bogdanm | 0:eff01767de02 | 38 | * @retval true Initialization was successful. |
bogdanm | 0:eff01767de02 | 39 | * @retval false Powering up failed. |
bogdanm | 0:eff01767de02 | 40 | */ |
bogdanm | 0:eff01767de02 | 41 | bool nrf_ecb_init(void); |
bogdanm | 0:eff01767de02 | 42 | |
bogdanm | 0:eff01767de02 | 43 | /** |
bogdanm | 0:eff01767de02 | 44 | * Encrypt/decrypt 16-byte data using current key. |
bogdanm | 0:eff01767de02 | 45 | * |
bogdanm | 0:eff01767de02 | 46 | * The function avoids unnecessary copying of data if the point to the |
bogdanm | 0:eff01767de02 | 47 | * correct locations in the ECB data structure. |
bogdanm | 0:eff01767de02 | 48 | * |
bogdanm | 0:eff01767de02 | 49 | * @param dst Result of encryption/decryption. 16 bytes will be written. |
bogdanm | 0:eff01767de02 | 50 | * @param src Source with 16-byte data to be encrypted/decrypted. |
bogdanm | 0:eff01767de02 | 51 | * |
bogdanm | 0:eff01767de02 | 52 | * @retval true If the encryption operation completed. |
bogdanm | 0:eff01767de02 | 53 | * @retval false If the encryption operation did not complete. |
bogdanm | 0:eff01767de02 | 54 | */ |
bogdanm | 0:eff01767de02 | 55 | bool nrf_ecb_crypt(uint8_t * dst, const uint8_t * src); |
bogdanm | 0:eff01767de02 | 56 | |
bogdanm | 0:eff01767de02 | 57 | /** |
bogdanm | 0:eff01767de02 | 58 | * Set the key to be used for encryption/decryption. |
bogdanm | 0:eff01767de02 | 59 | * |
bogdanm | 0:eff01767de02 | 60 | * @param key Pointer to key. 16 bytes will be read. |
bogdanm | 0:eff01767de02 | 61 | */ |
bogdanm | 0:eff01767de02 | 62 | void nrf_ecb_set_key(const uint8_t * key); |
bogdanm | 0:eff01767de02 | 63 | |
bogdanm | 0:eff01767de02 | 64 | #endif // NRF_ECB_H__ |
bogdanm | 0:eff01767de02 | 65 | |
bogdanm | 0:eff01767de02 | 66 | /** @} */ |