2 * @brief LPC18xx/43xx AES Engine driver
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * All rights reserved.
\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
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
32 #ifndef __AES_18XX_43XX_H_
\r
33 #define __AES_18XX_43XX_H_
\r
39 /** @defgroup AES_18XX_43XX CHIP: LPC18xx/43xx AES Engine driver
\r
40 * @ingroup CHIP_18XX_43XX_Drivers
\r
45 * @brief AES Engine operation mode
\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
55 * @brief Initialize the AES Engine function
\r
57 * This function will initialise all the AES Engine driver function pointers
\r
58 * and call the AES Engine Initialisation function.
\r
60 void Chip_AES_Init(void);
\r
63 * @brief Set operation mode in AES Engine
\r
64 * @param AesMode : AES Operation Mode
\r
67 uint32_t Chip_AES_SetMode(CHIP_AES_OP_MODE_T AesMode);
\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
74 void Chip_AES_LoadKey(uint32_t keyNum);
\r
77 * @brief Load randomly generated key in AES engine
\r
79 * To update the RNG and load a new random number,
\r
80 * the API call Chip_OTP_GenRand should be used
\r
82 void Chip_AES_LoadKeyRNG(void);
\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
89 void Chip_AES_LoadKeySW(uint8_t *pKey);
\r
92 * @brief Load 128-bit AES initialization vector in AES Engine
\r
93 * @param pVector : Pointer to 16 byte Initialisation vector
\r
96 void Chip_AES_LoadIV_SW(uint8_t *pVector);
\r
99 * @brief Load IC specific 128-bit AES initialization vector in AES Engine
\r
101 * This loads 128-bit AES IC specific initialization vector,
\r
102 * which is used to decrypt a boot image
\r
104 void Chip_AES_LoadIV_IC(void);
\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
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
116 uint32_t Chip_AES_Operate(uint8_t *pDatOut, uint8_t *pDatIn, uint32_t Size);
\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
123 * When calling the aes_ProgramKey2 function, ensure that VPP = 2.7 V to 3.6 V.
\r
125 uint32_t Chip_AES_ProgramKey(uint32_t KeyNum, uint8_t *pKey);
\r
135 #endif /* __AES_18XX_43XX_H_ */
\r