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