mbed TLS v2.3.0
ssl.h
Go to the documentation of this file.
1 
25 #ifndef MBEDTLS_SSL_H
26 #define MBEDTLS_SSL_H
27 
28 #if !defined(MBEDTLS_CONFIG_FILE)
29 #include "config.h"
30 #else
31 #include MBEDTLS_CONFIG_FILE
32 #endif
33 
34 #include "bignum.h"
35 #include "ecp.h"
36 
37 #include "ssl_ciphersuites.h"
38 
39 #if defined(MBEDTLS_X509_CRT_PARSE_C)
40 #include "x509_crt.h"
41 #include "x509_crl.h"
42 #endif
43 
44 #if defined(MBEDTLS_DHM_C)
45 #include "dhm.h"
46 #endif
47 
48 #if defined(MBEDTLS_ECDH_C)
49 #include "ecdh.h"
50 #endif
51 
52 #if defined(MBEDTLS_ZLIB_SUPPORT)
53 #include "zlib.h"
54 #endif
55 
56 #if defined(MBEDTLS_HAVE_TIME)
57 #include <time.h>
58 #endif
59 
60 /*
61  * SSL Error codes
62  */
63 #define MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE -0x7080
64 #define MBEDTLS_ERR_SSL_BAD_INPUT_DATA -0x7100
65 #define MBEDTLS_ERR_SSL_INVALID_MAC -0x7180
66 #define MBEDTLS_ERR_SSL_INVALID_RECORD -0x7200
67 #define MBEDTLS_ERR_SSL_CONN_EOF -0x7280
68 #define MBEDTLS_ERR_SSL_UNKNOWN_CIPHER -0x7300
69 #define MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN -0x7380
70 #define MBEDTLS_ERR_SSL_NO_RNG -0x7400
71 #define MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE -0x7480
72 #define MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE -0x7500
73 #define MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED -0x7580
74 #define MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED -0x7600
75 #define MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED -0x7680
76 #define MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE -0x7700
77 #define MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE -0x7780
78 #define MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED -0x7800
79 #define MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY -0x7880
80 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO -0x7900
81 #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO -0x7980
82 #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE -0x7A00
83 #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST -0x7A80
84 #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE -0x7B00
85 #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE -0x7B80
86 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE -0x7C00
87 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP -0x7C80
88 #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS -0x7D00
89 #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY -0x7D80
90 #define MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC -0x7E00
91 #define MBEDTLS_ERR_SSL_BAD_HS_FINISHED -0x7E80
92 #define MBEDTLS_ERR_SSL_ALLOC_FAILED -0x7F00
93 #define MBEDTLS_ERR_SSL_HW_ACCEL_FAILED -0x7F80
94 #define MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH -0x6F80
95 #define MBEDTLS_ERR_SSL_COMPRESSION_FAILED -0x6F00
96 #define MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION -0x6E80
97 #define MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET -0x6E00
98 #define MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED -0x6D80
99 #define MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH -0x6D00
100 #define MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY -0x6C80
101 #define MBEDTLS_ERR_SSL_INTERNAL_ERROR -0x6C00
102 #define MBEDTLS_ERR_SSL_COUNTER_WRAPPING -0x6B80
103 #define MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO -0x6B00
104 #define MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED -0x6A80
105 #define MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL -0x6A00
106 #define MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE -0x6980
107 #define MBEDTLS_ERR_SSL_WANT_READ -0x6900
108 #define MBEDTLS_ERR_SSL_WANT_WRITE -0x6880
109 #define MBEDTLS_ERR_SSL_TIMEOUT -0x6800
110 #define MBEDTLS_ERR_SSL_CLIENT_RECONNECT -0x6780
111 #define MBEDTLS_ERR_SSL_UNEXPECTED_RECORD -0x6700
113 /*
114  * Various constants
115  */
116 #define MBEDTLS_SSL_MAJOR_VERSION_3 3
117 #define MBEDTLS_SSL_MINOR_VERSION_0 0
118 #define MBEDTLS_SSL_MINOR_VERSION_1 1
119 #define MBEDTLS_SSL_MINOR_VERSION_2 2
120 #define MBEDTLS_SSL_MINOR_VERSION_3 3
122 #define MBEDTLS_SSL_TRANSPORT_STREAM 0
123 #define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1
125 #define MBEDTLS_SSL_MAX_HOST_NAME_LEN 255
127 /* RFC 6066 section 4, see also mfl_code_to_length in ssl_tls.c
128  * NONE must be zero so that memset()ing structure to zero works */
129 #define MBEDTLS_SSL_MAX_FRAG_LEN_NONE 0
130 #define MBEDTLS_SSL_MAX_FRAG_LEN_512 1
131 #define MBEDTLS_SSL_MAX_FRAG_LEN_1024 2
132 #define MBEDTLS_SSL_MAX_FRAG_LEN_2048 3
133 #define MBEDTLS_SSL_MAX_FRAG_LEN_4096 4
134 #define MBEDTLS_SSL_MAX_FRAG_LEN_INVALID 5
136 #define MBEDTLS_SSL_IS_CLIENT 0
137 #define MBEDTLS_SSL_IS_SERVER 1
138 
139 #define MBEDTLS_SSL_IS_NOT_FALLBACK 0
140 #define MBEDTLS_SSL_IS_FALLBACK 1
141 
142 #define MBEDTLS_SSL_EXTENDED_MS_DISABLED 0
143 #define MBEDTLS_SSL_EXTENDED_MS_ENABLED 1
144 
145 #define MBEDTLS_SSL_ETM_DISABLED 0
146 #define MBEDTLS_SSL_ETM_ENABLED 1
147 
148 #define MBEDTLS_SSL_COMPRESS_NULL 0
149 #define MBEDTLS_SSL_COMPRESS_DEFLATE 1
150 
151 #define MBEDTLS_SSL_VERIFY_NONE 0
152 #define MBEDTLS_SSL_VERIFY_OPTIONAL 1
153 #define MBEDTLS_SSL_VERIFY_REQUIRED 2
154 #define MBEDTLS_SSL_VERIFY_UNSET 3 /* Used only for sni_authmode */
155 
156 #define MBEDTLS_SSL_LEGACY_RENEGOTIATION 0
157 #define MBEDTLS_SSL_SECURE_RENEGOTIATION 1
158 
159 #define MBEDTLS_SSL_RENEGOTIATION_DISABLED 0
160 #define MBEDTLS_SSL_RENEGOTIATION_ENABLED 1
161 
162 #define MBEDTLS_SSL_ANTI_REPLAY_DISABLED 0
163 #define MBEDTLS_SSL_ANTI_REPLAY_ENABLED 1
164 
165 #define MBEDTLS_SSL_RENEGOTIATION_NOT_ENFORCED -1
166 #define MBEDTLS_SSL_RENEGO_MAX_RECORDS_DEFAULT 16
167 
168 #define MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION 0
169 #define MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION 1
170 #define MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE 2
171 
172 #define MBEDTLS_SSL_TRUNC_HMAC_DISABLED 0
173 #define MBEDTLS_SSL_TRUNC_HMAC_ENABLED 1
174 #define MBEDTLS_SSL_TRUNCATED_HMAC_LEN 10 /* 80 bits, rfc 6066 section 7 */
175 
176 #define MBEDTLS_SSL_SESSION_TICKETS_DISABLED 0
177 #define MBEDTLS_SSL_SESSION_TICKETS_ENABLED 1
178 
179 #define MBEDTLS_SSL_CBC_RECORD_SPLITTING_DISABLED 0
180 #define MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED 1
181 
182 #define MBEDTLS_SSL_ARC4_ENABLED 0
183 #define MBEDTLS_SSL_ARC4_DISABLED 1
184 
185 #define MBEDTLS_SSL_PRESET_DEFAULT 0
186 #define MBEDTLS_SSL_PRESET_SUITEB 2
187 
188 /*
189  * Default range for DTLS retransmission timer value, in milliseconds.
190  * RFC 6347 4.2.4.1 says from 1 second to 60 seconds.
191  */
192 #define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MIN 1000
193 #define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MAX 60000
194 
203 #if !defined(MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME)
204 #define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400
205 #endif
206 
207 /*
208  * Maxium fragment length in bytes,
209  * determines the size of each of the two internal I/O buffers.
210  *
211  * Note: the RFC defines the default size of SSL / TLS messages. If you
212  * change the value here, other clients / servers may not be able to
213  * communicate with you anymore. Only change this value if you control
214  * both sides of the connection and have it reduced at both sides, or
215  * if you're using the Max Fragment Length extension and you know all your
216  * peers are using it too!
217  */
218 #if !defined(MBEDTLS_SSL_MAX_CONTENT_LEN)
219 #define MBEDTLS_SSL_MAX_CONTENT_LEN 16384
220 #endif
221 
222 /* \} name SECTION: Module settings */
223 
224 /*
225  * Length of the verify data for secure renegotiation
226  */
227 #if defined(MBEDTLS_SSL_PROTO_SSL3)
228 #define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 36
229 #else
230 #define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 12
231 #endif
232 
233 /*
234  * Signaling ciphersuite values (SCSV)
235  */
236 #define MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO 0xFF
237 #define MBEDTLS_SSL_FALLBACK_SCSV_VALUE 0x5600
239 /*
240  * Supported Signature and Hash algorithms (For TLS 1.2)
241  * RFC 5246 section 7.4.1.4.1
242  */
243 #define MBEDTLS_SSL_HASH_NONE 0
244 #define MBEDTLS_SSL_HASH_MD5 1
245 #define MBEDTLS_SSL_HASH_SHA1 2
246 #define MBEDTLS_SSL_HASH_SHA224 3
247 #define MBEDTLS_SSL_HASH_SHA256 4
248 #define MBEDTLS_SSL_HASH_SHA384 5
249 #define MBEDTLS_SSL_HASH_SHA512 6
250 
251 #define MBEDTLS_SSL_SIG_ANON 0
252 #define MBEDTLS_SSL_SIG_RSA 1
253 #define MBEDTLS_SSL_SIG_ECDSA 3
254 
255 /*
256  * Client Certificate Types
257  * RFC 5246 section 7.4.4 plus RFC 4492 section 5.5
258  */
259 #define MBEDTLS_SSL_CERT_TYPE_RSA_SIGN 1
260 #define MBEDTLS_SSL_CERT_TYPE_ECDSA_SIGN 64
261 
262 /*
263  * Message, alert and handshake types
264  */
265 #define MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC 20
266 #define MBEDTLS_SSL_MSG_ALERT 21
267 #define MBEDTLS_SSL_MSG_HANDSHAKE 22
268 #define MBEDTLS_SSL_MSG_APPLICATION_DATA 23
269 
270 #define MBEDTLS_SSL_ALERT_LEVEL_WARNING 1
271 #define MBEDTLS_SSL_ALERT_LEVEL_FATAL 2
272 
273 #define MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY 0 /* 0x00 */
274 #define MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE 10 /* 0x0A */
275 #define MBEDTLS_SSL_ALERT_MSG_BAD_RECORD_MAC 20 /* 0x14 */
276 #define MBEDTLS_SSL_ALERT_MSG_DECRYPTION_FAILED 21 /* 0x15 */
277 #define MBEDTLS_SSL_ALERT_MSG_RECORD_OVERFLOW 22 /* 0x16 */
278 #define MBEDTLS_SSL_ALERT_MSG_DECOMPRESSION_FAILURE 30 /* 0x1E */
279 #define MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE 40 /* 0x28 */
280 #define MBEDTLS_SSL_ALERT_MSG_NO_CERT 41 /* 0x29 */
281 #define MBEDTLS_SSL_ALERT_MSG_BAD_CERT 42 /* 0x2A */
282 #define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_CERT 43 /* 0x2B */
283 #define MBEDTLS_SSL_ALERT_MSG_CERT_REVOKED 44 /* 0x2C */
284 #define MBEDTLS_SSL_ALERT_MSG_CERT_EXPIRED 45 /* 0x2D */
285 #define MBEDTLS_SSL_ALERT_MSG_CERT_UNKNOWN 46 /* 0x2E */
286 #define MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER 47 /* 0x2F */
287 #define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_CA 48 /* 0x30 */
288 #define MBEDTLS_SSL_ALERT_MSG_ACCESS_DENIED 49 /* 0x31 */
289 #define MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR 50 /* 0x32 */
290 #define MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR 51 /* 0x33 */
291 #define MBEDTLS_SSL_ALERT_MSG_EXPORT_RESTRICTION 60 /* 0x3C */
292 #define MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION 70 /* 0x46 */
293 #define MBEDTLS_SSL_ALERT_MSG_INSUFFICIENT_SECURITY 71 /* 0x47 */
294 #define MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR 80 /* 0x50 */
295 #define MBEDTLS_SSL_ALERT_MSG_INAPROPRIATE_FALLBACK 86 /* 0x56 */
296 #define MBEDTLS_SSL_ALERT_MSG_USER_CANCELED 90 /* 0x5A */
297 #define MBEDTLS_SSL_ALERT_MSG_NO_RENEGOTIATION 100 /* 0x64 */
298 #define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT 110 /* 0x6E */
299 #define MBEDTLS_SSL_ALERT_MSG_UNRECOGNIZED_NAME 112 /* 0x70 */
300 #define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY 115 /* 0x73 */
301 #define MBEDTLS_SSL_ALERT_MSG_NO_APPLICATION_PROTOCOL 120 /* 0x78 */
302 
303 #define MBEDTLS_SSL_HS_HELLO_REQUEST 0
304 #define MBEDTLS_SSL_HS_CLIENT_HELLO 1
305 #define MBEDTLS_SSL_HS_SERVER_HELLO 2
306 #define MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST 3
307 #define MBEDTLS_SSL_HS_NEW_SESSION_TICKET 4
308 #define MBEDTLS_SSL_HS_CERTIFICATE 11
309 #define MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE 12
310 #define MBEDTLS_SSL_HS_CERTIFICATE_REQUEST 13
311 #define MBEDTLS_SSL_HS_SERVER_HELLO_DONE 14
312 #define MBEDTLS_SSL_HS_CERTIFICATE_VERIFY 15
313 #define MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE 16
314 #define MBEDTLS_SSL_HS_FINISHED 20
315 
316 /*
317  * TLS extensions
318  */
319 #define MBEDTLS_TLS_EXT_SERVERNAME 0
320 #define MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME 0
321 
322 #define MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH 1
323 
324 #define MBEDTLS_TLS_EXT_TRUNCATED_HMAC 4
325 
326 #define MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES 10
327 #define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS 11
328 
329 #define MBEDTLS_TLS_EXT_SIG_ALG 13
330 
331 #define MBEDTLS_TLS_EXT_ALPN 16
332 
333 #define MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC 22 /* 0x16 */
334 #define MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET 0x0017 /* 23 */
335 
336 #define MBEDTLS_TLS_EXT_SESSION_TICKET 35
337 
338 #define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 256 /* experimental */
339 
340 #define MBEDTLS_TLS_EXT_RENEGOTIATION_INFO 0xFF01
341 
342 /*
343  * Size defines
344  */
345 #if !defined(MBEDTLS_PSK_MAX_LEN)
346 #define MBEDTLS_PSK_MAX_LEN 32 /* 256 bits */
347 #endif
348 
349 /* Dummy type used only for its size */
351 {
352 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
353  unsigned char _pms_rsa[48]; /* RFC 5246 8.1.1 */
354 #endif
355 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)
356  unsigned char _pms_dhm[MBEDTLS_MPI_MAX_SIZE]; /* RFC 5246 8.1.2 */
357 #endif
358 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
359  defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
360  defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
361  defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
362  unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]; /* RFC 4492 5.10 */
363 #endif
364 #if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
365  unsigned char _pms_psk[4 + 2 * MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 2 */
366 #endif
367 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
368  unsigned char _pms_dhe_psk[4 + MBEDTLS_MPI_MAX_SIZE
369  + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 3 */
370 #endif
371 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)
372  unsigned char _pms_rsa_psk[52 + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 4 */
373 #endif
374 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
375  unsigned char _pms_ecdhe_psk[4 + MBEDTLS_ECP_MAX_BYTES
376  + MBEDTLS_PSK_MAX_LEN]; /* RFC 5489 2 */
377 #endif
378 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
379  unsigned char _pms_ecjpake[32]; /* Thread spec: SHA-256 output */
380 #endif
381 };
382 
383 #define MBEDTLS_PREMASTER_SIZE sizeof( union mbedtls_ssl_premaster_secret )
384 
385 #ifdef __cplusplus
386 extern "C" {
387 #endif
388 
389 /*
390  * SSL state machine
391  */
392 typedef enum
393 {
413 }
415 
433 typedef int mbedtls_ssl_send_t( void *ctx,
434  const unsigned char *buf,
435  size_t len );
436 
456 typedef int mbedtls_ssl_recv_t( void *ctx,
457  unsigned char *buf,
458  size_t len );
459 
482 typedef int mbedtls_ssl_recv_timeout_t( void *ctx,
483  unsigned char *buf,
484  size_t len,
485  uint32_t timeout );
508 typedef void mbedtls_ssl_set_timer_t( void * ctx,
509  uint32_t int_ms,
510  uint32_t fin_ms );
511 
523 typedef int mbedtls_ssl_get_timer_t( void * ctx );
524 
525 
526 /* Defined below */
530 
531 /* Defined in ssl_internal.h */
534 #if defined(MBEDTLS_X509_CRT_PARSE_C)
536 #endif
537 #if defined(MBEDTLS_SSL_PROTO_DTLS)
539 #endif
540 
541 /*
542  * This structure is used for storing current session data.
543  */
545 {
546 #if defined(MBEDTLS_HAVE_TIME)
548 #endif
551  size_t id_len;
552  unsigned char id[32];
553  unsigned char master[48];
555 #if defined(MBEDTLS_X509_CRT_PARSE_C)
557 #endif /* MBEDTLS_X509_CRT_PARSE_C */
558  uint32_t verify_result;
560 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
561  unsigned char *ticket;
562  size_t ticket_len;
563  uint32_t ticket_lifetime;
564 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
565 
566 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
567  unsigned char mfl_code;
568 #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
569 
570 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
572 #endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
573 
574 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
576 #endif
577 };
578 
583 {
584  /* Group items by size (largest first) to minimize padding overhead */
585 
586  /*
587  * Pointers
588  */
589 
590  const int *ciphersuite_list[4];
593  void (*f_dbg)(void *, int, const char *, int, const char *);
594  void *p_dbg;
597  int (*f_rng)(void *, unsigned char *, size_t);
598  void *p_rng;
601  int (*f_get_cache)(void *, mbedtls_ssl_session *);
603  int (*f_set_cache)(void *, const mbedtls_ssl_session *);
604  void *p_cache;
606 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
607 
608  int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
609  void *p_sni;
610 #endif
611 
612 #if defined(MBEDTLS_X509_CRT_PARSE_C)
613 
614  int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *);
615  void *p_vrfy;
616 #endif
617 
618 #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
619 
620  int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
621  void *p_psk;
622 #endif
623 
624 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
625 
626  int (*f_cookie_write)( void *, unsigned char **, unsigned char *,
627  const unsigned char *, size_t );
629  int (*f_cookie_check)( void *, const unsigned char *, size_t,
630  const unsigned char *, size_t );
631  void *p_cookie;
632 #endif
633 
634 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
635 
636  int (*f_ticket_write)( void *, const mbedtls_ssl_session *,
637  unsigned char *, const unsigned char *, size_t *, uint32_t * );
639  int (*f_ticket_parse)( void *, mbedtls_ssl_session *, unsigned char *, size_t);
640  void *p_ticket;
641 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */
642 
643 #if defined(MBEDTLS_SSL_EXPORT_KEYS)
644 
645  int (*f_export_keys)( void *, const unsigned char *,
646  const unsigned char *, size_t, size_t, size_t );
648 #endif
649 
650 #if defined(MBEDTLS_X509_CRT_PARSE_C)
653  mbedtls_x509_crt *ca_chain;
655 #endif /* MBEDTLS_X509_CRT_PARSE_C */
656 
657 #if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED)
658  const int *sig_hashes;
659 #endif
660 
661 #if defined(MBEDTLS_ECP_C)
663 #endif
664 
665 #if defined(MBEDTLS_DHM_C)
668 #endif
669 
670 #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
671  unsigned char *psk;
672  size_t psk_len;
673  unsigned char *psk_identity;
675 #endif
676 
677 #if defined(MBEDTLS_SSL_ALPN)
678  const char **alpn_list;
679 #endif
680 
681  /*
682  * Numerical settings (int then char)
683  */
684 
685  uint32_t read_timeout;
687 #if defined(MBEDTLS_SSL_PROTO_DTLS)
688  uint32_t hs_timeout_min;
690  uint32_t hs_timeout_max;
692 #endif
693 
694 #if defined(MBEDTLS_SSL_RENEGOTIATION)
696  unsigned char renego_period[8];
698 #endif
699 
700 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
701  unsigned int badmac_limit;
702 #endif
703 
704 #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
705  unsigned int dhm_min_bitlen;
706 #endif
707 
708  unsigned char max_major_ver;
709  unsigned char max_minor_ver;
710  unsigned char min_major_ver;
711  unsigned char min_minor_ver;
713  /*
714  * Flags (bitfields)
715  */
716 
717  unsigned int endpoint : 1;
718  unsigned int transport : 1;
719  unsigned int authmode : 2;
720  /* needed even with renego disabled for LEGACY_BREAK_HANDSHAKE */
721  unsigned int allow_legacy_renegotiation : 2 ;
722 #if defined(MBEDTLS_ARC4_C)
723  unsigned int arc4_disabled : 1;
724 #endif
725 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
726  unsigned int mfl_code : 3;
727 #endif
728 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
729  unsigned int encrypt_then_mac : 1 ;
730 #endif
731 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
732  unsigned int extended_ms : 1;
733 #endif
734 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
735  unsigned int anti_replay : 1;
736 #endif
737 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
738  unsigned int cbc_record_splitting : 1;
739 #endif
740 #if defined(MBEDTLS_SSL_RENEGOTIATION)
741  unsigned int disable_renegotiation : 1;
742 #endif
743 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
744  unsigned int trunc_hmac : 1;
745 #endif
746 #if defined(MBEDTLS_SSL_SESSION_TICKETS)
747  unsigned int session_tickets : 1;
748 #endif
749 #if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)
750  unsigned int fallback : 1;
751 #endif
752 };
753 
754 
756 {
759  /*
760  * Miscellaneous
761  */
762  int state;
763 #if defined(MBEDTLS_SSL_RENEGOTIATION)
768 #endif
769 
770  int major_ver;
771  int minor_ver;
773 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
774  unsigned badmac_seen;
775 #endif
776 
782  void *p_bio;
784  /*
785  * Session layer
786  */
795  /*
796  * Record layer transformations
797  */
803  /*
804  * Timers
805  */
806  void *p_timer;
811  /*
812  * Record layer (incoming data)
813  */
814  unsigned char *in_buf;
815  unsigned char *in_ctr;
818  unsigned char *in_hdr;
819  unsigned char *in_len;
820  unsigned char *in_iv;
821  unsigned char *in_msg;
822  unsigned char *in_offt;
825  size_t in_msglen;
826  size_t in_left;
827 #if defined(MBEDTLS_SSL_PROTO_DTLS)
828  uint16_t in_epoch;
831 #endif
832 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
833  uint64_t in_window_top;
834  uint64_t in_window;
835 #endif
836 
837  size_t in_hslen;
839  int nb_zero;
842  /*
843  * Record layer (outgoing data)
844  */
845  unsigned char *out_buf;
846  unsigned char *out_ctr;
847  unsigned char *out_hdr;
848  unsigned char *out_len;
849  unsigned char *out_iv;
850  unsigned char *out_msg;
853  size_t out_msglen;
854  size_t out_left;
856 #if defined(MBEDTLS_ZLIB_SUPPORT)
857  unsigned char *compress_buf;
858 #endif
859 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
860  signed char split_done;
861 #endif
862 
863  /*
864  * PKI layer
865  */
868  /*
869  * User settings
870  */
871 #if defined(MBEDTLS_X509_CRT_PARSE_C)
872  char *hostname;
874 #endif
875 
876 #if defined(MBEDTLS_SSL_ALPN)
877  const char *alpn_chosen;
878 #endif
879 
880  /*
881  * Information for DTLS hello verify
882  */
883 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
884  unsigned char *cli_id;
885  size_t cli_id_len;
886 #endif
887 
888  /*
889  * Secure renegotiation
890  */
891  /* needed to know when to send extension on server */
894 #if defined(MBEDTLS_SSL_RENEGOTIATION)
898 #endif
899 };
900 
901 #if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
902 
903 #define MBEDTLS_SSL_CHANNEL_OUTBOUND 0
904 #define MBEDTLS_SSL_CHANNEL_INBOUND 1
905 
906 extern int (*mbedtls_ssl_hw_record_init)(mbedtls_ssl_context *ssl,
907  const unsigned char *key_enc, const unsigned char *key_dec,
908  size_t keylen,
909  const unsigned char *iv_enc, const unsigned char *iv_dec,
910  size_t ivlen,
911  const unsigned char *mac_enc, const unsigned char *mac_dec,
912  size_t maclen);
913 extern int (*mbedtls_ssl_hw_record_activate)(mbedtls_ssl_context *ssl, int direction);
914 extern int (*mbedtls_ssl_hw_record_reset)(mbedtls_ssl_context *ssl);
915 extern int (*mbedtls_ssl_hw_record_write)(mbedtls_ssl_context *ssl);
916 extern int (*mbedtls_ssl_hw_record_read)(mbedtls_ssl_context *ssl);
917 extern int (*mbedtls_ssl_hw_record_finish)(mbedtls_ssl_context *ssl);
918 #endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
919 
926 const int *mbedtls_ssl_list_ciphersuites( void );
927 
936 const char *mbedtls_ssl_get_ciphersuite_name( const int ciphersuite_id );
937 
946 int mbedtls_ssl_get_ciphersuite_id( const char *ciphersuite_name );
947 
956 
973  const mbedtls_ssl_config *conf );
974 
986 
993 void mbedtls_ssl_conf_endpoint( mbedtls_ssl_config *conf, int endpoint );
994 
1009 void mbedtls_ssl_conf_transport( mbedtls_ssl_config *conf, int transport );
1010 
1037 void mbedtls_ssl_conf_authmode( mbedtls_ssl_config *conf, int authmode );
1038 
1039 #if defined(MBEDTLS_X509_CRT_PARSE_C)
1040 
1052  int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
1053  void *p_vrfy );
1054 #endif /* MBEDTLS_X509_CRT_PARSE_C */
1055 
1064  int (*f_rng)(void *, unsigned char *, size_t),
1065  void *p_rng );
1066 
1082  void (*f_dbg)(void *, int, const char *, int, const char *),
1083  void *p_dbg );
1084 
1115  void *p_bio,
1116  mbedtls_ssl_send_t *f_send,
1117  mbedtls_ssl_recv_t *f_recv,
1118  mbedtls_ssl_recv_timeout_t *f_recv_timeout );
1119 
1136 void mbedtls_ssl_conf_read_timeout( mbedtls_ssl_config *conf, uint32_t timeout );
1137 
1159  void *p_timer,
1160  mbedtls_ssl_set_timer_t *f_set_timer,
1161  mbedtls_ssl_get_timer_t *f_get_timer );
1162 
1182 typedef int mbedtls_ssl_ticket_write_t( void *p_ticket,
1183  const mbedtls_ssl_session *session,
1184  unsigned char *start,
1185  const unsigned char *end,
1186  size_t *tlen,
1187  uint32_t *lifetime );
1188 
1189 #if defined(MBEDTLS_SSL_EXPORT_KEYS)
1190 
1210 typedef int mbedtls_ssl_export_keys_t( void *p_expkey,
1211  const unsigned char *ms,
1212  const unsigned char *kb,
1213  size_t maclen,
1214  size_t keylen,
1215  size_t ivlen );
1216 #endif /* MBEDTLS_SSL_EXPORT_KEYS */
1217 
1241 typedef int mbedtls_ssl_ticket_parse_t( void *p_ticket,
1242  mbedtls_ssl_session *session,
1243  unsigned char *buf,
1244  size_t len );
1245 
1246 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
1247 
1262  mbedtls_ssl_ticket_write_t *f_ticket_write,
1263  mbedtls_ssl_ticket_parse_t *f_ticket_parse,
1264  void *p_ticket );
1265 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */
1266 
1267 #if defined(MBEDTLS_SSL_EXPORT_KEYS)
1268 
1279  mbedtls_ssl_export_keys_t *f_export_keys,
1280  void *p_export_keys );
1281 #endif /* MBEDTLS_SSL_EXPORT_KEYS */
1282 
1297 typedef int mbedtls_ssl_cookie_write_t( void *ctx,
1298  unsigned char **p, unsigned char *end,
1299  const unsigned char *info, size_t ilen );
1300 
1314 typedef int mbedtls_ssl_cookie_check_t( void *ctx,
1315  const unsigned char *cookie, size_t clen,
1316  const unsigned char *info, size_t ilen );
1317 
1318 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
1319 
1348  mbedtls_ssl_cookie_write_t *f_cookie_write,
1349  mbedtls_ssl_cookie_check_t *f_cookie_check,
1350  void *p_cookie );
1351 
1372  const unsigned char *info,
1373  size_t ilen );
1374 
1375 #endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY && MBEDTLS_SSL_SRV_C */
1376 
1377 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
1378 
1393 void mbedtls_ssl_conf_dtls_anti_replay( mbedtls_ssl_config *conf, char mode );
1394 #endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */
1395 
1396 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
1397 
1420 void mbedtls_ssl_conf_dtls_badmac_limit( mbedtls_ssl_config *conf, unsigned limit );
1421 #endif /* MBEDTLS_SSL_DTLS_BADMAC_LIMIT */
1422 
1423 #if defined(MBEDTLS_SSL_PROTO_DTLS)
1424 
1455 void mbedtls_ssl_conf_handshake_timeout( mbedtls_ssl_config *conf, uint32_t min, uint32_t max );
1456 #endif /* MBEDTLS_SSL_PROTO_DTLS */
1457 
1458 #if defined(MBEDTLS_SSL_SRV_C)
1459 
1497  void *p_cache,
1498  int (*f_get_cache)(void *, mbedtls_ssl_session *),
1499  int (*f_set_cache)(void *, const mbedtls_ssl_session *) );
1500 #endif /* MBEDTLS_SSL_SRV_C */
1501 
1502 #if defined(MBEDTLS_SSL_CLI_C)
1503 
1518 #endif /* MBEDTLS_SSL_CLI_C */
1519 
1536  const int *ciphersuites );
1537 
1558  const int *ciphersuites,
1559  int major, int minor );
1560 
1561 #if defined(MBEDTLS_X509_CRT_PARSE_C)
1562 
1573  const mbedtls_x509_crt_profile *profile );
1574 
1583  mbedtls_x509_crt *ca_chain,
1584  mbedtls_x509_crl *ca_crl );
1585 
1615  mbedtls_x509_crt *own_cert,
1616  mbedtls_pk_context *pk_key );
1617 #endif /* MBEDTLS_X509_CRT_PARSE_C */
1618 
1619 #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
1620 
1641  const unsigned char *psk, size_t psk_len,
1642  const unsigned char *psk_identity, size_t psk_identity_len );
1643 
1644 
1658  const unsigned char *psk, size_t psk_len );
1659 
1685  int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *,
1686  size_t),
1687  void *p_psk );
1688 #endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */
1689 
1690 #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_SRV_C)
1691 
1702 int mbedtls_ssl_conf_dh_param( mbedtls_ssl_config *conf, const char *dhm_P, const char *dhm_G );
1703 
1714 #endif /* MBEDTLS_DHM_C && defined(MBEDTLS_SSL_SRV_C) */
1715 
1716 #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
1717 
1726  unsigned int bitlen );
1727 #endif /* MBEDTLS_DHM_C && MBEDTLS_SSL_CLI_C */
1728 
1729 #if defined(MBEDTLS_ECP_C)
1730 
1758  const mbedtls_ecp_group_id *curves );
1759 #endif /* MBEDTLS_ECP_C */
1760 
1761 #if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED)
1762 
1781  const int *hashes );
1782 #endif /* MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED */
1783 
1784 #if defined(MBEDTLS_X509_CRT_PARSE_C)
1785 
1796 int mbedtls_ssl_set_hostname( mbedtls_ssl_context *ssl, const char *hostname );
1797 #endif /* MBEDTLS_X509_CRT_PARSE_C */
1798 
1799 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
1800 
1813  mbedtls_x509_crt *own_cert,
1814  mbedtls_pk_context *pk_key );
1815 
1828  mbedtls_x509_crt *ca_chain,
1829  mbedtls_x509_crl *ca_crl );
1830 
1842  int authmode );
1843 
1868  int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *,
1869  size_t),
1870  void *p_sni );
1871 #endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
1872 
1873 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
1874 
1891 int mbedtls_ssl_set_hs_ecjpake_password( mbedtls_ssl_context *ssl,
1892  const unsigned char *pw,
1893  size_t pw_len );
1894 #endif /*MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
1895 
1896 #if defined(MBEDTLS_SSL_ALPN)
1897 
1909 int mbedtls_ssl_conf_alpn_protocols( mbedtls_ssl_config *conf, const char **protos );
1910 
1920 const char *mbedtls_ssl_get_alpn_protocol( const mbedtls_ssl_context *ssl );
1921 #endif /* MBEDTLS_SSL_ALPN */
1922 
1939 void mbedtls_ssl_conf_max_version( mbedtls_ssl_config *conf, int major, int minor );
1940 
1959 void mbedtls_ssl_conf_min_version( mbedtls_ssl_config *conf, int major, int minor );
1960 
1961 #if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)
1962 
1981 void mbedtls_ssl_conf_fallback( mbedtls_ssl_config *conf, char fallback );
1982 #endif /* MBEDTLS_SSL_FALLBACK_SCSV && MBEDTLS_SSL_CLI_C */
1983 
1984 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
1985 
1997 #endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */
1998 
1999 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
2000 
2012 #endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */
2013 
2014 #if defined(MBEDTLS_ARC4_C)
2015 
2030 void mbedtls_ssl_conf_arc4_support( mbedtls_ssl_config *conf, char arc4 );
2031 #endif /* MBEDTLS_ARC4_C */
2032 
2033 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
2034 
2049 int mbedtls_ssl_conf_max_frag_len( mbedtls_ssl_config *conf, unsigned char mfl_code );
2050 #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
2051 
2052 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
2053 
2061 void mbedtls_ssl_conf_truncated_hmac( mbedtls_ssl_config *conf, int truncate );
2062 #endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
2063 
2064 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
2065 
2077 #endif /* MBEDTLS_SSL_CBC_RECORD_SPLITTING */
2078 
2079 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
2080 
2090 void mbedtls_ssl_conf_session_tickets( mbedtls_ssl_config *conf, int use_tickets );
2091 #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
2092 
2093 #if defined(MBEDTLS_SSL_RENEGOTIATION)
2094 
2111 void mbedtls_ssl_conf_renegotiation( mbedtls_ssl_config *conf, int renegotiation );
2112 #endif /* MBEDTLS_SSL_RENEGOTIATION */
2113 
2141 void mbedtls_ssl_conf_legacy_renegotiation( mbedtls_ssl_config *conf, int allow_legacy );
2142 
2143 #if defined(MBEDTLS_SSL_RENEGOTIATION)
2144 
2181 void mbedtls_ssl_conf_renegotiation_enforced( mbedtls_ssl_config *conf, int max_records );
2182 
2201  const unsigned char period[8] );
2202 #endif /* MBEDTLS_SSL_RENEGOTIATION */
2203 
2212 
2224 uint32_t mbedtls_ssl_get_verify_result( const mbedtls_ssl_context *ssl );
2225 
2233 const char *mbedtls_ssl_get_ciphersuite( const mbedtls_ssl_context *ssl );
2234 
2242 const char *mbedtls_ssl_get_version( const mbedtls_ssl_context *ssl );
2243 
2255 
2256 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
2257 
2274 #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
2275 
2276 #if defined(MBEDTLS_X509_CRT_PARSE_C)
2277 
2292 #endif /* MBEDTLS_X509_CRT_PARSE_C */
2293 
2294 #if defined(MBEDTLS_SSL_CLI_C)
2295 
2312 #endif /* MBEDTLS_SSL_CLI_C */
2313 
2336 
2357 
2358 #if defined(MBEDTLS_SSL_RENEGOTIATION)
2359 
2378 #endif /* MBEDTLS_SSL_RENEGOTIATION */
2379 
2414 int mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len );
2415 
2451 int mbedtls_ssl_write( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len );
2452 
2470  unsigned char level,
2471  unsigned char message );
2486 
2493 
2505 
2523  int endpoint, int transport, int preset );
2524 
2531 
2538 
2546 
2547 #ifdef __cplusplus
2548 }
2549 #endif
2550 
2551 #endif /* ssl.h */
uint64_t in_window_top
Definition: ssl.h:833
mbedtls_ssl_send_t * f_send
Definition: ssl.h:777
void * p_rng
Definition: ssl.h:598
const char ** alpn_list
Definition: ssl.h:678
unsigned int transport
Definition: ssl.h:718
unsigned char * in_ctr
Definition: ssl.h:815
mbedtls_x509_crt * peer_cert
Definition: ssl.h:556
unsigned char * out_msg
Definition: ssl.h:850
unsigned char master[48]
Definition: ssl.h:553
unsigned int trunc_hmac
Definition: ssl.h:744
unsigned char * in_len
Definition: ssl.h:819
unsigned char * in_buf
Definition: ssl.h:814
unsigned int endpoint
Definition: ssl.h:717
Public key container.
Definition: pk.h:128
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.
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:1241
mbedtls_mpi dhm_P
Definition: ssl.h:666
char peer_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN]
Definition: ssl.h:897
unsigned char max_minor_ver
Definition: ssl.h:709
const char * mbedtls_ssl_get_ciphersuite_name(const int ciphersuite_id)
Return the name of the ciphersuite associated with the given ID.
void mbedtls_ssl_conf_encrypt_then_mac(mbedtls_ssl_config *conf, char etm)
Enable or disable Encrypt-then-MAC (Default: MBEDTLS_SSL_ETM_ENABLED)
unsigned char min_minor_ver
Definition: ssl.h:711
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:1297
unsigned char * in_hdr
Definition: ssl.h:818
size_t psk_identity_len
Definition: ssl.h:674
unsigned int dhm_min_bitlen
Definition: ssl.h:705
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:1314
void * p_sni
Definition: ssl.h:609
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.)
unsigned char * ticket
Definition: ssl.h:561
size_t ticket_len
Definition: ssl.h:562
void mbedtls_ssl_conf_extended_master_secret(mbedtls_ssl_config *conf, char ems)
Enable or disable Extended Master Secret negotiation.
unsigned char * out_iv
Definition: ssl.h:849
mbedtls_ssl_transform * transform_in
Definition: ssl.h:798
size_t in_left
Definition: ssl.h:826
unsigned int authmode
Definition: ssl.h:719
int mbedtls_ssl_send_t(void *ctx, const unsigned char *buf, size_t len)
Callback type: send data on the network.
Definition: ssl.h:433
unsigned int badmac_limit
Definition: ssl.h:701
void * p_psk
Definition: ssl.h:621
void mbedtls_ssl_conf_fallback(mbedtls_ssl_config *conf, char fallback)
Set the fallback flag (client-side only).
unsigned int anti_replay
Definition: ssl.h:735
int mbedtls_ssl_recv_t(void *ctx, unsigned char *buf, size_t len)
Callback type: receive data from the network.
Definition: ssl.h:456
unsigned int fallback
Definition: ssl.h:750
const mbedtls_ecp_group_id * curve_list
Definition: ssl.h:662
Elliptic curves over GF(p)
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) ...
Certificate revocation list structure.
Definition: x509_crl.h:71
void(* f_dbg)(void *, int, const char *, int, const char *)
Callback for printing debug output.
Definition: ssl.h:593
unsigned char _pms_dhm[MBEDTLS_MPI_MAX_SIZE]
Definition: ssl.h:356
void * p_cache
Definition: ssl.h:604
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).
unsigned char _pms_rsa[48]
Definition: ssl.h:353
unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]
Definition: ssl.h:362
unsigned char renego_period[8]
Definition: ssl.h:696
uint32_t ticket_lifetime
Definition: ssl.h:563
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_session * session_in
Definition: ssl.h:787
unsigned badmac_seen
Definition: ssl.h:774
void mbedtls_ssl_conf_dtls_anti_replay(mbedtls_ssl_config *conf, char mode)
Enable or disable anti-replay protection for DTLS.
int(* f_cookie_check)(void *, const unsigned char *, size_t, const unsigned char *, size_t)
Callback to verify validity of a ClientHello cookie.
Definition: ssl.h:629
mbedtls_ssl_get_timer_t * f_get_timer
Definition: ssl.h:809
Configuration options (set of defines)
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...
uint32_t mbedtls_ssl_get_verify_result(const mbedtls_ssl_context *ssl)
Return the result of the certificate verification.
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).
mbedtls_x509_crl * ca_crl
Definition: ssl.h:654
mbedtls_ssl_session * session_out
Definition: ssl.h:788
const mbedtls_x509_crt * mbedtls_ssl_get_peer_cert(const mbedtls_ssl_context *ssl)
Return the peer certificate from the current connection.
int mbedtls_ssl_send_alert_message(mbedtls_ssl_context *ssl, unsigned char level, unsigned char message)
Send an alert message.
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:482
SSL Ciphersuites for mbed TLS.
mbedtls_ssl_transform * transform_out
Definition: ssl.h:799
unsigned char mfl_code
Definition: ssl.h:567
void mbedtls_ssl_conf_renegotiation_period(mbedtls_ssl_config *conf, const unsigned char period[8])
Set record counter threshold for periodic renegotiation.
unsigned int mfl_code
Definition: ssl.h:726
Multi-precision integer library.
int encrypt_then_mac
Definition: ssl.h:575
size_t in_hslen
Definition: ssl.h:837
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.
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 (Default: MBEDTLS_SSL_MAX_CONTENT_LEN, usually 2^14 bytes) (Server: set maximum fragment length to emit, usually negotiated by the client during handshake (Client: set maximum fragment length to emit and negotiate with the server during handshake)
int(* f_sni)(void *, mbedtls_ssl_context *, const unsigned char *, size_t)
Callback for setting cert according to SNI extension.
Definition: ssl.h:608
int mbedtls_ssl_write(mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len)
Try to write exactly 'len' application data bytes.
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)
uint64_t in_window
Definition: ssl.h:834
int mbedtls_ssl_close_notify(mbedtls_ssl_context *ssl)
Notify the peer that the connection is being closed.
struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item
Definition: ssl.h:538
void * p_cookie
Definition: ssl.h:631
void mbedtls_ssl_conf_session_tickets(mbedtls_ssl_config *conf, int use_tickets)
Enable / Disable session tickets (client only).
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_transform * transform
Definition: ssl.h:800
uint32_t hs_timeout_min
Definition: ssl.h:688
mbedtls_ssl_handshake_params * handshake
Definition: ssl.h:792
void mbedtls_ssl_free(mbedtls_ssl_context *ssl)
Free referenced items in an SSL context and clear memory.
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.
void mbedtls_ssl_conf_endpoint(mbedtls_ssl_config *conf, int endpoint)
Set the current endpoint type.
size_t out_left
Definition: ssl.h:854
void mbedtls_ssl_session_free(mbedtls_ssl_session *session)
Free referenced items in an SSL session including the peer certificate and clear memory.
void mbedtls_ssl_conf_arc4_support(mbedtls_ssl_config *conf, char arc4)
Disable or enable support for RC4 (Default: MBEDTLS_SSL_ARC4_DISABLED)
unsigned char * in_msg
Definition: ssl.h:821
void mbedtls_ssl_conf_sig_hashes(mbedtls_ssl_config *conf, const int *hashes)
Set the allowed hashes for signatures during the handshake.
unsigned char min_major_ver
Definition: ssl.h:710
struct mbedtls_ssl_transform mbedtls_ssl_transform
Definition: ssl.h:532
mbedtls_ssl_set_timer_t * f_set_timer
Definition: ssl.h:808
const char * mbedtls_ssl_get_alpn_protocol(const mbedtls_ssl_context *ssl)
Get the name of the negotiated Application Layer Protocol.
int(* f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *)
Callback to customize X.509 certificate chain verification.
Definition: ssl.h:614
int(* f_set_cache)(void *, const mbedtls_ssl_session *)
Callback to store a session into the cache.
Definition: ssl.h:603
const int * ciphersuite_list[4]
Definition: ssl.h:590
void mbedtls_ssl_conf_dhm_min_bitlen(mbedtls_ssl_config *conf, unsigned int bitlen)
Set the minimum length for Diffie-Hellman parameters.
int(* f_cookie_write)(void *, unsigned char **, unsigned char *, const unsigned char *, size_t)
Callback to create & write a cookie for ClientHello veirifcation.
Definition: ssl.h:626
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.
mbedtls_ssl_key_cert * key_cert
Definition: ssl.h:652
mbedtls_ssl_recv_t * f_recv
Definition: ssl.h:778
int mbedtls_ssl_get_ciphersuite_id(const char *ciphersuite_name)
Return the ID of the ciphersuite associated with the given name.
void mbedtls_ssl_conf_transport(mbedtls_ssl_config *conf, int transport)
Set the transport type (TLS or DTLS).
mbedtls_ssl_session * session_negotiate
Definition: ssl.h:790
mbedtls_ssl_states
Definition: ssl.h:392
int(* f_psk)(void *, mbedtls_ssl_context *, const unsigned char *, size_t)
Callback to retrieve PSK key from identity.
Definition: ssl.h:620
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).
const int * sig_hashes
Definition: ssl.h:658
const int * mbedtls_ssl_list_ciphersuites(void)
Returns the list of ciphersuites supported by the SSL/TLS module.
void mbedtls_ssl_conf_renegotiation_enforced(mbedtls_ssl_config *conf, int max_records)
Enforce renegotiation requests.
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.
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.
size_t id_len
Definition: ssl.h:551
unsigned int encrypt_then_mac
Definition: ssl.h:729
void * p_bio
Definition: ssl.h:782
unsigned int cbc_record_splitting
Definition: ssl.h:738
int(* f_ticket_write)(void *, const mbedtls_ssl_session *, unsigned char *, const unsigned char *, size_t *, uint32_t *)
Callback to create & write a session ticket.
Definition: ssl.h:636
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.
int renego_status
Definition: ssl.h:764
int mbedtls_ssl_conf_alpn_protocols(mbedtls_ssl_config *conf, const char **protos)
Set the supported Application Layer Protocols.
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.
unsigned char _pms_ecdhe_psk[4+MBEDTLS_ECP_MAX_BYTES+MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:376
void * p_vrfy
Definition: ssl.h:615
const mbedtls_x509_crt_profile * cert_profile
Definition: ssl.h:651
void * p_timer
Definition: ssl.h:806
Diffie-Hellman-Merkle key exchange.
X.509 certificate parsing and writing.
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...
#define MBEDTLS_PSK_MAX_LEN
Definition: ssl.h:346
unsigned int session_tickets
Definition: ssl.h:747
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_session * session
Definition: ssl.h:789
unsigned char * in_iv
Definition: ssl.h:820
char own_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN]
Definition: ssl.h:896
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_transform * transform_negotiate
Definition: ssl.h:801
const char * mbedtls_ssl_get_ciphersuite(const mbedtls_ssl_context *ssl)
Return the name of the current ciphersuite.
mbedtls_ecp_group_id
Domain parameters (curve, subgroup and generator) identifiers.
Definition: ecp.h:55
unsigned char * out_ctr
Definition: ssl.h:846
int secure_renegotiation
Definition: ssl.h:892
int mbedtls_ssl_get_timer_t(void *ctx)
Callback type: get status of timers/delays.
Definition: ssl.h:523
DHM context structure.
Definition: dhm.h:151
const mbedtls_ssl_config * conf
Definition: ssl.h:757
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.
unsigned char * in_offt
Definition: ssl.h:822
unsigned int extended_ms
Definition: ssl.h:732
unsigned char max_major_ver
Definition: ssl.h:708
unsigned char * psk
Definition: ssl.h:671
void mbedtls_ssl_config_init(mbedtls_ssl_config *conf)
Initialize an SSL configuration context Just makes the context ready for mbedtls_ssl_config_defaults(...
int(* f_export_keys)(void *, const unsigned char *, const unsigned char *, size_t, size_t, size_t)
Callback to export key block and master secret.
Definition: ssl.h:645
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...
const char * alpn_chosen
Definition: ssl.h:877
Elliptic curve Diffie-Hellman.
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_mpi dhm_G
Definition: ssl.h:667
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...
#define MBEDTLS_MPI_MAX_SIZE
Maximum number of bytes for usable MPIs.
Definition: bignum.h:78
unsigned int disable_renegotiation
Definition: ssl.h:741
void * p_export_keys
Definition: ssl.h:647
char * hostname
Definition: ssl.h:872
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.
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...
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.
int mbedtls_ssl_setup(mbedtls_ssl_context *ssl, const mbedtls_ssl_config *conf)
Set up an SSL context for use.
size_t out_msglen
Definition: ssl.h:853
uint32_t read_timeout
Definition: ssl.h:685
void mbedtls_ssl_conf_legacy_renegotiation(mbedtls_ssl_config *conf, int allow_legacy)
Prevent or allow legacy renegotiation.
unsigned char _pms_rsa_psk[52+MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:372
int mbedtls_ssl_renegotiate(mbedtls_ssl_context *ssl)
Initiate an SSL renegotiation on the running connection.
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:1210
unsigned char * out_len
Definition: ssl.h:848
unsigned int arc4_disabled
Definition: ssl.h:723
int(* f_rng)(void *, unsigned char *, size_t)
Callback for getting (pseudo-)random numbers.
Definition: ssl.h:597
uint32_t hs_timeout_max
Definition: ssl.h:690
MPI structure.
Definition: bignum.h:146
X.509 certificate revocation list parsing.
SSL/TLS configuration to be shared between mbedtls_ssl_context structures.
Definition: ssl.h:582
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).
Container for an X.509 certificate.
Definition: x509_crt.h:54
int(* f_ticket_parse)(void *, mbedtls_ssl_session *, unsigned char *, size_t)
Callback to parse a session ticket into a session structure.
Definition: ssl.h:639
time_t mbedtls_time_t
Definition: platform.h:256
unsigned char * cli_id
Definition: ssl.h:884
int renego_max_records
Definition: ssl.h:695
mbedtls_ssl_recv_timeout_t * f_recv_timeout
Definition: ssl.h:779
mbedtls_x509_crt * ca_chain
Definition: ssl.h:653
void mbedtls_ssl_conf_read_timeout(mbedtls_ssl_config *conf, uint32_t timeout)
Set the timeout period for mbedtls_ssl_read() (Default: no timeout.)
size_t verify_data_len
Definition: ssl.h:895
void mbedtls_ssl_config_free(mbedtls_ssl_config *conf)
Free an SSL configuration context.
unsigned char * psk_identity
Definition: ssl.h:673
int mbedtls_ssl_read(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len)
Read at most 'len' application data bytes.
struct mbedtls_ssl_key_cert mbedtls_ssl_key_cert
Definition: ssl.h:535
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:508
size_t mbedtls_ssl_get_bytes_avail(const mbedtls_ssl_context *ssl)
Return the number of data bytes available to read.
unsigned char _pms_dhe_psk[4+MBEDTLS_MPI_MAX_SIZE+MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:369
size_t next_record_offset
Definition: ssl.h:829
unsigned char * out_buf
Definition: ssl.h:845
size_t psk_len
Definition: ssl.h:672
int(* f_get_cache)(void *, mbedtls_ssl_session *)
Callback to retrieve a session from the cache.
Definition: ssl.h:601
void mbedtls_ssl_session_init(mbedtls_ssl_session *session)
Initialize SSL session structure.
Security profile for certificate verification.
Definition: x509_crt.h:109
void * p_dbg
Definition: ssl.h:594
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:1182
size_t cli_id_len
Definition: ssl.h:885
void mbedtls_ssl_conf_handshake_timeout(mbedtls_ssl_config *conf, uint32_t min, uint32_t max)
Set retransmit timeout values for the DTLS handshake.
int mbedtls_ssl_config_defaults(mbedtls_ssl_config *conf, int endpoint, int transport, int preset)
Load reasonnable default SSL configuration values.
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.
void mbedtls_ssl_conf_curves(mbedtls_ssl_config *conf, const mbedtls_ecp_group_id *curves)
Set the allowed curves in order of preference.
int renego_records_seen
Definition: ssl.h:765
unsigned char * out_hdr
Definition: ssl.h:847
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.
unsigned char _pms_psk[4+2 *MBEDTLS_PSK_MAX_LEN]
Definition: ssl.h:365
uint32_t verify_result
Definition: ssl.h:558
int mbedtls_ssl_handshake(mbedtls_ssl_context *ssl)
Perform the SSL handshake.
void mbedtls_ssl_set_hs_authmode(mbedtls_ssl_context *ssl, int authmode)
Set authmode for the current handshake.
unsigned int allow_legacy_renegotiation
Definition: ssl.h:721
signed char split_done
Definition: ssl.h:860
int mbedtls_ssl_handshake_step(mbedtls_ssl_context *ssl)
Perform a single step of the SSL handshake.
const char * mbedtls_ssl_get_version(const mbedtls_ssl_context *ssl)
Return the current SSL version (SSLv3/TLSv1/etc)
void mbedtls_ssl_conf_authmode(mbedtls_ssl_config *conf, int authmode)
Set the certificate verification mode Default: NONE on server, REQUIRED on client.
int mbedtls_ssl_session_reset(mbedtls_ssl_context *ssl)
Reset an already initialized SSL context for re-use while retaining application-set variables...
int mbedtls_ssl_set_hostname(mbedtls_ssl_context *ssl, const char *hostname)
Set the hostname to check against the received server certificate.
struct mbedtls_ssl_handshake_params mbedtls_ssl_handshake_params
Definition: ssl.h:533
#define MBEDTLS_ECP_MAX_BYTES
Definition: ecp.h:181
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.
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...
void * p_ticket
Definition: ssl.h:640
void mbedtls_ssl_conf_ciphersuites(mbedtls_ssl_config *conf, const int *ciphersuites)
Set the list of allowed ciphersuites and the preference order.
size_t mbedtls_ssl_get_max_frag_len(const mbedtls_ssl_context *ssl)
Return the maximum fragment length (payload, in bytes).
#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN
Definition: ssl.h:230
mbedtls_time_t start
Definition: ssl.h:547
size_t in_msglen
Definition: ssl.h:825
uint16_t in_epoch
Definition: ssl.h:828