mbed TLS v2.23.0

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
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
11 * not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 *
22 * This file is part of mbed TLS (https://tls.mbed.org)
23 */
24 #ifndef MBEDTLS_SSL_H
25 #define MBEDTLS_SSL_H
26
27 #if !defined(MBEDTLS_CONFIG_FILE)
28 #include "mbedtls/config.h"
29 #else
30 #include MBEDTLS_CONFIG_FILE
31 #endif
32
33 #include "mbedtls/bignum.h"
34 #include "mbedtls/ecp.h"
35
36 #include "mbedtls/ssl_ciphersuites.h"
37
38 #if defined(MBEDTLS_X509_CRT_PARSE_C)
39 #include "mbedtls/x509_crt.h"
40 #include "mbedtls/x509_crl.h"
41 #endif
42
43 #if defined(MBEDTLS_DHM_C)
44 #include "mbedtls/dhm.h"
45 #endif
46
47 #if defined(MBEDTLS_ECDH_C)
48 #include "mbedtls/ecdh.h"
49 #endif
50
51 #if defined(MBEDTLS_ZLIB_SUPPORT)
52
53 #if defined(MBEDTLS_DEPRECATED_WARNING)
54 #warning "Record compression support via MBEDTLS_ZLIB_SUPPORT is deprecated and will be removed in the next major revision of the library"
55 #endif
56
57 #if defined(MBEDTLS_DEPRECATED_REMOVED)
58 #error "Record compression support via MBEDTLS_ZLIB_SUPPORT is deprecated and cannot be used if MBEDTLS_DEPRECATED_REMOVED is set"
59 #endif
60
61 #include "zlib.h"
62 #endif
63
64 #if defined(MBEDTLS_HAVE_TIME)
65 #include "mbedtls/platform_time.h"
66 #endif
67
68 #if defined(MBEDTLS_USE_PSA_CRYPTO)
69 #include "psa/crypto.h"
70 #endif /* MBEDTLS_USE_PSA_CRYPTO */
71
72 /*
73 * SSL Error codes
74 */
75 #define MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE -0x7080
76 #define MBEDTLS_ERR_SSL_BAD_INPUT_DATA -0x7100
77 #define MBEDTLS_ERR_SSL_INVALID_MAC -0x7180
78 #define MBEDTLS_ERR_SSL_INVALID_RECORD -0x7200
79 #define MBEDTLS_ERR_SSL_CONN_EOF -0x7280
80 #define MBEDTLS_ERR_SSL_UNKNOWN_CIPHER -0x7300
81 #define MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN -0x7380
82 #define MBEDTLS_ERR_SSL_NO_RNG -0x7400
83 #define MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE -0x7480
84 #define MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE -0x7500
85 #define MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED -0x7580
86 #define MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED -0x7600
87 #define MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED -0x7680
88 #define MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE -0x7700
89 #define MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE -0x7780
90 #define MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED -0x7800
91 #define MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY -0x7880
92 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO -0x7900
93 #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO -0x7980
94 #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE -0x7A00
95 #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST -0x7A80
96 #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE -0x7B00
97 #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE -0x7B80
98 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE -0x7C00
99 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP -0x7C80
100 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS -0x7D00
101 #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY -0x7D80
102 #define MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC -0x7E00
103 #define MBEDTLS_ERR_SSL_BAD_HS_FINISHED -0x7E80
104 #define MBEDTLS_ERR_SSL_ALLOC_FAILED -0x7F00
105 #define MBEDTLS_ERR_SSL_HW_ACCEL_FAILED -0x7F80
106 #define MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH -0x6F80
107 #define MBEDTLS_ERR_SSL_COMPRESSION_FAILED -0x6F00
108 #define MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION -0x6E80
109 #define MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET -0x6E00
110 #define MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED -0x6D80
111 #define MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH -0x6D00
112 #define MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY -0x6C80
113 #define MBEDTLS_ERR_SSL_INTERNAL_ERROR -0x6C00
114 #define MBEDTLS_ERR_SSL_COUNTER_WRAPPING -0x6B80
115 #define MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO -0x6B00
116 #define MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED -0x6A80
117 #define MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL -0x6A00
118 #define MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE -0x6980
119 #define MBEDTLS_ERR_SSL_WANT_READ -0x6900
120 #define MBEDTLS_ERR_SSL_WANT_WRITE -0x6880
121 #define MBEDTLS_ERR_SSL_TIMEOUT -0x6800
122 #define MBEDTLS_ERR_SSL_CLIENT_RECONNECT -0x6780
123 #define MBEDTLS_ERR_SSL_UNEXPECTED_RECORD -0x6700
124 #define MBEDTLS_ERR_SSL_NON_FATAL -0x6680
125 #define MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH -0x6600
126 #define MBEDTLS_ERR_SSL_CONTINUE_PROCESSING -0x6580
127 #define MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS -0x6500
128 #define MBEDTLS_ERR_SSL_EARLY_MESSAGE -0x6480
129 #define MBEDTLS_ERR_SSL_UNEXPECTED_CID -0x6000
130 #define MBEDTLS_ERR_SSL_VERSION_MISMATCH -0x5F00
131 #define MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS -0x7000
132 #define MBEDTLS_ERR_SSL_BAD_CONFIG -0x5E80
134 /*
135 * Various constants
136 */
137 #define MBEDTLS_SSL_MAJOR_VERSION_3 3
138 #define MBEDTLS_SSL_MINOR_VERSION_0 0
139 #define MBEDTLS_SSL_MINOR_VERSION_1 1
140 #define MBEDTLS_SSL_MINOR_VERSION_2 2
141 #define MBEDTLS_SSL_MINOR_VERSION_3 3
142 #define MBEDTLS_SSL_MINOR_VERSION_4 4
144 #define MBEDTLS_SSL_TRANSPORT_STREAM 0
145 #define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1
147 #define MBEDTLS_SSL_MAX_HOST_NAME_LEN 255
148 #define MBEDTLS_SSL_MAX_ALPN_NAME_LEN 255
150 #define MBEDTLS_SSL_MAX_ALPN_LIST_LEN 65535
152 /* RFC 6066 section 4, see also mfl_code_to_length in ssl_tls.c
153 * NONE must be zero so that memset()ing structure to zero works */
154 #define MBEDTLS_SSL_MAX_FRAG_LEN_NONE 0
155 #define MBEDTLS_SSL_MAX_FRAG_LEN_512 1
156 #define MBEDTLS_SSL_MAX_FRAG_LEN_1024 2
157 #define MBEDTLS_SSL_MAX_FRAG_LEN_2048 3
158 #define MBEDTLS_SSL_MAX_FRAG_LEN_4096 4
159 #define MBEDTLS_SSL_MAX_FRAG_LEN_INVALID 5
161 #define MBEDTLS_SSL_IS_CLIENT 0
162 #define MBEDTLS_SSL_IS_SERVER 1
163
164 #define MBEDTLS_SSL_IS_NOT_FALLBACK 0
165 #define MBEDTLS_SSL_IS_FALLBACK 1
166
167 #define MBEDTLS_SSL_EXTENDED_MS_DISABLED 0
168 #define MBEDTLS_SSL_EXTENDED_MS_ENABLED 1
169
170 #define MBEDTLS_SSL_CID_DISABLED 0
171 #define MBEDTLS_SSL_CID_ENABLED 1
172
173 #define MBEDTLS_SSL_ETM_DISABLED 0
174 #define MBEDTLS_SSL_ETM_ENABLED 1
175
176 #define MBEDTLS_SSL_COMPRESS_NULL 0
177 #define MBEDTLS_SSL_COMPRESS_DEFLATE 1
178
179 #define MBEDTLS_SSL_VERIFY_NONE 0
180 #define MBEDTLS_SSL_VERIFY_OPTIONAL 1
181 #define MBEDTLS_SSL_VERIFY_REQUIRED 2
182 #define MBEDTLS_SSL_VERIFY_UNSET 3 /* Used only for sni_authmode */
183
184 #define MBEDTLS_SSL_LEGACY_RENEGOTIATION 0
185 #define MBEDTLS_SSL_SECURE_RENEGOTIATION 1
186
187 #define MBEDTLS_SSL_RENEGOTIATION_DISABLED 0
188 #define MBEDTLS_SSL_RENEGOTIATION_ENABLED 1
189
190 #define MBEDTLS_SSL_ANTI_REPLAY_DISABLED 0
191 #define MBEDTLS_SSL_ANTI_REPLAY_ENABLED 1
192
193 #define MBEDTLS_SSL_RENEGOTIATION_NOT_ENFORCED -1
194 #define MBEDTLS_SSL_RENEGO_MAX_RECORDS_DEFAULT 16
195
196 #define MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION 0
197 #define MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION 1
198 #define MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE 2
199
200 #define MBEDTLS_SSL_TRUNC_HMAC_DISABLED 0
201 #define MBEDTLS_SSL_TRUNC_HMAC_ENABLED 1
202 #define MBEDTLS_SSL_TRUNCATED_HMAC_LEN 10 /* 80 bits, rfc 6066 section 7 */
203
204 #define MBEDTLS_SSL_SESSION_TICKETS_DISABLED 0
205 #define MBEDTLS_SSL_SESSION_TICKETS_ENABLED 1
206
207 #define MBEDTLS_SSL_CBC_RECORD_SPLITTING_DISABLED 0
208 #define MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED 1
209
210 #define MBEDTLS_SSL_ARC4_ENABLED 0
211 #define MBEDTLS_SSL_ARC4_DISABLED 1
212
213 #define MBEDTLS_SSL_PRESET_DEFAULT 0
214 #define MBEDTLS_SSL_PRESET_SUITEB 2
215
216 #define MBEDTLS_SSL_CERT_REQ_CA_LIST_ENABLED 1
217 #define MBEDTLS_SSL_CERT_REQ_CA_LIST_DISABLED 0
218
219 /*
220 * Default range for DTLS retransmission timer value, in milliseconds.
221 * RFC 6347 4.2.4.1 says from 1 second to 60 seconds.
222 */
223 #define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MIN 1000
224 #define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MAX 60000
225
234 #if !defined(MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME)
235 #define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400
236 #endif
237
238 /*
239 * Maximum fragment length in bytes,
240 * determines the size of each of the two internal I/O buffers.
241 *
242 * Note: the RFC defines the default size of SSL / TLS messages. If you
243 * change the value here, other clients / servers may not be able to
244 * communicate with you anymore. Only change this value if you control
245 * both sides of the connection and have it reduced at both sides, or
246 * if you're using the Max Fragment Length extension and you know all your
247 * peers are using it too!
248 */
249 #if !defined(MBEDTLS_SSL_MAX_CONTENT_LEN)
250 #define MBEDTLS_SSL_MAX_CONTENT_LEN 16384
251 #endif
252
253 #if !defined(MBEDTLS_SSL_IN_CONTENT_LEN)
254 #define MBEDTLS_SSL_IN_CONTENT_LEN MBEDTLS_SSL_MAX_CONTENT_LEN
255 #endif
256
257 #if !defined(MBEDTLS_SSL_OUT_CONTENT_LEN)
258 #define MBEDTLS_SSL_OUT_CONTENT_LEN MBEDTLS_SSL_MAX_CONTENT_LEN
259 #endif
260
261 /*
262 * Maximum number of heap-allocated bytes for the purpose of
263 * DTLS handshake message reassembly and future message buffering.
264 */
265 #if !defined(MBEDTLS_SSL_DTLS_MAX_BUFFERING)
266 #define MBEDTLS_SSL_DTLS_MAX_BUFFERING 32768
267 #endif
268
269 /*
270 * Maximum length of CIDs for incoming and outgoing messages.
271 */
272 #if !defined(MBEDTLS_SSL_CID_IN_LEN_MAX)
273 #define MBEDTLS_SSL_CID_IN_LEN_MAX 32
274 #endif
275
276 #if !defined(MBEDTLS_SSL_CID_OUT_LEN_MAX)
277 #define MBEDTLS_SSL_CID_OUT_LEN_MAX 32
278 #endif
279
280 #if !defined(MBEDTLS_SSL_CID_PADDING_GRANULARITY)
281 #define MBEDTLS_SSL_CID_PADDING_GRANULARITY 16
282 #endif
283
284 #if !defined(MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY)
285 #define MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY 1
286 #endif
287
288 /* \} name SECTION: Module settings */
289
290 /*
291 * Length of the verify data for secure renegotiation
292 */
293 #if defined(MBEDTLS_SSL_PROTO_SSL3)
294 #define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 36
295 #else
296 #define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 12
297 #endif
298
299 /*
300 * Signaling ciphersuite values (SCSV)
301 */
302 #define MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO 0xFF
303 #define MBEDTLS_SSL_FALLBACK_SCSV_VALUE 0x5600
305 /*
306 * Supported Signature and Hash algorithms (For TLS 1.2)
307 * RFC 5246 section 7.4.1.4.1
308 */
309 #define MBEDTLS_SSL_HASH_NONE 0
310 #define MBEDTLS_SSL_HASH_MD5 1
311 #define MBEDTLS_SSL_HASH_SHA1 2
312 #define MBEDTLS_SSL_HASH_SHA224 3
313 #define MBEDTLS_SSL_HASH_SHA256 4
314 #define MBEDTLS_SSL_HASH_SHA384 5
315 #define MBEDTLS_SSL_HASH_SHA512 6
316
317 #define MBEDTLS_SSL_SIG_ANON 0
318 #define MBEDTLS_SSL_SIG_RSA 1
319 #define MBEDTLS_SSL_SIG_ECDSA 3
320
321 /*
322 * Client Certificate Types
323 * RFC 5246 section 7.4.4 plus RFC 4492 section 5.5
324 */
325 #define MBEDTLS_SSL_CERT_TYPE_RSA_SIGN 1
326 #define MBEDTLS_SSL_CERT_TYPE_ECDSA_SIGN 64
327
328 /*
329 * Message, alert and handshake types
330 */
331 #define MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC 20
332 #define MBEDTLS_SSL_MSG_ALERT 21
333 #define MBEDTLS_SSL_MSG_HANDSHAKE 22
334 #define MBEDTLS_SSL_MSG_APPLICATION_DATA 23
335 #define MBEDTLS_SSL_MSG_CID 25
336
337 #define MBEDTLS_SSL_ALERT_LEVEL_WARNING 1
338 #define MBEDTLS_SSL_ALERT_LEVEL_FATAL 2
339
340 #define MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY 0 /* 0x00 */
341 #define MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE 10 /* 0x0A */
342 #define MBEDTLS_SSL_ALERT_MSG_BAD_RECORD_MAC 20 /* 0x14 */
343 #define MBEDTLS_SSL_ALERT_MSG_DECRYPTION_FAILED 21 /* 0x15 */
344 #define MBEDTLS_SSL_ALERT_MSG_RECORD_OVERFLOW 22 /* 0x16 */
345 #define MBEDTLS_SSL_ALERT_MSG_DECOMPRESSION_FAILURE 30 /* 0x1E */
346 #define MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE 40 /* 0x28 */
347 #define MBEDTLS_SSL_ALERT_MSG_NO_CERT 41 /* 0x29 */
348 #define MBEDTLS_SSL_ALERT_MSG_BAD_CERT 42 /* 0x2A */
349 #define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_CERT 43 /* 0x2B */
350 #define MBEDTLS_SSL_ALERT_MSG_CERT_REVOKED 44 /* 0x2C */
351 #define MBEDTLS_SSL_ALERT_MSG_CERT_EXPIRED 45 /* 0x2D */
352 #define MBEDTLS_SSL_ALERT_MSG_CERT_UNKNOWN 46 /* 0x2E */
353 #define MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER 47 /* 0x2F */
354 #define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_CA 48 /* 0x30 */
355 #define MBEDTLS_SSL_ALERT_MSG_ACCESS_DENIED 49 /* 0x31 */
356 #define MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR 50 /* 0x32 */
357 #define MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR 51 /* 0x33 */
358 #define MBEDTLS_SSL_ALERT_MSG_EXPORT_RESTRICTION 60 /* 0x3C */
359 #define MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION 70 /* 0x46 */
360 #define MBEDTLS_SSL_ALERT_MSG_INSUFFICIENT_SECURITY 71 /* 0x47 */
361 #define MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR 80 /* 0x50 */
362 #define MBEDTLS_SSL_ALERT_MSG_INAPROPRIATE_FALLBACK 86 /* 0x56 */
363 #define MBEDTLS_SSL_ALERT_MSG_USER_CANCELED 90 /* 0x5A */
364 #define MBEDTLS_SSL_ALERT_MSG_NO_RENEGOTIATION 100 /* 0x64 */
365 #define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT 110 /* 0x6E */
366 #define MBEDTLS_SSL_ALERT_MSG_UNRECOGNIZED_NAME 112 /* 0x70 */
367 #define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY 115 /* 0x73 */
368 #define MBEDTLS_SSL_ALERT_MSG_NO_APPLICATION_PROTOCOL 120 /* 0x78 */
369
370 #define MBEDTLS_SSL_HS_HELLO_REQUEST 0
371 #define MBEDTLS_SSL_HS_CLIENT_HELLO 1
372 #define MBEDTLS_SSL_HS_SERVER_HELLO 2
373 #define MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST 3
374 #define MBEDTLS_SSL_HS_NEW_SESSION_TICKET 4
375 #define MBEDTLS_SSL_HS_CERTIFICATE 11
376 #define MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE 12
377 #define MBEDTLS_SSL_HS_CERTIFICATE_REQUEST 13
378 #define MBEDTLS_SSL_HS_SERVER_HELLO_DONE 14
379 #define MBEDTLS_SSL_HS_CERTIFICATE_VERIFY 15
380 #define MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE 16
381 #define MBEDTLS_SSL_HS_FINISHED 20
382
383 /*
384 * TLS extensions
385 */
386 #define MBEDTLS_TLS_EXT_SERVERNAME 0
387 #define MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME 0
388
389 #define MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH 1
390
391 #define MBEDTLS_TLS_EXT_TRUNCATED_HMAC 4
392
393 #define MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES 10
394 #define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS 11
395
396 #define MBEDTLS_TLS_EXT_SIG_ALG 13
397
398 #define MBEDTLS_TLS_EXT_ALPN 16
399
400 #define MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC 22 /* 0x16 */
401 #define MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET 0x0017 /* 23 */
402
403 #define MBEDTLS_TLS_EXT_SESSION_TICKET 35
404
405 /* The value of the CID extension is still TBD as of
406 * draft-ietf-tls-dtls-connection-id-05
407 * (https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-05) */
408 #define MBEDTLS_TLS_EXT_CID 254 /* TBD */
409
410 #define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 256 /* experimental */
411
412 #define MBEDTLS_TLS_EXT_RENEGOTIATION_INFO 0xFF01
413
414 /*
415 * Size defines
416 */
417 #if !defined(MBEDTLS_PSK_MAX_LEN)
418 #define MBEDTLS_PSK_MAX_LEN 32 /* 256 bits */
419 #endif
420
421 /* Dummy type used only for its size */
422 union mbedtls_ssl_premaster_secret
423 {
424 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
425 unsigned char _pms_rsa[48]; /* RFC 5246 8.1.1 */
426 #endif
427 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)
428 unsigned char _pms_dhm[MBEDTLS_MPI_MAX_SIZE]; /* RFC 5246 8.1.2 */
429 #endif
430 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
431 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
432 defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
433 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
434 unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]; /* RFC 4492 5.10 */
435 #endif
436 #if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
437 unsigned char _pms_psk[4 + 2 * MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 2 */
438 #endif
439 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
440 unsigned char _pms_dhe_psk[4 + MBEDTLS_MPI_MAX_SIZE
441 + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 3 */
442 #endif
443 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)
444 unsigned char _pms_rsa_psk[52 + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 4 */
445 #endif
446 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
447 unsigned char _pms_ecdhe_psk[4 + MBEDTLS_ECP_MAX_BYTES
448 + MBEDTLS_PSK_MAX_LEN]; /* RFC 5489 2 */
449 #endif
450 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
451 unsigned char _pms_ecjpake[32]; /* Thread spec: SHA-256 output */
452 #endif
453 };
454
455 #define MBEDTLS_PREMASTER_SIZE sizeof( union mbedtls_ssl_premaster_secret )
456
457 #ifdef __cplusplus
458 extern "C" {
459 #endif
460
461 /*
462 * SSL state machine
463 */
464 typedef enum
465 {
466 MBEDTLS_SSL_HELLO_REQUEST,
467 MBEDTLS_SSL_CLIENT_HELLO,
468 MBEDTLS_SSL_SERVER_HELLO,
469 MBEDTLS_SSL_SERVER_CERTIFICATE,
470 MBEDTLS_SSL_SERVER_KEY_EXCHANGE,
471 MBEDTLS_SSL_CERTIFICATE_REQUEST,
472 MBEDTLS_SSL_SERVER_HELLO_DONE,
473 MBEDTLS_SSL_CLIENT_CERTIFICATE,
474 MBEDTLS_SSL_CLIENT_KEY_EXCHANGE,
475 MBEDTLS_SSL_CERTIFICATE_VERIFY,
476 MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC,
477 MBEDTLS_SSL_CLIENT_FINISHED,
478 MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC,
479 MBEDTLS_SSL_SERVER_FINISHED,
480 MBEDTLS_SSL_FLUSH_BUFFERS,
481 MBEDTLS_SSL_HANDSHAKE_WRAPUP,
482 MBEDTLS_SSL_HANDSHAKE_OVER,
483 MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET,
484 MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT,
485 }
486 mbedtls_ssl_states;
487
488 /*
489 * The tls_prf function types.
490 */
491 typedef enum
492 {
493 MBEDTLS_SSL_TLS_PRF_NONE,
494 MBEDTLS_SSL_TLS_PRF_SSL3,
495 MBEDTLS_SSL_TLS_PRF_TLS1,
496 MBEDTLS_SSL_TLS_PRF_SHA384,
497 MBEDTLS_SSL_TLS_PRF_SHA256
498 }
499 mbedtls_tls_prf_types;
517 typedef int mbedtls_ssl_send_t( void *ctx,
518 const unsigned char *buf,
519 size_t len );
520
540 typedef int mbedtls_ssl_recv_t( void *ctx,
541 unsigned char *buf,
542 size_t len );
543
566 typedef int mbedtls_ssl_recv_timeout_t( void *ctx,
567 unsigned char *buf,
568 size_t len,
569 uint32_t timeout );
592 typedef void mbedtls_ssl_set_timer_t( void * ctx,
593 uint32_t int_ms,
594 uint32_t fin_ms );
595
607 typedef int mbedtls_ssl_get_timer_t( void * ctx );
608
609 /* Defined below */
610 typedef struct mbedtls_ssl_session mbedtls_ssl_session;
611 typedef struct mbedtls_ssl_context mbedtls_ssl_context;
612 typedef struct mbedtls_ssl_config mbedtls_ssl_config;
613
614 /* Defined in ssl_internal.h */
615 typedef struct mbedtls_ssl_transform mbedtls_ssl_transform;
616 typedef struct mbedtls_ssl_handshake_params mbedtls_ssl_handshake_params;
617 typedef struct mbedtls_ssl_sig_hash_set_t mbedtls_ssl_sig_hash_set_t;
618 #if defined(MBEDTLS_X509_CRT_PARSE_C)
619 typedef struct mbedtls_ssl_key_cert mbedtls_ssl_key_cert;
620 #endif
621 #if defined(MBEDTLS_SSL_PROTO_DTLS)
622 typedef struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item;
623 #endif
624
625 #if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
626 #if defined(MBEDTLS_X509_CRT_PARSE_C)
627
698 typedef int mbedtls_ssl_async_sign_t( mbedtls_ssl_context *ssl,
699 mbedtls_x509_crt *cert,
700 mbedtls_md_type_t md_alg,
701 const unsigned char *hash,
702 size_t hash_len );
703
764 typedef int mbedtls_ssl_async_decrypt_t( mbedtls_ssl_context *ssl,
765 mbedtls_x509_crt *cert,
766 const unsigned char *input,
767 size_t input_len );
768 #endif /* MBEDTLS_X509_CRT_PARSE_C */
769
812 typedef int mbedtls_ssl_async_resume_t( mbedtls_ssl_context *ssl,
813 unsigned char *output,
814 size_t *output_len,
815 size_t output_size );
816
834 typedef void mbedtls_ssl_async_cancel_t( mbedtls_ssl_context *ssl );
835 #endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
836
837 #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \
838 !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
839 #define MBEDTLS_SSL_PEER_CERT_DIGEST_MAX_LEN 48
840 #if defined(MBEDTLS_SHA256_C)
841 #define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE MBEDTLS_MD_SHA256
842 #define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN 32
843 #elif defined(MBEDTLS_SHA512_C)
844 #define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE MBEDTLS_MD_SHA384
845 #define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN 48
846 #elif defined(MBEDTLS_SHA1_C)
847 #define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE MBEDTLS_MD_SHA1
848 #define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN 20
849 #else
850 /* This is already checked in check_config.h, but be sure. */
851 #error "Bad configuration - need SHA-1, SHA-256 or SHA-512 enabled to compute digest of peer CRT."
852 #endif
853 #endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED &&
854 !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
855
856 /*
857 * This structure is used for storing current session data.
858 *
859 * Note: when changing this definition, we need to check and update:
860 * - in tests/suites/test_suite_ssl.function:
861 * ssl_populate_session() and ssl_serialize_session_save_load()
862 * - in library/ssl_tls.c:
863 * mbedtls_ssl_session_init() and mbedtls_ssl_session_free()
864 * mbedtls_ssl_session_save() and ssl_session_load()
865 * ssl_session_copy()
866 */
867 struct mbedtls_ssl_session
868 {
869 #if defined(MBEDTLS_HAVE_TIME)
870 mbedtls_time_t start;
871 #endif
872 int ciphersuite;
873 int compression;
874 size_t id_len;
875 unsigned char id[32];
876 unsigned char master[48];
878 #if defined(MBEDTLS_X509_CRT_PARSE_C)
879 #if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
880 mbedtls_x509_crt *peer_cert;
881 #else /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
882
884 unsigned char *peer_cert_digest;
885 size_t peer_cert_digest_len;
886 mbedtls_md_type_t peer_cert_digest_type;
887 #endif /* !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
888 #endif /* MBEDTLS_X509_CRT_PARSE_C */
889 uint32_t verify_result;
891 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
892 unsigned char *ticket;
893 size_t ticket_len;
894 uint32_t ticket_lifetime;
895 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
896
897 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
898 unsigned char mfl_code;
899 #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
900
901 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
902 int trunc_hmac;
903 #endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
904
905 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
906 int encrypt_then_mac;
907 #endif
908 };
909
913 struct mbedtls_ssl_config
914 {
915 /* Group items by size (largest first) to minimize padding overhead */
916
917 /*
918 * Pointers
919 */
920
921 const int *ciphersuite_list[4];
924 void (*f_dbg)(void *, int, const char *, int, const char *);
925 void *p_dbg;
928 int (*f_rng)(void *, unsigned char *, size_t);
929 void *p_rng;
932 int (*f_get_cache)(void *, mbedtls_ssl_session *);
934 int (*f_set_cache)(void *, const mbedtls_ssl_session *);
935 void *p_cache;
937 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
938
939 int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
940 void *p_sni;
941 #endif
942
943 #if defined(MBEDTLS_X509_CRT_PARSE_C)
944
945 int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *);
946 void *p_vrfy;
947 #endif
948
949 #if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
950
951 int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
952 void *p_psk;
953 #endif
954
955 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
956
957 int (*f_cookie_write)( void *, unsigned char **, unsigned char *,
958 const unsigned char *, size_t );
960 int (*f_cookie_check)( void *, const unsigned char *, size_t,
961 const unsigned char *, size_t );
962 void *p_cookie;
963 #endif
964
965 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
966
967 int (*f_ticket_write)( void *, const mbedtls_ssl_session *,
968 unsigned char *, const unsigned char *, size_t *, uint32_t * );
970 int (*f_ticket_parse)( void *, mbedtls_ssl_session *, unsigned char *, size_t);
971 void *p_ticket;
972 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */
973
974 #if defined(MBEDTLS_SSL_EXPORT_KEYS)
975
976 int (*f_export_keys)( void *, const unsigned char *,
977 const unsigned char *, size_t, size_t, size_t );
980 int (*f_export_keys_ext)( void *, const unsigned char *,
981 const unsigned char *, size_t, size_t, size_t,
982 const unsigned char[32], const unsigned char[32],
983 mbedtls_tls_prf_types );
984 void *p_export_keys;
985 #endif
986
987 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
988 size_t cid_len;
989 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
990
991 #if defined(MBEDTLS_X509_CRT_PARSE_C)
992 const mbedtls_x509_crt_profile *cert_profile;
993 mbedtls_ssl_key_cert *key_cert;
994 mbedtls_x509_crt *ca_chain;
995 mbedtls_x509_crl *ca_crl;
996 #if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
997 mbedtls_x509_crt_ca_cb_t f_ca_cb;
998 void *p_ca_cb;
999 #endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
1000 #endif /* MBEDTLS_X509_CRT_PARSE_C */
1001
1002 #if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
1003 #if defined(MBEDTLS_X509_CRT_PARSE_C)
1004 mbedtls_ssl_async_sign_t *f_async_sign_start;
1005 mbedtls_ssl_async_decrypt_t *f_async_decrypt_start;
1006 #endif /* MBEDTLS_X509_CRT_PARSE_C */
1007 mbedtls_ssl_async_resume_t *f_async_resume;
1008 mbedtls_ssl_async_cancel_t *f_async_cancel;
1009 void *p_async_config_data;
1010 #endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
1011
1012 #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
1013 const int *sig_hashes;
1014 #endif
1015
1016 #if defined(MBEDTLS_ECP_C)
1017 const mbedtls_ecp_group_id *curve_list;
1018 #endif
1019
1020 #if defined(MBEDTLS_DHM_C)
1021 mbedtls_mpi dhm_P;
1022 mbedtls_mpi dhm_G;
1023 #endif
1024
1025 #if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
1026
1027 #if defined(MBEDTLS_USE_PSA_CRYPTO)
1028 psa_key_handle_t psk_opaque;
1033 #endif /* MBEDTLS_USE_PSA_CRYPTO */
1034
1035 unsigned char *psk;
1039 size_t psk_len;
1045 unsigned char *psk_identity;
1050 size_t psk_identity_len;
1056 #endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */
1057
1058 #if defined(MBEDTLS_SSL_ALPN)
1059 const char **alpn_list;
1060 #endif
1061
1062 /*
1063 * Numerical settings (int then char)
1064 */
1065
1066 uint32_t read_timeout;
1068 #if defined(MBEDTLS_SSL_PROTO_DTLS)
1069 uint32_t hs_timeout_min;
1071 uint32_t hs_timeout_max;
1073 #endif
1074
1075 #if defined(MBEDTLS_SSL_RENEGOTIATION)
1076 int renego_max_records;
1077 unsigned char renego_period[8];
1079 #endif
1080
1081 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
1082 unsigned int badmac_limit;
1083 #endif
1084
1085 #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
1086 unsigned int dhm_min_bitlen;
1087 #endif
1088
1089 unsigned char max_major_ver;
1090 unsigned char max_minor_ver;
1091 unsigned char min_major_ver;
1092 unsigned char min_minor_ver;
1094 /*
1095 * Flags (bitfields)
1096 */
1097
1098 unsigned int endpoint : 1;
1099 unsigned int transport : 1;
1100 unsigned int authmode : 2;
1101 /* needed even with renego disabled for LEGACY_BREAK_HANDSHAKE */
1102 unsigned int allow_legacy_renegotiation : 2 ;
1103 #if defined(MBEDTLS_ARC4_C)
1104 unsigned int arc4_disabled : 1;
1105 #endif
1106 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
1107 unsigned int mfl_code : 3;
1108 #endif
1109 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
1110 unsigned int encrypt_then_mac : 1 ;
1111 #endif
1112 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
1113 unsigned int extended_ms : 1;
1114 #endif
1115 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
1116 unsigned int anti_replay : 1;
1117 #endif
1118 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
1119 unsigned int cbc_record_splitting : 1;
1120 #endif
1121 #if defined(MBEDTLS_SSL_RENEGOTIATION)
1122 unsigned int disable_renegotiation : 1;
1123 #endif
1124 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
1125 unsigned int trunc_hmac : 1;
1126 #endif
1127 #if defined(MBEDTLS_SSL_SESSION_TICKETS)
1128 unsigned int session_tickets : 1;
1129 #endif
1130 #if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)
1131 unsigned int fallback : 1;
1132 #endif
1133 #if defined(MBEDTLS_SSL_SRV_C)
1134 unsigned int cert_req_ca_list : 1;
1136 #endif
1137 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
1138 unsigned int ignore_unexpected_cid : 1;
1141 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
1142 };
1143
1144
1145 struct mbedtls_ssl_context
1146 {
1147 const mbedtls_ssl_config *conf;
1149 /*
1150 * Miscellaneous
1151 */
1152 int state;
1153 #if defined(MBEDTLS_SSL_RENEGOTIATION)
1154 int renego_status;
1155 int renego_records_seen;
1158 #endif /* MBEDTLS_SSL_RENEGOTIATION */
1159
1160 int major_ver;
1161 int minor_ver;
1163 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
1164 unsigned badmac_seen;
1165 #endif /* MBEDTLS_SSL_DTLS_BADMAC_LIMIT */
1166
1167 #if defined(MBEDTLS_X509_CRT_PARSE_C)
1168
1169 int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *);
1170 void *p_vrfy;
1171 #endif
1172
1173 mbedtls_ssl_send_t *f_send;
1174 mbedtls_ssl_recv_t *f_recv;
1175 mbedtls_ssl_recv_timeout_t *f_recv_timeout;
1178 void *p_bio;
1180 /*
1181 * Session layer
1182 */
1183 mbedtls_ssl_session *session_in;
1184 mbedtls_ssl_session *session_out;
1185 mbedtls_ssl_session *session;
1186 mbedtls_ssl_session *session_negotiate;
1188 mbedtls_ssl_handshake_params *handshake;
1191 /*
1192 * Record layer transformations
1193 */
1194 mbedtls_ssl_transform *transform_in;
1195 mbedtls_ssl_transform *transform_out;
1196 mbedtls_ssl_transform *transform;
1197 mbedtls_ssl_transform *transform_negotiate;
1199 /*
1200 * Timers
1201 */
1202 void *p_timer;
1204 mbedtls_ssl_set_timer_t *f_set_timer;
1205 mbedtls_ssl_get_timer_t *f_get_timer;
1207 /*
1208 * Record layer (incoming data)
1209 */
1210 unsigned char *in_buf;
1211 unsigned char *in_ctr;
1214 unsigned char *in_hdr;
1215 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
1216 unsigned char *in_cid;
1218 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
1219 unsigned char *in_len;
1220 unsigned char *in_iv;
1221 unsigned char *in_msg;
1222 unsigned char *in_offt;
1224 int in_msgtype;
1225 size_t in_msglen;
1226 size_t in_left;
1227 #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
1228 size_t in_buf_len;
1229 #endif
1230 #if defined(MBEDTLS_SSL_PROTO_DTLS)
1231 uint16_t in_epoch;
1232 size_t next_record_offset;
1234 #endif /* MBEDTLS_SSL_PROTO_DTLS */
1235 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
1236 uint64_t in_window_top;
1237 uint64_t in_window;
1238 #endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */
1239
1240 size_t in_hslen;
1242 int nb_zero;
1244 int keep_current_message;
1247 #if defined(MBEDTLS_SSL_PROTO_DTLS)
1248 uint8_t disable_datagram_packing;
1250 #endif /* MBEDTLS_SSL_PROTO_DTLS */
1251
1252 /*
1253 * Record layer (outgoing data)
1254 */
1255 unsigned char *out_buf;
1256 unsigned char *out_ctr;
1257 unsigned char *out_hdr;
1258 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
1259 unsigned char *out_cid;
1261 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
1262 unsigned char *out_len;
1263 unsigned char *out_iv;
1264 unsigned char *out_msg;
1266 int out_msgtype;
1267 size_t out_msglen;
1268 size_t out_left;
1269 #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
1270 size_t out_buf_len;
1271 #endif
1272
1273 unsigned char cur_out_ctr[8];
1275 #if defined(MBEDTLS_SSL_PROTO_DTLS)
1276 uint16_t mtu;
1277 #endif /* MBEDTLS_SSL_PROTO_DTLS */
1278
1279 #if defined(MBEDTLS_ZLIB_SUPPORT)
1280 unsigned char *compress_buf;
1281 #endif /* MBEDTLS_ZLIB_SUPPORT */
1282 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
1283 signed char split_done;
1284 #endif /* MBEDTLS_SSL_CBC_RECORD_SPLITTING */
1285
1286 /*
1287 * PKI layer
1288 */
1289 int client_auth;
1291 /*
1292 * User settings
1293 */
1294 #if defined(MBEDTLS_X509_CRT_PARSE_C)
1295 char *hostname;
1297 #endif /* MBEDTLS_X509_CRT_PARSE_C */
1298
1299 #if defined(MBEDTLS_SSL_ALPN)
1300 const char *alpn_chosen;
1301 #endif /* MBEDTLS_SSL_ALPN */
1302
1303 /*
1304 * Information for DTLS hello verify
1305 */
1306 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
1307 unsigned char *cli_id;
1308 size_t cli_id_len;
1309 #endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY && MBEDTLS_SSL_SRV_C */
1310
1311 /*
1312 * Secure renegotiation
1313 */
1314 /* needed to know when to send extension on server */
1315 int secure_renegotiation;
1317 #if defined(MBEDTLS_SSL_RENEGOTIATION)
1318 size_t verify_data_len;
1319 char own_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN];
1320 char peer_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN];
1321 #endif /* MBEDTLS_SSL_RENEGOTIATION */
1322
1323 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
1324 /* CID configuration to use in subsequent handshakes. */
1325
1330 unsigned char own_cid[ MBEDTLS_SSL_CID_IN_LEN_MAX ];
1331 uint8_t own_cid_len;
1332 uint8_t negotiate_cid;
1336 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
1337 };
1338
1339 #if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
1340
1341 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
1342
1343 #define MBEDTLS_SSL_CHANNEL_OUTBOUND MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( 0 )
1344 #define MBEDTLS_SSL_CHANNEL_INBOUND MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( 1 )
1345
1346 #if defined(MBEDTLS_DEPRECATED_WARNING)
1347 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
1348 #else
1349 #define MBEDTLS_DEPRECATED
1350 #endif /* MBEDTLS_DEPRECATED_WARNING */
1351
1352 MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_init)(
1353 mbedtls_ssl_context *ssl,
1354 const unsigned char *key_enc, const unsigned char *key_dec,
1355 size_t keylen,
1356 const unsigned char *iv_enc, const unsigned char *iv_dec,
1357 size_t ivlen,
1358 const unsigned char *mac_enc, const unsigned char *mac_dec,
1359 size_t maclen);
1360 MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_activate)(
1361 mbedtls_ssl_context *ssl,
1362 int direction );
1363 MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_reset)(
1364 mbedtls_ssl_context *ssl );
1365 MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_write)(
1366 mbedtls_ssl_context *ssl );
1367 MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_read)(
1368 mbedtls_ssl_context *ssl );
1369 MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_finish)(
1370 mbedtls_ssl_context *ssl );
1371
1372 #undef MBEDTLS_DEPRECATED
1373 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
1374
1375 #endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
1376
1385 const char *mbedtls_ssl_get_ciphersuite_name( const int ciphersuite_id );
1386
1395 int mbedtls_ssl_get_ciphersuite_id( const char *ciphersuite_name );
1396
1404 void mbedtls_ssl_init( mbedtls_ssl_context *ssl );
1405
1426 int mbedtls_ssl_setup( mbedtls_ssl_context *ssl,
1427 const mbedtls_ssl_config *conf );
1428
1439 int mbedtls_ssl_session_reset( mbedtls_ssl_context *ssl );
1440
1447 void mbedtls_ssl_conf_endpoint( mbedtls_ssl_config *conf, int endpoint );
1448
1463 void mbedtls_ssl_conf_transport( mbedtls_ssl_config *conf, int transport );
1464
1491 void mbedtls_ssl_conf_authmode( mbedtls_ssl_config *conf, int authmode );
1492
1493 #if defined(MBEDTLS_X509_CRT_PARSE_C)
1494
1509 void mbedtls_ssl_conf_verify( mbedtls_ssl_config *conf,
1510 int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
1511 void *p_vrfy );
1512 #endif /* MBEDTLS_X509_CRT_PARSE_C */
1513
1521 void mbedtls_ssl_conf_rng( mbedtls_ssl_config *conf,
1522 int (*f_rng)(void *, unsigned char *, size_t),
1523 void *p_rng );
1524
1539 void mbedtls_ssl_conf_dbg( mbedtls_ssl_config *conf,
1540 void (*f_dbg)(void *, int, const char *, int, const char *),
1541 void *p_dbg );
1542
1573 void mbedtls_ssl_set_bio( mbedtls_ssl_context *ssl,
1574 void *p_bio,
1575 mbedtls_ssl_send_t *f_send,
1576 mbedtls_ssl_recv_t *f_recv,
1577 mbedtls_ssl_recv_timeout_t *f_recv_timeout );
1578
1579 #if defined(MBEDTLS_SSL_PROTO_DTLS)
1580
1581 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
1582
1583
1667 int mbedtls_ssl_set_cid( mbedtls_ssl_context *ssl,
1668 int enable,
1669 unsigned char const *own_cid,
1670 size_t own_cid_len );
1671
1709 int mbedtls_ssl_get_peer_cid( mbedtls_ssl_context *ssl,
1710 int *enabled,
1711 unsigned char peer_cid[ MBEDTLS_SSL_CID_OUT_LEN_MAX ],
1712 size_t *peer_cid_len );
1713
1714 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
1715
1758 void mbedtls_ssl_set_mtu( mbedtls_ssl_context *ssl, uint16_t mtu );
1759 #endif /* MBEDTLS_SSL_PROTO_DTLS */
1760
1761 #if defined(MBEDTLS_X509_CRT_PARSE_C)
1762
1780 void mbedtls_ssl_set_verify( mbedtls_ssl_context *ssl,
1781 int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
1782 void *p_vrfy );
1783 #endif /* MBEDTLS_X509_CRT_PARSE_C */
1784
1801 void mbedtls_ssl_conf_read_timeout( mbedtls_ssl_config *conf, uint32_t timeout );
1802
1803 #if defined(MBEDTLS_SSL_RECORD_CHECKING)
1804
1848 int mbedtls_ssl_check_record( mbedtls_ssl_context const *ssl,
1849 unsigned char *buf,
1850 size_t buflen );
1851 #endif /* MBEDTLS_SSL_RECORD_CHECKING */
1852
1873 void mbedtls_ssl_set_timer_cb( mbedtls_ssl_context *ssl,
1874 void *p_timer,
1875 mbedtls_ssl_set_timer_t *f_set_timer,
1876 mbedtls_ssl_get_timer_t *f_get_timer );
1877
1897 typedef int mbedtls_ssl_ticket_write_t( void *p_ticket,
1898 const mbedtls_ssl_session *session,
1899 unsigned char *start,
1900 const unsigned char *end,
1901 size_t *tlen,
1902 uint32_t *lifetime );
1903
1904 #if defined(MBEDTLS_SSL_EXPORT_KEYS)
1905
1925 typedef int mbedtls_ssl_export_keys_t( void *p_expkey,
1926 const unsigned char *ms,
1927 const unsigned char *kb,
1928 size_t maclen,
1929 size_t keylen,
1930 size_t ivlen );
1931
1957 typedef int mbedtls_ssl_export_keys_ext_t( void *p_expkey,
1958 const unsigned char *ms,
1959 const unsigned char *kb,
1960 size_t maclen,
1961 size_t keylen,
1962 size_t ivlen,
1963 const unsigned char client_random[32],
1964 const unsigned char server_random[32],
1965 mbedtls_tls_prf_types tls_prf_type );
1966 #endif /* MBEDTLS_SSL_EXPORT_KEYS */
1967
1991 typedef int mbedtls_ssl_ticket_parse_t( void *p_ticket,
1992 mbedtls_ssl_session *session,
1993 unsigned char *buf,
1994 size_t len );
1995
1996 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
1997
2011 void mbedtls_ssl_conf_session_tickets_cb( mbedtls_ssl_config *conf,
2012 mbedtls_ssl_ticket_write_t *f_ticket_write,
2013 mbedtls_ssl_ticket_parse_t *f_ticket_parse,
2014 void *p_ticket );
2015 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */
2016
2017 #if defined(MBEDTLS_SSL_EXPORT_KEYS)
2018
2028 void mbedtls_ssl_conf_export_keys_cb( mbedtls_ssl_config *conf,
2029 mbedtls_ssl_export_keys_t *f_export_keys,
2030 void *p_export_keys );
2031
2042 void mbedtls_ssl_conf_export_keys_ext_cb( mbedtls_ssl_config *conf,
2043 mbedtls_ssl_export_keys_ext_t *f_export_keys_ext,
2044 void *p_export_keys );
2045 #endif /* MBEDTLS_SSL_EXPORT_KEYS */
2046
2047 #if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
2048
2078 void mbedtls_ssl_conf_async_private_cb( mbedtls_ssl_config *conf,
2079 mbedtls_ssl_async_sign_t *f_async_sign,
2080 mbedtls_ssl_async_decrypt_t *f_async_decrypt,
2081 mbedtls_ssl_async_resume_t *f_async_resume,
2082 mbedtls_ssl_async_cancel_t *f_async_cancel,
2083 void *config_data );
2084
2093 void *mbedtls_ssl_conf_get_async_config_data( const mbedtls_ssl_config *conf );
2094
2109 void *mbedtls_ssl_get_async_operation_data( const mbedtls_ssl_context *ssl );
2110
2122 void mbedtls_ssl_set_async_operation_data( mbedtls_ssl_context *ssl,
2123 void *ctx );
2124 #endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
2125
2140 typedef int mbedtls_ssl_cookie_write_t( void *ctx,
2141 unsigned char **p, unsigned char *end,
2142 const unsigned char *info, size_t ilen );
2143
2157 typedef int mbedtls_ssl_cookie_check_t( void *ctx,
2158 const unsigned char *cookie, size_t clen,
2159 const unsigned char *info, size_t ilen );
2160
2161 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
2162
2190 void mbedtls_ssl_conf_dtls_cookies( mbedtls_ssl_config *conf,
2191 mbedtls_ssl_cookie_write_t *f_cookie_write,
2192 mbedtls_ssl_cookie_check_t *f_cookie_check,
2193 void *p_cookie );
2194
2214 int mbedtls_ssl_set_client_transport_id( mbedtls_ssl_context *ssl,
2215 const unsigned char *info,
2216 size_t ilen );
2217
2218 #endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY && MBEDTLS_SSL_SRV_C */
2219
2220 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
2221
2236 void mbedtls_ssl_conf_dtls_anti_replay( mbedtls_ssl_config *conf, char mode );
2237 #endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */
2238
2239 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
2240
2263 void mbedtls_ssl_conf_dtls_badmac_limit( mbedtls_ssl_config *conf, unsigned limit );
2264 #endif /* MBEDTLS_SSL_DTLS_BADMAC_LIMIT */
2265
2266 #if defined(MBEDTLS_SSL_PROTO_DTLS)
2267
2296 void mbedtls_ssl_set_datagram_packing( mbedtls_ssl_context *ssl,
2297 unsigned allow_packing );
2298
2330 void mbedtls_ssl_conf_handshake_timeout( mbedtls_ssl_config *conf, uint32_t min, uint32_t max );
2331 #endif /* MBEDTLS_SSL_PROTO_DTLS */
2332
2333 #if defined(MBEDTLS_SSL_SRV_C)
2334
2371 void mbedtls_ssl_conf_session_cache( mbedtls_ssl_config *conf,
2372 void *p_cache,
2373 int (*f_get_cache)(void *, mbedtls_ssl_session *),
2374 int (*f_set_cache)(void *, const mbedtls_ssl_session *) );
2375 #endif /* MBEDTLS_SSL_SRV_C */
2376
2377 #if defined(MBEDTLS_SSL_CLI_C)
2378
2392 int mbedtls_ssl_set_session( mbedtls_ssl_context *ssl, const mbedtls_ssl_session *session );
2393 #endif /* MBEDTLS_SSL_CLI_C */
2394
2427 int mbedtls_ssl_session_load( mbedtls_ssl_session *session,
2428 const unsigned char *buf,
2429 size_t len );
2430
2457 int mbedtls_ssl_session_save( const mbedtls_ssl_session *session,
2458 unsigned char *buf,
2459 size_t buf_len,
2460 size_t *olen );
2461
2477 const mbedtls_ssl_session *mbedtls_ssl_get_session_pointer( const mbedtls_ssl_context *ssl );
2478
2494 void mbedtls_ssl_conf_ciphersuites( mbedtls_ssl_config *conf,
2495 const int *ciphersuites );
2496
2497 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
2498 #define MBEDTLS_SSL_UNEXPECTED_CID_IGNORE 0
2499 #define MBEDTLS_SSL_UNEXPECTED_CID_FAIL 1
2500
2532 int mbedtls_ssl_conf_cid( mbedtls_ssl_config *conf, size_t len,
2533 int ignore_other_cids );
2534 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
2535
2555 void mbedtls_ssl_conf_ciphersuites_for_version( mbedtls_ssl_config *conf,
2556 const int *ciphersuites,
2557 int major, int minor );
2558
2559 #if defined(MBEDTLS_X509_CRT_PARSE_C)
2560
2570 void mbedtls_ssl_conf_cert_profile( mbedtls_ssl_config *conf,
2571 const mbedtls_x509_crt_profile *profile );
2572
2584 void mbedtls_ssl_conf_ca_chain( mbedtls_ssl_config *conf,
2585 mbedtls_x509_crt *ca_chain,
2586 mbedtls_x509_crl *ca_crl );
2587
2588 #if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
2589
2640 void mbedtls_ssl_conf_ca_cb( mbedtls_ssl_config *conf,
2641 mbedtls_x509_crt_ca_cb_t f_ca_cb,
2642 void *p_ca_cb );
2643 #endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
2644
2681 int mbedtls_ssl_conf_own_cert( mbedtls_ssl_config *conf,
2682 mbedtls_x509_crt *own_cert,
2683 mbedtls_pk_context *pk_key );
2684 #endif /* MBEDTLS_X509_CRT_PARSE_C */
2685
2686 #if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
2687
2718 int mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf,
2719 const unsigned char *psk, size_t psk_len,
2720 const unsigned char *psk_identity, size_t psk_identity_len );
2721
2722 #if defined(MBEDTLS_USE_PSA_CRYPTO)
2723
2759 int mbedtls_ssl_conf_psk_opaque( mbedtls_ssl_config *conf,
2760 psa_key_handle_t psk,
2761 const unsigned char *psk_identity,
2762 size_t psk_identity_len );
2763 #endif /* MBEDTLS_USE_PSA_CRYPTO */
2764
2781 int mbedtls_ssl_set_hs_psk( mbedtls_ssl_context *ssl,
2782 const unsigned char *psk, size_t psk_len );
2783
2784 #if defined(MBEDTLS_USE_PSA_CRYPTO)
2785
2805 int mbedtls_ssl_set_hs_psk_opaque( mbedtls_ssl_context *ssl,
2806 psa_key_handle_t psk );
2807 #endif /* MBEDTLS_USE_PSA_CRYPTO */
2808
2847 void mbedtls_ssl_conf_psk_cb( mbedtls_ssl_config *conf,
2848 int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *,
2849 size_t),
2850 void *p_psk );
2851 #endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */
2852
2853 #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_SRV_C)
2854
2855 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
2856
2857 #if defined(MBEDTLS_DEPRECATED_WARNING)
2858 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
2859 #else
2860 #define MBEDTLS_DEPRECATED
2861 #endif
2862
2876 MBEDTLS_DEPRECATED int mbedtls_ssl_conf_dh_param( mbedtls_ssl_config *conf,
2877 const char *dhm_P,
2878 const char *dhm_G );
2879
2880 #endif /* MBEDTLS_DEPRECATED_REMOVED */
2881
2895 int mbedtls_ssl_conf_dh_param_bin( mbedtls_ssl_config *conf,
2896 const unsigned char *dhm_P, size_t P_len,
2897 const unsigned char *dhm_G, size_t G_len );
2898
2908 int mbedtls_ssl_conf_dh_param_ctx( mbedtls_ssl_config *conf, mbedtls_dhm_context *dhm_ctx );
2909 #endif /* MBEDTLS_DHM_C && defined(MBEDTLS_SSL_SRV_C) */
2910
2911 #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
2912
2920 void mbedtls_ssl_conf_dhm_min_bitlen( mbedtls_ssl_config *conf,
2921 unsigned int bitlen );
2922 #endif /* MBEDTLS_DHM_C && MBEDTLS_SSL_CLI_C */
2923
2924 #if defined(MBEDTLS_ECP_C)
2925
2952 void mbedtls_ssl_conf_curves( mbedtls_ssl_config *conf,
2953 const mbedtls_ecp_group_id *curves );
2954 #endif /* MBEDTLS_ECP_C */
2955
2956 #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
2957
2975 void mbedtls_ssl_conf_sig_hashes( mbedtls_ssl_config *conf,
2976 const int *hashes );
2977 #endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
2978
2979 #if defined(MBEDTLS_X509_CRT_PARSE_C)
2980
2998 int mbedtls_ssl_set_hostname( mbedtls_ssl_context *ssl, const char *hostname );
2999 #endif /* MBEDTLS_X509_CRT_PARSE_C */
3000
3001 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
3002
3014 int mbedtls_ssl_set_hs_own_cert( mbedtls_ssl_context *ssl,
3015 mbedtls_x509_crt *own_cert,
3016 mbedtls_pk_context *pk_key );
3017
3029 void mbedtls_ssl_set_hs_ca_chain( mbedtls_ssl_context *ssl,
3030 mbedtls_x509_crt *ca_chain,
3031 mbedtls_x509_crl *ca_crl );
3032
3043 void mbedtls_ssl_set_hs_authmode( mbedtls_ssl_context *ssl,
3044 int authmode );
3045
3069 void mbedtls_ssl_conf_sni( mbedtls_ssl_config *conf,
3070 int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *,
3071 size_t),
3072 void *p_sni );
3073 #endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
3074
3075 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
3076
3093 int mbedtls_ssl_set_hs_ecjpake_password( mbedtls_ssl_context *ssl,
3094 const unsigned char *pw,
3095 size_t pw_len );
3096 #endif /*MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
3097
3098 #if defined(MBEDTLS_SSL_ALPN)
3099
3111 int mbedtls_ssl_conf_alpn_protocols( mbedtls_ssl_config *conf, const char **protos );
3112
3122 const char *mbedtls_ssl_get_alpn_protocol( const mbedtls_ssl_context *ssl );
3123 #endif /* MBEDTLS_SSL_ALPN */
3124
3141 void mbedtls_ssl_conf_max_version( mbedtls_ssl_config *conf, int major, int minor );
3142
3161 void mbedtls_ssl_conf_min_version( mbedtls_ssl_config *conf, int major, int minor );
3162
3163 #if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)
3164
3183 void mbedtls_ssl_conf_fallback( mbedtls_ssl_config *conf, char fallback );
3184 #endif /* MBEDTLS_SSL_FALLBACK_SCSV && MBEDTLS_SSL_CLI_C */
3185
3186 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
3187
3198 void mbedtls_ssl_conf_encrypt_then_mac( mbedtls_ssl_config *conf, char etm );
3199 #endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */
3200
3201 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
3202
3213 void mbedtls_ssl_conf_extended_master_secret( mbedtls_ssl_config *conf, char ems );
3214 #endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */
3215
3216 #if defined(MBEDTLS_ARC4_C)
3217
3232 void mbedtls_ssl_conf_arc4_support( mbedtls_ssl_config *conf, char arc4 );
3233 #endif /* MBEDTLS_ARC4_C */
3234
3235 #if defined(MBEDTLS_SSL_SRV_C)
3236
3245 void mbedtls_ssl_conf_cert_req_ca_list( mbedtls_ssl_config *conf,
3246 char cert_req_ca_list );
3247 #endif /* MBEDTLS_SSL_SRV_C */
3248
3249 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
3250
3284 int mbedtls_ssl_conf_max_frag_len( mbedtls_ssl_config *conf, unsigned char mfl_code );
3285 #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
3286
3287 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
3288
3296 void mbedtls_ssl_conf_truncated_hmac( mbedtls_ssl_config *conf, int truncate );
3297 #endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
3298
3299 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
3300
3311 void mbedtls_ssl_conf_cbc_record_splitting( mbedtls_ssl_config *conf, char split );
3312 #endif /* MBEDTLS_SSL_CBC_RECORD_SPLITTING */
3313
3314 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
3315
3325 void mbedtls_ssl_conf_session_tickets( mbedtls_ssl_config *conf, int use_tickets );
3326 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
3327
3328 #if defined(MBEDTLS_SSL_RENEGOTIATION)
3329
3346 void mbedtls_ssl_conf_renegotiation( mbedtls_ssl_config *conf, int renegotiation );
3347 #endif /* MBEDTLS_SSL_RENEGOTIATION */
3348
3376 void mbedtls_ssl_conf_legacy_renegotiation( mbedtls_ssl_config *conf, int allow_legacy );
3377
3378 #if defined(MBEDTLS_SSL_RENEGOTIATION)
3379
3416 void mbedtls_ssl_conf_renegotiation_enforced( mbedtls_ssl_config *conf, int max_records );
3417
3443 void mbedtls_ssl_conf_renegotiation_period( mbedtls_ssl_config *conf,
3444 const unsigned char period[8] );
3445 #endif /* MBEDTLS_SSL_RENEGOTIATION */
3446
3485 int mbedtls_ssl_check_pending( const mbedtls_ssl_context *ssl );
3486
3502 size_t mbedtls_ssl_get_bytes_avail( const mbedtls_ssl_context *ssl );
3503
3516 uint32_t mbedtls_ssl_get_verify_result( const mbedtls_ssl_context *ssl );
3517
3525 const char *mbedtls_ssl_get_ciphersuite( const mbedtls_ssl_context *ssl );
3526
3534 const char *mbedtls_ssl_get_version( const mbedtls_ssl_context *ssl );
3535
3549 int mbedtls_ssl_get_record_expansion( const mbedtls_ssl_context *ssl );
3550
3551 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
3552
3565 size_t mbedtls_ssl_get_output_max_frag_len( const mbedtls_ssl_context *ssl );
3566
3581 size_t mbedtls_ssl_get_input_max_frag_len( const mbedtls_ssl_context *ssl );
3582
3583 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
3584
3585 #if defined(MBEDTLS_DEPRECATED_WARNING)
3586 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
3587 #else
3588 #define MBEDTLS_DEPRECATED
3589 #endif
3590
3605 MBEDTLS_DEPRECATED size_t mbedtls_ssl_get_max_frag_len(
3606 const mbedtls_ssl_context *ssl );
3607 #endif /* MBEDTLS_DEPRECATED_REMOVED */
3608 #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
3609
3637 int mbedtls_ssl_get_max_out_record_payload( const mbedtls_ssl_context *ssl );
3638
3639 #if defined(MBEDTLS_X509_CRT_PARSE_C)
3640
3670 const mbedtls_x509_crt *mbedtls_ssl_get_peer_cert( const mbedtls_ssl_context *ssl );
3671 #endif /* MBEDTLS_X509_CRT_PARSE_C */
3672
3673 #if defined(MBEDTLS_SSL_CLI_C)
3674
3700 int mbedtls_ssl_get_session( const mbedtls_ssl_context *ssl, mbedtls_ssl_session *session );
3701 #endif /* MBEDTLS_SSL_CLI_C */
3702
3753 int mbedtls_ssl_handshake( mbedtls_ssl_context *ssl );
3754
3775 int mbedtls_ssl_handshake_step( mbedtls_ssl_context *ssl );
3776
3777 #if defined(MBEDTLS_SSL_RENEGOTIATION)
3778
3801 int mbedtls_ssl_renegotiate( mbedtls_ssl_context *ssl );
3802 #endif /* MBEDTLS_SSL_RENEGOTIATION */
3803
3881 int mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len );
3882
3943 int mbedtls_ssl_write( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len );
3944
3961 int mbedtls_ssl_send_alert_message( mbedtls_ssl_context *ssl,
3962 unsigned char level,
3963 unsigned char message );
3977 int mbedtls_ssl_close_notify( mbedtls_ssl_context *ssl );
3978
3984 void mbedtls_ssl_free( mbedtls_ssl_context *ssl );
3985
3986 #if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
3987
4035 int mbedtls_ssl_context_save( mbedtls_ssl_context *ssl,
4036 unsigned char *buf,
4037 size_t buf_len,
4038 size_t *olen );
4039
4105 int mbedtls_ssl_context_load( mbedtls_ssl_context *ssl,
4106 const unsigned char *buf,
4107 size_t len );
4108 #endif /* MBEDTLS_SSL_CONTEXT_SERIALIZATION */
4109
4120 void mbedtls_ssl_config_init( mbedtls_ssl_config *conf );
4121
4137 int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,
4138 int endpoint, int transport, int preset );
4139
4145 void mbedtls_ssl_config_free( mbedtls_ssl_config *conf );
4146
4152 void mbedtls_ssl_session_init( mbedtls_ssl_session *session );
4153
4163 void mbedtls_ssl_session_free( mbedtls_ssl_session *session );
4164
4180 int mbedtls_ssl_tls_prf( const mbedtls_tls_prf_types prf,
4181 const unsigned char *secret, size_t slen,
4182 const char *label,
4183 const unsigned char *random, size_t rlen,
4184 unsigned char *dstbuf, size_t dlen );
4185
4186 #ifdef __cplusplus
4187 }
4188 #endif
4189
4190 #endif /* ssl.h */
mbedtls_ssl_config::dhm_min_bitlen
unsigned int dhm_min_bitlen
Definition: ssl.h:1086
mbedtls_ssl_premaster_secret::_pms_dhm
unsigned char _pms_dhm[MBEDTLS_MPI_MAX_SIZE]
Definition: ssl.h:428
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:1263
mbedtls_ssl_states
mbedtls_ssl_states
Definition: ssl.h:465
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:484
MBEDTLS_SSL_CID_OUT_LEN_MAX
#define MBEDTLS_SSL_CID_OUT_LEN_MAX
Definition: ssl.h:277
MBEDTLS_SSL_FLUSH_BUFFERS
@ MBEDTLS_SSL_FLUSH_BUFFERS
Definition: ssl.h:480
MBEDTLS_SSL_HANDSHAKE_WRAPUP
@ MBEDTLS_SSL_HANDSHAKE_WRAPUP
Definition: ssl.h:481
mbedtls_ssl_context::out_len
unsigned char * out_len
Definition: ssl.h:1262
mbedtls_ssl_key_cert
struct mbedtls_ssl_key_cert mbedtls_ssl_key_cert
Definition: ssl.h:619
mbedtls_ssl_context::state
int state
Definition: ssl.h:1152
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:935
mbedtls_ssl_session::ciphersuite
int ciphersuite
Definition: ssl.h:872
mbedtls_ssl_config::p_vrfy
void * p_vrfy
Definition: ssl.h:946
mbedtls_ssl_session::master
unsigned char master[48]
Definition: ssl.h:876
mbedtls_ssl_context_save
int mbedtls_ssl_context_save(mbedtls_ssl_context *ssl, unsigned char *buf, size_t buf_len, size_t *olen)
Save an active connection as serialized data in a buffer. This allows the freeing or re-using of the ...
mbedtls_md_type_t
mbedtls_md_type_t
Supported message digests.
Definition: md.h:58
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:893
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:952
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:1897
mbedtls_x509_crt_ca_cb_t
int(* mbedtls_x509_crt_ca_cb_t)(void *p_ctx, mbedtls_x509_crt const *child, mbedtls_x509_crt **candidate_cas)
The type of trusted certificate callbacks.
Definition: x509_crt.h:721
mbedtls_ssl_context::f_set_timer
mbedtls_ssl_set_timer_t * f_set_timer
Definition: ssl.h:1204
mbedtls_ssl_context::in_hslen
size_t in_hslen
Definition: ssl.h:1240
MBEDTLS_SSL_SERVER_HELLO
@ MBEDTLS_SSL_SERVER_HELLO
Definition: ssl.h:468
mbedtls_ssl_flight_item
struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item
Definition: ssl.h:622
MBEDTLS_SSL_VERIFY_DATA_MAX_LEN
#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN
Definition: ssl.h:296
mbedtls_ssl_premaster_secret
Definition: ssl.h:423
mbedtls_ssl_context::next_record_offset
size_t next_record_offset
Definition: ssl.h:1232
mbedtls_ssl_session::trunc_hmac
int trunc_hmac
Definition: ssl.h:902
MBEDTLS_SSL_SERVER_CERTIFICATE
@ MBEDTLS_SSL_SERVER_CERTIFICATE
Definition: ssl.h:469
mbedtls_ssl_config::max_major_ver
unsigned char max_major_ver
Definition: ssl.h:1089
mbedtls_mpi
MPI structure.
Definition: bignum.h:187
x509_crl.h
X.509 certificate revocation list parsing.
mbedtls_ssl_config::read_timeout
uint32_t read_timeout
Definition: ssl.h:1066
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:540
mbedtls_ssl_context::in_epoch
uint16_t in_epoch
Definition: ssl.h:1231
MBEDTLS_SSL_CLIENT_CERTIFICATE
@ MBEDTLS_SSL_CLIENT_CERTIFICATE
Definition: ssl.h:473
mbedtls_ssl_context::transform
mbedtls_ssl_transform * transform
Definition: ssl.h:1196
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:873
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:992
mbedtls_ssl_context::session_out
mbedtls_ssl_session * session_out
Definition: ssl.h:1184
mbedtls_ssl_context::f_send
mbedtls_ssl_send_t * f_send
Definition: ssl.h:1173
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:1268
mbedtls_ssl_session
Definition: ssl.h:868
mbedtls_ssl_context::in_msg
unsigned char * in_msg
Definition: ssl.h:1221
mbedtls_ssl_export_keys_ext_t
int mbedtls_ssl_export_keys_ext_t(void *p_expkey, const unsigned char *ms, const unsigned char *kb, size_t maclen, size_t keylen, size_t ivlen, const unsigned char client_random[32], const unsigned char server_random[32], mbedtls_tls_prf_types tls_prf_type)
Callback type: Export key block, master secret, handshake randbytes and the tls_prf function used to ...
Definition: ssl.h:1957
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:994
mbedtls_ssl_context::nb_zero
int nb_zero
Definition: ssl.h:1242
mbedtls_ssl_context::split_done
signed char split_done
Definition: ssl.h:1283
mbedtls_ssl_config::p_sni
void * p_sni
Definition: ssl.h:940
MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET
@ MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET
Definition: ssl.h:483
mbedtls_ssl_premaster_secret::_pms_rsa
unsigned char _pms_rsa[48]
Definition: ssl.h:425
mbedtls_ssl_config::max_minor_ver
unsigned char max_minor_ver
Definition: ssl.h:1090
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:970
ecdh.h
This file contains ECDH definitions and functions.
mbedtls_ssl_config::psk_len
size_t psk_len
Definition: ssl.h:1039
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:188
mbedtls_ssl_context::cli_id_len
size_t cli_id_len
Definition: ssl.h:1308
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:482
MBEDTLS_SSL_TLS_PRF_NONE
@ MBEDTLS_SSL_TLS_PRF_NONE
Definition: ssl.h:493
MBEDTLS_SSL_SERVER_KEY_EXCHANGE
@ MBEDTLS_SSL_SERVER_KEY_EXCHANGE
Definition: ssl.h:470
mbedtls_ssl_config::badmac_limit
unsigned int badmac_limit
Definition: ssl.h:1082
MBEDTLS_SSL_CERTIFICATE_REQUEST
@ MBEDTLS_SSL_CERTIFICATE_REQUEST
Definition: ssl.h:471
MBEDTLS_SSL_TLS_PRF_SHA384
@ MBEDTLS_SSL_TLS_PRF_SHA384
Definition: ssl.h:496
mbedtls_ssl_config::curve_list
const mbedtls_ecp_group_id * curve_list
Definition: ssl.h:1017
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:592
mbedtls_ssl_config::f_vrfy
int(* f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *)
Definition: ssl.h:945
mbedtls_time_t
time_t mbedtls_time_t
Definition: platform_time.h:53
mbedtls_ssl_config::f_rng
int(* f_rng)(void *, unsigned char *, size_t)
Definition: ssl.h:928
mbedtls_dhm_context
The DHM context structure.
Definition: dhm.h:103
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:1128
mbedtls_ssl_config::dhm_P
mbedtls_mpi dhm_P
Definition: ssl.h:1021
mbedtls_x509_crl
Definition: x509_crl.h:71
MBEDTLS_PSK_MAX_LEN
#define MBEDTLS_PSK_MAX_LEN
Definition: ssl.h:418
MBEDTLS_SSL_SERVER_HELLO_DONE
@ MBEDTLS_SSL_SERVER_HELLO_DONE
Definition: ssl.h:472
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:1300
mbedtls_ssl_context::in_offt
unsigned char * in_offt
Definition: ssl.h:1222
mbedtls_ssl_session_load
int mbedtls_ssl_session_load(mbedtls_ssl_session *session, const unsigned char *buf, size_t len)
Load serialized session data into a session structure. On client, this can be used for loading saved ...
mbedtls_ssl_session::peer_cert
mbedtls_x509_crt * peer_cert
Definition: ssl.h:880
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:1195
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::f_export_keys_ext
int(* f_export_keys_ext)(void *, const unsigned char *, const unsigned char *, size_t, size_t, size_t, const unsigned char[32], const unsigned char[32], mbedtls_tls_prf_types)
Definition: ssl.h:980
mbedtls_ssl_config::psk_identity_len
size_t psk_identity_len
Definition: ssl.h:1050
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:1991
mbedtls_ssl_context::p_bio
void * p_bio
Definition: ssl.h:1178
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:517
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:984
mbedtls_ssl_context::renego_status
int renego_status
Definition: ssl.h:1154
mbedtls_ssl_config::f_get_cache
int(* f_get_cache)(void *, mbedtls_ssl_session *)
Definition: ssl.h:932
mbedtls_ssl_context::mtu
uint16_t mtu
Definition: ssl.h:1276
mbedtls_ssl_context::in_msgtype
int in_msgtype
Definition: ssl.h:1224
mbedtls_ssl_config::hs_timeout_max
uint32_t hs_timeout_max
Definition: ssl.h:1071
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:1197
mbedtls_ssl_config::p_dbg
void * p_dbg
Definition: ssl.h:925
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_context_load
int mbedtls_ssl_context_load(mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len)
Load serialized connection data to an SSL context.
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:1236
mbedtls_ssl_tls_prf
int mbedtls_ssl_tls_prf(const mbedtls_tls_prf_types prf, const unsigned char *secret, size_t slen, const char *label, const unsigned char *random, size_t rlen, unsigned char *dstbuf, size_t dlen)
TLS-PRF function for key derivation.
mbedtls_ssl_config::min_minor_ver
unsigned char min_minor_ver
Definition: ssl.h:1092
mbedtls_ssl_context::out_msglen
size_t out_msglen
Definition: ssl.h:1267
mbedtls_ssl_config::cert_req_ca_list
unsigned int cert_req_ca_list
Definition: ssl.h:1134
mbedtls_ssl_context::f_get_timer
mbedtls_ssl_get_timer_t * f_get_timer
Definition: ssl.h:1205
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:892
mbedtls_ssl_config::dhm_G
mbedtls_mpi dhm_G
Definition: ssl.h:1022
mbedtls_ssl_context::f_recv
mbedtls_ssl_recv_t * f_recv
Definition: ssl.h:1174
mbedtls_ssl_config::sig_hashes
const int * sig_hashes
Definition: ssl.h:1013
mbedtls_ssl_config::key_cert
mbedtls_ssl_key_cert * key_cert
Definition: ssl.h:993
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:1226
mbedtls_ssl_config::mfl_code
unsigned int mfl_code
Definition: ssl.h:1107
mbedtls_ssl_premaster_secret::_pms_ecdh
unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]
Definition: ssl.h:434
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:1160
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_context::p_vrfy
void * p_vrfy
Definition: ssl.h:1170
mbedtls_ssl_close_notify
int mbedtls_ssl_close_notify(mbedtls_ssl_context *ssl)
Notify the peer that the connection is being closed.
MBEDTLS_SSL_TLS_PRF_SSL3
@ MBEDTLS_SSL_TLS_PRF_SSL3
Definition: ssl.h:494
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_get_output_max_frag_len
size_t mbedtls_ssl_get_output_max_frag_len(const mbedtls_ssl_context *ssl)
Return the maximum fragment length (payload, in bytes) for the output buffer. For the client,...
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:55
mbedtls_ssl_config::trunc_hmac
unsigned int trunc_hmac
Definition: ssl.h:1125
MBEDTLS_SSL_CLIENT_KEY_EXCHANGE
@ MBEDTLS_SSL_CLIENT_KEY_EXCHANGE
Definition: ssl.h:474
bignum.h
Multi-precision integer library.
mbedtls_ssl_config::encrypt_then_mac
unsigned int encrypt_then_mac
Definition: ssl.h:1110
mbedtls_ssl_premaster_secret::_pms_dhe_psk
unsigned char _pms_dhe_psk[4+MBEDTLS_MPI_MAX_SIZE+MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:441
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:1319
mbedtls_ssl_context::p_timer
void * p_timer
Definition: ssl.h:1202
mbedtls_ssl_context
Definition: ssl.h:1146
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:1164
mbedtls_ssl_context::in_window
uint64_t in_window
Definition: ssl.h:1237
crypto.h
Platform Security Architecture cryptography module.
mbedtls_ecp_group_id
mbedtls_ecp_group_id
Definition: ecp.h:78
mbedtls_ssl_config::anti_replay
unsigned int anti_replay
Definition: ssl.h:1116
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:1925
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:479
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:1035
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:478
mbedtls_ssl_config::allow_legacy_renegotiation
unsigned int allow_legacy_renegotiation
Definition: ssl.h:1102
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:1185
mbedtls_ssl_config::f_cookie_write
int(* f_cookie_write)(void *, unsigned char **, unsigned char *, const unsigned char *, size_t)
Definition: ssl.h:957
mbedtls_ssl_session::ticket_lifetime
uint32_t ticket_lifetime
Definition: ssl.h:894
mbedtls_ssl_context::cur_out_ctr
unsigned char cur_out_ctr[8]
Definition: ssl.h:1273
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:1122
mbedtls_ssl_check_record
int mbedtls_ssl_check_record(mbedtls_ssl_context const *ssl, unsigned char *buf, size_t buflen)
Check whether a buffer contains a valid and authentic record that has not been seen before....
mbedtls_ssl_config::min_major_ver
unsigned char min_major_ver
Definition: ssl.h:1091
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:1147
mbedtls_ssl_set_verify
void mbedtls_ssl_set_verify(mbedtls_ssl_context *ssl, int(*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *), void *p_vrfy)
Set a connection-specific verification callback (optional).
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:1069
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_ssl_context::f_vrfy
int(* f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *)
Definition: ssl.h:1169
mbedtls_x509_crt_profile
Definition: x509_crt.h:162
mbedtls_ssl_premaster_secret::_pms_psk
unsigned char _pms_psk[4+2 *MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:437
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:914
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:1210
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:1104
mbedtls_ssl_context::out_msg
unsigned char * out_msg
Definition: ssl.h:1264
mbedtls_ssl_context::verify_data_len
size_t verify_data_len
Definition: ssl.h:1318
mbedtls_ssl_config::f_set_cache
int(* f_set_cache)(void *, const mbedtls_ssl_session *)
Definition: ssl.h:934
MBEDTLS_SSL_HELLO_REQUEST
@ MBEDTLS_SSL_HELLO_REQUEST
Definition: ssl.h:466
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_TLS_PRF_TLS1
@ MBEDTLS_SSL_TLS_PRF_TLS1
Definition: ssl.h:495
mbedtls_ssl_session::encrypt_then_mac
int encrypt_then_mac
Definition: ssl.h:906
mbedtls_ssl_context::hostname
char * hostname
Definition: ssl.h:1295
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_get_input_max_frag_len
size_t mbedtls_ssl_get_input_max_frag_len(const mbedtls_ssl_context *ssl)
Return the maximum fragment length (payload, in bytes) for the input buffer. This is the negotiated m...
mbedtls_ssl_conf_export_keys_ext_cb
void mbedtls_ssl_conf_export_keys_ext_cb(mbedtls_ssl_config *conf, mbedtls_ssl_export_keys_ext_t *f_export_keys_ext, void *p_export_keys)
Configure extended key export callback. (Default: none.)
mbedtls_ssl_transform
struct mbedtls_ssl_transform mbedtls_ssl_transform
Definition: ssl.h:615
mbedtls_ssl_config::endpoint
unsigned int endpoint
Definition: ssl.h:1098
mbedtls_ssl_config::p_rng
void * p_rng
Definition: ssl.h:929
mbedtls_ssl_context::out_ctr
unsigned char * out_ctr
Definition: ssl.h:1256
mbedtls_ssl_premaster_secret::_pms_rsa_psk
unsigned char _pms_rsa_psk[52+MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:444
mbedtls_ssl_get_session_pointer
const mbedtls_ssl_session * mbedtls_ssl_get_session_pointer(const mbedtls_ssl_context *ssl)
Get a pointer to the current session structure, for example to serialize it.
mbedtls_ssl_get_max_frag_len
MBEDTLS_DEPRECATED size_t mbedtls_ssl_get_max_frag_len(const mbedtls_ssl_context *ssl)
This function is a deprecated approach to getting the max fragment length. Its an alias for mbedtls_s...
mbedtls_ssl_config::p_ticket
void * p_ticket
Definition: ssl.h:971
MBEDTLS_SSL_CERTIFICATE_VERIFY
@ MBEDTLS_SSL_CERTIFICATE_VERIFY
Definition: ssl.h:475
mbedtls_ssl_premaster_secret::_pms_ecdhe_psk
unsigned char _pms_ecdhe_psk[4+MBEDTLS_ECP_MAX_BYTES+MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:448
mbedtls_ssl_context::handshake
mbedtls_ssl_handshake_params * handshake
Definition: ssl.h:1188
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:1077
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:1211
mbedtls_ssl_session::verify_result
uint32_t verify_result
Definition: ssl.h:889
mbedtls_ssl_config::ciphersuite_list
const int * ciphersuite_list[4]
Definition: ssl.h:921
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:1131
mbedtls_ssl_context::in_len
unsigned char * in_len
Definition: ssl.h:1219
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:976
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:2140
mbedtls_ssl_context::out_buf
unsigned char * out_buf
Definition: ssl.h:1255
mbedtls_ssl_session::id_len
size_t id_len
Definition: ssl.h:874
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:1214
mbedtls_ssl_context::out_msgtype
int out_msgtype
Definition: ssl.h:1266
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:1307
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:1175
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:477
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:1220
mbedtls_ssl_config::f_dbg
void(* f_dbg)(void *, int, const char *, int, const char *)
Definition: ssl.h:924
mbedtls_ssl_context::in_msglen
size_t in_msglen
Definition: ssl.h:1225
mbedtls_ssl_config::f_sni
int(* f_sni)(void *, mbedtls_ssl_context *, const unsigned char *, size_t)
Definition: ssl.h:939
mbedtls_ssl_context::out_hdr
unsigned char * out_hdr
Definition: ssl.h:1257
MBEDTLS_ECP_MAX_BYTES
#define MBEDTLS_ECP_MAX_BYTES
Definition: ecp.h:223
mbedtls_ssl_context::transform_in
mbedtls_ssl_transform * transform_in
Definition: ssl.h:1194
mbedtls_ssl_context::renego_records_seen
int renego_records_seen
Definition: ssl.h:1155
MBEDTLS_SSL_CID_IN_LEN_MAX
#define MBEDTLS_SSL_CID_IN_LEN_MAX
Definition: ssl.h:273
MBEDTLS_DEPRECATED
#define MBEDTLS_DEPRECATED
Definition: ssl.h:3588
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:1186
mbedtls_tls_prf_types
mbedtls_tls_prf_types
Definition: ssl.h:492
mbedtls_ssl_session_save
int mbedtls_ssl_session_save(const mbedtls_ssl_session *session, unsigned char *buf, size_t buf_len, size_t *olen)
Save session structure as serialized data in a buffer. On client, this can be used for saving session...
mbedtls_ssl_config::alpn_list
const char ** alpn_list
Definition: ssl.h:1059
mbedtls_ssl_config::psk_identity
unsigned char * psk_identity
Definition: ssl.h:1045
mbedtls_ssl_sig_hash_set_t
struct mbedtls_ssl_sig_hash_set_t mbedtls_ssl_sig_hash_set_t
Definition: ssl.h:617
MBEDTLS_SSL_CLIENT_HELLO
@ MBEDTLS_SSL_CLIENT_HELLO
Definition: ssl.h:467
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)
psa_key_handle_t
uint16_t psa_key_handle_t
Definition: crypto_platform.h:50
mbedtls_ssl_handshake_params
struct mbedtls_ssl_handshake_params mbedtls_ssl_handshake_params
Definition: ssl.h:616
mbedtls_ssl_config::renego_max_records
int renego_max_records
Definition: ssl.h:1076
mbedtls_ssl_config::ca_crl
mbedtls_x509_crl * ca_crl
Definition: ssl.h:995
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_TLS_PRF_SHA256
@ MBEDTLS_SSL_TLS_PRF_SHA256
Definition: ssl.h:497
x509_crt.h
X.509 certificate parsing and writing.
MBEDTLS_MPI_MAX_SIZE
#define MBEDTLS_MPI_MAX_SIZE
Definition: bignum.h:82
mbedtls_ssl_context::client_auth
int client_auth
Definition: ssl.h:1289
mbedtls_ssl_config::transport
unsigned int transport
Definition: ssl.h:1099
mbedtls_ssl_get_timer_t
int mbedtls_ssl_get_timer_t(void *ctx)
Callback type: get status of timers/delays.
Definition: ssl.h:607
mbedtls_ssl_config::authmode
unsigned int authmode
Definition: ssl.h:1100
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)
Configure a pre-shared key (PSK) and identity to be used in PSK-based ciphersuites.
mbedtls_ssl_config::cbc_record_splitting
unsigned int cbc_record_splitting
Definition: ssl.h:1119
mbedtls_ssl_session::start
mbedtls_time_t start
Definition: ssl.h:870
MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC
@ MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC
Definition: ssl.h:476
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:967
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:1320
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:566
mbedtls_ssl_context::keep_current_message
int keep_current_message
Definition: ssl.h:1244
mbedtls_ssl_context::minor_ver
int minor_ver
Definition: ssl.h:1161
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:1248
mbedtls_ssl_config::f_cookie_check
int(* f_cookie_check)(void *, const unsigned char *, size_t, const unsigned char *, size_t)
Definition: ssl.h:960
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:1183
mbedtls_ssl_config::f_psk
int(* f_psk)(void *, mbedtls_ssl_context *, const unsigned char *, size_t)
Definition: ssl.h:951
mbedtls_ssl_session::mfl_code
unsigned char mfl_code
Definition: ssl.h:898
mbedtls_ssl_context::secure_renegotiation
int secure_renegotiation
Definition: ssl.h:1315
mbedtls_ssl_config::p_cookie
void * p_cookie
Definition: ssl.h:962
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:2157
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:1113
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.