MSPM0G1X0X_G3X0X Driver Library  2.05.01.00
dl_aes.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*!****************************************************************************
33  * @file dl_aes.h
34  * @brief Advanced Encryption Standard (AES) Driver Library
35  * @defgroup AES Advanced Encryption Standard (AES)
36  *
37  * @anchor ti_dl_dl_aes_Overview
38  * # Overview
39  *
40  * The AES DriverLib allows full configuration of the MSPM0 AES module.
41  * The AES accelerator module accelerates encryption and decryption operations in hardware based
42  * on the FIPS PUB 197 advanced encryption standard (AES).
43  *
44  * <hr>
45  ******************************************************************************/
49 #ifndef ti_dl_dl_aes__include
50 #define ti_dl_dl_aes__include
51 
52 #include <stdbool.h>
53 #include <stddef.h>
54 #include <stdint.h>
55 
56 #include <ti/devices/msp/msp.h>
57 #include <ti/driverlib/dl_common.h>
58 
59 #ifdef __MSPM0_HAS_AES__
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 /* clang-format off */
66 
70 #define DL_AES_INTERRUPT_AES_READY (AES_CPU_INT_IMASK_AESRDY_MASK)
71 
75 #define DL_AES_EVENT_AES_DMA_TRIGGER0 (AES_DMA_TRIG0_IMASK_DMA0_MASK)
76 
80 #define DL_AES_EVENT_AES_DMA_TRIGGER1 (AES_DMA_TRIG1_IMASK_DMA1_SET)
81 
85 #define DL_AES_EVENT_AES_DMA_TRIGGER2 (AES_DMA_TRIG2_IMASK_DMA2_SET)
86 
87 /* clang-format on */
88 
90 typedef enum {
93  (AES_AESACTL0_OPX_OP0 | AES_AESACTL0_CMX_ECB),
94 
97  (AES_AESACTL0_OPX_OP0 | AES_AESACTL0_CMX_CBC),
98 
101  (AES_AESACTL0_OPX_OP0 | AES_AESACTL0_CMX_OFB),
102 
105  (AES_AESACTL0_OPX_OP0 | AES_AESACTL0_CMX_CFB),
106 
109  (AES_AESACTL0_OPX_OP1 | AES_AESACTL0_CMX_ECB),
110 
113  (AES_AESACTL0_OPX_OP1 | AES_AESACTL0_CMX_CBC),
114 
117  (AES_AESACTL0_OPX_OP1 | AES_AESACTL0_CMX_OFB),
118 
121  (AES_AESACTL0_OPX_OP1 | AES_AESACTL0_CMX_CFB),
122 
125  (AES_AESACTL0_OPX_OP2 | AES_AESACTL0_CMX_ECB),
126 
129  (AES_AESACTL0_OPX_OP2 | AES_AESACTL0_CMX_CBC),
130 
133  (AES_AESACTL0_OPX_OP2 | AES_AESACTL0_CMX_OFB),
134 
137  (AES_AESACTL0_OPX_OP2 | AES_AESACTL0_CMX_CFB),
138 
141  (AES_AESACTL0_OPX_OP3 | AES_AESACTL0_CMX_ECB),
142 
145  (AES_AESACTL0_OPX_OP3 | AES_AESACTL0_CMX_CBC),
146 
149  (AES_AESACTL0_OPX_OP3 | AES_AESACTL0_CMX_OFB),
150 
153  (AES_AESACTL0_OPX_OP3 | AES_AESACTL0_CMX_CFB),
154 } DL_AES_MODE;
155 
157 typedef enum {
159  DL_AES_IIDX_AES_READY = AES_CPU_INT_IIDX_STAT_AESRDY,
161  DL_AES_IIDX_AES_DMA_TRIGGER0 = AES_DMA_TRIG0_IIDX_STAT_DMA0,
163  DL_AES_IIDX_AES_DMA_TRIGGER1 = AES_DMA_TRIG1_IIDX_STAT_DMA1,
165  DL_AES_IIDX_AES_DMA_TRIGGER2 = AES_DMA_TRIG2_IIDX_STAT_DMA2
166 } DL_AES_IIDX;
167 
169 typedef enum {
171  DL_AES_OPERATION_ENC = AES_AESACTL0_OPX_OP0,
173  DL_AES_OPERATION_DEC_SAME_KEY = AES_AESACTL0_OPX_OP1,
175  DL_AES_OPERATION_GEN_FIRST_ROUND = AES_AESACTL0_OPX_OP2,
180 
182 typedef enum {
184  DL_AES_KEY_LENGTH_128 = AES_AESACTL0_KLX_AES128,
186  DL_AES_KEY_LENGTH_256 = AES_AESACTL0_KLX_AES256,
188 
190 typedef enum {
195 } DL_AES_STATUS;
196 
201 typedef struct {
205  uint32_t controlWord0;
209  uint32_t controlWord1;
212  uint32_t interruptMask0;
215  uint32_t interruptMask1;
218  uint32_t interruptMask2;
221  uint32_t interruptMask3;
224  bool backupRdy;
226 
236 __STATIC_INLINE void DL_AES_enablePower(AES_Regs *aes)
237 {
238  aes->GPRCM.PWREN = (AES_PWREN_KEY_UNLOCK_W | AES_PWREN_ENABLE_ENABLE);
239 }
240 
249 __STATIC_INLINE void DL_AES_disablePower(AES_Regs *aes)
250 {
251  aes->GPRCM.PWREN = (AES_PWREN_KEY_UNLOCK_W | AES_PWREN_ENABLE_DISABLE);
252 }
253 
270 __STATIC_INLINE bool DL_AES_isPowerEnabled(const AES_Regs *aes)
271 {
272  return (
273  (aes->GPRCM.PWREN & AES_PWREN_ENABLE_MASK) == AES_PWREN_ENABLE_ENABLE);
274 }
275 
281 __STATIC_INLINE void DL_AES_reset(AES_Regs *aes)
282 {
283  aes->GPRCM.RSTCTL =
284  (AES_RSTCTL_KEY_UNLOCK_W | AES_RSTCTL_RESETSTKYCLR_CLR |
285  AES_RSTCTL_RESETASSERT_ASSERT);
286 }
287 
297 __STATIC_INLINE bool DL_AES_isReset(const AES_Regs *aes)
298 {
299  return ((aes->GPRCM.STAT & AES_STAT_RESETSTKY_MASK) ==
300  AES_STAT_RESETSTKY_RESET);
301 }
302 
315 __STATIC_INLINE void DL_AES_init(
316  AES_Regs *aes, DL_AES_MODE aesConfig, DL_AES_KEY_LENGTH keyLength)
317 {
318  DL_Common_updateReg(&aes->AESACTL0,
319  ((uint32_t) aesConfig | (uint32_t) keyLength),
320  (uint32_t)(AES_AESACTL0_OPX_MASK | AES_AESACTL0_CMX_MASK |
321  AES_AESACTL0_KLX_MASK));
322 }
323 
333 __STATIC_INLINE void DL_AES_softwareReset(AES_Regs *aes)
334 {
335  aes->AESACTL0 |= (AES_AESACTL0_SWRST_RST);
336 }
337 
349 __STATIC_INLINE bool DL_AES_isFaultFlagSet(const AES_Regs *aes)
350 {
351  return (
352  (aes->AESACTL0 & AES_AESACTL0_ERRFG_MASK) == AES_AESACTL0_ERRFG_ERR);
353 }
354 
362 __STATIC_INLINE void DL_AES_clearFaultFlag(AES_Regs *aes)
363 {
364  aes->AESACTL0 &= ~(AES_AESACTL0_ERRFG_ERR);
365 }
366 
374 __STATIC_INLINE void DL_AES_enableCipherMode(AES_Regs *aes)
375 {
376  aes->AESACTL0 |= (AES_AESACTL0_CMEN_ENABLE);
377 }
378 
386 __STATIC_INLINE void DL_AES_disablesCipherMode(AES_Regs *aes)
387 {
388  aes->AESACTL0 &= ~(AES_AESACTL0_CMEN_ENABLE);
389 }
390 
409 __STATIC_INLINE void DL_AES_setCipherBlockCounter(
410  AES_Regs *aes, uint32_t count)
411 {
412  DL_Common_updateReg(&aes->AESACTL1, count, AES_AESACTL1_BLKCNTX_MASK);
413 }
414 
426 __STATIC_INLINE uint32_t DL_AES_getCipherBlockCounter(const AES_Regs *aes)
427 {
428  return (aes->AESACTL1 & AES_AESACTL1_BLKCNTX_MASK);
429 }
430 
443 __STATIC_INLINE bool DL_AES_isBusy(const AES_Regs *aes)
444 {
445  return (
446  (aes->AESASTAT & AES_AESASTAT_BUSY_MASK) == AES_AESASTAT_BUSY_BUSY);
447 }
448 
461 __STATIC_INLINE bool DL_AES_getDataOutReadStatus(const AES_Regs *aes)
462 {
463  return (
464  (aes->AESASTAT & AES_AESASTAT_DOUTRD_MASK) == AES_AESASTAT_DOUTRD_ALL);
465 }
466 
477 __STATIC_INLINE uint8_t DL_AES_getKeyBytesCount(const AES_Regs *aes)
478 {
479  return ((uint8_t)((aes->AESASTAT & AES_AESASTAT_KEYCNTX_MAXNUM) >> 4));
480 }
481 
492 __STATIC_INLINE uint8_t DL_AES_getDataInBytesCount(const AES_Regs *aes)
493 {
494  return ((uint8_t)((aes->AESASTAT & AES_AESASTAT_DINCNTX_MAXNUM) >> 8));
495 }
496 
507 __STATIC_INLINE uint8_t DL_AES_getDataOutBytesCount(const AES_Regs *aes)
508 {
509  return ((uint8_t)((aes->AESASTAT & AES_AESASTAT_DOUTCNTX_MAXNUM) >> 12));
510 }
511 
521 __STATIC_INLINE void DL_AES_setAllDataWritten(AES_Regs *aes)
522 {
523  aes->AESASTAT |= AES_AESASTAT_DINWR_ALL;
524 }
525 
535 __STATIC_INLINE void DL_AES_setAllKeyWritten(AES_Regs *aes)
536 {
537  aes->AESASTAT |= AES_AESASTAT_KEYWR_ALL;
538 }
539 
552 __STATIC_INLINE bool DL_AES_isAllDataWritten(const AES_Regs *aes)
553 {
554  return (aes->AESASTAT & AES_AESASTAT_DINWR_MASK) == AES_AESASTAT_DINWR_ALL;
555 }
556 
568 __STATIC_INLINE bool DL_AES_isAllKeysWritten(const AES_Regs *aes)
569 {
570  return (aes->AESASTAT & AES_AESASTAT_KEYWR_MASK) == AES_AESASTAT_KEYWR_ALL;
571 }
572 
593 DL_AES_STATUS DL_AES_setKey(
594  AES_Regs *aes, const uint8_t *key, DL_AES_KEY_LENGTH keyLength);
595 
612  AES_Regs *aes, const uint32_t *keyAligned, DL_AES_KEY_LENGTH keyLength);
613 
630 DL_AES_STATUS DL_AES_xorData(
631  const uint8_t *data, const uint8_t *xorData, uint8_t *xorOutputData);
632 
645 void DL_AES_xorDataAligned(uint32_t *dataAligned, uint32_t *xorDataAligned,
646  uint32_t *xorOutputDataAligned);
647 
664 DL_AES_STATUS DL_AES_loadDataIn(AES_Regs *aes, const uint8_t *data);
665 
678 void DL_AES_loadDataInAligned(AES_Regs *aes, const uint32_t *dataAligned);
679 
697 DL_AES_STATUS DL_AES_getDataOut(const AES_Regs *aes, uint8_t *data);
698 
711 void DL_AES_getDataOutAligned(const AES_Regs *aes, uint32_t *dataAligned);
712 
732 DL_AES_STATUS DL_AES_loadXORDataIn(AES_Regs *aes, const uint8_t *data);
733 
748 void DL_AES_loadXORDataInAligned(AES_Regs *aes, const uint32_t *dataAligned);
749 
770  AES_Regs *aes, const uint8_t *data);
771 
787  AES_Regs *aes, const uint32_t *dataAligned);
788 
795 __STATIC_INLINE void DL_AES_enableInterrupt(AES_Regs *aes)
796 {
797  aes->CPU_INT.IMASK |= DL_AES_INTERRUPT_AES_READY;
798 }
799 
806 __STATIC_INLINE void DL_AES_enableDMATrigger0Interrupt(AES_Regs *aes)
807 {
808  aes->DMA_TRIG0.IMASK |= DL_AES_EVENT_AES_DMA_TRIGGER0;
809 }
810 
817 __STATIC_INLINE void DL_AES_enableDMATrigger1Interrupt(AES_Regs *aes)
818 {
819  aes->DMA_TRIG1.IMASK |= DL_AES_EVENT_AES_DMA_TRIGGER1;
820 }
821 
828 __STATIC_INLINE void DL_AES_enableDMATrigger2Interrupt(AES_Regs *aes)
829 {
830  aes->DMA_TRIG2.IMASK |= DL_AES_EVENT_AES_DMA_TRIGGER2;
831 }
832 
839 __STATIC_INLINE void DL_AES_disableInterrupt(AES_Regs *aes)
840 {
841  aes->CPU_INT.IMASK &= ~(AES_CPU_INT_IMASK_AESRDY_MASK);
842 }
843 
850 __STATIC_INLINE void DL_AES_disableDMATrigger0Event(AES_Regs *aes)
851 {
852  aes->DMA_TRIG0.IMASK &= ~(AES_DMA_TRIG0_IMASK_DMA0_MASK);
853 }
854 
861 __STATIC_INLINE void DL_AES_disableDMATrigger1Event(AES_Regs *aes)
862 {
863  aes->DMA_TRIG1.IMASK &= ~(AES_DMA_TRIG1_IMASK_DMA1_MASK);
864 }
865 
872 __STATIC_INLINE void DL_AES_disableDMATrigger2Event(AES_Regs *aes)
873 {
874  aes->DMA_TRIG2.IMASK &= ~(AES_DMA_TRIG2_IMASK_DMA2_MASK);
875 }
876 
888 __STATIC_INLINE uint32_t DL_AES_getEnabledInterrupts(const AES_Regs *aes)
889 {
890  return (aes->CPU_INT.IMASK & AES_CPU_INT_IMASK_AESRDY_MASK);
891 }
892 
904 __STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger0Event(const AES_Regs *aes)
905 {
906  return (aes->DMA_TRIG0.IMASK & AES_DMA_TRIG0_IMASK_DMA0_MASK);
907 }
908 
920 __STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger1Event(const AES_Regs *aes)
921 {
922  return (aes->DMA_TRIG1.IMASK & AES_DMA_TRIG1_IMASK_DMA1_MASK);
923 }
924 
936 __STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger2Event(const AES_Regs *aes)
937 {
938  return (aes->DMA_TRIG2.IMASK & AES_DMA_TRIG2_IMASK_DMA2_MASK);
939 }
940 
956 __STATIC_INLINE uint32_t DL_AES_getEnabledInterruptStatus(const AES_Regs *aes)
957 {
958  return (aes->CPU_INT.MIS & AES_CPU_INT_IMASK_AESRDY_MASK);
959 }
960 
977  const AES_Regs *aes)
978 {
979  return (aes->DMA_TRIG0.MIS & AES_DMA_TRIG0_IMASK_DMA0_MASK);
980 }
981 
998  const AES_Regs *aes)
999 {
1000  return (aes->DMA_TRIG1.MIS & AES_DMA_TRIG1_IMASK_DMA1_MASK);
1001 }
1002 
1019  const AES_Regs *aes)
1020 {
1021  return (aes->DMA_TRIG2.MIS & AES_DMA_TRIG2_IMASK_DMA2_MASK);
1022 }
1023 
1038 __STATIC_INLINE uint32_t DL_AES_getRawInterruptStatus(const AES_Regs *aes)
1039 {
1040  return (aes->CPU_INT.RIS & AES_CPU_INT_IMASK_AESRDY_MASK);
1041 }
1042 
1057 __STATIC_INLINE uint32_t DL_AES_getRawDMATrigger0EventStatus(
1058  const AES_Regs *aes)
1059 {
1060  return (aes->DMA_TRIG0.RIS & AES_DMA_TRIG0_IMASK_DMA0_MASK);
1061 }
1062 
1077 __STATIC_INLINE uint32_t DL_AES_getRawDMATrigger1EventStatus(
1078  const AES_Regs *aes)
1079 {
1080  return (aes->DMA_TRIG1.RIS & AES_DMA_TRIG1_IMASK_DMA1_MASK);
1081 }
1082 
1097 __STATIC_INLINE uint32_t DL_AES_getRawDMATrigger2EventStatus(
1098  const AES_Regs *aes)
1099 {
1100  return (aes->DMA_TRIG2.RIS & AES_DMA_TRIG2_IMASK_DMA2_MASK);
1101 }
1102 
1114 __STATIC_INLINE DL_AES_IIDX DL_AES_getPendingInterrupt(const AES_Regs *aes)
1115 {
1116  uint32_t interruptIdx = (uint32_t) aes->CPU_INT.IIDX;
1117 
1118  return (DL_AES_IIDX) interruptIdx;
1119 }
1120 
1132 __STATIC_INLINE DL_AES_IIDX DL_AES_getPendingDMATrigger0Event(
1133  const AES_Regs *aes)
1134 {
1135  uint32_t eventIdx = (uint32_t) aes->DMA_TRIG0.IIDX;
1136 
1137  return (DL_AES_IIDX) eventIdx;
1138 }
1139 
1151 __STATIC_INLINE DL_AES_IIDX DL_AES_getPendingDMATrigger1Event(
1152  const AES_Regs *aes)
1153 {
1154  uint32_t eventIdx = (uint32_t) aes->DMA_TRIG1.IIDX;
1155 
1156  return (DL_AES_IIDX) eventIdx;
1157 }
1158 
1170 __STATIC_INLINE DL_AES_IIDX DL_AES_getPendingDMATrigger2Event(
1171  const AES_Regs *aes)
1172 {
1173  uint32_t eventIdx = (uint32_t) aes->DMA_TRIG2.IIDX;
1174 
1175  return (DL_AES_IIDX) eventIdx;
1176 }
1177 
1184 __STATIC_INLINE void DL_AES_clearInterruptStatus(AES_Regs *aes)
1185 {
1186  aes->CPU_INT.ICLR |= AES_CPU_INT_IMASK_AESRDY_MASK;
1187 }
1188 
1195 __STATIC_INLINE void DL_AES_clearDMATrigger0EventStatus(AES_Regs *aes)
1196 {
1197  aes->DMA_TRIG0.ICLR |= AES_DMA_TRIG0_IMASK_DMA0_MASK;
1198 }
1199 
1206 __STATIC_INLINE void DL_AES_clearDMATrigger1EventStatus(AES_Regs *aes)
1207 {
1208  aes->DMA_TRIG1.ICLR |= AES_DMA_TRIG1_IMASK_DMA1_MASK;
1209 }
1210 
1217 __STATIC_INLINE void DL_AES_clearDMATrigger2EventStatus(AES_Regs *aes)
1218 {
1219  aes->DMA_TRIG2.ICLR |= AES_DMA_TRIG2_IMASK_DMA2_MASK;
1220 }
1221 
1237 bool DL_AES_saveConfiguration(const AES_Regs *aes, DL_AES_backupConfig *ptr);
1238 
1254 bool DL_AES_restoreConfiguration(AES_Regs *aes, DL_AES_backupConfig *ptr);
1255 
1256 #ifdef __cplusplus
1257 }
1258 #endif
1259 
1260 #endif /* __MSPM0_HAS_AES__ */
1261 
1262 #endif /* ti_dl_dl_aes__include */
1263 
DL_AES_STATUS DL_AES_loadXORDataIn(AES_Regs *aes, const uint8_t *data)
Data is XORed with the current word of the state and then block of data is encrypted. Encryption or decryption is started immediately after loading data.
Selects decryption using Cipher Block Chaining (CBC) mode.
Definition: dl_aes.h:112
DL_AES_KEY_LENGTH
Definition: dl_aes.h:182
Selects encryption using Output Feedback (OFB) mode.
Definition: dl_aes.h:100
__STATIC_INLINE void DL_Common_updateReg(volatile uint32_t *reg, uint32_t val, uint32_t mask)
Writes value to specified register - retaining bits unaffected by mask.
Definition: dl_common.h:63
__STATIC_INLINE void DL_AES_init(AES_Regs *aes, DL_AES_MODE aesConfig, DL_AES_KEY_LENGTH keyLength)
Initializes AES peripheral.
Definition: dl_aes.h:315
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger0EventStatus(const AES_Regs *aes)
Check interrupt flag of DMA Trigger 0 Event.
Definition: dl_aes.h:976
Definition: dl_aes.h:184
#define DL_AES_EVENT_AES_DMA_TRIGGER0
DMA Trigger Event 0.
Definition: dl_aes.h:75
__STATIC_INLINE void DL_AES_enableInterrupt(AES_Regs *aes)
Enable AES Ready interrupt.
Definition: dl_aes.h:795
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger0Event(const AES_Regs *aes)
Check if DMA Trigger 0 Event is enabled.
Definition: dl_aes.h:904
__STATIC_INLINE void DL_AES_enablePower(AES_Regs *aes)
Enables the Peripheral Write Enable (PWREN) register for the AES.
Definition: dl_aes.h:236
__STATIC_INLINE void DL_AES_enableCipherMode(AES_Regs *aes)
Enables cipher mode.
Definition: dl_aes.h:374
__STATIC_INLINE void DL_AES_enableDMATrigger2Interrupt(AES_Regs *aes)
Enables DMA trigger 2 to publish AES events to the DMA.
Definition: dl_aes.h:828
__STATIC_INLINE uint8_t DL_AES_getKeyBytesCount(const AES_Regs *aes)
Gets Key byte count.
Definition: dl_aes.h:477
DL_AES_STATUS DL_AES_xorData(const uint8_t *data, const uint8_t *xorData, uint8_t *xorOutputData)
XORs an AES 128-bit block of data in software.
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger2Event(const AES_Regs *aes)
Check if DMA Trigger 2 Event is enabled.
Definition: dl_aes.h:936
__STATIC_INLINE DL_AES_IIDX DL_AES_getPendingDMATrigger1Event(const AES_Regs *aes)
Get highest priority pending DMA Trigger 1 Event.
Definition: dl_aes.h:1151
__STATIC_INLINE bool DL_AES_isPowerEnabled(const AES_Regs *aes)
Returns if the Peripheral Write Enable (PWREN) register for the AES is enabled.
Definition: dl_aes.h:270
__STATIC_INLINE bool DL_AES_isReset(const AES_Regs *aes)
Returns if AES peripheral was reset.
Definition: dl_aes.h:297
uint32_t controlWord0
Definition: dl_aes.h:205
__STATIC_INLINE DL_AES_IIDX DL_AES_getPendingDMATrigger2Event(const AES_Regs *aes)
Get highest priority pending DMA Trigger 2 Event.
Definition: dl_aes.h:1170
DL_AES_STATUS DL_AES_loadXORDataInWithoutTrigger(AES_Regs *aes, const uint8_t *data)
Data is XORed with the current word of the state and then block of data is encrypted. Encryption or decryption is NOT started after loading data.
Selects encryption using Cipher Feedback (CFB) mode.
Definition: dl_aes.h:104
__STATIC_INLINE void DL_AES_enableDMATrigger0Interrupt(AES_Regs *aes)
Enables DMA trigger 0 to publish AES events to the DMA.
Definition: dl_aes.h:806
Selects encryption using Electronic Code Book (ECB) mode.
Definition: dl_aes.h:92
__STATIC_INLINE void DL_AES_disableDMATrigger1Event(AES_Regs *aes)
Disable DMA Trigger 1 Event.
Definition: dl_aes.h:861
Definition: dl_aes.h:161
Definition: dl_aes.h:192
__STATIC_INLINE void DL_AES_setCipherBlockCounter(AES_Regs *aes, uint32_t count)
Set cipher block counter value.
Definition: dl_aes.h:409
DL_AES_STATUS DL_AES_getDataOut(const AES_Regs *aes, uint8_t *data)
Gets output of encrypted data.
#define DL_AES_EVENT_AES_DMA_TRIGGER2
DMA Trigger Event 2.
Definition: dl_aes.h:85
Definition: dl_aes.h:173
Selects encryption using Cipher Block Chaining (CBC) mode.
Definition: dl_aes.h:96
__STATIC_INLINE uint32_t DL_AES_getRawDMATrigger2EventStatus(const AES_Regs *aes)
Check interrupt flag of DMA Trigger 2 Event.
Definition: dl_aes.h:1097
Selects first round key using Output Feedback (OFB) mode.
Definition: dl_aes.h:132
DriverLib Common APIs.
__STATIC_INLINE uint32_t DL_AES_getCipherBlockCounter(const AES_Regs *aes)
Get current cipher block counter value.
Definition: dl_aes.h:426
__STATIC_INLINE void DL_AES_setAllDataWritten(AES_Regs *aes)
Set bit to write all STATE bytes to STATE registers and triggers a new encryption.
Definition: dl_aes.h:521
DL_AES_STATUS
Definition: dl_aes.h:190
Selects decryption with 1st round key using ECB mode.
Definition: dl_aes.h:140
DL_AES_STATUS DL_AES_loadDataIn(AES_Regs *aes, const uint8_t *data)
Encrypts a block of data using the AES module.
Definition: dl_aes.h:186
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger1EventStatus(const AES_Regs *aes)
Check interrupt flag of DMA Trigger 1 Event.
Definition: dl_aes.h:997
DL_AES_MODE
Definition: dl_aes.h:90
Selects decryption with 1st round key using CFB mode.
Definition: dl_aes.h:152
__STATIC_INLINE bool DL_AES_getDataOutReadStatus(const AES_Regs *aes)
Gets the DATAOUT read status.
Definition: dl_aes.h:461
__STATIC_INLINE void DL_AES_enableDMATrigger1Interrupt(AES_Regs *aes)
Enables DMA trigger 1 to publish AES events to the DMA.
Definition: dl_aes.h:817
void DL_AES_loadXORDataInWithoutTriggerAligned(AES_Regs *aes, const uint32_t *dataAligned)
Data is XORed with the current word of the state and then block of data is encrypted. Encryption or decryption is NOT started after loading data.
__STATIC_INLINE void DL_AES_clearDMATrigger2EventStatus(AES_Regs *aes)
Clear pending DMA Trigger 2 Event.
Definition: dl_aes.h:1217
bool backupRdy
Definition: dl_aes.h:224
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger2EventStatus(const AES_Regs *aes)
Check interrupt flag of DMA Trigger 2 Event.
Definition: dl_aes.h:1018
Selects decryption with 1st round key using CBC mode.
Definition: dl_aes.h:144
DL_AES_STATUS DL_AES_setKey(AES_Regs *aes, const uint8_t *key, DL_AES_KEY_LENGTH keyLength)
Loads a 128 or 256 bit key to AES module.
__STATIC_INLINE void DL_AES_disablePower(AES_Regs *aes)
Disables the Peripheral Write Enable (PWREN) register for the AES.
Definition: dl_aes.h:249
DL_AES_IIDX
Definition: dl_aes.h:157
Selects decryption using Electronic Code Book (ECB) mode.
Definition: dl_aes.h:108
uint32_t interruptMask1
Definition: dl_aes.h:215
Selects decryption using Output Feedback (OFB) mode.
Definition: dl_aes.h:116
void DL_AES_loadDataInAligned(AES_Regs *aes, const uint32_t *dataAligned)
Encrypts a block of data using the AES module.
__STATIC_INLINE DL_AES_IIDX DL_AES_getPendingInterrupt(const AES_Regs *aes)
Get highest priority pending AES interrupt.
Definition: dl_aes.h:1114
uint32_t interruptMask0
Definition: dl_aes.h:212
bool DL_AES_saveConfiguration(const AES_Regs *aes, DL_AES_backupConfig *ptr)
Save AES configuration before entering a power loss state. Note that operation-specific variables (in...
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger1Event(const AES_Regs *aes)
Check if DMA Trigger 1 Event is enabled.
Definition: dl_aes.h:920
__STATIC_INLINE bool DL_AES_isBusy(const AES_Regs *aes)
Gets the AES module busy status.
Definition: dl_aes.h:443
__STATIC_INLINE uint32_t DL_AES_getEnabledInterrupts(const AES_Regs *aes)
Check if AES Ready interrupt is enabled.
Definition: dl_aes.h:888
Selects decryption using Cipher Feedback (CFB) mode.
Definition: dl_aes.h:120
bool DL_AES_restoreConfiguration(AES_Regs *aes, DL_AES_backupConfig *ptr)
Restore AES configuration after leaving a power loss state. Note that operation-specific variables (i...
Definition: dl_aes.h:175
__STATIC_INLINE uint8_t DL_AES_getDataInBytesCount(const AES_Regs *aes)
Gets Data In byte count.
Definition: dl_aes.h:492
__STATIC_INLINE uint32_t DL_AES_getRawInterruptStatus(const AES_Regs *aes)
Check interrupt flag of AES Ready interrupt.
Definition: dl_aes.h:1038
void DL_AES_getDataOutAligned(const AES_Regs *aes, uint32_t *dataAligned)
Gets output of encrypted data.
Selects first round key for Electronic Code Book (ECB) mode.
Definition: dl_aes.h:124
__STATIC_INLINE uint32_t DL_AES_getRawDMATrigger0EventStatus(const AES_Regs *aes)
Check interrupt flag of DMA Trigger 0 Event.
Definition: dl_aes.h:1057
#define DL_AES_EVENT_AES_DMA_TRIGGER1
DMA Trigger Event 1.
Definition: dl_aes.h:80
__STATIC_INLINE void DL_AES_softwareReset(AES_Regs *aes)
Immediately resets the complete AES accelerator module even when busy.
Definition: dl_aes.h:333
__STATIC_INLINE void DL_AES_setAllKeyWritten(AES_Regs *aes)
Set bit to write all KEY bytes to KEY register, which is used to encrypt and decrypt data...
Definition: dl_aes.h:535
Definition: dl_aes.h:194
Selects first round key using Cipher Feedback (CFB) mode.
Definition: dl_aes.h:136
__STATIC_INLINE uint32_t DL_AES_getRawDMATrigger1EventStatus(const AES_Regs *aes)
Check interrupt flag of DMA Trigger 1 Event.
Definition: dl_aes.h:1077
uint32_t controlWord1
Definition: dl_aes.h:209
Definition: dl_aes.h:163
__STATIC_INLINE void DL_AES_disablesCipherMode(AES_Regs *aes)
Disables cipher mode.
Definition: dl_aes.h:386
uint32_t interruptMask3
Definition: dl_aes.h:221
DL_AES_OPERATION
Definition: dl_aes.h:169
__STATIC_INLINE uint32_t DL_AES_getEnabledInterruptStatus(const AES_Regs *aes)
Check interrupt flag of AES Ready interrupt.
Definition: dl_aes.h:956
Selects decryption with 1st round key using OFB mode.
Definition: dl_aes.h:148
__STATIC_INLINE DL_AES_IIDX DL_AES_getPendingDMATrigger0Event(const AES_Regs *aes)
Get highest priority pending DMA Trigger 0 Event.
Definition: dl_aes.h:1132
__STATIC_INLINE void DL_AES_clearDMATrigger1EventStatus(AES_Regs *aes)
Clear pending DMA Trigger 1 Event.
Definition: dl_aes.h:1206
Selects first round key using Cipher Block Chaining (CBC) mode.
Definition: dl_aes.h:128
void DL_AES_setKeyAligned(AES_Regs *aes, const uint32_t *keyAligned, DL_AES_KEY_LENGTH keyLength)
Loads a 128 or 256 bit key to AES module.
Definition: dl_aes.h:159
void DL_AES_loadXORDataInAligned(AES_Regs *aes, const uint32_t *dataAligned)
Data is XORed with the current word of the state and then block of data is encrypted. Encryption or decryption is started immediately after loading data.
__STATIC_INLINE void DL_AES_clearDMATrigger0EventStatus(AES_Regs *aes)
Clear pending DMA Trigger 0 Event.
Definition: dl_aes.h:1195
__STATIC_INLINE void DL_AES_reset(AES_Regs *aes)
Resets AES peripheral.
Definition: dl_aes.h:281
__STATIC_INLINE uint8_t DL_AES_getDataOutBytesCount(const AES_Regs *aes)
Gets Data Out byte count.
Definition: dl_aes.h:507
__STATIC_INLINE bool DL_AES_isFaultFlagSet(const AES_Regs *aes)
Returns status of AES error flag.
Definition: dl_aes.h:349
Definition: dl_aes.h:165
__STATIC_INLINE bool DL_AES_isAllKeysWritten(const AES_Regs *aes)
Check if all bytes are to be written to registers containing KEY info.
Definition: dl_aes.h:568
__STATIC_INLINE void DL_AES_disableDMATrigger2Event(AES_Regs *aes)
Disable DMA Trigger 2 Event.
Definition: dl_aes.h:872
__STATIC_INLINE void DL_AES_disableDMATrigger0Event(AES_Regs *aes)
Disable DMA Trigger 0 Event.
Definition: dl_aes.h:850
__STATIC_INLINE void DL_AES_disableInterrupt(AES_Regs *aes)
Disable AES Ready interrupt.
Definition: dl_aes.h:839
__STATIC_INLINE void DL_AES_clearFaultFlag(AES_Regs *aes)
Clears AES error flag.
Definition: dl_aes.h:362
Definition: dl_aes.h:171
#define DL_AES_INTERRUPT_AES_READY
AES Ready interrupt.
Definition: dl_aes.h:70
uint32_t interruptMask2
Definition: dl_aes.h:218
__STATIC_INLINE void DL_AES_clearInterruptStatus(AES_Regs *aes)
Clear pending AES Ready Interrupt.
Definition: dl_aes.h:1184
void DL_AES_xorDataAligned(uint32_t *dataAligned, uint32_t *xorDataAligned, uint32_t *xorOutputDataAligned)
XORs an aligned 128-bit data block in software.
Configuration structure to backup AES peripheral state before going to STOP/STANDBY mode...
Definition: dl_aes.h:201
__STATIC_INLINE bool DL_AES_isAllDataWritten(const AES_Regs *aes)
Check if all bytes are to be written to registers containing STATE info.
Definition: dl_aes.h:552
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale