AESECBXXF3.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  */
58 #ifndef ti_drivers_aesecb_AESECBXXF3__include
59 #define ti_drivers_aesecb_AESECBXXF3__include
60 
61 #include <stdbool.h>
62 #include <stdint.h>
63 
64 #include <ti/drivers/AESECB.h>
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
79 #define AESECBXXF3_DMA_SIZE_THRESHOLD (1U * AES_BLOCK_SIZE)
80 
81 /*
82  * AES ECB auto config for a single block encryption:
83  * ECB SRC as BUF
84  * Trigger points for auto ECB as WRBUF3S (encryption starts by writing BUF3)
85  * BUSHALT enabled
86  */
87 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC23X0) || (DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX)
88  #define AESECBXXF3_SINGLE_BLOCK_AUTOCFG \
89  ((uint32_t)AES_AUTOCFG_AESSRC_BUF | (uint32_t)AES_AUTOCFG_TRGAES_WRBUF3S | (uint32_t)AES_AUTOCFG_BUSHALT_EN)
90 #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC35XX)
91  /* Not used for CC35XX */
92 #else
93  #error "Unsupported DeviceFamily_Parent for AESECBXXF3!"
94 #endif
95 
103 
109 typedef struct
110 {
111  /* Common member first to allow struct to be cast to the common type */
117 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX) || (DeviceFamily_PARENT == DeviceFamily_PARENT_CC35XX)
118  const uint8_t *input;
119  uint8_t *output;
120  size_t inputLength;
122  volatile size_t totalDataLengthRemaining;
128  int_fast16_t hsmStatus;
129  uint32_t keyAssetID;
130  /* Intentionally use implementation-independent uint32_t datatype for
131  * keyLocation to avoid user dependencies on any implementation-specific
132  * headers (e.g. mbedTLS). This data type must be large enough to hold any
133  * implementation-specific keyLocation data.
134  */
135  uint32_t keyLocation;
136  /* To indicate whether a segmented operation is in progress */
138 #endif
140 
156 void AESECBXXF3_processData(AESCommonXXF3_Object *object, const uint8_t *input, uint8_t *output, size_t inputLength);
173 __STATIC_INLINE bool AESECB_acquireLock(AESECB_Handle handle, uint32_t timeout)
174 {
175  return CryptoResourceXXF3_acquireLock(timeout);
176 }
187 __STATIC_INLINE void AESECB_releaseLock(AESECB_Handle handle)
188 {
190 }
201 __STATIC_INLINE void AESECB_enableThreadSafety(AESECB_Handle handle)
202 {
203  AESECBXXF3_Object *object = (AESECBXXF3_Object *)handle->object;
204  object->threadSafe = true;
205 }
219 __STATIC_INLINE void AESECB_disableThreadSafety(AESECB_Handle handle)
220 {
221  AESECBXXF3_Object *object = (AESECBXXF3_Object *)handle->object;
222  object->threadSafe = false;
223 }
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 #endif /* ti_drivers_aesecb_AESECBXXF3__include */
AESCommonXXF3_Object common
Definition: AESECBXXF3.h:112
void CryptoResourceXXF3_releaseLock(void)
bool threadSafe
Definition: AESECBXXF3.h:116
uint8_t * output
Definition: AESECBXXF3.h:119
const uint8_t * input
Definition: AESECBXXF3.h:118
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.
AESCommonXXF3_HWAttrs AESECBXXF3_HWAttrs
AESECBXXF3 Hardware Attributes.
Definition: AESECBXXF3.h:102
AESECB_CallbackFxn callbackFxn
Definition: AESECBXXF3.h:114
bool segmentedOperationInProgress
Definition: AESECBXXF3.h:137
AESECB_OperationType operationType
Definition: AESECBXXF3.h:115
size_t inputLength
Definition: AESECBXXF3.h:120
volatile size_t totalDataLengthRemaining
Definition: AESECBXXF3.h:122
Struct containing the parameters required for encrypting/decrypting and a message.
Definition: AESECB.h:587
AESECB driver header.
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: AESECBXXF3.h:128
uint32_t keyLocation
Definition: AESECBXXF3.h:135
uint32_t keyAssetID
Definition: AESECBXXF3.h:129
void(* AESECB_CallbackFxn)(AESECB_Handle handle, int_fast16_t returnValue, AESECB_Operation *operation, AESECB_OperationType operationType)
The definition of a callback function used by the AESECB driver when used in AESECB_RETURN_BEHAVIOR_C...
Definition: AESECB.h:661
size_t totalDataLength
Definition: AESECBXXF3.h:121
AESCommonXXF3 Object.
Definition: AESCommonXXF3.h:143
bool CryptoResourceXXF3_acquireLock(uint32_t timeout)
void * object
Definition: AESCommon.h:157
AESECB_Operation * operation
Definition: AESECBXXF3.h:113
AESECB_OperationType
Enum for the operation types supported by the driver.
Definition: AESECB.h:636
AESECBXXF3 Object.
Definition: AESECBXXF3.h:109
AESCommonXXF3 Hardware Attributes.
Definition: AESCommonXXF3.h:121
© Copyright 1995-2026, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale