aes256.h
Go to the documentation of this file.
1 #ifndef AES256_H_
2 #define AES256_H_
3 
4 //*****************************************************************************
5 //
8 //
9 //*****************************************************************************
10 
11 //*****************************************************************************
12 //
13 // If building with a C++ compiler, make all of the definitions in this header
14 // have a C binding.
15 //
16 //*****************************************************************************
17 #ifdef __cplusplus
18 extern "C"
19 {
20 #endif
21 
22 #include <stdint.h>
23 #include "register_remap.h"
24 #include <stdbool.h>
25 #include <msp432.h>
26 
27 /* Module Defines and macro for easy access */
28 #define AES256_CMSIS(x) ((AES256_Type *) x)
29 
30 //*****************************************************************************
31 //
32 // The following are deprecated values. Please refer to documentation for the
33 // correct values to use.
34 //
35 //*****************************************************************************
36 #define Key_128BIT 128
37 #define Key_192BIT 192
38 #define Key_256BIT 256
39 
40 //*****************************************************************************
41 //
42 // The following are values that can be passed to the keyLength parameter for
43 // functions: AES256_setCipherKey(), AES256_setDecipherKey(), and
44 // AES256_startSetDecipherKey().
45 //
46 //*****************************************************************************
47 #define AES256_KEYLENGTH_128BIT 128
48 #define AES256_KEYLENGTH_192BIT 192
49 #define AES256_KEYLENGTH_256BIT 256
50 
51 //*****************************************************************************
52 //
53 // The following are values that can be passed toThe following are values that
54 // can be returned by the AES256_getErrorFlagStatus() function.
55 //
56 //*****************************************************************************
57 #define AES256_ERROR_OCCURRED AESERRFG
58 #define AES256_NO_ERROR 0x00
59 
60 //*****************************************************************************
61 //
62 // The following are values that can be passed toThe following are values that
63 // can be returned by the AES256_isBusy() function.
64 //
65 //*****************************************************************************
66 #define AES256_BUSY AESBUSY
67 #define AES256_NOT_BUSY 0x00
68 
69 //*****************************************************************************
70 //
71 // The following are values that can be passed toThe following are values that
72 // can be returned by the AES256_getInterruptFlagStatus() function.
73 //
74 //*****************************************************************************
75 #define AES256_READY_INTERRUPT 0x01
76 #define AES256_NOTREADY_INTERRUPT 0x00
77 
78 //*****************************************************************************
79 //
80 // Prototypes for the APIs.
81 //
82 //*****************************************************************************
83 
84 //*****************************************************************************
85 //
98 //
99 //*****************************************************************************
100 extern bool AES256_setCipherKey(uint32_t moduleInstance,
101  const uint8_t *cipherKey, uint_fast16_t keyLength);
102 
103 //*****************************************************************************
104 //
117 //
118 //*****************************************************************************
119 extern void AES256_encryptData(uint32_t moduleInstance, const uint8_t *data,
120  uint8_t *encryptedData);
121 
122 //*****************************************************************************
123 //
137 //
138 //*****************************************************************************
139 extern void AES256_decryptData(uint32_t moduleInstance, const uint8_t *data,
140  uint8_t *decryptedData);
141 
142 //*****************************************************************************
143 //
159 //
160 //*****************************************************************************
161 extern bool AES256_setDecipherKey(uint32_t moduleInstance,
162  const uint8_t *cipherKey, uint_fast16_t keyLength);
163 
164 //*****************************************************************************
165 //
173 //
174 //*****************************************************************************
175 extern void AES256_clearInterruptFlag(uint32_t moduleInstance);
176 
177 //*****************************************************************************
178 //
187 //
188 //*****************************************************************************
189 extern uint32_t AES256_getInterruptFlagStatus(uint32_t moduleInstance);
190 
191 //*****************************************************************************
192 //
200 //
201 //*****************************************************************************
202 extern void AES256_enableInterrupt(uint32_t moduleInstance);
203 
204 //*****************************************************************************
205 //
213 //
214 //*****************************************************************************
215 extern void AES256_disableInterrupt(uint32_t moduleInstance);
216 
217 //*****************************************************************************
218 //
226 //
227 //*****************************************************************************
228 extern void AES256_reset(uint32_t moduleInstance);
229 
230 //*****************************************************************************
231 //
245 //
246 //*****************************************************************************
247 extern void AES256_startEncryptData(uint32_t moduleInstance,
248  const uint8_t *data);
249 
250 //*****************************************************************************
251 //
266 //
267 //*****************************************************************************
268 extern void AES256_startDecryptData(uint32_t moduleInstance,
269  const uint8_t *data);
270 
271 //*****************************************************************************
272 //
288 //
289 //*****************************************************************************
290 extern bool AES256_startSetDecipherKey(uint32_t moduleInstance,
291  const uint8_t *cipherKey, uint_fast16_t keyLength);
292 
293 //*****************************************************************************
294 //
306 //
307 //*****************************************************************************
308 extern bool AES256_getDataOut(uint32_t moduleInstance,
309  uint8_t *outputData);
310 
311 //*****************************************************************************
312 //
318 //
319 //*****************************************************************************
320 extern bool AES256_isBusy(uint32_t moduleInstance);
321 
322 //*****************************************************************************
323 //
331 //
332 //*****************************************************************************
333 extern void AES256_clearErrorFlag(uint32_t moduleInstance);
334 
335 //*****************************************************************************
336 //
345 //
346 //*****************************************************************************
347 extern uint32_t AES256_getErrorFlagStatus(uint32_t moduleInstance);
348 
349 //*****************************************************************************
350 //
365 //
366 //*****************************************************************************
367 extern void AES256_registerInterrupt(uint32_t moduleInstance,
368  void (*intHandler)(void));
369 
370 //*****************************************************************************
371 //
384 //
385 //*****************************************************************************
386 extern void AES256_unregisterInterrupt(uint32_t moduleInstance);
387 
388 //*****************************************************************************
389 //
395 //
396 //*****************************************************************************
397 extern uint32_t AES256_getInterruptStatus(uint32_t moduleInstance);
398 
399 //*****************************************************************************
400 //
401 // Mark the end of the C bindings section for C++ compilers.
402 //
403 //*****************************************************************************
404 #ifdef __cplusplus
405 }
406 #endif
407 
408 //*****************************************************************************
409 //
410 // Close the Doxygen group.
412 //
413 //*****************************************************************************
414 
415 #endif /* AES256_H_ */
416 
void AES256_startDecryptData(uint32_t moduleInstance, const uint8_t *data)
Decypts a block of data using the AES256 module.
Definition: aes256.c:207
bool AES256_setCipherKey(uint32_t moduleInstance, const uint8_t *cipherKey, uint_fast16_t keyLength)
Loads a 128, 192 or 256 bit cipher key to AES256 module.
Definition: aes256.c:5
void AES256_clearInterruptFlag(uint32_t moduleInstance)
Clears the AES256 ready interrupt flag.
Definition: aes256.c:161
void AES256_encryptData(uint32_t moduleInstance, const uint8_t *data, uint8_t *encryptedData)
Encrypts a block of data using the AES256 module.
Definition: aes256.c:46
bool AES256_isBusy(uint32_t moduleInstance)
Gets the AES256 module busy status.
Definition: aes256.c:288
bool AES256_getDataOut(uint32_t moduleInstance, uint8_t *outputData)
Reads back the output data from AES256 module.
Definition: aes256.c:268
void AES256_enableInterrupt(uint32_t moduleInstance)
Enables AES256 ready interrupt.
Definition: aes256.c:171
void AES256_registerInterrupt(uint32_t moduleInstance, void(*intHandler)(void))
Definition: aes256.c:303
bool AES256_startSetDecipherKey(uint32_t moduleInstance, const uint8_t *cipherKey, uint_fast16_t keyLength)
Sets the decipher key.
Definition: aes256.c:228
uint32_t AES256_getInterruptFlagStatus(uint32_t moduleInstance)
Gets the AES256 ready interrupt flag status.
Definition: aes256.c:166
void AES256_disableInterrupt(uint32_t moduleInstance)
Disables AES256 ready interrupt.
Definition: aes256.c:176
void AES256_decryptData(uint32_t moduleInstance, const uint8_t *data, uint8_t *decryptedData)
Decrypts a block of data using the AES256 module.
Definition: aes256.c:81
void AES256_reset(uint32_t moduleInstance)
Resets AES256 Module immediately.
Definition: aes256.c:181
bool AES256_setDecipherKey(uint32_t moduleInstance, const uint8_t *cipherKey, uint_fast16_t keyLength)
Sets the decipher key.
Definition: aes256.c:116
uint32_t AES256_getInterruptStatus(uint32_t moduleInstance)
Definition: aes256.c:315
uint32_t AES256_getErrorFlagStatus(uint32_t moduleInstance)
Gets the AES256 error flag status.
Definition: aes256.c:298
void AES256_unregisterInterrupt(uint32_t moduleInstance)
Definition: aes256.c:309
void AES256_clearErrorFlag(uint32_t moduleInstance)
Clears the AES256 error flag.
Definition: aes256.c:293
void AES256_startEncryptData(uint32_t moduleInstance, const uint8_t *data)
Starts an encryption process on the AES256 module.
Definition: aes256.c:186

Copyright 2014, Texas Instruments Incorporated