AESCMACXXF3.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2026, 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  */
64 #ifndef ti_drivers_aescmac_AESCMACXXF3__include
65 #define ti_drivers_aescmac_AESCMACXXF3__include
66 
67 #include <stdbool.h>
68 #include <stdint.h>
69 
70 #include <ti/drivers/AESCMAC.h>
73 
74 #include <ti/devices/DeviceFamily.h>
75 
76 #if (DeviceFamily_PARENT != DeviceFamily_PARENT_CC35XX)
77  #include DeviceFamily_constructPath(inc/hw_types.h)
78  #include DeviceFamily_constructPath(driverlib/aes.h)
79 #endif
80 
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
84 
85 /*
86  * Default AES CMAC & CBC-MAC auto config:
87  * AES SRC as TXTXBUF
88  * Trigger point for auto AES as WRBUF3 (encryption starts by writing BUF3)
89  * BUSHALT enabled
90  */
91 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC23X0) || (DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX)
92  #define AESCMACXXF3_DEFAULT_AUTOCFG \
93  ((uint32_t)AES_AUTOCFG_AESSRC_TXTXBUF | (uint32_t)AES_AUTOCFG_TRGAES_WRBUF3 | (uint32_t)AES_AUTOCFG_BUSHALT_EN)
94 #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC35XX)
95  /* Not used for CC35XX */
96 #else
97  #error "Unsupported DeviceFamily_Parent for AESCMACXXF3!"
98 #endif
99 
100 /*
101  * AES CMAC DMA config:
102  * - ADRCHA = BUF0
103  * - TRGCHA = AESSTART
104  */
105 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC23X0) || (DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX)
106  #define AESCMACXXF3_DMA_CONFIG ((uint32_t)AES_DMA_ADRCHA_BUF0 | (uint32_t)AES_DMA_TRGCHA_AESSTART)
107 #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC35XX)
108  /* Not used for CC35XX */
109 #else
110  #error "Unsupported DeviceFamily_Parent for AESCMACXXF3!"
111 #endif
112 
113 #define AESCBCMACLPF3_DMA_CONFIG AESCMACXXF3_DMA_CONFIG
114 
122 
128 typedef struct
129 {
130  /* Common member first to allow struct to be cast to the common type */
132  volatile uint32_t intermediateTag[AES_TAG_LENGTH_BYTES / 4U];
133  uint32_t finalInputBlock[AES_BLOCK_SIZE_WORDS];
138 #if ((DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX) || (DeviceFamily_PARENT == DeviceFamily_PARENT_CC35XX))
139  uint8_t *input;
140  size_t inputLength;
141  uint32_t tempAssetID;
142  uint32_t keyAssetID;
148  int_fast16_t hsmStatus;
149  /* To indicate whether a segmented operation is in progress */
152 #endif
155 
166 void AESCMACXXF3_processBlocks(const uint8_t *input, size_t transactionLength);
167 
175 void AESCMACXXF3_readTag(uint32_t tagOut[AES_TAG_LENGTH_BYTES / 4U]);
176 
193 __STATIC_INLINE bool AESCMAC_acquireLock(AESCMAC_Handle handle, uint32_t timeout)
194 {
195  return CryptoResourceXXF3_acquireLock(timeout);
196 }
207 __STATIC_INLINE void AESCMAC_releaseLock(AESCMAC_Handle handle)
208 {
210 }
221 __STATIC_INLINE void AESCMAC_enableThreadSafety(AESCMAC_Handle handle)
222 {
223  AESCMACXXF3_Object *object = (AESCMACXXF3_Object *)handle->object;
224  object->threadSafe = true;
225 }
239 __STATIC_INLINE void AESCMAC_disableThreadSafety(AESCMAC_Handle handle)
240 {
241  AESCMACXXF3_Object *object = (AESCMACXXF3_Object *)handle->object;
242  object->threadSafe = false;
243 }
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif /* ti_drivers_aescmac_AESCMACXXF3__include */
uint32_t tempAssetID
Definition: AESCMACXXF3.h:141
void CryptoResourceXXF3_releaseLock(void)
AES Global configuration.
Definition: AESCommon.h:154
AESCommon driver implementation for the Low Power F3 family.
Shared resources to arbitrate access to the AES engine.
uint32_t keyAssetID
Definition: AESCMACXXF3.h:142
AESCMAC_Operation * operation
Definition: AESCMACXXF3.h:135
AESCMAC_OperationType
Enum for the operation types supported by the driver.
Definition: AESCMAC.h:772
AESCommonXXF3_Object common
Definition: AESCMACXXF3.h:131
void(* AESCMAC_CallbackFxn)(AESCMAC_Handle handle, int_fast16_t returnValue, AESCMAC_Operation *operation, AESCMAC_OperationType operationType)
The definition of a callback function used by the AESCMAC driver when used in AESCMAC_RETURN_BEHAVIOR...
Definition: AESCMAC.h:796
AESCMAC_CallbackFxn callbackFxn
Definition: AESCMACXXF3.h:134
bool segmentedOperationInProgress
Definition: AESCMACXXF3.h:150
AESCMAC_OperationalMode
Defines the operation modes for the AESCMAC driver.
Definition: AESCMAC.h:708
#define AES_BLOCK_SIZE_WORDS
Definition: AESCommonXXF3.h:104
size_t inputLength
Definition: AESCMACXXF3.h:140
bool driverCreatedKeyAsset
Definition: AESCMACXXF3.h:151
AESCommonXXF3 Object.
Definition: AESCommonXXF3.h:143
bool CryptoResourceXXF3_acquireLock(uint32_t timeout)
AESCMAC_OperationalMode operationalMode
Definition: AESCMACXXF3.h:137
AESCMAC (CMAC and CBC-MAC) driver header.
void * object
Definition: AESCommon.h:157
AESCMACXXF3 Object.
Definition: AESCMACXXF3.h:128
Struct containing the parameters required for signing or verifying a message.
Definition: AESCMAC.h:717
int_fast16_t hsmStatus
The status of the HSM Boot up process if HSMXXF3_STATUS_SUCCESS, the HSM booted properly. if HSMXXF3_STATUS_ERROR, the HSM did not boot properly.
Definition: AESCMACXXF3.h:148
AESCommonXXF3_HWAttrs AESCMACXXF3_HWAttrs
AESCMACXXF3 Hardware Attributes.
Definition: AESCMACXXF3.h:121
AESCMAC_OperationType operationType
Definition: AESCMACXXF3.h:136
bool threadSafe
Definition: AESCMACXXF3.h:153
uint8_t * input
Definition: AESCMACXXF3.h:139
AESCommonXXF3 Hardware Attributes.
Definition: AESCommonXXF3.h:121
#define AES_TAG_LENGTH_BYTES
Definition: AESCommonXXF3.h:111
© Copyright 1995-2026, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale