AESECBLPF3.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2024, 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_AESECBLPF3__include
59 #define ti_drivers_aesecb_AESECBLPF3__include
60 
61 #include <stdbool.h>
62 #include <stdint.h>
63 
64 #include <ti/drivers/AESECB.h>
67 
68 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX) || (DeviceFamily_PARENT == DeviceFamily_PARENT_CC35XX)
70 #endif
71 
72 #ifdef __cplusplus
73 extern "C" {
74 #endif
75 
83 #define AESECBLPF3_DMA_SIZE_THRESHOLD (1U * AES_BLOCK_SIZE)
84 
85 /*
86  * AES ECB auto config for a single block encryption:
87  * ECB SRC as BUF
88  * Trigger points for auto ECB as WRBUF3S (encryption starts by writing BUF3)
89  * BUSHALT enabled
90  */
91 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC23X0) || (DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX)
92  #define AESECBLPF3_SINGLE_BLOCK_AUTOCFG \
93  ((uint32_t)AES_AUTOCFG_AESSRC_BUF | (uint32_t)AES_AUTOCFG_TRGAES_WRBUF3S | (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 AESECBLPF3!"
98 #endif
99 
107 
113 typedef struct
114 {
115  /* Common member first to allow struct to be cast to the common type */
121 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX) || (DeviceFamily_PARENT == DeviceFamily_PARENT_CC35XX)
122  const uint8_t *input;
123  uint8_t *output;
124  size_t inputLength;
126  volatile size_t totalDataLengthRemaining;
132  int_fast16_t hsmStatus;
133  uint32_t keyAssetID;
135  /* To indicate whether a segmented operation is in progress
136  */
138 #endif
140 
156 void AESECBLPF3_processData(AESCommonLPF3_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 CryptoResourceLPF3_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  AESECBLPF3_Object *object = handle->object;
204  object->threadSafe = true;
205 }
219 __STATIC_INLINE void AESECB_disableThreadSafety(AESECB_Handle handle)
220 {
221  AESECBLPF3_Object *object = handle->object;
222  object->threadSafe = false;
223 }
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 #endif /* ti_drivers_aesecb_AESECBLPF3__include */
volatile size_t totalDataLengthRemaining
Definition: AESECBLPF3.h:126
bool threadSafe
Definition: AESECBLPF3.h:120
AESECB_CallbackFxn callbackFxn
Definition: AESECBLPF3.h:118
bool CryptoResourceLPF3_acquireLock(uint32_t timeout)
CryptoKeyKeyStore_PSA driver header.
AESCommonLPF3_Object common
Definition: AESECBLPF3.h:116
AES Global configuration.
Definition: AESCommon.h:154
KeyStore_PSA_KeyLocation keyLocation
Definition: AESECBLPF3.h:134
size_t totalDataLength
Definition: AESECBLPF3.h:125
size_t inputLength
Definition: AESECBLPF3.h:124
Struct containing the parameters required for encrypting/decrypting and a message.
Definition: AESECB.h:587
AESECB driver header.
AESCommonLPF3 Hardware Attributes.
Definition: AESCommonLPF3.h:103
psa_key_location_t KeyStore_PSA_KeyLocation
Definition: CryptoKeyKeyStore_PSA.h:251
void CryptoResourceLPF3_releaseLock(void)
AESCommon driver implementation for the Low Power F3 family.
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
int_fast16_t hsmStatus
The staus of the HSM Boot up process if HSMLPF3_STATUS_SUCCESS, the HSM booted properly. if HSMLPF3_STATUS_ERROR, the HSM did not boot properly.
Definition: AESECBLPF3.h:132
AESECB_Operation * operation
Definition: AESECBLPF3.h:117
Shared resources to arbitrate access to the AES engine.
uint8_t * output
Definition: AESECBLPF3.h:123
AESECBLPF3 Object.
Definition: AESECBLPF3.h:113
const uint8_t * input
Definition: AESECBLPF3.h:122
void * object
Definition: AESCommon.h:157
uint32_t keyAssetID
Definition: AESECBLPF3.h:133
AESECB_OperationType
Enum for the operation types supported by the driver.
Definition: AESECB.h:636
AESCommonLPF3_HWAttrs AESECBLPF3_HWAttrs
AESECBLPF3 Hardware Attributes.
Definition: AESECBLPF3.h:106
AESECB_OperationType operationType
Definition: AESECBLPF3.h:119
bool segmentedOperationInProgress
Definition: AESECBLPF3.h:137
AESCommonLPF3 Object.
Definition: AESCommonLPF3.h:125
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale