Lancaster University fork of the Nordic nrf51-SDK repository, which actually lives on github: https://github.com/lancaster-university/nrf51-sdk
nrf_ecb.h
00001 /* 00002 * Copyright (c) Nordic Semiconductor ASA 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without modification, 00006 * are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright notice, this 00009 * list of conditions and the following disclaimer. 00010 * 00011 * 2. Redistributions in binary form must reproduce the above copyright notice, this 00012 * list of conditions and the following disclaimer in the documentation and/or 00013 * other materials provided with the distribution. 00014 * 00015 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 00016 * contributors to this software may be used to endorse or promote products 00017 * derived from this software without specific prior written permission. 00018 * 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00021 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00022 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00023 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 00024 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00025 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00026 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00027 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 */ 00032 00033 /** 00034 * @file 00035 * @brief ECB driver API. 00036 */ 00037 00038 #ifndef NRF_ECB_H__ 00039 #define NRF_ECB_H__ 00040 00041 /** 00042 * @defgroup nrf_ecb AES ECB encryption 00043 * @{ 00044 * @ingroup nrf_drivers 00045 * @brief Driver for the AES Electronic Code Book (ECB) peripheral. 00046 * 00047 * To encrypt and decrypt data, the peripheral must first be powered on 00048 * using @ref nrf_ecb_init. Next, the key must be set using @ref nrf_ecb_set_key. 00049 */ 00050 00051 #include <stdint.h> 00052 00053 /** 00054 * @brief Function for initializing and powering on the ECB peripheral. 00055 * 00056 * This function allocates memory for the ECBDATAPTR. 00057 * @retval true If initialization was successful. 00058 * @retval false If powering on failed. 00059 */ 00060 bool nrf_ecb_init(void); 00061 00062 /** 00063 * @brief Function for encrypting and decrypting 16-byte data using current key. 00064 * 00065 * This function avoids unnecessary copying of data if the parameters point to the 00066 * correct locations in the ECB data structure. 00067 * 00068 * @param dst Result of encryption/decryption. 16 bytes will be written. 00069 * @param src Source with 16-byte data to be encrypted/decrypted. 00070 * 00071 * @retval true If the encryption operation completed. 00072 * @retval false If the encryption operation did not complete. 00073 */ 00074 bool nrf_ecb_crypt(uint8_t * dst, const uint8_t * src); 00075 00076 /** 00077 * @brief Function for setting the key to be used for encryption and decryption. 00078 * 00079 * @param key Pointer to the key. 16 bytes will be read. 00080 */ 00081 void nrf_ecb_set_key(const uint8_t * key); 00082 00083 #endif // NRF_ECB_H__ 00084 00085 /** @} */
Generated on Tue Jul 12 2022 15:07:14 by 1.7.2