• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of the openHiTLS project.
3  *
4  * openHiTLS is licensed under the Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *
8  *     http://license.coscl.org.cn/MulanPSL2
9  *
10  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13  * See the Mulan PSL v2 for more details.
14  */
15 
16 #ifndef SEND_PROCESS_H
17 #define SEND_PROCESS_H
18 
19 #include <stdint.h>
20 #include "tls.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /**
27  * @brief   Send a handshake message
28  *
29  * @param   ctx [IN] TLS context
30  *
31  * @retval  HITLS_SUCCESS
32  * @retval  HITLS_UNREGISTERED_CALLBACK
33  * @retval  HITLS_CRYPT_ERR_DIGEST hash operation failed
34  * @retval  HITLS_MEMCPY_FAIL Memory copy failed
35  * @retval  HITLS_MEMALLOC_FAIL Memory allocation failed
36  * @return  For details, see REC_Write
37  */
38 int32_t HS_SendMsg(TLS_Ctx *ctx);
39 
40 /**
41  * @brief   Server sends Hello Request messsage
42  *
43  * @param   ctx [IN] TLS context
44  *
45  * @retval  HITLS_SUCCESS
46  * @retval  For details, see hitls_error.h
47  */
48 int32_t ServerSendHelloRequestProcess(TLS_Ctx *ctx);
49 
50 /**
51  * @brief   Server sends Hello Verify Request messsage
52  *
53  * @param   ctx [IN] TLS context
54  *
55  * @retval  HITLS_SUCCESS
56  * @retval  For details, see hitls_error.h
57  */
58 int32_t DtlsServerSendHelloVerifyRequestProcess(TLS_Ctx *ctx);
59 
60 /**
61  * @brief   Client sends client hello messsage
62  *
63  * @param   ctx [IN] TLS context
64  *
65  * @retval  HITLS_SUCCESS
66  * @retval  For details, see hitls_error.h
67  */
68 int32_t ClientSendClientHelloProcess(TLS_Ctx *ctx);
69 
70 /**
71  * @brief   Server sends server hello messsage
72  *
73  * @param   ctx [IN] TLS context
74  *
75  * @retval  HITLS_SUCCESS
76  * @return  For details, see hitls_error.h
77  */
78 int32_t ServerSendServerHelloProcess(TLS_Ctx *ctx);
79 
80 /**
81  * @brief   send certificate messsage
82  * @attention The certificates sent by client and server are the same, except for the processing empty certificates
83  * @param   ctx [IN] TLS context
84  *
85  * @retval  HITLS_SUCCESS
86  * @return  For details, see hitls_error.h
87  */
88 int32_t SendCertificateProcess(TLS_Ctx *ctx);
89 
90 /**
91  * @brief   Server sends server keyExchange messsage
92  *
93  * @param   ctx [IN] TLS context
94  *
95  * @retval  HITLS_SUCCESS
96  * @return  For details, see hitls_error.h
97  */
98 int32_t ServerSendServerKeyExchangeProcess(TLS_Ctx *ctx);
99 
100 /**
101  * @brief   Server sends server certificate request messsage
102  * @param   ctx [IN] TLS context
103  *
104  * @retval  HITLS_SUCCESS
105  * @return  For details, see hitls_error.h
106  */
107 int32_t ServerSendCertRequestProcess(TLS_Ctx *ctx);
108 
109 /**
110  * @brief   Server sends server hello done message
111  *
112  * @param   ctx [IN] TLS context
113  *
114  * @retval  HITLS_SUCCESS
115  * @return  For details, see hitls_error.h
116  */
117 int32_t ServerSendServerHelloDoneProcess(TLS_Ctx *ctx);
118 
119 /**
120  * @brief   Client sends client key exchange messsage
121  *
122  * @param   ctx [IN] TLS context
123  *
124  * @retval  HITLS_SUCCESS
125  * @retval  For details, see hitls_error.h
126  */
127 int32_t ClientSendClientKeyExchangeProcess(TLS_Ctx *ctx);
128 
129 /**
130  * @brief   Client sends client certificate verify messsage
131  *
132  * @param   ctx [IN] TLS context
133  *
134  * @retval  HITLS_SUCCESS
135  * @retval  For details, see hitls_error.h
136  */
137 int32_t ClientSendCertVerifyProcess(TLS_Ctx *ctx);
138 
139 /**
140  * @brief   Server sends ccs messsage
141  *
142  * @param   ctx [IN] TLS context
143  *
144  * @retval  HITLS_SUCCESS
145  * @return  For details, see hitls_error.h
146  */
147 int32_t SendChangeCipherSpecProcess(TLS_Ctx *ctx);
148 
149 /**
150  * @brief   Server sends new session messsage
151  *
152  * @param   ctx [IN] TLS context
153  *
154  * @retval  HITLS_SUCCESS
155  * @return  For details, see hitls_error.h
156  */
157 int32_t SendNewSessionTicketProcess(TLS_Ctx *ctx);
158 
159 /**
160  * @brief   TLS1.3 Server sends new session messsage
161  *
162  * @param   ctx [IN] TLS context
163  *
164  * @retval  HITLS_SUCCESS
165  * @return  For details, see hitls_error.h
166  */
167 int32_t Tls13SendNewSessionTicketProcess(TLS_Ctx *ctx);
168 
169 int32_t Tls12ClientSendFinishedProcess(TLS_Ctx *ctx);
170 
171 int32_t Tls12ServerSendFinishedProcess(TLS_Ctx *ctx);
172 
173 /**
174  * @brief   Client sends finished messsage
175  *
176  * @param   ctx [IN] TLS context
177  *
178  * @retval  HITLS_SUCCESS
179  * @retval  For details, see hitls_error.h
180  */
181 #ifdef HITLS_TLS_PROTO_DTLS12
182 int32_t DtlsClientSendFinishedProcess(TLS_Ctx *ctx);
183 #endif
184 
185 /**
186  * @brief   Server sends dtls finished messsage
187  *
188  * @param   ctx [IN] TLS context
189  *
190  * @retval  HITLS_SUCCESS
191  * @return  For details, see hitls_error.h
192  */
193 #ifdef HITLS_TLS_PROTO_DTLS12
194 int32_t DtlsServerSendFinishedProcess(TLS_Ctx *ctx);
195 #endif
196 
197 /**
198  * @brief   TLS 1.3 Client sends client hello messsage
199  *
200  * @param   ctx [IN] TLS context
201  *
202  * @retval  HITLS_SUCCESS
203  * @retval  For details, see hitls_error.h
204  */
205 int32_t Tls13ClientSendClientHelloProcess(TLS_Ctx *ctx);
206 
207 /**
208  * @brief   TLS 1.3 Server sends hello retry request messsage
209  *
210  * @param   ctx [IN] TLS context
211  *
212  * @retval  HITLS_SUCCESS
213  * @retval  For details, see hitls_error.h
214  */
215 int32_t Tls13ServerSendHelloRetryRequestProcess(TLS_Ctx *ctx);
216 
217 /**
218  * @brief   TLS 1.3 Server sends server hello messsage
219  *
220  * @param   ctx [IN] TLS context
221  *
222  * @retval  HITLS_SUCCESS
223  * @retval  For details, see hitls_error.h
224  */
225 int32_t Tls13ServerSendServerHelloProcess(TLS_Ctx *ctx);
226 
227 /**
228  * @brief   TLS 1.3 Server sends encrypted extensions messsage
229  *
230  * @param   ctx [IN] TLS context
231  *
232  * @retval  HITLS_SUCCESS
233  * @retval  For details, see hitls_error.h
234  */
235 int32_t Tls13ServerSendEncryptedExtensionsProcess(TLS_Ctx *ctx);
236 
237 /**
238  * @brief   TLS 1.3 Server sends certificate request messsage
239  *
240  * @param   ctx [IN] TLS context
241  *
242  * @retval  HITLS_SUCCESS
243  * @retval  For details, see hitls_error.h
244  */
245 int32_t Tls13ServerSendCertRequestProcess(TLS_Ctx *ctx);
246 
247 /**
248  * @brief   TLS 1.3 Client sends certificate messsage
249  *
250  * @param   ctx [IN] TLS context
251  *
252  * @retval  HITLS_SUCCESS
253  * @retval  For details, see hitls_error.h
254  */
255 int32_t Tls13ClientSendCertificateProcess(TLS_Ctx *ctx);
256 
257 /**
258  * @brief   TLS 1.3 Server sends certificate messsage
259  *
260  * @param   ctx [IN] TLS context
261  *
262  * @retval  HITLS_SUCCESS
263  * @retval  For details, see hitls_error.h
264  */
265 int32_t Tls13ServerSendCertificateProcess(TLS_Ctx *ctx);
266 
267 /**
268  * @brief   TLS 1.3 send certificate verify messsage
269  *
270  * @param   ctx [IN] TLS context
271  *
272  * @retval  HITLS_SUCCESS
273  * @retval  For details, see hitls_error.h
274  */
275 int32_t Tls13SendCertVerifyProcess(TLS_Ctx *ctx);
276 
277 /**
278  * @brief   TLS 1.3 Server sends finished messsage
279  *
280  * @param   ctx [IN] TLS context
281  *
282  * @retval  HITLS_SUCCESS
283  * @retval  For details, see hitls_error.h
284  */
285 int32_t Tls13ServerSendFinishedProcess(TLS_Ctx *ctx);
286 
287 /**
288  * @brief   TLS 1.3 Client sends finished messsage
289  *
290  * @param   ctx [IN] TLS context
291  *
292  * @retval  HITLS_SUCCESS
293  * @retval  For details, see hitls_error.h
294  */
295 int32_t Tls13ClientSendFinishedProcess(TLS_Ctx *ctx);
296 
297 #ifdef __cplusplus
298 }
299 #endif
300 
301 #endif
302