mbed TLS v2.16.7
ssl.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
8  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9  *
10  * This file is provided under the Apache License 2.0, or the
11  * GNU General Public License v2.0 or later.
12  *
13  * **********
14  * Apache License 2.0:
15  *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may
17  * not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19  *
20  * http://www.apache.org/licenses/LICENSE-2.0
21  *
22  * Unless required by applicable law or agreed to in writing, software
23  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  * See the License for the specific language governing permissions and
26  * limitations under the License.
27  *
28  * **********
29  *
30  * **********
31  * GNU General Public License v2.0 or later:
32  *
33  * This program is free software; you can redistribute it and/or modify
34  * it under the terms of the GNU General Public License as published by
35  * the Free Software Foundation; either version 2 of the License, or
36  * (at your option) any later version.
37  *
38  * This program is distributed in the hope that it will be useful,
39  * but WITHOUT ANY WARRANTY; without even the implied warranty of
40  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41  * GNU General Public License for more details.
42  *
43  * You should have received a copy of the GNU General Public License along
44  * with this program; if not, write to the Free Software Foundation, Inc.,
45  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
46  *
47  * **********
48  *
49  * This file is part of mbed TLS (https://tls.mbed.org)
50  */
51 #ifndef MBEDTLS_SSL_H
52 #define MBEDTLS_SSL_H
53 
54 #if !defined(MBEDTLS_CONFIG_FILE)
55 #include "config.h"
56 #else
57 #include MBEDTLS_CONFIG_FILE
58 #endif
59 
60 #include "bignum.h"
61 #include "ecp.h"
62 
63 #include "ssl_ciphersuites.h"
64 
65 #if defined(MBEDTLS_X509_CRT_PARSE_C)
66 #include "x509_crt.h"
67 #include "x509_crl.h"
68 #endif
69 
70 #if defined(MBEDTLS_DHM_C)
71 #include "dhm.h"
72 #endif
73 
74 #if defined(MBEDTLS_ECDH_C)
75 #include "ecdh.h"
76 #endif
77 
78 #if defined(MBEDTLS_ZLIB_SUPPORT)
79 
80 #if defined(MBEDTLS_DEPRECATED_WARNING)
81 #warning "Record compression support via MBEDTLS_ZLIB_SUPPORT is deprecated and will be removed in the next major revision of the library"
82 #endif
83 
84 #if defined(MBEDTLS_DEPRECATED_REMOVED)
85 #error "Record compression support via MBEDTLS_ZLIB_SUPPORT is deprecated and cannot be used if MBEDTLS_DEPRECATED_REMOVED is set"
86 #endif
87 
88 #include "zlib.h"
89 #endif
90 
91 #if defined(MBEDTLS_HAVE_TIME)
92 #include "platform_time.h"
93 #endif
94 
95 /*
96  * SSL Error codes
97  */
98 #define MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE -0x7080
99 #define MBEDTLS_ERR_SSL_BAD_INPUT_DATA -0x7100
100 #define MBEDTLS_ERR_SSL_INVALID_MAC -0x7180
101 #define MBEDTLS_ERR_SSL_INVALID_RECORD -0x7200
102 #define MBEDTLS_ERR_SSL_CONN_EOF -0x7280
103 #define MBEDTLS_ERR_SSL_UNKNOWN_CIPHER -0x7300
104 #define MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN -0x7380
105 #define MBEDTLS_ERR_SSL_NO_RNG -0x7400
106 #define MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE -0x7480
107 #define MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE -0x7500
108 #define MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED -0x7580
109 #define MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED -0x7600
110 #define MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED -0x7680
111 #define MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE -0x7700
112 #define MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE -0x7780
113 #define MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED -0x7800
114 #define MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY -0x7880
115 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO -0x7900
116 #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO -0x7980
117 #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE -0x7A00
118 #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST -0x7A80
119 #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE -0x7B00
120 #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE -0x7B80
121 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE -0x7C00
122 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP -0x7C80
123 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS -0x7D00
124 #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY -0x7D80
125 #define MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC -0x7E00
126 #define MBEDTLS_ERR_SSL_BAD_HS_FINISHED -0x7E80
127 #define MBEDTLS_ERR_SSL_ALLOC_FAILED -0x7F00
128 #define MBEDTLS_ERR_SSL_HW_ACCEL_FAILED -0x7F80
129 #define MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH -0x6F80
130 #define MBEDTLS_ERR_SSL_COMPRESSION_FAILED -0x6F00
131 #define MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION -0x6E80
132 #define MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET -0x6E00
133 #define MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED -0x6D80
134 #define MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH -0x6D00
135 #define MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY -0x6C80
136 #define MBEDTLS_ERR_SSL_INTERNAL_ERROR -0x6C00
137 #define MBEDTLS_ERR_SSL_COUNTER_WRAPPING -0x6B80
138 #define MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO -0x6B00
139 #define MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED -0x6A80
140 #define MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL -0x6A00
141 #define MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE -0x6980
142 #define MBEDTLS_ERR_SSL_WANT_READ -0x6900
143 #define MBEDTLS_ERR_SSL_WANT_WRITE -0x6880
144 #define MBEDTLS_ERR_SSL_TIMEOUT -0x6800
145 #define MBEDTLS_ERR_SSL_CLIENT_RECONNECT -0x6780
146 #define MBEDTLS_ERR_SSL_UNEXPECTED_RECORD -0x6700
147 #define MBEDTLS_ERR_SSL_NON_FATAL -0x6680
148 #define MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH -0x6600
149 #define MBEDTLS_ERR_SSL_CONTINUE_PROCESSING -0x6580
150 #define MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS -0x6500
151 #define MBEDTLS_ERR_SSL_EARLY_MESSAGE -0x6480
152 #define MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS -0x7000
153 #define MBEDTLS_ERR_SSL_BAD_CONFIG -0x5E80
155 /*
156  * Various constants
157  */
158 #define MBEDTLS_SSL_MAJOR_VERSION_3 3
159 #define MBEDTLS_SSL_MINOR_VERSION_0 0
160 #define MBEDTLS_SSL_MINOR_VERSION_1 1
161 #define MBEDTLS_SSL_MINOR_VERSION_2 2
162 #define MBEDTLS_SSL_MINOR_VERSION_3 3
164 #define MBEDTLS_SSL_TRANSPORT_STREAM 0
165 #define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1
167 #define MBEDTLS_SSL_MAX_HOST_NAME_LEN 255
168 #define MBEDTLS_SSL_MAX_ALPN_NAME_LEN 255
170 #define MBEDTLS_SSL_MAX_ALPN_LIST_LEN 65535
172 /* RFC 6066 section 4, see also mfl_code_to_length in ssl_tls.c
173  * NONE must be zero so that memset()ing structure to zero works */
174 #define MBEDTLS_SSL_MAX_FRAG_LEN_NONE 0
175 #define MBEDTLS_SSL_MAX_FRAG_LEN_512 1
176 #define MBEDTLS_SSL_MAX_FRAG_LEN_1024 2
177 #define MBEDTLS_SSL_MAX_FRAG_LEN_2048 3
178 #define MBEDTLS_SSL_MAX_FRAG_LEN_4096 4
179 #define MBEDTLS_SSL_MAX_FRAG_LEN_INVALID 5
181 #define MBEDTLS_SSL_IS_CLIENT 0
182 #define MBEDTLS_SSL_IS_SERVER 1
183 
184 #define MBEDTLS_SSL_IS_NOT_FALLBACK 0
185 #define MBEDTLS_SSL_IS_FALLBACK 1
186 
187 #define MBEDTLS_SSL_EXTENDED_MS_DISABLED 0
188 #define MBEDTLS_SSL_EXTENDED_MS_ENABLED 1
189 
190 #define MBEDTLS_SSL_ETM_DISABLED 0
191 #define MBEDTLS_SSL_ETM_ENABLED 1
192 
193 #define MBEDTLS_SSL_COMPRESS_NULL 0
194 #define MBEDTLS_SSL_COMPRESS_DEFLATE 1
195 
196 #define MBEDTLS_SSL_VERIFY_NONE 0
197 #define MBEDTLS_SSL_VERIFY_OPTIONAL 1
198 #define MBEDTLS_SSL_VERIFY_REQUIRED 2
199 #define MBEDTLS_SSL_VERIFY_UNSET 3 /* Used only for sni_authmode */
200 
201 #define MBEDTLS_SSL_LEGACY_RENEGOTIATION 0
202 #define MBEDTLS_SSL_SECURE_RENEGOTIATION 1
203 
204 #define MBEDTLS_SSL_RENEGOTIATION_DISABLED 0
205 #define MBEDTLS_SSL_RENEGOTIATION_ENABLED 1
206 
207 #define MBEDTLS_SSL_ANTI_REPLAY_DISABLED 0
208 #define MBEDTLS_SSL_ANTI_REPLAY_ENABLED 1
209 
210 #define MBEDTLS_SSL_RENEGOTIATION_NOT_ENFORCED -1
211 #define MBEDTLS_SSL_RENEGO_MAX_RECORDS_DEFAULT 16
212 
213 #define MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION 0
214 #define MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION 1
215 #define MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE 2
216 
217 #define MBEDTLS_SSL_TRUNC_HMAC_DISABLED 0
218 #define MBEDTLS_SSL_TRUNC_HMAC_ENABLED 1
219 #define MBEDTLS_SSL_TRUNCATED_HMAC_LEN 10 /* 80 bits, rfc 6066 section 7 */
220 
221 #define MBEDTLS_SSL_SESSION_TICKETS_DISABLED 0
222 #define MBEDTLS_SSL_SESSION_TICKETS_ENABLED 1
223 
224 #define MBEDTLS_SSL_CBC_RECORD_SPLITTING_DISABLED 0
225 #define MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED 1
226 
227 #define MBEDTLS_SSL_ARC4_ENABLED 0
228 #define MBEDTLS_SSL_ARC4_DISABLED 1
229 
230 #define MBEDTLS_SSL_PRESET_DEFAULT 0
231 #define MBEDTLS_SSL_PRESET_SUITEB 2
232 
233 #define MBEDTLS_SSL_CERT_REQ_CA_LIST_ENABLED 1
234 #define MBEDTLS_SSL_CERT_REQ_CA_LIST_DISABLED 0
235 
236 /*
237  * Default range for DTLS retransmission timer value, in milliseconds.
238  * RFC 6347 4.2.4.1 says from 1 second to 60 seconds.
239  */
240 #define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MIN 1000
241 #define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MAX 60000
242 
251 #if !defined(MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME)
252 #define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400
253 #endif
254 
255 /*
256  * Maximum fragment length in bytes,
257  * determines the size of each of the two internal I/O buffers.
258  *
259  * Note: the RFC defines the default size of SSL / TLS messages. If you
260  * change the value here, other clients / servers may not be able to
261  * communicate with you anymore. Only change this value if you control
262  * both sides of the connection and have it reduced at both sides, or
263  * if you're using the Max Fragment Length extension and you know all your
264  * peers are using it too!
265  */
266 #if !defined(MBEDTLS_SSL_MAX_CONTENT_LEN)
267 #define MBEDTLS_SSL_MAX_CONTENT_LEN 16384
268 #endif
269 
270 #if !defined(MBEDTLS_SSL_IN_CONTENT_LEN)
271 #define MBEDTLS_SSL_IN_CONTENT_LEN MBEDTLS_SSL_MAX_CONTENT_LEN
272 #endif
273 
274 #if !defined(MBEDTLS_SSL_OUT_CONTENT_LEN)
275 #define MBEDTLS_SSL_OUT_CONTENT_LEN MBEDTLS_SSL_MAX_CONTENT_LEN
276 #endif
277 
278 /*
279  * Maximum number of heap-allocated bytes for the purpose of
280  * DTLS handshake message reassembly and future message buffering.
281  */
282 #if !defined(MBEDTLS_SSL_DTLS_MAX_BUFFERING)
283 #define MBEDTLS_SSL_DTLS_MAX_BUFFERING 32768
284 #endif
285 
286 /* \} name SECTION: Module settings */
287 
288 /*
289  * Length of the verify data for secure renegotiation
290  */
291 #if defined(MBEDTLS_SSL_PROTO_SSL3)
292 #define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 36
293 #else
294 #define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 12
295 #endif
296 
297 /*
298  * Signaling ciphersuite values (SCSV)
299  */
300 #define MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO 0xFF
301 #define MBEDTLS_SSL_FALLBACK_SCSV_VALUE 0x5600
303 /*
304  * Supported Signature and Hash algorithms (For TLS 1.2)
305  * RFC 5246 section 7.4.1.4.1
306  */
307 #define MBEDTLS_SSL_HASH_NONE 0
308 #define MBEDTLS_SSL_HASH_MD5 1
309 #define MBEDTLS_SSL_HASH_SHA1 2
310 #define MBEDTLS_SSL_HASH_SHA224 3
311 #define MBEDTLS_SSL_HASH_SHA256 4
312 #define MBEDTLS_SSL_HASH_SHA384 5
313 #define MBEDTLS_SSL_HASH_SHA512 6
314 
315 #define MBEDTLS_SSL_SIG_ANON 0
316 #define MBEDTLS_SSL_SIG_RSA 1
317 #define MBEDTLS_SSL_SIG_ECDSA 3
318 
319 /*
320  * Client Certificate Types
321  * RFC 5246 section 7.4.4 plus RFC 4492 section 5.5
322  */
323 #define MBEDTLS_SSL_CERT_TYPE_RSA_SIGN 1
324 #define MBEDTLS_SSL_CERT_TYPE_ECDSA_SIGN 64
325 
326 /*
327  * Message, alert and handshake types
328  */
329 #define MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC 20
330 #define MBEDTLS_SSL_MSG_ALERT 21
331 #define MBEDTLS_SSL_MSG_HANDSHAKE 22
332 #define MBEDTLS_SSL_MSG_APPLICATION_DATA 23
333 
334 #define MBEDTLS_SSL_ALERT_LEVEL_WARNING 1
335 #define MBEDTLS_SSL_ALERT_LEVEL_FATAL 2
336 
337 #define MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY 0 /* 0x00 */
338 #define MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE 10 /* 0x0A */
339 #define MBEDTLS_SSL_ALERT_MSG_BAD_RECORD_MAC 20 /* 0x14 */
340 #define MBEDTLS_SSL_ALERT_MSG_DECRYPTION_FAILED 21 /* 0x15 */
341 #define MBEDTLS_SSL_ALERT_MSG_RECORD_OVERFLOW 22 /* 0x16 */
342 #define MBEDTLS_SSL_ALERT_MSG_DECOMPRESSION_FAILURE 30 /* 0x1E */
343 #define MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE 40 /* 0x28 */
344 #define MBEDTLS_SSL_ALERT_MSG_NO_CERT 41 /* 0x29 */
345 #define MBEDTLS_SSL_ALERT_MSG_BAD_CERT 42 /* 0x2A */
346 #define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_CERT 43 /* 0x2B */
347 #define MBEDTLS_SSL_ALERT_MSG_CERT_REVOKED 44 /* 0x2C */
348 #define MBEDTLS_SSL_ALERT_MSG_CERT_EXPIRED 45 /* 0x2D */
349 #define MBEDTLS_SSL_ALERT_MSG_CERT_UNKNOWN 46 /* 0x2E */
350 #define MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER 47 /* 0x2F */
351 #define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_CA 48 /* 0x30 */
352 #define MBEDTLS_SSL_ALERT_MSG_ACCESS_DENIED 49 /* 0x31 */
353 #define MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR 50 /* 0x32 */
354 #define MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR 51 /* 0x33 */
355 #define MBEDTLS_SSL_ALERT_MSG_EXPORT_RESTRICTION 60 /* 0x3C */
356 #define MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION 70 /* 0x46 */
357 #define MBEDTLS_SSL_ALERT_MSG_INSUFFICIENT_SECURITY 71 /* 0x47 */
358 #define MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR 80 /* 0x50 */
359 #define MBEDTLS_SSL_ALERT_MSG_INAPROPRIATE_FALLBACK 86 /* 0x56 */
360 #define MBEDTLS_SSL_ALERT_MSG_USER_CANCELED 90 /* 0x5A */
361 #define MBEDTLS_SSL_ALERT_MSG_NO_RENEGOTIATION 100 /* 0x64 */
362 #define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT 110 /* 0x6E */
363 #define MBEDTLS_SSL_ALERT_MSG_UNRECOGNIZED_NAME 112 /* 0x70 */
364 #define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY 115 /* 0x73 */
365 #define MBEDTLS_SSL_ALERT_MSG_NO_APPLICATION_PROTOCOL 120 /* 0x78 */
366 
367 #define MBEDTLS_SSL_HS_HELLO_REQUEST 0
368 #define MBEDTLS_SSL_HS_CLIENT_HELLO 1
369 #define MBEDTLS_SSL_HS_SERVER_HELLO 2
370 #define MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST 3
371 #define MBEDTLS_SSL_HS_NEW_SESSION_TICKET 4
372 #define MBEDTLS_SSL_HS_CERTIFICATE 11
373 #define MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE 12
374 #define MBEDTLS_SSL_HS_CERTIFICATE_REQUEST 13
375 #define MBEDTLS_SSL_HS_SERVER_HELLO_DONE 14
376 #define MBEDTLS_SSL_HS_CERTIFICATE_VERIFY 15
377 #define MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE 16
378 #define MBEDTLS_SSL_HS_FINISHED 20
379 
380 /*
381  * TLS extensions
382  */
383 #define MBEDTLS_TLS_EXT_SERVERNAME 0
384 #define MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME 0
385 
386 #define MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH 1
387 
388 #define MBEDTLS_TLS_EXT_TRUNCATED_HMAC 4
389 
390 #define MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES 10
391 #define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS 11
392 
393 #define MBEDTLS_TLS_EXT_SIG_ALG 13
394 
395 #define MBEDTLS_TLS_EXT_ALPN 16
396 
397 #define MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC 22 /* 0x16 */
398 #define MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET 0x0017 /* 23 */
399 
400 #define MBEDTLS_TLS_EXT_SESSION_TICKET 35
401 
402 #define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 256 /* experimental */
403 
404 #define MBEDTLS_TLS_EXT_RENEGOTIATION_INFO 0xFF01
405 
406 /*
407  * Size defines
408  */
409 #if !defined(MBEDTLS_PSK_MAX_LEN)
410 #define MBEDTLS_PSK_MAX_LEN 32 /* 256 bits */
411 #endif
412 
413 /* Dummy type used only for its size */
415 {
416 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
417  unsigned char _pms_rsa[48]; /* RFC 5246 8.1.1 */
418 #endif
419 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)
420  unsigned char _pms_dhm[MBEDTLS_MPI_MAX_SIZE]; /* RFC 5246 8.1.2 */
421 #endif
422 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
423  defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
424  defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
425  defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
426  unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]; /* RFC 4492 5.10 */
427 #endif
428 #if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
429  unsigned char _pms_psk[4 + 2 * MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 2 */
430 #endif
431 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
433  + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 3 */
434 #endif
435 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)
436  unsigned char _pms_rsa_psk[52 + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 4 */
437 #endif
438 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
440  + MBEDTLS_PSK_MAX_LEN]; /* RFC 5489 2 */
441 #endif
442 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
443  unsigned char _pms_ecjpake[32]; /* Thread spec: SHA-256 output */
444 #endif
445 };
446 
447 #define MBEDTLS_PREMASTER_SIZE sizeof( union mbedtls_ssl_premaster_secret )
448 
449 #ifdef __cplusplus
450 extern "C" {
451 #endif
452 
453 /*
454  * SSL state machine
455  */
456 typedef enum
457 {
477 }
479 
497 typedef int mbedtls_ssl_send_t( void *ctx,
498  const unsigned char *buf,
499  size_t len );
500 
520 typedef int mbedtls_ssl_recv_t( void *ctx,
521  unsigned char *buf,
522  size_t len );
523 
546 typedef int mbedtls_ssl_recv_timeout_t( void *ctx,
547  unsigned char *buf,
548  size_t len,
549  uint32_t timeout );
572 typedef void mbedtls_ssl_set_timer_t( void * ctx,
573  uint32_t int_ms,
574  uint32_t fin_ms );
575 
587 typedef int mbedtls_ssl_get_timer_t( void * ctx );
588 
589 /* Defined below */
593 
594 /* Defined in ssl_internal.h */
598 #if defined(MBEDTLS_X509_CRT_PARSE_C)
600 #endif
601 #if defined(MBEDTLS_SSL_PROTO_DTLS)
603 #endif
604 
605 #if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
606 #if defined(MBEDTLS_X509_CRT_PARSE_C)
607 
678 typedef int mbedtls_ssl_async_sign_t( mbedtls_ssl_context *ssl,
679  mbedtls_x509_crt *cert,
680  mbedtls_md_type_t md_alg,
681  const unsigned char *hash,
682  size_t hash_len );
683 
744 typedef int mbedtls_ssl_async_decrypt_t( mbedtls_ssl_context *ssl,
745  mbedtls_x509_crt *cert,
746  const unsigned char *input,
747  size_t input_len );
748 #endif /* MBEDTLS_X509_CRT_PARSE_C */
749 
792 typedef int mbedtls_ssl_async_resume_t( mbedtls_ssl_context *ssl,
793  unsigned char *output,
794  size_t *output_len,
795  size_t output_size );
796 
814 typedef void mbedtls_ssl_async_cancel_t( mbedtls_ssl_context *ssl );
815 #endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
816 
817 /*
818  * This structure is used for storing current session data.
819  */
821 {
822 #if defined(MBEDTLS_HAVE_TIME)
824 #endif
827  size_t id_len;
828  unsigned char id[32];
829  unsigned char master[48];
831 #if defined(MBEDTLS_X509_CRT_PARSE_C)
833 #endif /* MBEDTLS_X509_CRT_PARSE_C */
834  uint32_t verify_result;
836 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
837  unsigned char *ticket;
838  size_t ticket_len;
839  uint32_t ticket_lifetime;
840 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
841 
842 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
843  unsigned char mfl_code;
844 #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
845 
846 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
848 #endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
849 
850 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
852 #endif
853 };
854 
859 {
860  /* Group items by size (largest first) to minimize padding overhead */
861 
862  /*
863  * Pointers
864  */
865 
866  const int *ciphersuite_list[4];
869  void (*f_dbg)(void *, int, const char *, int, const char *);
870  void *p_dbg;
873  int (*f_rng)(void *, unsigned char *, size_t);
874  void *p_rng;
877  int (*f_get_cache)(void *, mbedtls_ssl_session *);
879  int (*f_set_cache)(void *, const mbedtls_ssl_session *);
880  void *p_cache;
882 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
883 
884  int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
885  void *p_sni;
886 #endif
887 
888 #if defined(MBEDTLS_X509_CRT_PARSE_C)
889 
890  int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *);
891  void *p_vrfy;
892 #endif
893 
894 #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
895 
896  int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
897  void *p_psk;
898 #endif
899 
900 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
901 
902  int (*f_cookie_write)( void *, unsigned char **, unsigned char *,
903  const unsigned char *, size_t );
905  int (*f_cookie_check)( void *, const unsigned char *, size_t,
906  const unsigned char *, size_t );
907  void *p_cookie;
908 #endif
909 
910 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
911 
912  int (*f_ticket_write)( void *, const mbedtls_ssl_session *,
913  unsigned char *, const unsigned char *, size_t *, uint32_t * );
915  int (*f_ticket_parse)( void *, mbedtls_ssl_session *, unsigned char *, size_t);
916  void *p_ticket;
917 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */
918 
919 #if defined(MBEDTLS_SSL_EXPORT_KEYS)
920 
921  int (*f_export_keys)( void *, const unsigned char *,
922  const unsigned char *, size_t, size_t, size_t );
924 #endif
925 
926 #if defined(MBEDTLS_X509_CRT_PARSE_C)
931 #endif /* MBEDTLS_X509_CRT_PARSE_C */
932 
933 #if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
934 #if defined(MBEDTLS_X509_CRT_PARSE_C)
935  mbedtls_ssl_async_sign_t *f_async_sign_start;
936  mbedtls_ssl_async_decrypt_t *f_async_decrypt_start;
937 #endif /* MBEDTLS_X509_CRT_PARSE_C */
938  mbedtls_ssl_async_resume_t *f_async_resume;
939  mbedtls_ssl_async_cancel_t *f_async_cancel;
940  void *p_async_config_data;
941 #endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
942 
943 #if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED)
944  const int *sig_hashes;
945 #endif
946 
947 #if defined(MBEDTLS_ECP_C)
949 #endif
950 
951 #if defined(MBEDTLS_DHM_C)
954 #endif
955 
956 #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
957  unsigned char *psk;
960  size_t psk_len;
963  unsigned char *psk_identity;
969 #endif
970 
971 #if defined(MBEDTLS_SSL_ALPN)
972  const char **alpn_list;
973 #endif
974 
975  /*
976  * Numerical settings (int then char)
977  */
978 
979  uint32_t read_timeout;
981 #if defined(MBEDTLS_SSL_PROTO_DTLS)
982  uint32_t hs_timeout_min;
984  uint32_t hs_timeout_max;
986 #endif
987 
988 #if defined(MBEDTLS_SSL_RENEGOTIATION)
990  unsigned char renego_period[8];
992 #endif
993 
994 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
995  unsigned int badmac_limit;
996 #endif
997 
998 #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
999  unsigned int dhm_min_bitlen;
1000 #endif
1001 
1002  unsigned char max_major_ver;
1003  unsigned char max_minor_ver;
1004  unsigned char min_major_ver;
1005  unsigned char min_minor_ver;
1007  /*
1008  * Flags (bitfields)
1009  */
1010 
1011  unsigned int endpoint : 1;
1012  unsigned int transport : 1;
1013  unsigned int authmode : 2;
1014  /* needed even with renego disabled for LEGACY_BREAK_HANDSHAKE */
1015  unsigned int allow_legacy_renegotiation : 2 ;
1016 #if defined(MBEDTLS_ARC4_C)
1017  unsigned int arc4_disabled : 1;
1018 #endif
1019 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
1020  unsigned int mfl_code : 3;
1021 #endif
1022 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
1023  unsigned int encrypt_then_mac : 1 ;
1024 #endif
1025 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
1026  unsigned int extended_ms : 1;
1027 #endif
1028 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
1029  unsigned int anti_replay : 1;
1030 #endif
1031 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
1032  unsigned int cbc_record_splitting : 1;
1033 #endif
1034 #if defined(MBEDTLS_SSL_RENEGOTIATION)
1035  unsigned int disable_renegotiation : 1;
1036 #endif
1037 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
1038  unsigned int trunc_hmac : 1;
1039 #endif
1040 #if defined(MBEDTLS_SSL_SESSION_TICKETS)
1041  unsigned int session_tickets : 1;
1042 #endif
1043 #if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)
1044  unsigned int fallback : 1;
1045 #endif
1046 #if defined(MBEDTLS_SSL_SRV_C)
1047  unsigned int cert_req_ca_list : 1;
1049 #endif
1050 };
1051 
1052 
1054 {
1057  /*
1058  * Miscellaneous
1059  */
1060  int state;
1061 #if defined(MBEDTLS_SSL_RENEGOTIATION)
1066 #endif /* MBEDTLS_SSL_RENEGOTIATION */
1067 
1071 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
1072  unsigned badmac_seen;
1073 #endif /* MBEDTLS_SSL_DTLS_BADMAC_LIMIT */
1074 
1080  void *p_bio;
1082  /*
1083  * Session layer
1084  */
1093  /*
1094  * Record layer transformations
1095  */
1101  /*
1102  * Timers
1103  */
1104  void *p_timer;
1109  /*
1110  * Record layer (incoming data)
1111  */
1112  unsigned char *in_buf;
1113  unsigned char *in_ctr;
1116  unsigned char *in_hdr;
1117  unsigned char *in_len;
1118  unsigned char *in_iv;
1119  unsigned char *in_msg;
1120  unsigned char *in_offt;
1123  size_t in_msglen;
1124  size_t in_left;
1125 #if defined(MBEDTLS_SSL_PROTO_DTLS)
1126  uint16_t in_epoch;
1129 #endif /* MBEDTLS_SSL_PROTO_DTLS */
1130 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
1131  uint64_t in_window_top;
1132  uint64_t in_window;
1133 #endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */
1134 
1135  size_t in_hslen;
1137  int nb_zero;
1142 #if defined(MBEDTLS_SSL_PROTO_DTLS)
1145 #endif /* MBEDTLS_SSL_PROTO_DTLS */
1146 
1147  /*
1148  * Record layer (outgoing data)
1149  */
1150  unsigned char *out_buf;
1151  unsigned char *out_ctr;
1152  unsigned char *out_hdr;
1153  unsigned char *out_len;
1154  unsigned char *out_iv;
1155  unsigned char *out_msg;
1158  size_t out_msglen;
1159  size_t out_left;
1161  unsigned char cur_out_ctr[8];
1163 #if defined(MBEDTLS_SSL_PROTO_DTLS)
1164  uint16_t mtu;
1165 #endif /* MBEDTLS_SSL_PROTO_DTLS */
1166 
1167 #if defined(MBEDTLS_ZLIB_SUPPORT)
1168  unsigned char *compress_buf;
1169 #endif /* MBEDTLS_ZLIB_SUPPORT */
1170 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
1171  signed char split_done;
1172 #endif /* MBEDTLS_SSL_CBC_RECORD_SPLITTING */
1173 
1174  /*
1175  * PKI layer
1176  */
1179  /*
1180  * User settings
1181  */
1182 #if defined(MBEDTLS_X509_CRT_PARSE_C)
1183  char *hostname;
1185 #endif /* MBEDTLS_X509_CRT_PARSE_C */
1186 
1187 #if defined(MBEDTLS_SSL_ALPN)
1188  const char *alpn_chosen;
1189 #endif /* MBEDTLS_SSL_ALPN */
1190 
1191  /*
1192  * Information for DTLS hello verify
1193  */
1194 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
1195  unsigned char *cli_id;
1196  size_t cli_id_len;
1197 #endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY && MBEDTLS_SSL_SRV_C */
1198 
1199  /*
1200  * Secure renegotiation
1201  */
1202  /* needed to know when to send extension on server */
1205 #if defined(MBEDTLS_SSL_RENEGOTIATION)
1209 #endif /* MBEDTLS_SSL_RENEGOTIATION */
1210 };
1211 
1212 #if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
1213 
1214 #define MBEDTLS_SSL_CHANNEL_OUTBOUND 0
1215 #define MBEDTLS_SSL_CHANNEL_INBOUND 1
1216 
1217 extern int (*mbedtls_ssl_hw_record_init)(mbedtls_ssl_context *ssl,
1218  const unsigned char *key_enc, const unsigned char *key_dec,
1219  size_t keylen,
1220  const unsigned char *iv_enc, const unsigned char *iv_dec,
1221  size_t ivlen,
1222  const unsigned char *mac_enc, const unsigned char *mac_dec,
1223  size_t maclen);
1224 extern int (*mbedtls_ssl_hw_record_activate)(mbedtls_ssl_context *ssl, int direction);
1225 extern int (*mbedtls_ssl_hw_record_reset)(mbedtls_ssl_context *ssl);
1226 extern int (*mbedtls_ssl_hw_record_write)(mbedtls_ssl_context *ssl);
1227 extern int (*mbedtls_ssl_hw_record_read)(mbedtls_ssl_context *ssl);
1228 extern int (*mbedtls_ssl_hw_record_finish)(mbedtls_ssl_context *ssl);
1229 #endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
1230 
1239 const char *mbedtls_ssl_get_ciphersuite_name( const int ciphersuite_id );
1240 
1249 int mbedtls_ssl_get_ciphersuite_id( const char *ciphersuite_name );
1250 
1259 
1281  const mbedtls_ssl_config *conf );
1282 
1294 
1301 void mbedtls_ssl_conf_endpoint( mbedtls_ssl_config *conf, int endpoint );
1302 
1317 void mbedtls_ssl_conf_transport( mbedtls_ssl_config *conf, int transport );
1318 
1345 void mbedtls_ssl_conf_authmode( mbedtls_ssl_config *conf, int authmode );
1346 
1347 #if defined(MBEDTLS_X509_CRT_PARSE_C)
1348 
1360  int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
1361  void *p_vrfy );
1362 #endif /* MBEDTLS_X509_CRT_PARSE_C */
1363 
1372  int (*f_rng)(void *, unsigned char *, size_t),
1373  void *p_rng );
1374 
1390  void (*f_dbg)(void *, int, const char *, int, const char *),
1391  void *p_dbg );
1392 
1424  void *p_bio,
1425  mbedtls_ssl_send_t *f_send,
1426  mbedtls_ssl_recv_t *f_recv,
1427  mbedtls_ssl_recv_timeout_t *f_recv_timeout );
1428 
1429 #if defined(MBEDTLS_SSL_PROTO_DTLS)
1430 
1472 void mbedtls_ssl_set_mtu( mbedtls_ssl_context *ssl, uint16_t mtu );
1473 #endif /* MBEDTLS_SSL_PROTO_DTLS */
1474 
1491 void mbedtls_ssl_conf_read_timeout( mbedtls_ssl_config *conf, uint32_t timeout );
1492 
1514  void *p_timer,
1515  mbedtls_ssl_set_timer_t *f_set_timer,
1516  mbedtls_ssl_get_timer_t *f_get_timer );
1517 
1537 typedef int mbedtls_ssl_ticket_write_t( void *p_ticket,
1538  const mbedtls_ssl_session *session,
1539  unsigned char *start,
1540  const unsigned char *end,
1541  size_t *tlen,
1542  uint32_t *lifetime );
1543 
1544 #if defined(MBEDTLS_SSL_EXPORT_KEYS)
1545 
1565 typedef int mbedtls_ssl_export_keys_t( void *p_expkey,
1566  const unsigned char *ms,
1567  const unsigned char *kb,
1568  size_t maclen,
1569  size_t keylen,
1570  size_t ivlen );
1571 #endif /* MBEDTLS_SSL_EXPORT_KEYS */
1572 
1596 typedef int mbedtls_ssl_ticket_parse_t( void *p_ticket,
1597  mbedtls_ssl_session *session,
1598  unsigned char *buf,
1599  size_t len );
1600 
1601 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
1602 
1617  mbedtls_ssl_ticket_write_t *f_ticket_write,
1618  mbedtls_ssl_ticket_parse_t *f_ticket_parse,
1619  void *p_ticket );
1620 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */
1621 
1622 #if defined(MBEDTLS_SSL_EXPORT_KEYS)
1623 
1634  mbedtls_ssl_export_keys_t *f_export_keys,
1635  void *p_export_keys );
1636 #endif /* MBEDTLS_SSL_EXPORT_KEYS */
1637 
1638 #if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
1639 
1669 void mbedtls_ssl_conf_async_private_cb( mbedtls_ssl_config *conf,
1670  mbedtls_ssl_async_sign_t *f_async_sign,
1671  mbedtls_ssl_async_decrypt_t *f_async_decrypt,
1672  mbedtls_ssl_async_resume_t *f_async_resume,
1673  mbedtls_ssl_async_cancel_t *f_async_cancel,
1674  void *config_data );
1675 
1684 void *mbedtls_ssl_conf_get_async_config_data( const mbedtls_ssl_config *conf );
1685 
1700 void *mbedtls_ssl_get_async_operation_data( const mbedtls_ssl_context *ssl );
1701 
1713 void mbedtls_ssl_set_async_operation_data( mbedtls_ssl_context *ssl,
1714  void *ctx );
1715 #endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
1716 
1731 typedef int mbedtls_ssl_cookie_write_t( void *ctx,
1732  unsigned char **p, unsigned char *end,
1733  const unsigned char *info, size_t ilen );
1734 
1748 typedef int mbedtls_ssl_cookie_check_t( void *ctx,
1749  const unsigned char *cookie, size_t clen,
1750  const unsigned char *info, size_t ilen );
1751 
1752 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
1753 
1782  mbedtls_ssl_cookie_write_t *f_cookie_write,
1783  mbedtls_ssl_cookie_check_t *f_cookie_check,
1784  void *p_cookie );
1785 
1806  const unsigned char *info,
1807  size_t ilen );
1808 
1809 #endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY && MBEDTLS_SSL_SRV_C */
1810 
1811 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
1812 
1828 #endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */
1829 
1830 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
1831 
1855 #endif /* MBEDTLS_SSL_DTLS_BADMAC_LIMIT */
1856 
1857 #if defined(MBEDTLS_SSL_PROTO_DTLS)
1858 
1888  unsigned allow_packing );
1889 
1921 void mbedtls_ssl_conf_handshake_timeout( mbedtls_ssl_config *conf, uint32_t min, uint32_t max );
1922 #endif /* MBEDTLS_SSL_PROTO_DTLS */
1923 
1924 #if defined(MBEDTLS_SSL_SRV_C)
1925 
1963  void *p_cache,
1964  int (*f_get_cache)(void *, mbedtls_ssl_session *),
1965  int (*f_set_cache)(void *, const mbedtls_ssl_session *) );
1966 #endif /* MBEDTLS_SSL_SRV_C */
1967 
1968 #if defined(MBEDTLS_SSL_CLI_C)
1969 
1984 #endif /* MBEDTLS_SSL_CLI_C */
1985 
2002  const int *ciphersuites );
2003 
2024  const int *ciphersuites,
2025  int major, int minor );
2026 
2027 #if defined(MBEDTLS_X509_CRT_PARSE_C)
2028 
2039  const mbedtls_x509_crt_profile *profile );
2040 
2053  mbedtls_x509_crt *ca_chain,
2054  mbedtls_x509_crl *ca_crl );
2055 
2093  mbedtls_x509_crt *own_cert,
2094  mbedtls_pk_context *pk_key );
2095 #endif /* MBEDTLS_X509_CRT_PARSE_C */
2096 
2097 #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
2098 
2119  const unsigned char *psk, size_t psk_len,
2120  const unsigned char *psk_identity, size_t psk_identity_len );
2121 
2122 
2136  const unsigned char *psk, size_t psk_len );
2137 
2163  int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *,
2164  size_t),
2165  void *p_psk );
2166 #endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */
2167 
2168 #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_SRV_C)
2169 
2170 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
2171 
2172 #if defined(MBEDTLS_DEPRECATED_WARNING)
2173 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
2174 #else
2175 #define MBEDTLS_DEPRECATED
2176 #endif
2177 
2192  const char *dhm_P,
2193  const char *dhm_G );
2194 
2195 #endif /* MBEDTLS_DEPRECATED_REMOVED */
2196 
2211  const unsigned char *dhm_P, size_t P_len,
2212  const unsigned char *dhm_G, size_t G_len );
2213 
2224 #endif /* MBEDTLS_DHM_C && defined(MBEDTLS_SSL_SRV_C) */
2225 
2226 #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
2227 
2236  unsigned int bitlen );
2237 #endif /* MBEDTLS_DHM_C && MBEDTLS_SSL_CLI_C */
2238 
2239 #if defined(MBEDTLS_ECP_C)
2240 
2268  const mbedtls_ecp_group_id *curves );
2269 #endif /* MBEDTLS_ECP_C */
2270 
2271 #if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED)
2272 
2291  const int *hashes );
2292 #endif /* MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED */
2293 
2294 #if defined(MBEDTLS_X509_CRT_PARSE_C)
2295 
2313 int mbedtls_ssl_set_hostname( mbedtls_ssl_context *ssl, const char *hostname );
2314 #endif /* MBEDTLS_X509_CRT_PARSE_C */
2315 
2316 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
2317 
2330  mbedtls_x509_crt *own_cert,
2331  mbedtls_pk_context *pk_key );
2332 
2345  mbedtls_x509_crt *ca_chain,
2346  mbedtls_x509_crl *ca_crl );
2347 
2359  int authmode );
2360 
2385  int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *,
2386  size_t),
2387  void *p_sni );
2388 #endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
2389 
2390 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
2391 
2408 int mbedtls_ssl_set_hs_ecjpake_password( mbedtls_ssl_context *ssl,
2409  const unsigned char *pw,
2410  size_t pw_len );
2411 #endif /*MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
2412 
2413 #if defined(MBEDTLS_SSL_ALPN)
2414 
2426 int mbedtls_ssl_conf_alpn_protocols( mbedtls_ssl_config *conf, const char **protos );
2427 
2438 #endif /* MBEDTLS_SSL_ALPN */
2439 
2456 void mbedtls_ssl_conf_max_version( mbedtls_ssl_config *conf, int major, int minor );
2457 
2476 void mbedtls_ssl_conf_min_version( mbedtls_ssl_config *conf, int major, int minor );
2477 
2478 #if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)
2479 
2498 void mbedtls_ssl_conf_fallback( mbedtls_ssl_config *conf, char fallback );
2499 #endif /* MBEDTLS_SSL_FALLBACK_SCSV && MBEDTLS_SSL_CLI_C */
2500 
2501 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
2502 
2514 #endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */
2515 
2516 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
2517 
2529 #endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */
2530 
2531 #if defined(MBEDTLS_ARC4_C)
2532 
2548 #endif /* MBEDTLS_ARC4_C */
2549 
2550 #if defined(MBEDTLS_SSL_SRV_C)
2551 
2561  char cert_req_ca_list );
2562 #endif /* MBEDTLS_SSL_SRV_C */
2563 
2564 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
2565 
2599 int mbedtls_ssl_conf_max_frag_len( mbedtls_ssl_config *conf, unsigned char mfl_code );
2600 #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
2601 
2602 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
2603 
2612 #endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
2613 
2614 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
2615 
2627 #endif /* MBEDTLS_SSL_CBC_RECORD_SPLITTING */
2628 
2629 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
2630 
2641 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
2642 
2643 #if defined(MBEDTLS_SSL_RENEGOTIATION)
2644 
2661 void mbedtls_ssl_conf_renegotiation( mbedtls_ssl_config *conf, int renegotiation );
2662 #endif /* MBEDTLS_SSL_RENEGOTIATION */
2663 
2692 
2693 #if defined(MBEDTLS_SSL_RENEGOTIATION)
2694 
2732 
2759  const unsigned char period[8] );
2760 #endif /* MBEDTLS_SSL_RENEGOTIATION */
2761 
2801 
2818 
2832 
2841 
2850 
2865 
2866 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
2867 
2880 #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
2881 
2909 
2910 #if defined(MBEDTLS_X509_CRT_PARSE_C)
2911 
2926 #endif /* MBEDTLS_X509_CRT_PARSE_C */
2927 
2928 #if defined(MBEDTLS_SSL_CLI_C)
2929 
2956 #endif /* MBEDTLS_SSL_CLI_C */
2957 
3009 
3031 
3032 #if defined(MBEDTLS_SSL_RENEGOTIATION)
3033 
3057 #endif /* MBEDTLS_SSL_RENEGOTIATION */
3058 
3129 int mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len );
3130 
3191 int mbedtls_ssl_write( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len );
3192 
3210  unsigned char level,
3211  unsigned char message );
3226 
3233 
3245 
3262  int endpoint, int transport, int preset );
3263 
3270 
3277 
3288 
3289 #ifdef __cplusplus
3290 }
3291 #endif
3292 
3293 #endif /* ssl.h */
mbedtls_ssl_config::dhm_min_bitlen
unsigned int dhm_min_bitlen
Definition: ssl.h:999
mbedtls_ssl_premaster_secret::_pms_dhm
unsigned char _pms_dhm[MBEDTLS_MPI_MAX_SIZE]
Definition: ssl.h:420
mbedtls_ssl_set_mtu
void mbedtls_ssl_set_mtu(mbedtls_ssl_context *ssl, uint16_t mtu)
Set the Maximum Tranport Unit (MTU). Special value: 0 means unset (no limit). This represents the max...
mbedtls_ssl_context::out_iv
unsigned char * out_iv
Definition: ssl.h:1154
mbedtls_ssl_states
mbedtls_ssl_states
Definition: ssl.h:457
mbedtls_ssl_conf_dh_param_bin
int mbedtls_ssl_conf_dh_param_bin(mbedtls_ssl_config *conf, const unsigned char *dhm_P, size_t P_len, const unsigned char *dhm_G, size_t G_len)
Set the Diffie-Hellman public P and G values from big-endian binary presentations....
MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT
@ MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT
Definition: ssl.h:476
MBEDTLS_SSL_FLUSH_BUFFERS
@ MBEDTLS_SSL_FLUSH_BUFFERS
Definition: ssl.h:472
MBEDTLS_SSL_HANDSHAKE_WRAPUP
@ MBEDTLS_SSL_HANDSHAKE_WRAPUP
Definition: ssl.h:473
mbedtls_ssl_context::out_len
unsigned char * out_len
Definition: ssl.h:1153
mbedtls_ssl_key_cert
struct mbedtls_ssl_key_cert mbedtls_ssl_key_cert
Definition: ssl.h:599
mbedtls_ssl_context::state
int state
Definition: ssl.h:1060
mbedtls_ssl_conf_legacy_renegotiation
void mbedtls_ssl_conf_legacy_renegotiation(mbedtls_ssl_config *conf, int allow_legacy)
Prevent or allow legacy renegotiation. (Default: MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION)
mbedtls_ssl_config::p_cache
void * p_cache
Definition: ssl.h:880
mbedtls_ssl_session::ciphersuite
int ciphersuite
Definition: ssl.h:825
mbedtls_ssl_config::p_vrfy
void * p_vrfy
Definition: ssl.h:891
mbedtls_ssl_session::master
unsigned char master[48]
Definition: ssl.h:829
mbedtls_md_type_t
mbedtls_md_type_t
Supported message digests.
Definition: md.h:85
mbedtls_ssl_get_ciphersuite
const char * mbedtls_ssl_get_ciphersuite(const mbedtls_ssl_context *ssl)
Return the name of the current ciphersuite.
mbedtls_ssl_conf_own_cert
int mbedtls_ssl_conf_own_cert(mbedtls_ssl_config *conf, mbedtls_x509_crt *own_cert, mbedtls_pk_context *pk_key)
Set own certificate chain and private key.
mbedtls_ssl_session::ticket_len
size_t ticket_len
Definition: ssl.h:838
ecp.h
This file provides an API for Elliptic Curves over GF(P) (ECP).
mbedtls_ssl_config::p_psk
void * p_psk
Definition: ssl.h:897
mbedtls_ssl_ticket_write_t
int mbedtls_ssl_ticket_write_t(void *p_ticket, const mbedtls_ssl_session *session, unsigned char *start, const unsigned char *end, size_t *tlen, uint32_t *lifetime)
Callback type: generate and write session ticket.
Definition: ssl.h:1537
mbedtls_ssl_context::f_set_timer
mbedtls_ssl_set_timer_t * f_set_timer
Definition: ssl.h:1106
mbedtls_ssl_context::in_hslen
size_t in_hslen
Definition: ssl.h:1135
MBEDTLS_SSL_SERVER_HELLO
@ MBEDTLS_SSL_SERVER_HELLO
Definition: ssl.h:460
mbedtls_ssl_flight_item
struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item
Definition: ssl.h:602
MBEDTLS_SSL_VERIFY_DATA_MAX_LEN
#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN
Definition: ssl.h:294
mbedtls_ssl_premaster_secret
Definition: ssl.h:415
mbedtls_ssl_context::next_record_offset
size_t next_record_offset
Definition: ssl.h:1127
mbedtls_ssl_session::trunc_hmac
int trunc_hmac
Definition: ssl.h:847
MBEDTLS_SSL_SERVER_CERTIFICATE
@ MBEDTLS_SSL_SERVER_CERTIFICATE
Definition: ssl.h:461
mbedtls_ssl_config::max_major_ver
unsigned char max_major_ver
Definition: ssl.h:1002
mbedtls_mpi
MPI structure.
Definition: bignum.h:213
x509_crl.h
X.509 certificate revocation list parsing.
mbedtls_ssl_config::read_timeout
uint32_t read_timeout
Definition: ssl.h:979
mbedtls_ssl_recv_t
int mbedtls_ssl_recv_t(void *ctx, unsigned char *buf, size_t len)
Callback type: receive data from the network.
Definition: ssl.h:520
mbedtls_ssl_context::in_epoch
uint16_t in_epoch
Definition: ssl.h:1126
MBEDTLS_SSL_CLIENT_CERTIFICATE
@ MBEDTLS_SSL_CLIENT_CERTIFICATE
Definition: ssl.h:465
mbedtls_ssl_context::transform
mbedtls_ssl_transform * transform
Definition: ssl.h:1098
mbedtls_ssl_conf_renegotiation_enforced
void mbedtls_ssl_conf_renegotiation_enforced(mbedtls_ssl_config *conf, int max_records)
Enforce renegotiation requests. (Default: enforced, max_records = 16)
mbedtls_ssl_session::compression
int compression
Definition: ssl.h:826
mbedtls_ssl_conf_ciphersuites
void mbedtls_ssl_conf_ciphersuites(mbedtls_ssl_config *conf, const int *ciphersuites)
Set the list of allowed ciphersuites and the preference order. First in the list has the highest pref...
mbedtls_ssl_config::cert_profile
const mbedtls_x509_crt_profile * cert_profile
Definition: ssl.h:927
mbedtls_ssl_context::session_out
mbedtls_ssl_session * session_out
Definition: ssl.h:1086
mbedtls_ssl_context::f_send
mbedtls_ssl_send_t * f_send
Definition: ssl.h:1075
mbedtls_ssl_conf_verify
void mbedtls_ssl_conf_verify(mbedtls_ssl_config *conf, int(*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *), void *p_vrfy)
Set the verification callback (Optional).
mbedtls_ssl_context::out_left
size_t out_left
Definition: ssl.h:1159
mbedtls_ssl_session
Definition: ssl.h:821
mbedtls_ssl_context::in_msg
unsigned char * in_msg
Definition: ssl.h:1119
ssl_ciphersuites.h
SSL Ciphersuites for mbed TLS.
mbedtls_ssl_read
int mbedtls_ssl_read(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len)
Read at most 'len' application data bytes.
mbedtls_ssl_get_alpn_protocol
const char * mbedtls_ssl_get_alpn_protocol(const mbedtls_ssl_context *ssl)
Get the name of the negotiated Application Layer Protocol. This function should be called after the h...
mbedtls_ssl_config::ca_chain
mbedtls_x509_crt * ca_chain
Definition: ssl.h:929
mbedtls_ssl_context::nb_zero
int nb_zero
Definition: ssl.h:1137
mbedtls_ssl_context::split_done
signed char split_done
Definition: ssl.h:1171
mbedtls_ssl_config::p_sni
void * p_sni
Definition: ssl.h:885
MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET
@ MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET
Definition: ssl.h:475
mbedtls_ssl_premaster_secret::_pms_rsa
unsigned char _pms_rsa[48]
Definition: ssl.h:417
mbedtls_ssl_config::max_minor_ver
unsigned char max_minor_ver
Definition: ssl.h:1003
mbedtls_ssl_conf_dtls_anti_replay
void mbedtls_ssl_conf_dtls_anti_replay(mbedtls_ssl_config *conf, char mode)
Enable or disable anti-replay protection for DTLS. (DTLS only, no effect on TLS.) Default: enabled.
mbedtls_ssl_conf_max_version
void mbedtls_ssl_conf_max_version(mbedtls_ssl_config *conf, int major, int minor)
Set the maximum supported version sent from the client side and/or accepted at the server side (Defau...
mbedtls_ssl_config::f_ticket_parse
int(* f_ticket_parse)(void *, mbedtls_ssl_session *, unsigned char *, size_t)
Definition: ssl.h:915
ecdh.h
This file contains ECDH definitions and functions.
mbedtls_ssl_config::psk_len
size_t psk_len
Definition: ssl.h:960
mbedtls_ssl_conf_cbc_record_splitting
void mbedtls_ssl_conf_cbc_record_splitting(mbedtls_ssl_config *conf, char split)
Enable / Disable 1/n-1 record splitting (Default: MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED)
mbedtls_pk_context
Public key container.
Definition: pk.h:158
mbedtls_ssl_context::cli_id_len
size_t cli_id_len
Definition: ssl.h:1196
mbedtls_ssl_free
void mbedtls_ssl_free(mbedtls_ssl_context *ssl)
Free referenced items in an SSL context and clear memory.
MBEDTLS_SSL_HANDSHAKE_OVER
@ MBEDTLS_SSL_HANDSHAKE_OVER
Definition: ssl.h:474
MBEDTLS_SSL_SERVER_KEY_EXCHANGE
@ MBEDTLS_SSL_SERVER_KEY_EXCHANGE
Definition: ssl.h:462
mbedtls_ssl_config::badmac_limit
unsigned int badmac_limit
Definition: ssl.h:995
MBEDTLS_SSL_CERTIFICATE_REQUEST
@ MBEDTLS_SSL_CERTIFICATE_REQUEST
Definition: ssl.h:463
mbedtls_ssl_config::curve_list
const mbedtls_ecp_group_id * curve_list
Definition: ssl.h:948
mbedtls_ssl_set_timer_t
void mbedtls_ssl_set_timer_t(void *ctx, uint32_t int_ms, uint32_t fin_ms)
Callback type: set a pair of timers/delays to watch.
Definition: ssl.h:572
mbedtls_ssl_config::f_vrfy
int(* f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *)
Definition: ssl.h:890
mbedtls_time_t
time_t mbedtls_time_t
Definition: platform_time.h:80
mbedtls_ssl_config::f_rng
int(* f_rng)(void *, unsigned char *, size_t)
Definition: ssl.h:873
mbedtls_dhm_context
The DHM context structure.
Definition: dhm.h:130
mbedtls_ssl_config_free
void mbedtls_ssl_config_free(mbedtls_ssl_config *conf)
Free an SSL configuration context.
mbedtls_ssl_config::session_tickets
unsigned int session_tickets
Definition: ssl.h:1041
mbedtls_ssl_config::dhm_P
mbedtls_mpi dhm_P
Definition: ssl.h:952
mbedtls_x509_crl
Definition: x509_crl.h:98
MBEDTLS_PSK_MAX_LEN
#define MBEDTLS_PSK_MAX_LEN
Definition: ssl.h:410
MBEDTLS_SSL_SERVER_HELLO_DONE
@ MBEDTLS_SSL_SERVER_HELLO_DONE
Definition: ssl.h:464
mbedtls_ssl_session_init
void mbedtls_ssl_session_init(mbedtls_ssl_session *session)
Initialize SSL session structure.
mbedtls_ssl_set_timer_cb
void mbedtls_ssl_set_timer_cb(mbedtls_ssl_context *ssl, void *p_timer, mbedtls_ssl_set_timer_t *f_set_timer, mbedtls_ssl_get_timer_t *f_get_timer)
Set the timer callbacks (Mandatory for DTLS.)
mbedtls_ssl_context::alpn_chosen
const char * alpn_chosen
Definition: ssl.h:1188
mbedtls_ssl_context::in_offt
unsigned char * in_offt
Definition: ssl.h:1120
mbedtls_ssl_session::peer_cert
mbedtls_x509_crt * peer_cert
Definition: ssl.h:832
mbedtls_ssl_handshake
int mbedtls_ssl_handshake(mbedtls_ssl_context *ssl)
Perform the SSL handshake.
mbedtls_ssl_context::transform_out
mbedtls_ssl_transform * transform_out
Definition: ssl.h:1097
mbedtls_ssl_renegotiate
int mbedtls_ssl_renegotiate(mbedtls_ssl_context *ssl)
Initiate an SSL renegotiation on the running connection. Client: perform the renegotiation right now....
mbedtls_ssl_config::psk_identity_len
size_t psk_identity_len
Definition: ssl.h:966
mbedtls_ssl_ticket_parse_t
int mbedtls_ssl_ticket_parse_t(void *p_ticket, mbedtls_ssl_session *session, unsigned char *buf, size_t len)
Callback type: parse and load session ticket.
Definition: ssl.h:1596
mbedtls_ssl_context::p_bio
void * p_bio
Definition: ssl.h:1080
mbedtls_ssl_send_t
int mbedtls_ssl_send_t(void *ctx, const unsigned char *buf, size_t len)
Callback type: send data on the network.
Definition: ssl.h:497
mbedtls_ssl_conf_truncated_hmac
void mbedtls_ssl_conf_truncated_hmac(mbedtls_ssl_config *conf, int truncate)
Activate negotiation of truncated HMAC (Default: MBEDTLS_SSL_TRUNC_HMAC_DISABLED)
mbedtls_ssl_config::p_export_keys
void * p_export_keys
Definition: ssl.h:923
mbedtls_ssl_context::renego_status
int renego_status
Definition: ssl.h:1062
mbedtls_ssl_config::f_get_cache
int(* f_get_cache)(void *, mbedtls_ssl_session *)
Definition: ssl.h:877
mbedtls_ssl_context::mtu
uint16_t mtu
Definition: ssl.h:1164
mbedtls_ssl_context::in_msgtype
int in_msgtype
Definition: ssl.h:1122
mbedtls_ssl_config::hs_timeout_max
uint32_t hs_timeout_max
Definition: ssl.h:984
mbedtls_ssl_session_reset
int mbedtls_ssl_session_reset(mbedtls_ssl_context *ssl)
Reset an already initialized SSL context for re-use while retaining application-set variables,...
mbedtls_ssl_context::transform_negotiate
mbedtls_ssl_transform * transform_negotiate
Definition: ssl.h:1099
mbedtls_ssl_config::p_dbg
void * p_dbg
Definition: ssl.h:870
mbedtls_ssl_send_alert_message
int mbedtls_ssl_send_alert_message(mbedtls_ssl_context *ssl, unsigned char level, unsigned char message)
Send an alert message.
mbedtls_ssl_config_defaults
int mbedtls_ssl_config_defaults(mbedtls_ssl_config *conf, int endpoint, int transport, int preset)
Load reasonnable default SSL configuration values. (You need to call mbedtls_ssl_config_init() first....
mbedtls_ssl_context::in_window_top
uint64_t in_window_top
Definition: ssl.h:1131
mbedtls_ssl_config::min_minor_ver
unsigned char min_minor_ver
Definition: ssl.h:1005
mbedtls_ssl_context::out_msglen
size_t out_msglen
Definition: ssl.h:1158
mbedtls_ssl_config::cert_req_ca_list
unsigned int cert_req_ca_list
Definition: ssl.h:1047
mbedtls_ssl_context::f_get_timer
mbedtls_ssl_get_timer_t * f_get_timer
Definition: ssl.h:1107
mbedtls_ssl_conf_read_timeout
void mbedtls_ssl_conf_read_timeout(mbedtls_ssl_config *conf, uint32_t timeout)
Set the timeout period for mbedtls_ssl_read() (Default: no timeout.)
mbedtls_ssl_session::ticket
unsigned char * ticket
Definition: ssl.h:837
mbedtls_ssl_config::dhm_G
mbedtls_mpi dhm_G
Definition: ssl.h:953
mbedtls_ssl_context::f_recv
mbedtls_ssl_recv_t * f_recv
Definition: ssl.h:1076
mbedtls_ssl_config::sig_hashes
const int * sig_hashes
Definition: ssl.h:944
mbedtls_ssl_config::key_cert
mbedtls_ssl_key_cert * key_cert
Definition: ssl.h:928
mbedtls_ssl_conf_renegotiation_period
void mbedtls_ssl_conf_renegotiation_period(mbedtls_ssl_config *conf, const unsigned char period[8])
Set record counter threshold for periodic renegotiation. (Default: 2^48 - 1)
mbedtls_ssl_context::in_left
size_t in_left
Definition: ssl.h:1124
mbedtls_ssl_config::mfl_code
unsigned int mfl_code
Definition: ssl.h:1020
mbedtls_ssl_premaster_secret::_pms_ecdh
unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]
Definition: ssl.h:426
mbedtls_ssl_set_client_transport_id
int mbedtls_ssl_set_client_transport_id(mbedtls_ssl_context *ssl, const unsigned char *info, size_t ilen)
Set client's transport-level identification info. (Server only. DTLS only.)
mbedtls_ssl_context::major_ver
int major_ver
Definition: ssl.h:1068
mbedtls_ssl_conf_cert_req_ca_list
void mbedtls_ssl_conf_cert_req_ca_list(mbedtls_ssl_config *conf, char cert_req_ca_list)
Whether to send a list of acceptable CAs in CertificateRequest messages. (Default: do send)
mbedtls_ssl_close_notify
int mbedtls_ssl_close_notify(mbedtls_ssl_context *ssl)
Notify the peer that the connection is being closed.
mbedtls_ssl_conf_dhm_min_bitlen
void mbedtls_ssl_conf_dhm_min_bitlen(mbedtls_ssl_config *conf, unsigned int bitlen)
Set the minimum length for Diffie-Hellman parameters. (Client-side only.) (Default: 1024 bits....
mbedtls_ssl_conf_dtls_cookies
void mbedtls_ssl_conf_dtls_cookies(mbedtls_ssl_config *conf, mbedtls_ssl_cookie_write_t *f_cookie_write, mbedtls_ssl_cookie_check_t *f_cookie_check, void *p_cookie)
Register callbacks for DTLS cookies (Server only. DTLS only.)
mbedtls_ssl_conf_renegotiation
void mbedtls_ssl_conf_renegotiation(mbedtls_ssl_config *conf, int renegotiation)
Enable / Disable renegotiation support for connection when initiated by peer (Default: MBEDTLS_SSL_RE...
mbedtls_ssl_set_session
int mbedtls_ssl_set_session(mbedtls_ssl_context *ssl, const mbedtls_ssl_session *session)
Request resumption of session (client-side only) Session data is copied from presented session struct...
mbedtls_ssl_conf_authmode
void mbedtls_ssl_conf_authmode(mbedtls_ssl_config *conf, int authmode)
Set the certificate verification mode Default: NONE on server, REQUIRED on client.
mbedtls_x509_crt
Definition: x509_crt.h:81
mbedtls_ssl_config::trunc_hmac
unsigned int trunc_hmac
Definition: ssl.h:1038
MBEDTLS_SSL_CLIENT_KEY_EXCHANGE
@ MBEDTLS_SSL_CLIENT_KEY_EXCHANGE
Definition: ssl.h:466
bignum.h
Multi-precision integer library.
mbedtls_ssl_config::encrypt_then_mac
unsigned int encrypt_then_mac
Definition: ssl.h:1023
mbedtls_ssl_premaster_secret::_pms_dhe_psk
unsigned char _pms_dhe_psk[4+MBEDTLS_MPI_MAX_SIZE+MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:433
mbedtls_ssl_set_hs_own_cert
int mbedtls_ssl_set_hs_own_cert(mbedtls_ssl_context *ssl, mbedtls_x509_crt *own_cert, mbedtls_pk_context *pk_key)
Set own certificate and key for the current handshake.
mbedtls_ssl_get_session
int mbedtls_ssl_get_session(const mbedtls_ssl_context *ssl, mbedtls_ssl_session *session)
Save session in order to resume it later (client-side only) Session data is copied to presented sessi...
mbedtls_ssl_conf_transport
void mbedtls_ssl_conf_transport(mbedtls_ssl_config *conf, int transport)
Set the transport type (TLS or DTLS). Default: TLS.
mbedtls_ssl_context::own_verify_data
char own_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN]
Definition: ssl.h:1207
mbedtls_ssl_context::p_timer
void * p_timer
Definition: ssl.h:1104
mbedtls_ssl_context
Definition: ssl.h:1054
mbedtls_ssl_conf_max_frag_len
int mbedtls_ssl_conf_max_frag_len(mbedtls_ssl_config *conf, unsigned char mfl_code)
Set the maximum fragment length to emit and/or negotiate. (Typical: the smaller of MBEDTLS_SSL_IN_CON...
mbedtls_ssl_init
void mbedtls_ssl_init(mbedtls_ssl_context *ssl)
Initialize an SSL context Just makes the context ready for mbedtls_ssl_setup() or mbedtls_ssl_free()
mbedtls_ssl_conf_sig_hashes
void mbedtls_ssl_conf_sig_hashes(mbedtls_ssl_config *conf, const int *hashes)
Set the allowed hashes for signatures during the handshake. (Default: all available hashes except MD5...
mbedtls_ssl_context::badmac_seen
unsigned badmac_seen
Definition: ssl.h:1072
mbedtls_ssl_context::in_window
uint64_t in_window
Definition: ssl.h:1132
mbedtls_ecp_group_id
mbedtls_ecp_group_id
Definition: ecp.h:105
mbedtls_ssl_config::anti_replay
unsigned int anti_replay
Definition: ssl.h:1029
dhm.h
This file contains Diffie-Hellman-Merkle (DHM) key exchange definitions and functions.
mbedtls_ssl_conf_dh_param
MBEDTLS_DEPRECATED int mbedtls_ssl_conf_dh_param(mbedtls_ssl_config *conf, const char *dhm_P, const char *dhm_G)
Set the Diffie-Hellman public P and G values, read as hexadecimal strings (server-side only) (Default...
mbedtls_ssl_export_keys_t
int mbedtls_ssl_export_keys_t(void *p_expkey, const unsigned char *ms, const unsigned char *kb, size_t maclen, size_t keylen, size_t ivlen)
Callback type: Export key block and master secret.
Definition: ssl.h:1565
mbedtls_ssl_get_peer_cert
const mbedtls_x509_crt * mbedtls_ssl_get_peer_cert(const mbedtls_ssl_context *ssl)
Return the peer certificate from the current connection.
mbedtls_ssl_conf_sni
void mbedtls_ssl_conf_sni(mbedtls_ssl_config *conf, int(*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *, size_t), void *p_sni)
Set server side ServerName TLS extension callback (optional, server-side only).
MBEDTLS_SSL_SERVER_FINISHED
@ MBEDTLS_SSL_SERVER_FINISHED
Definition: ssl.h:471
mbedtls_ssl_set_datagram_packing
void mbedtls_ssl_set_datagram_packing(mbedtls_ssl_context *ssl, unsigned allow_packing)
Allow or disallow packing of multiple handshake records within a single datagram.
mbedtls_ssl_config::psk
unsigned char * psk
Definition: ssl.h:957
mbedtls_ssl_handshake_step
int mbedtls_ssl_handshake_step(mbedtls_ssl_context *ssl)
Perform a single step of the SSL handshake.
MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC
@ MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC
Definition: ssl.h:470
mbedtls_ssl_config::allow_legacy_renegotiation
unsigned int allow_legacy_renegotiation
Definition: ssl.h:1015
mbedtls_ssl_get_max_out_record_payload
int mbedtls_ssl_get_max_out_record_payload(const mbedtls_ssl_context *ssl)
Return the current maximum outgoing record payload in bytes. This takes into account the config....
mbedtls_ssl_context::session
mbedtls_ssl_session * session
Definition: ssl.h:1087
mbedtls_ssl_config::f_cookie_write
int(* f_cookie_write)(void *, unsigned char **, unsigned char *, const unsigned char *, size_t)
Definition: ssl.h:902
mbedtls_ssl_session::ticket_lifetime
uint32_t ticket_lifetime
Definition: ssl.h:839
mbedtls_ssl_context::cur_out_ctr
unsigned char cur_out_ctr[8]
Definition: ssl.h:1161
mbedtls_ssl_conf_handshake_timeout
void mbedtls_ssl_conf_handshake_timeout(mbedtls_ssl_config *conf, uint32_t min, uint32_t max)
Set retransmit timeout values for the DTLS handshake. (DTLS only, no effect on TLS....
mbedtls_ssl_conf_psk_cb
void mbedtls_ssl_conf_psk_cb(mbedtls_ssl_config *conf, int(*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *, size_t), void *p_psk)
Set the PSK callback (server-side only).
mbedtls_ssl_set_hs_authmode
void mbedtls_ssl_set_hs_authmode(mbedtls_ssl_context *ssl, int authmode)
Set authmode for the current handshake.
mbedtls_ssl_config::disable_renegotiation
unsigned int disable_renegotiation
Definition: ssl.h:1035
mbedtls_ssl_get_max_frag_len
size_t mbedtls_ssl_get_max_frag_len(const mbedtls_ssl_context *ssl)
Return the maximum fragment length (payload, in bytes). This is the value negotiated with peer if any...
mbedtls_ssl_config::min_major_ver
unsigned char min_major_ver
Definition: ssl.h:1004
mbedtls_ssl_write
int mbedtls_ssl_write(mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len)
Try to write exactly 'len' application data bytes.
mbedtls_ssl_context::conf
const mbedtls_ssl_config * conf
Definition: ssl.h:1055
mbedtls_ssl_conf_encrypt_then_mac
void mbedtls_ssl_conf_encrypt_then_mac(mbedtls_ssl_config *conf, char etm)
Enable or disable Encrypt-then-MAC (Default: MBEDTLS_SSL_ETM_ENABLED)
mbedtls_ssl_conf_cert_profile
void mbedtls_ssl_conf_cert_profile(mbedtls_ssl_config *conf, const mbedtls_x509_crt_profile *profile)
Set the X.509 security profile used for verification.
mbedtls_ssl_get_bytes_avail
size_t mbedtls_ssl_get_bytes_avail(const mbedtls_ssl_context *ssl)
Return the number of application data bytes remaining to be read from the current record.
platform_time.h
mbed TLS Platform time abstraction
mbedtls_ssl_config::hs_timeout_min
uint32_t hs_timeout_min
Definition: ssl.h:982
mbedtls_ssl_session_free
void mbedtls_ssl_session_free(mbedtls_ssl_session *session)
Free referenced items in an SSL session including the peer certificate and clear memory.
mbedtls_ssl_set_bio
void mbedtls_ssl_set_bio(mbedtls_ssl_context *ssl, void *p_bio, mbedtls_ssl_send_t *f_send, mbedtls_ssl_recv_t *f_recv, mbedtls_ssl_recv_timeout_t *f_recv_timeout)
Set the underlying BIO callbacks for write, read and read-with-timeout.
mbedtls_ssl_conf_min_version
void mbedtls_ssl_conf_min_version(mbedtls_ssl_config *conf, int major, int minor)
Set the minimum accepted SSL/TLS protocol version (Default: TLS 1.0)
mbedtls_x509_crt_profile
Definition: x509_crt.h:136
mbedtls_ssl_premaster_secret::_pms_psk
unsigned char _pms_psk[4+2 *MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:429
mbedtls_ssl_get_version
const char * mbedtls_ssl_get_version(const mbedtls_ssl_context *ssl)
Return the current SSL version (SSLv3/TLSv1/etc)
mbedtls_ssl_conf_dtls_badmac_limit
void mbedtls_ssl_conf_dtls_badmac_limit(mbedtls_ssl_config *conf, unsigned limit)
Set a limit on the number of records with a bad MAC before terminating the connection....
mbedtls_ssl_config
Definition: ssl.h:859
mbedtls_ssl_config_init
void mbedtls_ssl_config_init(mbedtls_ssl_config *conf)
Initialize an SSL configuration context Just makes the context ready for mbedtls_ssl_config_defaults(...
mbedtls_ssl_context::in_buf
unsigned char * in_buf
Definition: ssl.h:1112
mbedtls_ssl_conf_fallback
void mbedtls_ssl_conf_fallback(mbedtls_ssl_config *conf, char fallback)
Set the fallback flag (client-side only). (Default: MBEDTLS_SSL_IS_NOT_FALLBACK).
mbedtls_ssl_config::arc4_disabled
unsigned int arc4_disabled
Definition: ssl.h:1017
mbedtls_ssl_context::out_msg
unsigned char * out_msg
Definition: ssl.h:1155
mbedtls_ssl_context::verify_data_len
size_t verify_data_len
Definition: ssl.h:1206
mbedtls_ssl_config::f_set_cache
int(* f_set_cache)(void *, const mbedtls_ssl_session *)
Definition: ssl.h:879
MBEDTLS_SSL_HELLO_REQUEST
@ MBEDTLS_SSL_HELLO_REQUEST
Definition: ssl.h:458
mbedtls_ssl_conf_extended_master_secret
void mbedtls_ssl_conf_extended_master_secret(mbedtls_ssl_config *conf, char ems)
Enable or disable Extended Master Secret negotiation. (Default: MBEDTLS_SSL_EXTENDED_MS_ENABLED)
mbedtls_ssl_session::encrypt_then_mac
int encrypt_then_mac
Definition: ssl.h:851
mbedtls_ssl_context::hostname
char * hostname
Definition: ssl.h:1183
mbedtls_ssl_conf_curves
void mbedtls_ssl_conf_curves(mbedtls_ssl_config *conf, const mbedtls_ecp_group_id *curves)
Set the allowed curves in order of preference. (Default: all defined curves.)
mbedtls_ssl_transform
struct mbedtls_ssl_transform mbedtls_ssl_transform
Definition: ssl.h:595
mbedtls_ssl_config::endpoint
unsigned int endpoint
Definition: ssl.h:1011
mbedtls_ssl_config::p_rng
void * p_rng
Definition: ssl.h:874
mbedtls_ssl_context::out_ctr
unsigned char * out_ctr
Definition: ssl.h:1151
mbedtls_ssl_premaster_secret::_pms_rsa_psk
unsigned char _pms_rsa_psk[52+MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:436
mbedtls_ssl_config::p_ticket
void * p_ticket
Definition: ssl.h:916
MBEDTLS_SSL_CERTIFICATE_VERIFY
@ MBEDTLS_SSL_CERTIFICATE_VERIFY
Definition: ssl.h:467
mbedtls_ssl_premaster_secret::_pms_ecdhe_psk
unsigned char _pms_ecdhe_psk[4+MBEDTLS_ECP_MAX_BYTES+MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:440
mbedtls_ssl_context::handshake
mbedtls_ssl_handshake_params * handshake
Definition: ssl.h:1090
mbedtls_ssl_conf_session_tickets_cb
void mbedtls_ssl_conf_session_tickets_cb(mbedtls_ssl_config *conf, mbedtls_ssl_ticket_write_t *f_ticket_write, mbedtls_ssl_ticket_parse_t *f_ticket_parse, void *p_ticket)
Configure SSL session ticket callbacks (server only). (Default: none.)
mbedtls_ssl_config::renego_period
unsigned char renego_period[8]
Definition: ssl.h:990
mbedtls_ssl_conf_rng
void mbedtls_ssl_conf_rng(mbedtls_ssl_config *conf, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Set the random number generator callback.
mbedtls_ssl_context::in_ctr
unsigned char * in_ctr
Definition: ssl.h:1113
mbedtls_ssl_session::verify_result
uint32_t verify_result
Definition: ssl.h:834
mbedtls_ssl_config::ciphersuite_list
const int * ciphersuite_list[4]
Definition: ssl.h:866
mbedtls_ssl_conf_ciphersuites_for_version
void mbedtls_ssl_conf_ciphersuites_for_version(mbedtls_ssl_config *conf, const int *ciphersuites, int major, int minor)
Set the list of allowed ciphersuites and the preference order for a specific version of the protocol....
mbedtls_ssl_config::fallback
unsigned int fallback
Definition: ssl.h:1044
mbedtls_ssl_context::in_len
unsigned char * in_len
Definition: ssl.h:1117
mbedtls_ssl_config::f_export_keys
int(* f_export_keys)(void *, const unsigned char *, const unsigned char *, size_t, size_t, size_t)
Definition: ssl.h:921
mbedtls_ssl_get_ciphersuite_id
int mbedtls_ssl_get_ciphersuite_id(const char *ciphersuite_name)
Return the ID of the ciphersuite associated with the given name.
mbedtls_ssl_conf_alpn_protocols
int mbedtls_ssl_conf_alpn_protocols(mbedtls_ssl_config *conf, const char **protos)
Set the supported Application Layer Protocols.
mbedtls_ssl_cookie_write_t
int mbedtls_ssl_cookie_write_t(void *ctx, unsigned char **p, unsigned char *end, const unsigned char *info, size_t ilen)
Callback type: generate a cookie.
Definition: ssl.h:1731
mbedtls_ssl_context::out_buf
unsigned char * out_buf
Definition: ssl.h:1150
mbedtls_ssl_session::id_len
size_t id_len
Definition: ssl.h:827
mbedtls_ssl_set_hostname
int mbedtls_ssl_set_hostname(mbedtls_ssl_context *ssl, const char *hostname)
Set or reset the hostname to check against the received server certificate. It sets the ServerName TL...
mbedtls_ssl_context::in_hdr
unsigned char * in_hdr
Definition: ssl.h:1116
mbedtls_ssl_context::out_msgtype
int out_msgtype
Definition: ssl.h:1157
mbedtls_ssl_set_hs_ca_chain
void mbedtls_ssl_set_hs_ca_chain(mbedtls_ssl_context *ssl, mbedtls_x509_crt *ca_chain, mbedtls_x509_crl *ca_crl)
Set the data required to verify peer certificate for the current handshake.
mbedtls_ssl_context::cli_id
unsigned char * cli_id
Definition: ssl.h:1195
config.h
Configuration options (set of defines)
mbedtls_ssl_get_record_expansion
int mbedtls_ssl_get_record_expansion(const mbedtls_ssl_context *ssl)
Return the (maximum) number of bytes added by the record layer: header + encryption/MAC overhead (inc...
mbedtls_ssl_context::f_recv_timeout
mbedtls_ssl_recv_timeout_t * f_recv_timeout
Definition: ssl.h:1077
mbedtls_ssl_conf_session_tickets
void mbedtls_ssl_conf_session_tickets(mbedtls_ssl_config *conf, int use_tickets)
Enable / Disable session tickets (client only). (Default: MBEDTLS_SSL_SESSION_TICKETS_ENABLED....
mbedtls_ssl_check_pending
int mbedtls_ssl_check_pending(const mbedtls_ssl_context *ssl)
Check if there is data already read from the underlying transport but not yet processed.
MBEDTLS_SSL_CLIENT_FINISHED
@ MBEDTLS_SSL_CLIENT_FINISHED
Definition: ssl.h:469
mbedtls_ssl_conf_dbg
void mbedtls_ssl_conf_dbg(mbedtls_ssl_config *conf, void(*f_dbg)(void *, int, const char *, int, const char *), void *p_dbg)
Set the debug callback.
mbedtls_ssl_context::in_iv
unsigned char * in_iv
Definition: ssl.h:1118
mbedtls_ssl_config::f_dbg
void(* f_dbg)(void *, int, const char *, int, const char *)
Definition: ssl.h:869
mbedtls_ssl_context::in_msglen
size_t in_msglen
Definition: ssl.h:1123
mbedtls_ssl_config::f_sni
int(* f_sni)(void *, mbedtls_ssl_context *, const unsigned char *, size_t)
Definition: ssl.h:884
mbedtls_ssl_context::out_hdr
unsigned char * out_hdr
Definition: ssl.h:1152
MBEDTLS_ECP_MAX_BYTES
#define MBEDTLS_ECP_MAX_BYTES
Definition: ecp.h:240
mbedtls_ssl_context::transform_in
mbedtls_ssl_transform * transform_in
Definition: ssl.h:1096
mbedtls_ssl_context::renego_records_seen
int renego_records_seen
Definition: ssl.h:1063
MBEDTLS_DEPRECATED
#define MBEDTLS_DEPRECATED
Definition: ssl.h:2175
mbedtls_ssl_get_verify_result
uint32_t mbedtls_ssl_get_verify_result(const mbedtls_ssl_context *ssl)
Return the result of the certificate verification.
mbedtls_ssl_context::session_negotiate
mbedtls_ssl_session * session_negotiate
Definition: ssl.h:1088
mbedtls_ssl_config::alpn_list
const char ** alpn_list
Definition: ssl.h:972
mbedtls_ssl_config::psk_identity
unsigned char * psk_identity
Definition: ssl.h:963
mbedtls_ssl_sig_hash_set_t
struct mbedtls_ssl_sig_hash_set_t mbedtls_ssl_sig_hash_set_t
Definition: ssl.h:597
MBEDTLS_SSL_CLIENT_HELLO
@ MBEDTLS_SSL_CLIENT_HELLO
Definition: ssl.h:459
mbedtls_ssl_conf_dh_param_ctx
int mbedtls_ssl_conf_dh_param_ctx(mbedtls_ssl_config *conf, mbedtls_dhm_context *dhm_ctx)
Set the Diffie-Hellman public P and G values, read from existing context (server-side only)
mbedtls_ssl_handshake_params
struct mbedtls_ssl_handshake_params mbedtls_ssl_handshake_params
Definition: ssl.h:596
mbedtls_ssl_config::renego_max_records
int renego_max_records
Definition: ssl.h:989
mbedtls_ssl_config::ca_crl
mbedtls_x509_crl * ca_crl
Definition: ssl.h:930
mbedtls_ssl_conf_arc4_support
void mbedtls_ssl_conf_arc4_support(mbedtls_ssl_config *conf, char arc4)
Disable or enable support for RC4 (Default: MBEDTLS_SSL_ARC4_DISABLED)
mbedtls_ssl_context::compress_buf
unsigned char * compress_buf
Definition: ssl.h:1168
x509_crt.h
X.509 certificate parsing and writing.
MBEDTLS_MPI_MAX_SIZE
#define MBEDTLS_MPI_MAX_SIZE
Definition: bignum.h:109
mbedtls_ssl_context::client_auth
int client_auth
Definition: ssl.h:1177
mbedtls_ssl_config::transport
unsigned int transport
Definition: ssl.h:1012
mbedtls_ssl_get_timer_t
int mbedtls_ssl_get_timer_t(void *ctx)
Callback type: get status of timers/delays.
Definition: ssl.h:587
mbedtls_ssl_config::authmode
unsigned int authmode
Definition: ssl.h:1013
mbedtls_ssl_conf_psk
int mbedtls_ssl_conf_psk(mbedtls_ssl_config *conf, const unsigned char *psk, size_t psk_len, const unsigned char *psk_identity, size_t psk_identity_len)
Set the Pre Shared Key (PSK) and the expected identity name.
mbedtls_ssl_config::cbc_record_splitting
unsigned int cbc_record_splitting
Definition: ssl.h:1032
mbedtls_ssl_session::start
mbedtls_time_t start
Definition: ssl.h:823
MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC
@ MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC
Definition: ssl.h:468
mbedtls_ssl_config::f_ticket_write
int(* f_ticket_write)(void *, const mbedtls_ssl_session *, unsigned char *, const unsigned char *, size_t *, uint32_t *)
Definition: ssl.h:912
mbedtls_ssl_conf_endpoint
void mbedtls_ssl_conf_endpoint(mbedtls_ssl_config *conf, int endpoint)
Set the current endpoint type.
mbedtls_ssl_context::peer_verify_data
char peer_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN]
Definition: ssl.h:1208
mbedtls_ssl_recv_timeout_t
int mbedtls_ssl_recv_timeout_t(void *ctx, unsigned char *buf, size_t len, uint32_t timeout)
Callback type: receive data from the network, with timeout.
Definition: ssl.h:546
mbedtls_ssl_context::keep_current_message
int keep_current_message
Definition: ssl.h:1139
mbedtls_ssl_context::minor_ver
int minor_ver
Definition: ssl.h:1069
mbedtls_ssl_get_ciphersuite_name
const char * mbedtls_ssl_get_ciphersuite_name(const int ciphersuite_id)
Return the name of the ciphersuite associated with the given ID.
mbedtls_ssl_context::disable_datagram_packing
uint8_t disable_datagram_packing
Definition: ssl.h:1143
mbedtls_ssl_config::f_cookie_check
int(* f_cookie_check)(void *, const unsigned char *, size_t, const unsigned char *, size_t)
Definition: ssl.h:905
mbedtls_ssl_setup
int mbedtls_ssl_setup(mbedtls_ssl_context *ssl, const mbedtls_ssl_config *conf)
Set up an SSL context for use.
mbedtls_ssl_context::session_in
mbedtls_ssl_session * session_in
Definition: ssl.h:1085
mbedtls_ssl_config::f_psk
int(* f_psk)(void *, mbedtls_ssl_context *, const unsigned char *, size_t)
Definition: ssl.h:896
mbedtls_ssl_session::mfl_code
unsigned char mfl_code
Definition: ssl.h:843
mbedtls_ssl_context::secure_renegotiation
int secure_renegotiation
Definition: ssl.h:1203
mbedtls_ssl_config::p_cookie
void * p_cookie
Definition: ssl.h:907
mbedtls_ssl_set_hs_psk
int mbedtls_ssl_set_hs_psk(mbedtls_ssl_context *ssl, const unsigned char *psk, size_t psk_len)
Set the Pre Shared Key (PSK) for the current handshake.
mbedtls_ssl_cookie_check_t
int mbedtls_ssl_cookie_check_t(void *ctx, const unsigned char *cookie, size_t clen, const unsigned char *info, size_t ilen)
Callback type: verify a cookie.
Definition: ssl.h:1748
mbedtls_ssl_conf_export_keys_cb
void mbedtls_ssl_conf_export_keys_cb(mbedtls_ssl_config *conf, mbedtls_ssl_export_keys_t *f_export_keys, void *p_export_keys)
Configure key export callback. (Default: none.)
mbedtls_ssl_config::extended_ms
unsigned int extended_ms
Definition: ssl.h:1026
mbedtls_ssl_conf_session_cache
void mbedtls_ssl_conf_session_cache(mbedtls_ssl_config *conf, void *p_cache, int(*f_get_cache)(void *, mbedtls_ssl_session *), int(*f_set_cache)(void *, const mbedtls_ssl_session *))
Set the session cache callbacks (server-side only) If not set, no session resuming is done (except if...
mbedtls_ssl_conf_ca_chain
void mbedtls_ssl_conf_ca_chain(mbedtls_ssl_config *conf, mbedtls_x509_crt *ca_chain, mbedtls_x509_crl *ca_crl)
Set the data required to verify peer certificate.