ECJPAKECC26X4_s.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 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_ecjpake_ECJPAKECC26X4_s__include
34 #define ti_drivers_ecjpake_ECJPAKECC26X4_s__include
35 
36 #include <stdint.h>
37 
39 #include <ti/drivers/ECJPAKE.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  * ECJPAKE secure message types
56  */
57 #define ECJPAKE_S_MSG_TYPE_CONSTRUCT ECJPAKE_S_MSG_TYPE(0U)
58 #define ECJPAKE_S_MSG_TYPE_OPEN ECJPAKE_S_MSG_TYPE(1U)
59 #define ECJPAKE_S_MSG_TYPE_REGISTER_CALLBACK ECJPAKE_S_MSG_TYPE(2U)
60 #define ECJPAKE_S_MSG_TYPE_CLOSE ECJPAKE_S_MSG_TYPE(3U)
61 #define ECJPAKE_S_MSG_TYPE_ROUND_ONE_GENERATE_KEYS ECJPAKE_S_MSG_TYPE(4U)
62 #define ECJPAKE_S_MSG_TYPE_GENERATE_ZKP ECJPAKE_S_MSG_TYPE(5U)
63 #define ECJPAKE_S_MSG_TYPE_VERIFY_ZKP ECJPAKE_S_MSG_TYPE(6U)
64 #define ECJPAKE_S_MSG_TYPE_ROUND_TWO_GENERATE_KEYS ECJPAKE_S_MSG_TYPE(7U)
65 #define ECJPAKE_S_MSG_TYPE_COMPUTE_SHARED_SECRET ECJPAKE_S_MSG_TYPE(8U)
66 #define ECJPAKE_S_MSG_TYPE_CANCEL_OPERATION ECJPAKE_S_MSG_TYPE(9U)
67 
68 /*
69  * Config pool size determines how many dynamic driver instances can be created
70  * by the non-secure client using ECJPAKE_construct().
71  */
72 #ifndef CONFIG_ECJPAKE_S_CONFIG_POOL_SIZE
73  #define CONFIG_ECJPAKE_S_CONFIG_POOL_SIZE 1
74 #endif
75 
76 #define ECJPAKE_SECURE_CALLBACK_COUNT (CONFIG_TI_DRIVERS_ECJPAKE_COUNT + CONFIG_ECJPAKE_S_CONFIG_POOL_SIZE)
77 
78 /*
79  * ========= ECJPAKE Secure Callback struct =========
80  * Non-secure clients must register their callback after opening or
81  * constructing a driver instance with blocking or callback return behavior.
82  */
83 typedef struct
84 {
86  /* ECJPAKE callback fxn parameters */
88  int_fast16_t returnStatus;
92 
93 /*
94  * ========= ECJPAKE Secure Message Structs =========
95  * These secure message structs correspond to the secure message types defined
96  * above. Together, they are used by non-secure client to make PSA calls to the
97  * ECJPAKE secure service. There is a single input vector for the PSA call
98  * which is a pointer to secure message struct. If the underlying function
99  * has a return value, there is a single output vector which is a pointer to
100  * storage for the return value.
101  */
102 typedef struct
103 {
107 
108 typedef struct
109 {
110  uint_least8_t index;
113 
114 typedef struct
115 {
119 
120 typedef struct
121 {
124 
125 /*
126  * Message struct for the following message types:
127  * - ECJPAKE_S_MSG_TYPE_ROUND_ONE_GENERATE_KEYS
128  * - ECJPAKE_S_MSG_TYPE_GENERATE_ZKP
129  * - ECJPAKE_S_MSG_TYPE_VERIFY_ZKP
130  * - ECJPAKE_S_MSG_TYPE_ROUND_TWO_GENERATE_KEYS
131  * - ECJPAKE_S_MSG_TYPE_COMPUTE_SHARED_SECRET
132  */
133 typedef struct
134 {
138 
139 typedef struct
140 {
143 
154 psa_status_t ECJPAKE_s_handlePsaMsg(psa_msg_t *msg);
155 
161 void ECJPAKE_s_init(void);
162 
163 #ifdef __cplusplus
164 }
165 #endif
166 
167 #endif /* ti_drivers_ecjpake_ECJPAKECC26X4_s__include */
ECJPAKE_Handle handle
Definition: ECJPAKECC26X4_s.h:135
ECJPAKE_Handle handle
Definition: ECJPAKECC26X4_s.h:87
ECJPAKE_Config * config
Definition: ECJPAKECC26X4_s.h:104
Definition: SecureCallback.h:51
Definition: ECJPAKECC26X4_s.h:102
ECJPAKE_Handle handle
Definition: ECJPAKECC26X4_s.h:122
ECJPAKE_OperationType
Enum for the operation types supported by the driver.
Definition: ECJPAKE.h:1118
ECJPAKE_Handle handle
Definition: ECJPAKECC26X4_s.h:116
int_fast16_t returnStatus
Definition: ECJPAKECC26X4_s.h:88
SecureCallback_Object object
Definition: ECJPAKECC26X4_s.h:85
Definition: ECJPAKECC26X4_s.h:120
Definition: ECJPAKECC26X4_s.h:83
Definition: ECJPAKECC26X4_s.h:139
ECJPAKE_OperationType operationType
Definition: ECJPAKECC26X4_s.h:90
Secure Crypto Service.
ECJPAKE Parameters.
Definition: ECJPAKE.h:1158
ECJPAKE_Operation operation
Definition: ECJPAKECC26X4_s.h:136
Definition: ECJPAKECC26X4_s.h:133
ECJPAKE Global configuration.
Definition: ECJPAKE.h:826
ECJPAKE_s_SecureCallback * callback
Definition: ECJPAKECC26X4_s.h:117
const ECJPAKE_Params * params
Definition: ECJPAKECC26X4_s.h:111
TI Driver for Elliptic Curve Password Authenticated Key Exchange by Juggling.
ECJPAKE_Operation operation
Definition: ECJPAKECC26X4_s.h:89
Definition: ECJPAKECC26X4_s.h:114
const ECJPAKE_Params * params
Definition: ECJPAKECC26X4_s.h:105
Definition: ECJPAKECC26X4_s.h:108
ECJPAKE_Handle handle
Definition: ECJPAKECC26X4_s.h:141
void ECJPAKE_s_init(void)
Initializes the ECJPAKE secure driver.
uint_least8_t index
Definition: ECJPAKECC26X4_s.h:110
psa_status_t ECJPAKE_s_handlePsaMsg(psa_msg_t *msg)
Handles PSA messages for ECJPAKE secure driver.
Union containing pointers to all supported operation structs.
Definition: ECJPAKE.h:1103
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale