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 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
79 #define AESECBLPF3_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
88  #define AESEBCLPF3_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_CC27XX
91  #define AESEBCLPF3_SINGLE_BLOCK_AUTOCFG \
92  ((uint32_t)AES_AUTOCFG_ECBSRC_BUF | (uint32_t)AES_AUTOCFG_TRGECB_WRBUF3S | (uint32_t)AES_AUTOCFG_BUSHALT_EN)
93 #else
94  #error "Unsupported DeviceFamily_Parent for AESECBLPF3!"
95 #endif
96 
104 
110 typedef struct
111 {
112  /* Common member first to allow struct to be cast to the common type */
118 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX)
119  const uint8_t *input;
120  uint8_t *output;
121  size_t inputLength;
123  volatile size_t totalDataLengthRemaining;
129  int_fast16_t hsmStatus;
130  /* To indicate whether a segmented operation is in progress
131  */
133 #endif
135 
151 void AESECBLPF3_processData(AESCommonLPF3_Object *object, const uint8_t *input, uint8_t *output, size_t inputLength);
168 __STATIC_INLINE bool AESECB_acquireLock(AESECB_Handle handle, uint32_t timeout)
169 {
170  return CryptoResourceLPF3_acquireLock(timeout);
171 }
182 __STATIC_INLINE void AESECB_releaseLock(AESECB_Handle handle)
183 {
185 }
196 __STATIC_INLINE void AESECB_enableThreadSafety(AESECB_Handle handle)
197 {
198  AESECBLPF3_Object *object = handle->object;
199  object->threadSafe = true;
200 }
214 __STATIC_INLINE void AESECB_disableThreadSafety(AESECB_Handle handle)
215 {
216  AESECBLPF3_Object *object = handle->object;
217  object->threadSafe = false;
218 }
221 #ifdef __cplusplus
222 }
223 #endif
224 
225 #endif /* ti_drivers_aesecb_AESECBLPF3__include */
volatile size_t totalDataLengthRemaining
Definition: AESECBLPF3.h:123
bool threadSafe
Definition: AESECBLPF3.h:117
AESECB_CallbackFxn callbackFxn
Definition: AESECBLPF3.h:115
bool CryptoResourceLPF3_acquireLock(uint32_t timeout)
AESCommonLPF3_Object common
Definition: AESECBLPF3.h:113
AES Global configuration.
Definition: AESCommon.h:154
size_t totalDataLength
Definition: AESECBLPF3.h:122
size_t inputLength
Definition: AESECBLPF3.h:121
Struct containing the parameters required for encrypting/decrypting and a message.
Definition: AESECB.h:581
AESECB driver header.
AESCommonLPF3 Hardware Attributes.
Definition: AESCommonLPF3.h:80
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:652
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:129
AESECB_Operation * operation
Definition: AESECBLPF3.h:114
Shared resources to arbitrate access to the AES engine.
uint8_t * output
Definition: AESECBLPF3.h:120
AESECBLPF3 Object.
Definition: AESECBLPF3.h:110
const uint8_t * input
Definition: AESECBLPF3.h:119
void * object
Definition: AESCommon.h:157
AESECB_OperationType
Enum for the operation types supported by the driver.
Definition: AESECB.h:627
AESCommonLPF3_HWAttrs AESECBLPF3_HWAttrs
AESECBLPF3 Hardware Attributes.
Definition: AESECBLPF3.h:103
AESECB_OperationType operationType
Definition: AESECBLPF3.h:116
bool segmentedOperationInProgress
Definition: AESECBLPF3.h:132
AESCommonLPF3 Object.
Definition: AESCommonLPF3.h:102
© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale