AESECBCC26X4_s.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 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_aesecb_AESECBCC26X4_s__include
34 #define ti_drivers_aesecb_AESECBCC26X4_s__include
35 
36 #include <stdint.h>
37 
39 #include <ti/drivers/AESECB.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_PSA_API)
47  #include "ti_drivers_config.h" /* Sysconfig generated header */
48 #endif
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 /*
55  * AES ECB secure message types
56  *
57  * Non-secure clients must register their callback after opening or
58  * constructing a driver instance with blocking or callback return behavior.
59  */
60 #define AESECB_S_MSG_TYPE_CONSTRUCT (CRYPTO_S_MSG_TYPE_INDEX_AESECB | ((int32_t)1 << (CRYPTO_S_MSG_TYPE_SHIFT + 0U)))
61 #define AESECB_S_MSG_TYPE_OPEN (CRYPTO_S_MSG_TYPE_INDEX_AESECB | ((int32_t)1 << (CRYPTO_S_MSG_TYPE_SHIFT + 1U)))
62 #define AESECB_S_MSG_TYPE_REGISTER_CALLBACK \
63  (CRYPTO_S_MSG_TYPE_INDEX_AESECB | ((int32_t)1 << (CRYPTO_S_MSG_TYPE_SHIFT + 2U)))
64 #define AESECB_S_MSG_TYPE_CLOSE (CRYPTO_S_MSG_TYPE_INDEX_AESECB | ((int32_t)1 << (CRYPTO_S_MSG_TYPE_SHIFT + 3U)))
65 #define AESECB_S_MSG_TYPE_ONE_STEP_ENCRYPT \
66  (CRYPTO_S_MSG_TYPE_INDEX_AESECB | ((int32_t)1 << (CRYPTO_S_MSG_TYPE_SHIFT + 4U)))
67 #define AESECB_S_MSG_TYPE_ONE_STEP_DECRYPT \
68  (CRYPTO_S_MSG_TYPE_INDEX_AESECB | ((int32_t)1 << (CRYPTO_S_MSG_TYPE_SHIFT + 5U)))
69 #define AESECB_S_MSG_TYPE_SETUP_ENCRYPT \
70  (CRYPTO_S_MSG_TYPE_INDEX_AESECB | ((int32_t)1 << (CRYPTO_S_MSG_TYPE_SHIFT + 6U)))
71 #define AESECB_S_MSG_TYPE_SETUP_DECRYPT \
72  (CRYPTO_S_MSG_TYPE_INDEX_AESECB | ((int32_t)1 << (CRYPTO_S_MSG_TYPE_SHIFT + 7U)))
73 #define AESECB_S_MSG_TYPE_ADD_DATA (CRYPTO_S_MSG_TYPE_INDEX_AESECB | ((int32_t)1 << (CRYPTO_S_MSG_TYPE_SHIFT + 8U)))
74 #define AESECB_S_MSG_TYPE_FINALIZE (CRYPTO_S_MSG_TYPE_INDEX_AESECB | ((int32_t)1 << (CRYPTO_S_MSG_TYPE_SHIFT + 9U)))
75 #define AESECB_S_MSG_TYPE_CANCEL_OPERATION \
76  (CRYPTO_S_MSG_TYPE_INDEX_AESECB | ((int32_t)1 << (CRYPTO_S_MSG_TYPE_SHIFT + 10U)))
77 
78 /*
79  * Config pool size determines how many dynamic driver instances can be created
80  * by the non-secure client using AESECB_construct().
81  */
82 #ifndef CONFIG_AESECB_S_CONFIG_POOL_SIZE
83  #define CONFIG_AESECB_S_CONFIG_POOL_SIZE 1
84 #endif
85 
86 #define AESECB_SECURE_CALLBACK_COUNT (CONFIG_TI_DRIVERS_AESECB_COUNT + CONFIG_AESECB_S_CONFIG_POOL_SIZE)
87 
88 /*
89  * ========= AES ECB Secure Callback struct =========
90  */
91 typedef struct
92 {
94  /* AES ECB callback fxn parameters */
96  int_fast16_t returnValue;
100 
101 /*
102  * ========= AES ECB Secure Message Structs =========
103  * These secure message structs correspond to the secure message types defined
104  * above. Together, they are used by non-secure client to make PSA calls to the
105  * AES ECB secure service. There is a single input vector for the PSA call
106  * which is a pointer to secure message struct. If the underlying function
107  * has a return value, there is a single output vector which is a pointer to
108  * storage for the return value.
109  */
110 typedef struct
111 {
115 
116 typedef struct
117 {
118  uint_least8_t index;
121 
122 typedef struct
123 {
127 
128 typedef struct
129 {
132 
133 typedef struct
134 {
138 
140 
141 typedef struct
142 {
144  const CryptoKey *key;
146 
148 
150 
151 typedef struct
152 {
155 
166 psa_status_t AESECB_s_handlePsaMsg(psa_msg_t *msg);
167 
173 void AESECB_s_init(void);
174 
175 #ifdef __cplusplus
176 }
177 #endif
178 
179 #endif /* ti_drivers_aesecb_AESECBCC26X4_s__include */
AESECB_Operation * operation
Definition: AESECBCC26X4_s.h:97
AESECB_s_OperationMsg AESECB_s_OneStepOperationMsg
Definition: AESECBCC26X4_s.h:139
Definition: SecureCallback.h:51
AESECB_Handle handle
Definition: AESECBCC26X4_s.h:124
AES Global configuration.
Definition: AESCommon.h:154
AESECB_Config * config
Definition: AESECBCC26X4_s.h:112
CryptoKey datastructure.
Definition: CryptoKey.h:192
AESECB_Handle handle
Definition: AESECBCC26X4_s.h:135
Definition: AESECBCC26X4_s.h:133
const CryptoKey * key
Definition: AESECBCC26X4_s.h:144
ECB Parameters.
Definition: AESECB.h:665
Secure Crypto Service.
AESECB_s_SecureCallback * callback
Definition: AESECBCC26X4_s.h:125
Definition: AESECBCC26X4_s.h:128
Definition: AESECBCC26X4_s.h:91
int_fast16_t returnValue
Definition: AESECBCC26X4_s.h:96
Struct containing the parameters required for encrypting/decrypting and a message.
Definition: AESECB.h:581
AESECB driver header.
Definition: AESECBCC26X4_s.h:110
AESECB_Handle handle
Definition: AESECBCC26X4_s.h:153
const AESECB_Params * params
Definition: AESECBCC26X4_s.h:113
psa_status_t AESECB_s_handlePsaMsg(psa_msg_t *msg)
Handles PSA messages for AES ECB secure driver.
SecureCallback_Object object
Definition: AESECBCC26X4_s.h:93
void AESECB_s_init(void)
Initializes the AES ECB secure driver.
const AESECB_Params * params
Definition: AESECBCC26X4_s.h:119
Definition: AESECBCC26X4_s.h:122
AESECB_OperationType operationType
Definition: AESECBCC26X4_s.h:98
AESECB_Handle handle
Definition: AESECBCC26X4_s.h:130
Definition: AESECBCC26X4_s.h:151
AESECB_s_OperationMsg AESECB_s_FinalizeMsg
Definition: AESECBCC26X4_s.h:149
AESECB_OperationType
Enum for the operation types supported by the driver.
Definition: AESECB.h:627
AESECB_Handle handle
Definition: AESECBCC26X4_s.h:95
AESECB_Operation * operation
Definition: AESECBCC26X4_s.h:136
uint_least8_t index
Definition: AESECBCC26X4_s.h:118
Definition: AESECBCC26X4_s.h:141
AESECB_Handle handle
Definition: AESECBCC26X4_s.h:143
Definition: AESECBCC26X4_s.h:116
AESECB_s_OperationMsg AESECB_s_AddDataMsg
Definition: AESECBCC26X4_s.h:147
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale