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