MAX32655 Peripheral Driver API
Peripheral Driver API for the MAX32655
aes.h
1 
6 /* ****************************************************************************
7  * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
23  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Except as contained in this notice, the name of Maxim Integrated
28  * Products, Inc. shall not be used except as stated in the Maxim Integrated
29  * Products, Inc. Branding Policy.
30  *
31  * The mere transfer of this software does not imply any licenses
32  * of trade secrets, proprietary technology, copyrights, patents,
33  * trademarks, maskwork rights, or any other form of intellectual
34  * property whatsoever. Maxim Integrated Products, Inc. retains all
35  * ownership rights.
36  *
37  *************************************************************************** */
38 
39 #ifndef _AES_H_
40 #define _AES_H_
41 
42 /***** Includes *****/
43 #include "aes_regs.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
54 
56 /***** Definitions *****/
57 
58 typedef void (*mxc_aes_complete_t) (void* req, int result);
59 
60 /* ************************************************************************* */
61 /* Cipher Definitions */
62 /* ************************************************************************* */
63 
68 typedef enum {
69  MXC_AES_128BITS = MXC_S_AES_CTRL_KEY_SIZE_AES128,
70  MXC_AES_192BITS = MXC_S_AES_CTRL_KEY_SIZE_AES192,
71  MXC_AES_256BITS = MXC_S_AES_CTRL_KEY_SIZE_AES256,
72 } mxc_aes_keys_t;
73 
78 typedef enum {
79  MXC_AES_ENCRYPT_EXT_KEY = 0,
80  MXC_AES_DECRYPT_EXT_KEY = 1,
81  MXC_AES_DECRYPT_INT_KEY = 2
82 } mxc_aes_enc_type_t;
83 
88 typedef struct _mxc_aes_cipher_req_t {
89  uint32_t length;
90  uint32_t *inputData;
91  uint32_t *resultData;
92  mxc_aes_keys_t keySize;
93  mxc_aes_enc_type_t encryption;
94  mxc_aes_complete_t callback;
96 
97 /***** Function Prototypes *****/
98 
99 /* ************************************************************************* */
100 /* Global Control/Configuration functions */
101 /* ************************************************************************* */
102 
108 int MXC_AES_Init (void);
109 
115 void MXC_AES_EnableInt (uint32_t interrupt);
116 
122 void MXC_AES_DisableInt (uint32_t interrupt);
123 
129 int MXC_AES_IsBusy (void);
130 
136 int MXC_AES_Shutdown (void);
137 
142 void MXC_AES_DMACallback (int ch, int error);
143 
147 void MXC_AES_GenerateKey (void);
148 
154 void MXC_AES_SetKeySize (mxc_aes_keys_t key);
155 
161 mxc_aes_keys_t MXC_AES_GetKeySize (void);
162 
167 void MXC_AES_FlushInputFIFO (void);
168 
173 void MXC_AES_FlushOutputFIFO (void);
174 
179 void MXC_AES_Start (void);
180 
186 uint32_t MXC_AES_GetFlags (void);
187 
193 void MXC_AES_ClearFlags (uint32_t flags);
194 
203 int MXC_AES_Generic (mxc_aes_req_t* req);
204 
213 int MXC_AES_Encrypt (mxc_aes_req_t* req);
214 
223 int MXC_AES_Decrypt (mxc_aes_req_t* req);
224 
232 int MXC_AES_TXDMAConfig (void *src_addr, int len);
233 
241 int MXC_AES_RXDMAConfig (void *dest_addr, int len);
242 
251 int MXC_AES_GenericAsync (mxc_aes_req_t* req, uint8_t enc);
252 
261 int MXC_AES_EncryptAsync (mxc_aes_req_t* req);
262 
271 int MXC_AES_DecryptAsync (mxc_aes_req_t* req);
272 
278 void MXC_AES_SetExtKey(const void* key, mxc_aes_keys_t len);
279 
280 #ifdef __cplusplus
281 }
282 #endif
283 
285 #endif /* _AES_H_ */
mxc_aes_complete_t callback
Callback function.
Definition: aes.h:94
#define MXC_S_AES_CTRL_KEY_SIZE_AES128
Definition: aes_regs.h:137
mxc_aes_enc_type_t encryption
Encrytion type or mxc_aes_enc_type_t.
Definition: aes.h:93
uint32_t * resultData
Pointer to encrypted data.
Definition: aes.h:91
#define MXC_S_AES_CTRL_KEY_SIZE_AES256
Definition: aes_regs.h:141
uint32_t * inputData
Pointer to input data.
Definition: aes.h:90
#define MXC_S_AES_CTRL_KEY_SIZE_AES192
Definition: aes_regs.h:139
uint32_t length
Length of the data.
Definition: aes.h:89
Structure used to set up AES request.
Definition: aes.h:88
mxc_aes_keys_t keySize
Size of AES key.
Definition: aes.h:92