]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/LPCOpen/lpc_core/lpc_chip/chip_18xx_43xx/aes_18xx_43xx.h
Update LPC18xx FreeRTOS+UDP demo to use LPCOpen USB and Ethernet drivers.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / LPCOpen / lpc_core / lpc_chip / chip_18xx_43xx / aes_18xx_43xx.h
1 /*\r
2  * @brief LPC18xx/43xx AES Engine driver\r
3  *\r
4  * @note\r
5  * Copyright(C) NXP Semiconductors, 2012\r
6  * All rights reserved.\r
7  *\r
8  * @par\r
9  * Software that is described herein is for illustrative purposes only\r
10  * which provides customers with programming information regarding the\r
11  * LPC products.  This software is supplied "AS IS" without any warranties of\r
12  * any kind, and NXP Semiconductors and its licensor disclaim any and\r
13  * all warranties, express or implied, including all implied warranties of\r
14  * merchantability, fitness for a particular purpose and non-infringement of\r
15  * intellectual property rights.  NXP Semiconductors assumes no responsibility\r
16  * or liability for the use of the software, conveys no license or rights under any\r
17  * patent, copyright, mask work right, or any other intellectual property rights in\r
18  * or to any products. NXP Semiconductors reserves the right to make changes\r
19  * in the software without notification. NXP Semiconductors also makes no\r
20  * representation or warranty that such application will be suitable for the\r
21  * specified use without further testing or modification.\r
22  *\r
23  * @par\r
24  * Permission to use, copy, modify, and distribute this software and its\r
25  * documentation is hereby granted, under NXP Semiconductors' and its\r
26  * licensor's relevant copyrights in the software, without fee, provided that it\r
27  * is used in conjunction with NXP Semiconductors microcontrollers.  This\r
28  * copyright, permission, and disclaimer notice must appear in all copies of\r
29  * this code.\r
30  */\r
31 \r
32 #ifndef __AES_18XX_43XX_H_\r
33 #define __AES_18XX_43XX_H_\r
34 \r
35 #ifdef __cplusplus\r
36 extern "C" {\r
37 #endif\r
38 \r
39 /** @defgroup AES_18XX_43XX CHIP: LPC18xx/43xx AES Engine driver\r
40  * @ingroup CHIP_18XX_43XX_Drivers\r
41  * @{\r
42  */\r
43 \r
44 /**\r
45  * @brief       AES Engine operation mode\r
46  */\r
47 typedef enum CHIP_AES_OP_MODE {\r
48         CHIP_AES_API_CMD_ENCODE_ECB,    /*!< ECB Encode mode */\r
49         CHIP_AES_API_CMD_DECODE_ECB,    /*!< ECB Decode mode */\r
50         CHIP_AES_API_CMD_ENCODE_CBC,    /*!< CBC Encode mode */\r
51         CHIP_AES_API_CMD_DECODE_CBC,    /*!< CBC Decode mode */\r
52 } CHIP_AES_OP_MODE_T;\r
53 \r
54 /**\r
55  * @brief       Initialize the AES Engine function\r
56  * @return       None\r
57  * This function will initialise all the AES Engine driver function pointers\r
58  * and call the AES Engine Initialisation function.\r
59  */\r
60 void Chip_AES_Init(void);\r
61 \r
62 /**\r
63  * @brief       Set operation mode in AES Engine\r
64  * @param       AesMode : AES Operation Mode\r
65  * @return      Status\r
66  */\r
67 uint32_t Chip_AES_SetMode(CHIP_AES_OP_MODE_T AesMode);\r
68 \r
69 /**\r
70  * @brief       Load 128-bit AES user key in AES Engine\r
71  * @param   keyNum: 0 - Load AES 128-bit user key 1, else load user key2\r
72  * @return      None\r
73  */\r
74 void Chip_AES_LoadKey(uint32_t keyNum);\r
75 \r
76 /**\r
77  * @brief       Load randomly generated key in AES engine\r
78  * @return      None\r
79  * To update the RNG and load a new random number,\r
80  * the API call Chip_OTP_GenRand should be used\r
81  */\r
82 void Chip_AES_LoadKeyRNG(void);\r
83 \r
84 /**\r
85  * @brief       Load 128-bit AES software defined user key in AES Engine\r
86  * @param   pKey        : Pointer to 16 byte user key\r
87  * @return      None\r
88  */\r
89 void Chip_AES_LoadKeySW(uint8_t *pKey);\r
90 \r
91 /**\r
92  * @brief Load 128-bit AES initialization vector in AES Engine\r
93  * @param   pVector     : Pointer to 16 byte Initialisation vector\r
94  * @return      None\r
95  */\r
96 void Chip_AES_LoadIV_SW(uint8_t *pVector);\r
97 \r
98 /**\r
99  * @brief Load IC specific 128-bit AES initialization vector in AES Engine\r
100  * @return      None\r
101  * This loads 128-bit AES IC specific initialization vector,\r
102  * which is used to decrypt a boot image\r
103  */\r
104 void Chip_AES_LoadIV_IC(void);\r
105 \r
106 /**\r
107  * @brief Operate AES Engine\r
108  * @param   pDatOut     : Pointer to output data stream\r
109  * @param   pDatIn      : Pointer to input data stream\r
110  * @param   Size        : Size of the data stream (128-bit)\r
111  * @return      Status\r
112  * This function performs the AES operation after the AES mode\r
113  * has been set using Chip_AES_SetMode and the appropriate keys\r
114  * and init vectors have been loaded\r
115  */\r
116 uint32_t Chip_AES_Operate(uint8_t *pDatOut, uint8_t *pDatIn, uint32_t Size);\r
117 \r
118 /**\r
119  * @brief       Program 128-bit AES Key in OTP\r
120  * @param   KeyNum      : Key Number (Select 0 or 1)\r
121  * @param       pKey        : Pointer to AES Key (16 bytes required)\r
122  * @return      Status\r
123  * When calling the aes_ProgramKey2 function, ensure that VPP = 2.7 V to 3.6 V.\r
124  */\r
125 uint32_t Chip_AES_ProgramKey(uint32_t KeyNum, uint8_t *pKey);\r
126 \r
127 /**\r
128  * @}\r
129  */\r
130 \r
131 #ifdef __cplusplus\r
132 }\r
133 #endif\r
134 \r
135 #endif /* __AES_18XX_43XX_H_ */\r