SG RFID nRF51822 fork

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nrf_ecb.h Source File

nrf_ecb.h

Go to the documentation of this file.
00001 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is confidential property of Nordic 
00004  * Semiconductor ASA.Terms and conditions of usage are described in detail 
00005  * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *              
00011  * $LastChangedRevision: 13999 $
00012  */
00013 
00014 /**
00015  * @file
00016  * @brief ECB driver API.
00017  */
00018 
00019 #ifndef NRF_ECB_H__
00020 #define NRF_ECB_H__
00021 
00022 /**
00023  * @defgroup nrf_ecb AES ECB encryption
00024  * @{
00025  * @ingroup nrf_drivers
00026  * @brief Driver for the nRF51 AES Electronic Code Book (ECB) peripheral.
00027  *
00028  * In order to encrypt and decrypt data the peripheral must be powered on
00029  * using nrf_ecb_init() and then the key set using nrf_ecb_set_key.
00030  */
00031 
00032 #include <stdint.h>
00033 
00034 /**
00035  * Initialize and power on the ECB peripheral.
00036  *
00037  * Allocates memory for the ECBDATAPTR.
00038  * @retval true Initialization was successful.
00039  * @retval false Powering up failed.
00040  */
00041 bool nrf_ecb_init(void);
00042 
00043 /**
00044  * Encrypt/decrypt 16-byte data using current key.
00045  *
00046  * The function avoids unnecessary copying of data if the point to the 
00047  * correct locations in the ECB data structure.
00048  *
00049  * @param dst Result of encryption/decryption. 16 bytes will be written. 
00050  * @param src Source with 16-byte data to be encrypted/decrypted.
00051  *
00052  * @retval true  If the encryption operation completed.
00053  * @retval false If the encryption operation did not complete.
00054  */
00055 bool nrf_ecb_crypt(uint8_t * dst, const uint8_t * src);
00056 
00057 /**
00058  * Set the key to be used for encryption/decryption.
00059  *
00060  * @param key Pointer to key. 16 bytes will be read.
00061  */
00062 void nrf_ecb_set_key(const uint8_t * key);
00063 
00064 #endif  // NRF_ECB_H__
00065 
00066 /** @} */