AESGCMCC26X4_s.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022-2023, Texas Instruments Incorporated - https://www.ti.com
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  */
32 
33 #ifndef ti_drivers_aesgcm_AESGCMCC26X4_s__include
34 #define ti_drivers_aesgcm_AESGCMCC26X4_s__include
35 
36 #include <stdint.h>
37 
39 #include <ti/drivers/AESGCM.h>
40 
42 
43 #include <third_party/tfm/interface/include/psa/error.h>
44 #include <third_party/tfm/interface/include/psa/service.h>
45 
46 #if defined(TFM_BUILD)
47  #include "ti_drivers_config.h" /* Sysconfig generated header */
48 #endif
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 /*
55  * AES GCM secure message types
56  */
57 #define AESGCM_S_MSG_TYPE_CONSTRUCT AESGCM_S_MSG_TYPE(0U)
58 #define AESGCM_S_MSG_TYPE_OPEN AESGCM_S_MSG_TYPE(1U)
59 #define AESGCM_S_MSG_TYPE_REGISTER_CALLBACK AESGCM_S_MSG_TYPE(2U)
60 #define AESGCM_S_MSG_TYPE_CLOSE AESGCM_S_MSG_TYPE(3U)
61 #define AESGCM_S_MSG_TYPE_ONE_STEP_ENCRYPT AESGCM_S_MSG_TYPE(4U)
62 #define AESGCM_S_MSG_TYPE_ONE_STEP_DECRYPT AESGCM_S_MSG_TYPE(5U)
63 #define AESGCM_S_MSG_TYPE_SETUP_ENCRYPT AESGCM_S_MSG_TYPE(6U)
64 #define AESGCM_S_MSG_TYPE_SETUP_DECRYPT AESGCM_S_MSG_TYPE(7U)
65 #define AESGCM_S_MSG_TYPE_SET_LENGTHS AESGCM_S_MSG_TYPE(8U)
66 #define AESGCM_S_MSG_TYPE_SET_IV AESGCM_S_MSG_TYPE(9U)
67 #define AESGCM_S_MSG_TYPE_ADD_AAD AESGCM_S_MSG_TYPE(10U)
68 #define AESGCM_S_MSG_TYPE_ADD_DATA AESGCM_S_MSG_TYPE(11U)
69 #define AESGCM_S_MSG_TYPE_FINALIZE_ENCRYPT AESGCM_S_MSG_TYPE(12U)
70 #define AESGCM_S_MSG_TYPE_FINALIZE_DECRYPT AESGCM_S_MSG_TYPE(13U)
71 #define AESGCM_S_MSG_TYPE_CANCEL_OPERATION AESGCM_S_MSG_TYPE(14U)
72 
73 /*
74  * Config pool size determines how many dynamic driver instances can be created
75  * by the non-secure client using AESGCM_construct().
76  */
77 #ifndef CONFIG_AESGCM_S_CONFIG_POOL_SIZE
78  #define CONFIG_AESGCM_S_CONFIG_POOL_SIZE 1
79 #endif
80 
81 #define AESGCM_SECURE_CALLBACK_COUNT (CONFIG_TI_DRIVERS_AESGCM_COUNT + CONFIG_AESGCM_S_CONFIG_POOL_SIZE)
82 
83 /*
84  * ========= AES GCM Secure Callback struct =========
85  * Non-secure clients must register their callback after opening or
86  * constructing a driver instance with blocking or callback return behavior.
87  */
88 typedef struct
89 {
91  /* AES GCM callback fxn parameters */
93  int_fast16_t returnValue;
97 
98 /*
99  * ========= AES GCM Secure Message Structs =========
100  * These secure message structs correspond to the secure message types defined
101  * above. Together, they are used by non-secure client to make PSA calls to the
102  * AES GCM secure service. There is a single input vector for the PSA call
103  * which is a pointer to secure message struct. If the underlying function
104  * has a return value, there is a single output vector which is a pointer to
105  * storage for the return value.
106  */
107 typedef struct
108 {
112 
113 typedef struct
114 {
115  uint_least8_t index;
118 
119 typedef struct
120 {
124 
125 typedef struct
126 {
129 
130 typedef struct
131 {
135 
136 typedef struct
137 {
139  const CryptoKey *key;
143 
144 typedef struct
145 {
147  size_t aadLength;
150 
151 typedef struct
152 {
154  const uint8_t *iv;
155  size_t ivLength;
157 
158 typedef struct
159 {
163 
164 typedef struct
165 {
169 
170 typedef struct
171 {
175 
176 typedef struct
177 {
180 
191 psa_status_t AESGCM_s_handlePsaMsg(psa_msg_t *msg);
192 
198 void AESGCM_s_init(void);
199 
200 #ifdef __cplusplus
201 }
202 #endif
203 
204 #endif /* ti_drivers_aesgcm_AESGCMCC26X4_s__include */
AESGCM_Handle handle
Definition: AESGCMCC26X4_s.h:172
Definition: SecureCallback.h:51
psa_status_t AESGCM_s_handlePsaMsg(psa_msg_t *msg)
Handles PSA messages for AES GCM secure driver.
Definition: AESGCMCC26X4_s.h:130
AESGCM_OperationType
Enum for the operation types supported by the driver.
Definition: AESGCM.h:868
Definition: AESGCMCC26X4_s.h:136
uint_least8_t index
Definition: AESGCMCC26X4_s.h:115
AESGCM_Handle handle
Definition: AESGCMCC26X4_s.h:92
const uint8_t * iv
Definition: AESGCMCC26X4_s.h:154
Definition: AESGCMCC26X4_s.h:144
AES Global configuration.
Definition: AESCommon.h:154
AESGCM_OperationUnion * operation
Definition: AESGCMCC26X4_s.h:94
Definition: AESGCMCC26X4_s.h:164
AESGCM_SegmentedAADOperation * operation
Definition: AESGCMCC26X4_s.h:161
AESGCM_Handle handle
Definition: AESGCMCC26X4_s.h:138
AESGCM driver header.
CryptoKey datastructure.
Definition: CryptoKey.h:196
Struct containing the parameters required for encrypting/decrypting a message in a segmented operatio...
Definition: AESGCM.h:789
size_t ivLength
Definition: AESGCMCC26X4_s.h:155
AESGCM_Handle handle
Definition: AESGCMCC26X4_s.h:121
AESGCM_s_SecureCallback * callback
Definition: AESGCMCC26X4_s.h:122
AESGCM_OperationType operationType
Definition: AESGCMCC26X4_s.h:95
AESGCM_Handle handle
Definition: AESGCMCC26X4_s.h:153
Struct containing the parameters required for authenticating/verifying additional data in a segmented...
Definition: AESGCM.h:771
SecureCallback_Object object
Definition: AESGCMCC26X4_s.h:90
int_fast16_t returnValue
Definition: AESGCMCC26X4_s.h:93
Secure Crypto Service.
const AESGCM_Params * params
Definition: AESGCMCC26X4_s.h:110
AESGCM_Handle handle
Definition: AESGCMCC26X4_s.h:146
Definition: AESGCMCC26X4_s.h:107
size_t totalPlaintextLength
Definition: AESGCMCC26X4_s.h:141
AESGCM_Handle handle
Definition: AESGCMCC26X4_s.h:160
Definition: AESGCMCC26X4_s.h:119
Struct containing the parameters required for finalizing an encryption/decryption and authentication/...
Definition: AESGCM.h:814
AESGCM_SegmentedFinalizeOperation * operation
Definition: AESGCMCC26X4_s.h:173
AESGCM_OneStepOperation * operation
Definition: AESGCMCC26X4_s.h:133
Struct containing the parameters required for encrypting/decrypting and authenticating/verifying a me...
Definition: AESGCM.h:716
Definition: AESGCMCC26X4_s.h:176
size_t aadLength
Definition: AESGCMCC26X4_s.h:147
Definition: AESGCMCC26X4_s.h:151
AESGCM_Handle handle
Definition: AESGCMCC26X4_s.h:132
AESGCM_Config * config
Definition: AESGCMCC26X4_s.h:109
Definition: AESGCMCC26X4_s.h:113
AESGCM_SegmentedDataOperation * operation
Definition: AESGCMCC26X4_s.h:167
Definition: AESGCMCC26X4_s.h:170
Definition: AESGCMCC26X4_s.h:158
AESGCM_Handle handle
Definition: AESGCMCC26X4_s.h:127
Union containing a reference to a one step, segmented AAD, segmented data, or segmented finalize oper...
Definition: AESGCM.h:856
const CryptoKey * key
Definition: AESGCMCC26X4_s.h:139
const AESGCM_Params * params
Definition: AESGCMCC26X4_s.h:116
AESGCM_Handle handle
Definition: AESGCMCC26X4_s.h:166
AESGCM_Handle handle
Definition: AESGCMCC26X4_s.h:178
void AESGCM_s_init(void)
Initializes the AES GCM secure driver.
GCM Parameters.
Definition: AESGCM.h:911
Definition: AESGCMCC26X4_s.h:125
Definition: AESGCMCC26X4_s.h:88
size_t totalAADLength
Definition: AESGCMCC26X4_s.h:140
size_t plaintextLength
Definition: AESGCMCC26X4_s.h:148
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale