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 <stdbool.h>
24 #include <msp.h>
25 
26 /* Module Defines and macro for easy access */
27 #define AES256_CMSIS(x) ((AES256_Type *) x)
28 
29 //*****************************************************************************
30 //
31 // The following are deprecated values. Please refer to documentation for the
32 // correct values to use.
33 //
34 //*****************************************************************************
35 #define Key_128BIT 128
36 #define Key_192BIT 192
37 #define Key_256BIT 256
38 
39 //*****************************************************************************
40 //
41 // The following are values that can be passed to the keyLength parameter for
42 // functions: AES256_setCipherKey(), AES256_setDecipherKey(), and
43 // AES256_startSetDecipherKey().
44 //
45 //*****************************************************************************
46 #define AES256_KEYLENGTH_128BIT 128
47 #define AES256_KEYLENGTH_192BIT 192
48 #define AES256_KEYLENGTH_256BIT 256
49 
50 //*****************************************************************************
51 //
52 // The following are values that can be passed toThe following are values that
53 // can be returned by the AES256_getErrorFlagStatus() function.
54 //
55 //*****************************************************************************
56 #define AES256_ERROR_OCCURRED AES256_CTL0_ERRFG
57 #define AES256_NO_ERROR 0x00
58 
59 //*****************************************************************************
60 //
61 // The following are values that can be passed toThe following are values that
62 // can be returned by the AES256_isBusy() function.
63 //
64 //*****************************************************************************
65 #define AES256_BUSY AES256_STAT_BUSY
66 #define AES256_NOT_BUSY 0x00
67 
68 //*****************************************************************************
69 //
70 // The following are values that can be passed toThe following are values that
71 // can be returned by the AES256_getInterruptFlagStatus() function.
72 //
73 //*****************************************************************************
74 #define AES256_READY_INTERRUPT 0x01
75 #define AES256_NOTREADY_INTERRUPT 0x00
76 
77 //*****************************************************************************
78 //
79 // Prototypes for the APIs.
80 //
81 //*****************************************************************************
82 
83 //*****************************************************************************
84 //
97 //
98 //*****************************************************************************
99 extern bool AES256_setCipherKey(uint32_t moduleInstance,
100  const uint8_t *cipherKey, uint_fast16_t keyLength);
101 
102 //*****************************************************************************
103 //
116 //
117 //*****************************************************************************
118 extern void AES256_encryptData(uint32_t moduleInstance, const uint8_t *data,
119  uint8_t *encryptedData);
120 
121 //*****************************************************************************
122 //
136 //
137 //*****************************************************************************
138 extern void AES256_decryptData(uint32_t moduleInstance, const uint8_t *data,
139  uint8_t *decryptedData);
140 
141 //*****************************************************************************
142 //
158 //
159 //*****************************************************************************
160 extern bool AES256_setDecipherKey(uint32_t moduleInstance,
161  const uint8_t *cipherKey, uint_fast16_t keyLength);
162 
163 //*****************************************************************************
164 //
172 //
173 //*****************************************************************************
174 extern void AES256_clearInterruptFlag(uint32_t moduleInstance);
175 
176 //*****************************************************************************
177 //
186 //
187 //*****************************************************************************
188 extern uint32_t AES256_getInterruptFlagStatus(uint32_t moduleInstance);
189 
190 //*****************************************************************************
191 //
199 //
200 //*****************************************************************************
201 extern void AES256_enableInterrupt(uint32_t moduleInstance);
202 
203 //*****************************************************************************
204 //
212 //
213 //*****************************************************************************
214 extern void AES256_disableInterrupt(uint32_t moduleInstance);
215 
216 //*****************************************************************************
217 //
225 //
226 //*****************************************************************************
227 extern void AES256_reset(uint32_t moduleInstance);
228 
229 //*****************************************************************************
230 //
244 //
245 //*****************************************************************************
246 extern void AES256_startEncryptData(uint32_t moduleInstance,
247  const uint8_t *data);
248 
249 //*****************************************************************************
250 //
265 //
266 //*****************************************************************************
267 extern void AES256_startDecryptData(uint32_t moduleInstance,
268  const uint8_t *data);
269 
270 //*****************************************************************************
271 //
287 //
288 //*****************************************************************************
289 extern bool AES256_startSetDecipherKey(uint32_t moduleInstance,
290  const uint8_t *cipherKey, uint_fast16_t keyLength);
291 
292 //*****************************************************************************
293 //
305 //
306 //*****************************************************************************
307 extern bool AES256_getDataOut(uint32_t moduleInstance,
308  uint8_t *outputData);
309 
310 //*****************************************************************************
311 //
317 //
318 //*****************************************************************************
319 extern bool AES256_isBusy(uint32_t moduleInstance);
320 
321 //*****************************************************************************
322 //
330 //
331 //*****************************************************************************
332 extern void AES256_clearErrorFlag(uint32_t moduleInstance);
333 
334 //*****************************************************************************
335 //
344 //
345 //*****************************************************************************
346 extern uint32_t AES256_getErrorFlagStatus(uint32_t moduleInstance);
347 
348 //*****************************************************************************
349 //
364 //
365 //*****************************************************************************
366 extern void AES256_registerInterrupt(uint32_t moduleInstance,
367  void (*intHandler)(void));
368 
369 //*****************************************************************************
370 //
383 //
384 //*****************************************************************************
385 extern void AES256_unregisterInterrupt(uint32_t moduleInstance);
386 
387 //*****************************************************************************
388 //
394 //
395 //*****************************************************************************
396 extern uint32_t AES256_getInterruptStatus(uint32_t moduleInstance);
397 
398 //*****************************************************************************
399 //
400 // Mark the end of the C bindings section for C++ compilers.
401 //
402 //*****************************************************************************
403 #ifdef __cplusplus
404 }
405 #endif
406 
407 //*****************************************************************************
408 //
409 // Close the Doxygen group.
411 //
412 //*****************************************************************************
413 
414 #endif /* AES256_H_ */
415 
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 2016, Texas Instruments Incorporated