AESCommonLPF3.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2023, 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  */
41 #ifndef ti_drivers_aescommon_AESCommonLPF3__include
42 #define ti_drivers_aescommon_AESCommonLPF3__include
43 
44 #include <stdbool.h>
45 #include <stdint.h>
46 
47 #include <ti/drivers/AESCommon.h>
49 
50 #include <ti/drivers/dpl/HwiP.h>
51 
52 #include <ti/devices/DeviceFamily.h>
53 #include DeviceFamily_constructPath(inc/hw_types.h)
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /*
60  * Unaligned input/output pointer arguments are not supported by default
61  * because the performance will be up to 5x slower. Enabling unaligned I/O
62  * is strongly discouraged.
63  */
64 #ifndef AESCommonLPF3_UNALIGNED_IO_SUPPORT_ENABLE
65  #define AESCommonLPF3_UNALIGNED_IO_SUPPORT_ENABLE 0
66 #endif
67 
68 /* DMA Channel Numbers */
69 #define DMA_CH4 4U
70 #define DMA_CH5 5U
71 
72 /* DMA Channel 4 is reserved for AES Channel A (input) */
73 #define AESCommonLPF3_DMA_CHA_BITMASK ((uint32_t)1U << DMA_CH4)
74 /* DMA Channel 5 is reserved for AES Channel B (output) */
75 #define AESCommonLPF3_DMA_CHB_BITMASK ((uint32_t)1U << DMA_CH5)
76 
80 typedef struct
81 {
94  uint8_t intPriority;
96 
102 typedef struct
103 {
106  volatile int_fast16_t returnStatus;
108  bool isOpen;
109  volatile bool cryptoResourceLocked;
110  volatile bool operationInProgress;
111  volatile bool powerConstraintSet;
113 
122 void AESCommonLPF3_init(void);
123 
137 int_fast16_t AESCommonLPF3_construct(AESCommonLPF3_Object *object, AES_ReturnBehavior returnBehavior, uint32_t timeout);
147 void AESCommonLPF3_loadKey(const CryptoKey *key);
158 void AESCommonLPF3_setupOperation(CryptoKey *key, uint32_t autoCfgVal);
169 void AESCommonLPF3_close(AESCommonLPF3_Object *object);
182 int_fast16_t AESCommonLPF3_setOperationInProgress(AESCommonLPF3_Object *object);
193 __STATIC_INLINE void AESCommonLPF3_clearOperationInProgress(AESCommonLPF3_Object *object)
194 {
195  object->operationInProgress = false;
196 }
210 void AESCommonLPF3_cleanup(AESCommonLPF3_Object *object);
221 int_fast16_t AESCommonLPF3_setupSegmentedOperation(AESCommonLPF3_Object *object, const CryptoKey *key);
236 bool AESCommonLPF3_isDMALengthValid(const void *input, const void *output, size_t length);
254 void AESCommonLPF3_configInputDMA(const void *input, size_t inputLength);
273 void AESCommonLPF3_configOutputDMA(void *output, size_t outputLength);
285 void AESCommonLPF3_cancelDMA(bool cancelChannelB);
300 void AESCommonLPF3_cancelOperation(AESCommonLPF3_Object *object, bool cancelDMAChannelB);
312 void AESCommonLPF3_setupHwi(HwiP_Fxn hwiFxn, uintptr_t hwiFxnArg, uint8_t intPriority);
322 void AESCommonLPF3_cleanupHwi(AESCommonLPF3_Object *object);
333 void AESCommonLPF3_setupDMA(AESCommonLPF3_Object *object, uint32_t dmaConfig);
336 #ifdef __cplusplus
337 }
338 #endif
339 
340 #endif /* ti_drivers_aescommon_AESCommonLPF3__include */
The CryptoKey type is an opaque representation of a cryptographic key.
volatile int_fast16_t returnStatus
Definition: AESCommonLPF3.h:106
AES_ReturnBehavior
The return behavior of AES functions.
Definition: AESCommon.h:184
AES_ReturnBehavior returnBehavior
Definition: AESCommonLPF3.h:107
CryptoKey datastructure.
Definition: CryptoKey.h:192
volatile bool operationInProgress
Definition: AESCommonLPF3.h:110
volatile bool powerConstraintSet
Definition: AESCommonLPF3.h:111
CryptoKey key
Definition: AESCommonLPF3.h:105
uint8_t intPriority
Crypto Peripheral&#39;s interrupt priority.
Definition: AESCommonLPF3.h:94
AESCommonLPF3 Hardware Attributes.
Definition: AESCommonLPF3.h:80
uint32_t semaphoreTimeout
Definition: AESCommonLPF3.h:104
AES common module header for all devices.
bool isOpen
Definition: AESCommonLPF3.h:108
volatile bool cryptoResourceLocked
Definition: AESCommonLPF3.h:109
AESCommonLPF3 Object.
Definition: AESCommonLPF3.h:102
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale