• 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 RECV_PROCESS_H
17 #define RECV_PROCESS_H
18 
19 #include <stdint.h>
20 #include "tls.h"
21 #include "hs_msg.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 int32_t Tls12ServerRecvClientHelloProcess(TLS_Ctx *ctx, const HS_Msg *msg);
28 
29 /**
30  * @brief   Server processes DTLS client hello message
31  *
32  * @param   ctx [IN] TLS context
33  * @param   msg [IN] client hello message
34  *
35  * @retval  HITLS_SUCCESS
36  * @retval  For other error codes, see hitls_error.h
37  */
38 #ifdef HITLS_TLS_PROTO_DTLS12
39 int32_t DtlsServerRecvClientHelloProcess(TLS_Ctx *ctx, const HS_Msg *msg);
40 #endif
41 
42 /*
43  * @brief   Dtls client processes hello verify request message
44  *
45  * @param   ctx [IN] TLS context
46  * @param   msg [IN] hello verify request message
47  *
48  * @retval  HITLS_SUCCESS
49  * @retval  For other error codes, see hitls_error.h
50  */
51 #ifdef HITLS_TLS_PROTO_DTLS12
52 int32_t DtlsClientRecvHelloVerifyRequestProcess(TLS_Ctx *ctx, HS_Msg *msg);
53 #endif
54 
55 /**
56  * @brief   Client processes Server Hello message
57  *
58  * @param   ctx [IN] TLS context
59  * @param   msg [IN] server hello message
60  *
61  * @retval  HITLS_SUCCESS
62  * @retval  For other error codes, see hitls_error.h
63  */
64 int32_t ClientRecvServerHelloProcess(TLS_Ctx *ctx, const HS_Msg *msg);
65 
66 /**
67  * @brief   Process peer certificate
68  *
69  * @param   ctx [IN] TLS context
70  * @param   msg [IN] certificate message
71  *
72  * @retval  HITLS_SUCCESS
73  * @retval  For other error codes, see hitls_error.h
74  */
75 int32_t RecvCertificateProcess(TLS_Ctx *ctx, const HS_Msg *msg);
76 
77 /**
78  * @brief   Process server key exchange
79  *
80  * @param   ctx [IN] TLS context
81  * @param   msg [IN] server key exchange message
82  *
83  * @retval  HITLS_SUCCESS
84  * @retval  For other error codes, see hitls_error.h
85  */
86 int32_t ClientRecvServerKxProcess(TLS_Ctx *ctx, HS_Msg *msg);
87 
88 /**
89  * @brief   Process server certificate request
90  *
91  * @param   ctx [IN] TLS context
92  * @param   msg [IN] server certificate request message
93  *
94  * @retval  HITLS_SUCCESS
95  * @retval  For other error codes, see hitls_error.h
96  */
97 int32_t ClientRecvCertRequestProcess(TLS_Ctx *ctx, HS_Msg *msg);
98 
99 /**
100  * @brief   Process sever hello done
101  *
102  * @param   ctx [IN] TLS context
103  *
104  * @return  HITLS_SUCCESS
105  */
106 int32_t ClientRecvServerHelloDoneProcess(TLS_Ctx *ctx);
107 
108 /**
109  * @brief   The server processes the client key exchange
110  *
111  * @param   ctx [IN] TLS context
112  * @param   msg [IN] Parsed handshake message
113  *
114  * @retval  HITLS_SUCCESS
115  * @retval  For other error codes, see hitls_error.h
116  */
117 int32_t ServerRecvClientKxProcess(TLS_Ctx *ctx, const HS_Msg *msg);
118 
119 /**
120  * @brief   Server process client certificate verification message
121  *
122  * @param   ctx [IN] TLS context
123  *
124  * @retval  HITLS_SUCCESS
125  * @retval  For other error codes, see hitls_error.h
126  */
127 int32_t ServerRecvClientCertVerifyProcess(TLS_Ctx *ctx);
128 
129 /**
130  * @brief   TLS1.2 client processes the new session ticket message
131  *
132  * @param   ctx [IN] TLS context
133  *
134  * @retval  HITLS_SUCCESS
135  * @retval  For other error codes, see hitls_error.h
136  */
137 int32_t Tls12ClientRecvNewSeesionTicketProcess(TLS_Ctx *ctx, HS_Msg *hsMsg);
138 
139 /**
140  * @brief   TLS1.3 client processes the new session ticket message
141  *
142  * @param   ctx [IN] TLS context
143  *
144  * @retval  HITLS_SUCCESS
145  * @retval  For other error codes, see hitls_error.h
146  */
147 int32_t Tls13ClientRecvNewSessionTicketProcess(TLS_Ctx *ctx, HS_Msg *hsMsg);
148 
149 int32_t Tls12ServerRecvFinishedProcess(TLS_Ctx *ctx, const HS_Msg *msg);
150 
151 int32_t Tls12ClientRecvFinishedProcess(TLS_Ctx *ctx, const HS_Msg *msg);
152 
153 /**
154  * @brief   Server processes dlts client finished message
155  *
156  * @param   ctx [IN] TLS context
157  * @param   msg [IN] finished message
158  *
159  * @retval  HITLS_SUCCESS
160  * @retval  HITLS_MSG_HANDLE_VERIFY_FINISHED_FAIL Failed to verify the finished message
161  */
162 #ifdef HITLS_TLS_PROTO_DTLS12
163 int32_t DtlsServerRecvFinishedProcess(TLS_Ctx *ctx, const HS_Msg *msg);
164 #endif
165 
166 /**
167  * @brief   Client processes dlts server finished message
168  *
169  * @param   ctx [IN] TLS context
170  * @param   msg [IN] finished message
171  *
172  * @retval  HITLS_SUCCESS
173  * @retval  HITLS_MSG_HANDLE_VERIFY_FINISHED_FAIL Failed to verify the finished message
174  */
175 #ifdef HITLS_TLS_PROTO_DTLS12
176 int32_t DtlsClientRecvFinishedProcess(TLS_Ctx *ctx, const HS_Msg *msg);
177 #endif
178 
179 /**
180  * @brief   TLS1.3 server process client hello message
181  *
182  * @param   ctx [IN] TLS context
183  * @param   msg [IN] client hello message
184  *
185  * @retval  HITLS_SUCCESS
186  * @retval  For other error codes, see hitls_error.h
187  */
188 int32_t Tls13ServerRecvClientHelloProcess(TLS_Ctx *ctx, HS_Msg *msg);
189 
190 /**
191  * @brief   TLS1.3 client process server hello message
192  *
193  * @param   ctx [IN] TLS context
194  * @param   msg [IN] server hello message
195  *
196  * @retval  HITLS_SUCCESS
197  * @retval  For other error codes, see hitls_error.h
198  */
199 int32_t Tls13ClientRecvServerHelloProcess(TLS_Ctx *ctx, const HS_Msg *msg);
200 
201 /**
202  * @brief   TLS1.3 client process encrypted extensions message
203  *
204  * @param   ctx [IN] TLS context
205  * @param   msg [IN] encrypted extensions message
206  *
207  * @retval  HITLS_SUCCESS
208  * @retval  For other error codes, see hitls_error.h
209  */
210 int32_t Tls13ClientRecvEncryptedExtensionsProcess(TLS_Ctx *ctx, const HS_Msg *msg);
211 
212 /**
213  * @brief   TLS1.3 client processes certificate request message
214  *
215  * @param   ctx [IN] TLS context
216  * @param   msg [IN] certificate request message
217  *
218  * @retval  HITLS_SUCCESS
219  * @retval  For other error codes, see hitls_error.h
220  */
221 int32_t Tls13ClientRecvCertRequestProcess(TLS_Ctx *ctx, const HS_Msg *msg);
222 
223 /**
224  * @brief   TLS1.3 process certificate message
225  *
226  * @param   ctx [IN] TLS context
227  * @param   msg [IN] certificate message
228  *
229  * @retval  HITLS_SUCCESS
230  * @retval  For other error codes, see hitls_error.h
231  */
232 int32_t Tls13RecvCertificateProcess(TLS_Ctx *ctx, const HS_Msg *msg);
233 
234 /**
235  * @brief   TLS1.3 process certificate verify message
236  *
237  * @param   ctx [IN] TLS context
238  * @param   msg [IN] certificate verify message
239  *
240  * @retval  HITLS_SUCCESS
241  * @retval  For other error codes, see hitls_error.h
242  */
243 int32_t Tls13RecvCertVerifyProcess(TLS_Ctx *ctx);
244 
245 /**
246  * @brief   TLS1.3 client process finished message
247  *
248  * @param   ctx [IN] TLS context
249  * @param   msg [IN] finished message
250  *
251  * @retval  HITLS_SUCCESS
252  * @retval  For other error codes, see hitls_error.h
253  */
254 int32_t Tls13ClientRecvFinishedProcess(TLS_Ctx *ctx, const HS_Msg *msg);
255 
256 /**
257  * @brief   TLS1.3 server process finished message
258  *
259  * @param   ctx [IN] TLS context
260  * @param   msg [IN] finished message
261  *
262  * @retval  HITLS_SUCCESS
263  * @retval  For other error codes, see hitls_error.h
264  */
265 int32_t Tls13ServerRecvFinishedProcess(TLS_Ctx *ctx, const HS_Msg *msg);
266 
267 #ifdef __cplusplus
268 }
269 #endif /* end __cplusplus */
270 
271 #endif /* end RECV_PROCESS_H */
272