25#if !defined(MBEDTLS_CONFIG_FILE)
28#include MBEDTLS_CONFIG_FILE
43#if defined(MBEDTLS_X509_CRT_PARSE_C)
48#if defined(MBEDTLS_DHM_C)
57#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C)
61#if defined(MBEDTLS_ZLIB_SUPPORT)
63#if defined(MBEDTLS_DEPRECATED_WARNING)
64#warning "Record compression support via MBEDTLS_ZLIB_SUPPORT is deprecated and will be removed in the next major revision of the library"
67#if defined(MBEDTLS_DEPRECATED_REMOVED)
68#error "Record compression support via MBEDTLS_ZLIB_SUPPORT is deprecated and cannot be used if MBEDTLS_DEPRECATED_REMOVED is set"
74#if defined(MBEDTLS_HAVE_TIME)
78#if defined(MBEDTLS_USE_PSA_CRYPTO)
85#define MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE -0x7080
86#define MBEDTLS_ERR_SSL_BAD_INPUT_DATA -0x7100
87#define MBEDTLS_ERR_SSL_INVALID_MAC -0x7180
88#define MBEDTLS_ERR_SSL_INVALID_RECORD -0x7200
89#define MBEDTLS_ERR_SSL_CONN_EOF -0x7280
90#define MBEDTLS_ERR_SSL_UNKNOWN_CIPHER -0x7300
91#define MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN -0x7380
92#define MBEDTLS_ERR_SSL_NO_RNG -0x7400
93#define MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE -0x7480
94#define MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE -0x7500
95#define MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED -0x7580
96#define MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED -0x7600
97#define MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED -0x7680
98#define MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE -0x7700
99#define MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE -0x7780
100#define MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED -0x7800
101#define MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY -0x7880
102#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO -0x7900
103#define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO -0x7980
104#define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE -0x7A00
105#define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST -0x7A80
106#define MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE -0x7B00
107#define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE -0x7B80
108#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE -0x7C00
109#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP -0x7C80
110#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS -0x7D00
111#define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY -0x7D80
112#define MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC -0x7E00
113#define MBEDTLS_ERR_SSL_BAD_HS_FINISHED -0x7E80
114#define MBEDTLS_ERR_SSL_ALLOC_FAILED -0x7F00
115#define MBEDTLS_ERR_SSL_HW_ACCEL_FAILED -0x7F80
116#define MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH -0x6F80
117#define MBEDTLS_ERR_SSL_COMPRESSION_FAILED -0x6F00
118#define MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION -0x6E80
119#define MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET -0x6E00
120#define MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED -0x6D80
121#define MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH -0x6D00
122#define MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY -0x6C80
123#define MBEDTLS_ERR_SSL_INTERNAL_ERROR -0x6C00
124#define MBEDTLS_ERR_SSL_COUNTER_WRAPPING -0x6B80
125#define MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO -0x6B00
126#define MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED -0x6A80
127#define MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL -0x6A00
128#define MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE -0x6980
129#define MBEDTLS_ERR_SSL_WANT_READ -0x6900
130#define MBEDTLS_ERR_SSL_WANT_WRITE -0x6880
131#define MBEDTLS_ERR_SSL_TIMEOUT -0x6800
132#define MBEDTLS_ERR_SSL_CLIENT_RECONNECT -0x6780
133#define MBEDTLS_ERR_SSL_UNEXPECTED_RECORD -0x6700
134#define MBEDTLS_ERR_SSL_NON_FATAL -0x6680
135#define MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH -0x6600
136#define MBEDTLS_ERR_SSL_CONTINUE_PROCESSING -0x6580
137#define MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS -0x6500
138#define MBEDTLS_ERR_SSL_EARLY_MESSAGE -0x6480
139#define MBEDTLS_ERR_SSL_UNEXPECTED_CID -0x6000
140#define MBEDTLS_ERR_SSL_VERSION_MISMATCH -0x5F00
141#define MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS -0x7000
142#define MBEDTLS_ERR_SSL_BAD_CONFIG -0x5E80
147#define MBEDTLS_SSL_MAJOR_VERSION_3 3
148#define MBEDTLS_SSL_MINOR_VERSION_0 0
149#define MBEDTLS_SSL_MINOR_VERSION_1 1
150#define MBEDTLS_SSL_MINOR_VERSION_2 2
151#define MBEDTLS_SSL_MINOR_VERSION_3 3
152#define MBEDTLS_SSL_MINOR_VERSION_4 4
154#define MBEDTLS_SSL_TRANSPORT_STREAM 0
155#define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1
157#define MBEDTLS_SSL_MAX_HOST_NAME_LEN 255
158#define MBEDTLS_SSL_MAX_ALPN_NAME_LEN 255
160#define MBEDTLS_SSL_MAX_ALPN_LIST_LEN 65535
164#define MBEDTLS_SSL_MAX_FRAG_LEN_NONE 0
165#define MBEDTLS_SSL_MAX_FRAG_LEN_512 1
166#define MBEDTLS_SSL_MAX_FRAG_LEN_1024 2
167#define MBEDTLS_SSL_MAX_FRAG_LEN_2048 3
168#define MBEDTLS_SSL_MAX_FRAG_LEN_4096 4
169#define MBEDTLS_SSL_MAX_FRAG_LEN_INVALID 5
171#define MBEDTLS_SSL_IS_CLIENT 0
172#define MBEDTLS_SSL_IS_SERVER 1
174#define MBEDTLS_SSL_IS_NOT_FALLBACK 0
175#define MBEDTLS_SSL_IS_FALLBACK 1
177#define MBEDTLS_SSL_EXTENDED_MS_DISABLED 0
178#define MBEDTLS_SSL_EXTENDED_MS_ENABLED 1
180#define MBEDTLS_SSL_CID_DISABLED 0
181#define MBEDTLS_SSL_CID_ENABLED 1
183#define MBEDTLS_SSL_ETM_DISABLED 0
184#define MBEDTLS_SSL_ETM_ENABLED 1
186#define MBEDTLS_SSL_COMPRESS_NULL 0
187#define MBEDTLS_SSL_COMPRESS_DEFLATE 1
189#define MBEDTLS_SSL_VERIFY_NONE 0
190#define MBEDTLS_SSL_VERIFY_OPTIONAL 1
191#define MBEDTLS_SSL_VERIFY_REQUIRED 2
192#define MBEDTLS_SSL_VERIFY_UNSET 3
194#define MBEDTLS_SSL_LEGACY_RENEGOTIATION 0
195#define MBEDTLS_SSL_SECURE_RENEGOTIATION 1
197#define MBEDTLS_SSL_RENEGOTIATION_DISABLED 0
198#define MBEDTLS_SSL_RENEGOTIATION_ENABLED 1
200#define MBEDTLS_SSL_ANTI_REPLAY_DISABLED 0
201#define MBEDTLS_SSL_ANTI_REPLAY_ENABLED 1
203#define MBEDTLS_SSL_RENEGOTIATION_NOT_ENFORCED -1
204#define MBEDTLS_SSL_RENEGO_MAX_RECORDS_DEFAULT 16
206#define MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION 0
207#define MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION 1
208#define MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE 2
210#define MBEDTLS_SSL_TRUNC_HMAC_DISABLED 0
211#define MBEDTLS_SSL_TRUNC_HMAC_ENABLED 1
212#define MBEDTLS_SSL_TRUNCATED_HMAC_LEN 10
214#define MBEDTLS_SSL_SESSION_TICKETS_DISABLED 0
215#define MBEDTLS_SSL_SESSION_TICKETS_ENABLED 1
217#define MBEDTLS_SSL_CBC_RECORD_SPLITTING_DISABLED 0
218#define MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED 1
220#define MBEDTLS_SSL_ARC4_ENABLED 0
221#define MBEDTLS_SSL_ARC4_DISABLED 1
223#define MBEDTLS_SSL_PRESET_DEFAULT 0
224#define MBEDTLS_SSL_PRESET_SUITEB 2
226#define MBEDTLS_SSL_CERT_REQ_CA_LIST_ENABLED 1
227#define MBEDTLS_SSL_CERT_REQ_CA_LIST_DISABLED 0
229#define MBEDTLS_SSL_DTLS_SRTP_MKI_UNSUPPORTED 0
230#define MBEDTLS_SSL_DTLS_SRTP_MKI_SUPPORTED 1
236#define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MIN 1000
237#define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MAX 60000
247#if !defined(MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME)
248#define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400
262#if !defined(MBEDTLS_SSL_MAX_CONTENT_LEN)
263#define MBEDTLS_SSL_MAX_CONTENT_LEN 16384
266#if !defined(MBEDTLS_SSL_IN_CONTENT_LEN)
267#define MBEDTLS_SSL_IN_CONTENT_LEN MBEDTLS_SSL_MAX_CONTENT_LEN
270#if !defined(MBEDTLS_SSL_OUT_CONTENT_LEN)
271#define MBEDTLS_SSL_OUT_CONTENT_LEN MBEDTLS_SSL_MAX_CONTENT_LEN
278#if !defined(MBEDTLS_SSL_DTLS_MAX_BUFFERING)
279#define MBEDTLS_SSL_DTLS_MAX_BUFFERING 32768
285#if !defined(MBEDTLS_SSL_CID_IN_LEN_MAX)
286#define MBEDTLS_SSL_CID_IN_LEN_MAX 32
289#if !defined(MBEDTLS_SSL_CID_OUT_LEN_MAX)
290#define MBEDTLS_SSL_CID_OUT_LEN_MAX 32
293#if !defined(MBEDTLS_SSL_CID_PADDING_GRANULARITY)
294#define MBEDTLS_SSL_CID_PADDING_GRANULARITY 16
297#if !defined(MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY)
298#define MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY 1
306#if defined(MBEDTLS_SSL_PROTO_SSL3)
307#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 36
309#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 12
315#define MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO 0xFF
316#define MBEDTLS_SSL_FALLBACK_SCSV_VALUE 0x5600
322#define MBEDTLS_SSL_HASH_NONE 0
323#define MBEDTLS_SSL_HASH_MD5 1
324#define MBEDTLS_SSL_HASH_SHA1 2
325#define MBEDTLS_SSL_HASH_SHA224 3
326#define MBEDTLS_SSL_HASH_SHA256 4
327#define MBEDTLS_SSL_HASH_SHA384 5
328#define MBEDTLS_SSL_HASH_SHA512 6
330#define MBEDTLS_SSL_SIG_ANON 0
331#define MBEDTLS_SSL_SIG_RSA 1
332#define MBEDTLS_SSL_SIG_ECDSA 3
338#define MBEDTLS_SSL_CERT_TYPE_RSA_SIGN 1
339#define MBEDTLS_SSL_CERT_TYPE_ECDSA_SIGN 64
344#define MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC 20
345#define MBEDTLS_SSL_MSG_ALERT 21
346#define MBEDTLS_SSL_MSG_HANDSHAKE 22
347#define MBEDTLS_SSL_MSG_APPLICATION_DATA 23
348#define MBEDTLS_SSL_MSG_CID 25
350#define MBEDTLS_SSL_ALERT_LEVEL_WARNING 1
351#define MBEDTLS_SSL_ALERT_LEVEL_FATAL 2
353#define MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY 0
354#define MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE 10
355#define MBEDTLS_SSL_ALERT_MSG_BAD_RECORD_MAC 20
356#define MBEDTLS_SSL_ALERT_MSG_DECRYPTION_FAILED 21
357#define MBEDTLS_SSL_ALERT_MSG_RECORD_OVERFLOW 22
358#define MBEDTLS_SSL_ALERT_MSG_DECOMPRESSION_FAILURE 30
359#define MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE 40
360#define MBEDTLS_SSL_ALERT_MSG_NO_CERT 41
361#define MBEDTLS_SSL_ALERT_MSG_BAD_CERT 42
362#define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_CERT 43
363#define MBEDTLS_SSL_ALERT_MSG_CERT_REVOKED 44
364#define MBEDTLS_SSL_ALERT_MSG_CERT_EXPIRED 45
365#define MBEDTLS_SSL_ALERT_MSG_CERT_UNKNOWN 46
366#define MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER 47
367#define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_CA 48
368#define MBEDTLS_SSL_ALERT_MSG_ACCESS_DENIED 49
369#define MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR 50
370#define MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR 51
371#define MBEDTLS_SSL_ALERT_MSG_EXPORT_RESTRICTION 60
372#define MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION 70
373#define MBEDTLS_SSL_ALERT_MSG_INSUFFICIENT_SECURITY 71
374#define MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR 80
375#define MBEDTLS_SSL_ALERT_MSG_INAPROPRIATE_FALLBACK 86
376#define MBEDTLS_SSL_ALERT_MSG_USER_CANCELED 90
377#define MBEDTLS_SSL_ALERT_MSG_NO_RENEGOTIATION 100
378#define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT 110
379#define MBEDTLS_SSL_ALERT_MSG_UNRECOGNIZED_NAME 112
380#define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY 115
381#define MBEDTLS_SSL_ALERT_MSG_NO_APPLICATION_PROTOCOL 120
383#define MBEDTLS_SSL_HS_HELLO_REQUEST 0
384#define MBEDTLS_SSL_HS_CLIENT_HELLO 1
385#define MBEDTLS_SSL_HS_SERVER_HELLO 2
386#define MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST 3
387#define MBEDTLS_SSL_HS_NEW_SESSION_TICKET 4
388#define MBEDTLS_SSL_HS_CERTIFICATE 11
389#define MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE 12
390#define MBEDTLS_SSL_HS_CERTIFICATE_REQUEST 13
391#define MBEDTLS_SSL_HS_SERVER_HELLO_DONE 14
392#define MBEDTLS_SSL_HS_CERTIFICATE_VERIFY 15
393#define MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE 16
394#define MBEDTLS_SSL_HS_FINISHED 20
399#define MBEDTLS_TLS_EXT_SERVERNAME 0
400#define MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME 0
402#define MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH 1
404#define MBEDTLS_TLS_EXT_TRUNCATED_HMAC 4
406#define MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES 10
407#define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS 11
409#define MBEDTLS_TLS_EXT_SIG_ALG 13
411#define MBEDTLS_TLS_EXT_USE_SRTP 14
413#define MBEDTLS_TLS_EXT_ALPN 16
415#define MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC 22
416#define MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET 0x0017
418#define MBEDTLS_TLS_EXT_SESSION_TICKET 35
423#define MBEDTLS_TLS_EXT_CID 254
425#define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 256
427#define MBEDTLS_TLS_EXT_RENEGOTIATION_INFO 0xFF01
432#if !defined(MBEDTLS_PSK_MAX_LEN)
433#define MBEDTLS_PSK_MAX_LEN 32
439#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
440 unsigned char _pms_rsa[48];
442#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)
445#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
446 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
447 defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
448 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
449 unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES];
451#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
452 unsigned char _pms_psk[4 + 2 * MBEDTLS_PSK_MAX_LEN];
454#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
456 + MBEDTLS_PSK_MAX_LEN];
458#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)
459 unsigned char _pms_rsa_psk[52 + MBEDTLS_PSK_MAX_LEN];
461#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
462 unsigned char _pms_ecdhe_psk[4 + MBEDTLS_ECP_MAX_BYTES
463 + MBEDTLS_PSK_MAX_LEN];
465#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
466 unsigned char _pms_ecjpake[32];
470#define MBEDTLS_PREMASTER_SIZE sizeof( union mbedtls_ssl_premaster_secret )
481 MBEDTLS_SSL_HELLO_REQUEST,
482 MBEDTLS_SSL_CLIENT_HELLO,
483 MBEDTLS_SSL_SERVER_HELLO,
484 MBEDTLS_SSL_SERVER_CERTIFICATE,
485 MBEDTLS_SSL_SERVER_KEY_EXCHANGE,
486 MBEDTLS_SSL_CERTIFICATE_REQUEST,
487 MBEDTLS_SSL_SERVER_HELLO_DONE,
488 MBEDTLS_SSL_CLIENT_CERTIFICATE,
489 MBEDTLS_SSL_CLIENT_KEY_EXCHANGE,
490 MBEDTLS_SSL_CERTIFICATE_VERIFY,
491 MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC,
492 MBEDTLS_SSL_CLIENT_FINISHED,
493 MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC,
494 MBEDTLS_SSL_SERVER_FINISHED,
495 MBEDTLS_SSL_FLUSH_BUFFERS,
496 MBEDTLS_SSL_HANDSHAKE_WRAPUP,
497 MBEDTLS_SSL_HANDSHAKE_OVER,
498 MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET,
499 MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT,
508 MBEDTLS_SSL_TLS_PRF_NONE,
509 MBEDTLS_SSL_TLS_PRF_SSL3,
510 MBEDTLS_SSL_TLS_PRF_TLS1,
511 MBEDTLS_SSL_TLS_PRF_SHA384,
512 MBEDTLS_SSL_TLS_PRF_SHA256
514mbedtls_tls_prf_types;
533 const unsigned char *buf,
632typedef struct mbedtls_ssl_sig_hash_set_t mbedtls_ssl_sig_hash_set_t;
633#if defined(MBEDTLS_X509_CRT_PARSE_C)
634typedef struct mbedtls_ssl_key_cert mbedtls_ssl_key_cert;
636#if defined(MBEDTLS_SSL_PROTO_DTLS)
637typedef struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item;
640#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
641#if defined(MBEDTLS_X509_CRT_PARSE_C)
716 const unsigned char *hash,
781 const unsigned char *input,
828 unsigned char *output,
830 size_t output_size );
852#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \
853 !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
854#define MBEDTLS_SSL_PEER_CERT_DIGEST_MAX_LEN 48
855#if defined(MBEDTLS_SHA256_C)
856#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE MBEDTLS_MD_SHA256
857#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN 32
858#elif defined(MBEDTLS_SHA512_C)
859#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE MBEDTLS_MD_SHA384
860#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN 48
861#elif defined(MBEDTLS_SHA1_C)
862#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE MBEDTLS_MD_SHA1
863#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN 20
866#error "Bad configuration - need SHA-1, SHA-256 or SHA-512 enabled to compute digest of peer CRT."
871#if defined(MBEDTLS_SSL_DTLS_SRTP)
873#define MBEDTLS_TLS_SRTP_MAX_MKI_LENGTH 255
874#define MBEDTLS_TLS_SRTP_MAX_PROFILE_LIST_LENGTH 4
884#define MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80 ( (uint16_t) 0x0001)
885#define MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32 ( (uint16_t) 0x0002)
886#define MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80 ( (uint16_t) 0x0005)
887#define MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32 ( (uint16_t) 0x0006)
889#define MBEDTLS_TLS_SRTP_UNSET ( (uint16_t) 0x0000)
891typedef uint16_t mbedtls_ssl_srtp_profile;
893typedef struct mbedtls_dtls_srtp_info_t
896 mbedtls_ssl_srtp_profile chosen_dtls_srtp_profile;
900 unsigned char mki_value[MBEDTLS_TLS_SRTP_MAX_MKI_LENGTH];
902mbedtls_dtls_srtp_info;
919#if defined(MBEDTLS_HAVE_TIME)
920 mbedtls_time_t start;
925 unsigned char id[32];
928#if defined(MBEDTLS_X509_CRT_PARSE_C)
929#if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
934 unsigned char *peer_cert_digest;
935 size_t peer_cert_digest_len;
941#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
942 unsigned char *ticket;
944 uint32_t ticket_lifetime;
947#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
948 unsigned char mfl_code;
951#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
955#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
956 int encrypt_then_mac;
974 void (*
f_dbg)(
void *, int,
const char *, int,
const char *);
978 int (*
f_rng)(
void *,
unsigned char *, size_t);
987#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
993#if defined(MBEDTLS_X509_CRT_PARSE_C)
999#if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
1005#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
1007 int (*f_cookie_write)(
void *,
unsigned char **,
unsigned char *,
1008 const unsigned char *, size_t );
1010 int (*f_cookie_check)(
void *,
const unsigned char *, size_t,
1011 const unsigned char *, size_t );
1015#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
1018 unsigned char *,
const unsigned char *,
size_t *, uint32_t * );
1024#if defined(MBEDTLS_SSL_EXPORT_KEYS)
1026 int (*f_export_keys)(
void *,
const unsigned char *,
1027 const unsigned char *, size_t, size_t, size_t );
1030 int (*f_export_keys_ext)(
void *,
const unsigned char *,
1031 const unsigned char *, size_t, size_t, size_t,
1032 const unsigned char[32],
const unsigned char[32],
1033 mbedtls_tls_prf_types );
1034 void *p_export_keys;
1037#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
1041#if defined(MBEDTLS_X509_CRT_PARSE_C)
1043 mbedtls_ssl_key_cert *key_cert;
1046#if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
1047 mbedtls_x509_crt_ca_cb_t f_ca_cb;
1052#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
1053#if defined(MBEDTLS_X509_CRT_PARSE_C)
1054 mbedtls_ssl_async_sign_t *f_async_sign_start;
1055 mbedtls_ssl_async_decrypt_t *f_async_decrypt_start;
1057 mbedtls_ssl_async_resume_t *f_async_resume;
1058 mbedtls_ssl_async_cancel_t *f_async_cancel;
1059 void *p_async_config_data;
1062#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
1063 const int *sig_hashes;
1066#if defined(MBEDTLS_ECP_C)
1070#if defined(MBEDTLS_DHM_C)
1075#if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
1077#if defined(MBEDTLS_USE_PSA_CRYPTO)
1096 unsigned char *psk_identity;
1101 size_t psk_identity_len;
1109#if defined(MBEDTLS_SSL_ALPN)
1110 const char **alpn_list;
1113#if defined(MBEDTLS_SSL_DTLS_SRTP)
1115 const mbedtls_ssl_srtp_profile *dtls_srtp_profile_list;
1117 size_t dtls_srtp_profile_list_len;
1126#if defined(MBEDTLS_SSL_PROTO_DTLS)
1127 uint32_t hs_timeout_min;
1129 uint32_t hs_timeout_max;
1133#if defined(MBEDTLS_SSL_RENEGOTIATION)
1134 int renego_max_records;
1135 unsigned char renego_period[8];
1139#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
1140 unsigned int badmac_limit;
1143#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
1144 unsigned int dhm_min_bitlen;
1161#if defined(MBEDTLS_ARC4_C)
1162 unsigned int arc4_disabled : 1;
1164#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
1165 unsigned int mfl_code : 3;
1167#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
1168 unsigned int encrypt_then_mac : 1 ;
1170#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
1171 unsigned int extended_ms : 1;
1173#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
1174 unsigned int anti_replay : 1;
1176#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
1177 unsigned int cbc_record_splitting : 1;
1179#if defined(MBEDTLS_SSL_RENEGOTIATION)
1180 unsigned int disable_renegotiation : 1;
1182#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
1183 unsigned int trunc_hmac : 1;
1185#if defined(MBEDTLS_SSL_SESSION_TICKETS)
1186 unsigned int session_tickets : 1;
1188#if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)
1189 unsigned int fallback : 1;
1191#if defined(MBEDTLS_SSL_SRV_C)
1192 unsigned int cert_req_ca_list : 1;
1195#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
1196 unsigned int ignore_unexpected_cid : 1;
1200#if defined(MBEDTLS_SSL_DTLS_SRTP)
1201 unsigned int dtls_srtp_mki_support : 1;
1214#if defined(MBEDTLS_SSL_RENEGOTIATION)
1216 int renego_records_seen;
1224#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
1225 unsigned badmac_seen;
1228#if defined(MBEDTLS_X509_CRT_PARSE_C)
1276#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
1277 unsigned char *in_cid;
1288#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
1291#if defined(MBEDTLS_SSL_PROTO_DTLS)
1293 size_t next_record_offset;
1296#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
1297 uint64_t in_window_top;
1308#if defined(MBEDTLS_SSL_PROTO_DTLS)
1309 uint8_t disable_datagram_packing;
1319#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
1320 unsigned char *out_cid;
1330#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
1336#if defined(MBEDTLS_SSL_PROTO_DTLS)
1340#if defined(MBEDTLS_ZLIB_SUPPORT)
1341 unsigned char *compress_buf;
1343#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
1344 signed char split_done;
1355#if defined(MBEDTLS_X509_CRT_PARSE_C)
1360#if defined(MBEDTLS_SSL_ALPN)
1361 const char *alpn_chosen;
1364#if defined(MBEDTLS_SSL_DTLS_SRTP)
1368 mbedtls_dtls_srtp_info dtls_srtp_info;
1374#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
1375 unsigned char *cli_id;
1385#if defined(MBEDTLS_SSL_RENEGOTIATION)
1386 size_t verify_data_len;
1387 char own_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN];
1388 char peer_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN];
1391#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
1398 unsigned char own_cid[ MBEDTLS_SSL_CID_IN_LEN_MAX ];
1399 uint8_t own_cid_len;
1400 uint8_t negotiate_cid;
1407#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
1409#if !defined(MBEDTLS_DEPRECATED_REMOVED)
1411#define MBEDTLS_SSL_CHANNEL_OUTBOUND MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( 0 )
1412#define MBEDTLS_SSL_CHANNEL_INBOUND MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( 1 )
1414#if defined(MBEDTLS_DEPRECATED_WARNING)
1415#define MBEDTLS_DEPRECATED __attribute__((deprecated))
1417#define MBEDTLS_DEPRECATED
1420MBEDTLS_DEPRECATED
extern int (*mbedtls_ssl_hw_record_init)(
1422 const unsigned char *key_enc,
const unsigned char *key_dec,
1424 const unsigned char *iv_enc,
const unsigned char *iv_dec,
1426 const unsigned char *mac_enc,
const unsigned char *mac_dec,
1428MBEDTLS_DEPRECATED
extern int (*mbedtls_ssl_hw_record_activate)(
1431MBEDTLS_DEPRECATED
extern int (*mbedtls_ssl_hw_record_reset)(
1433MBEDTLS_DEPRECATED
extern int (*mbedtls_ssl_hw_record_write)(
1435MBEDTLS_DEPRECATED
extern int (*mbedtls_ssl_hw_record_read)(
1437MBEDTLS_DEPRECATED
extern int (*mbedtls_ssl_hw_record_finish)(
1440#undef MBEDTLS_DEPRECATED
1561#if defined(MBEDTLS_X509_CRT_PARSE_C)
1590 int (*f_rng)(
void *,
unsigned char *,
size_t),
1608 void (*f_dbg)(
void *,
int,
const char *,
int,
const char *),
1647#if defined(MBEDTLS_SSL_PROTO_DTLS)
1649#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
1737 unsigned char const *own_cid,
1738 size_t own_cid_len );
1779 unsigned char peer_cid[ MBEDTLS_SSL_CID_OUT_LEN_MAX ],
1780 size_t *peer_cid_len );
1829#if defined(MBEDTLS_X509_CRT_PARSE_C)
1871#if defined(MBEDTLS_SSL_RECORD_CHECKING)
1967 unsigned char *start,
1968 const unsigned char *end,
1970 uint32_t *lifetime );
1972#if defined(MBEDTLS_SSL_EXPORT_KEYS)
1993typedef int mbedtls_ssl_export_keys_t(
void *p_expkey,
1994 const unsigned char *ms,
1995 const unsigned char *kb,
2025typedef int mbedtls_ssl_export_keys_ext_t(
void *p_expkey,
2026 const unsigned char *ms,
2027 const unsigned char *kb,
2031 const unsigned char client_random[32],
2032 const unsigned char server_random[32],
2033 mbedtls_tls_prf_types tls_prf_type );
2064#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
2085#if defined(MBEDTLS_SSL_EXPORT_KEYS)
2097 mbedtls_ssl_export_keys_t *f_export_keys,
2098 void *p_export_keys );
2113 mbedtls_ssl_export_keys_ext_t *f_export_keys_ext,
2114 void *p_export_keys );
2117#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
2149 mbedtls_ssl_async_sign_t *f_async_sign,
2150 mbedtls_ssl_async_decrypt_t *f_async_decrypt,
2151 mbedtls_ssl_async_resume_t *f_async_resume,
2152 mbedtls_ssl_async_cancel_t *f_async_cancel,
2153 void *config_data );
2211 unsigned char **p,
unsigned char *end,
2212 const unsigned char *
info,
size_t ilen );
2228 const unsigned char *cookie,
size_t clen,
2229 const unsigned char *
info,
size_t ilen );
2231#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
2285 const unsigned char *
info,
2290#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
2309#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
2336#if defined(MBEDTLS_SSL_PROTO_DTLS)
2367 unsigned allow_packing );
2400void mbedtls_ssl_conf_handshake_timeout(
mbedtls_ssl_config *conf, uint32_t min, uint32_t max );
2403#if defined(MBEDTLS_SSL_SRV_C)
2447#if defined(MBEDTLS_SSL_CLI_C)
2498 const unsigned char *buf,
2565 const int *ciphersuites );
2567#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
2568#define MBEDTLS_SSL_UNEXPECTED_CID_IGNORE 0
2569#define MBEDTLS_SSL_UNEXPECTED_CID_FAIL 1
2603 int ignore_other_cids );
2626 const int *ciphersuites,
2627 int major,
int minor );
2629#if defined(MBEDTLS_X509_CRT_PARSE_C)
2658#if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
2711 mbedtls_x509_crt_ca_cb_t f_ca_cb,
2756#if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
2789 const unsigned char *psk,
size_t psk_len,
2790 const unsigned char *psk_identity,
size_t psk_identity_len );
2792#if defined(MBEDTLS_USE_PSA_CRYPTO)
2831 const unsigned char *psk_identity,
2832 size_t psk_identity_len );
2852 const unsigned char *psk,
size_t psk_len );
2854#if defined(MBEDTLS_USE_PSA_CRYPTO)
2923#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_SRV_C)
2925#if !defined(MBEDTLS_DEPRECATED_REMOVED)
2927#if defined(MBEDTLS_DEPRECATED_WARNING)
2928#define MBEDTLS_DEPRECATED __attribute__((deprecated))
2930#define MBEDTLS_DEPRECATED
2948 const char *dhm_G );
2966 const unsigned char *dhm_P,
size_t P_len,
2967 const unsigned char *dhm_G,
size_t G_len );
2981#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
2991 unsigned int bitlen );
2994#if defined(MBEDTLS_ECP_C)
3026#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
3046 const int *hashes );
3049#if defined(MBEDTLS_X509_CRT_PARSE_C)
3071#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
3145#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
3164 const unsigned char *pw,
3168#if defined(MBEDTLS_SSL_ALPN)
3195#if defined(MBEDTLS_SSL_DTLS_SRTP)
3196#if defined(MBEDTLS_DEBUG_C)
3197static inline const char *mbedtls_ssl_get_srtp_profile_as_string( mbedtls_ssl_srtp_profile profile )
3201 case MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80:
3202 return(
"MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80" );
3203 case MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32:
3204 return(
"MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32" );
3205 case MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80:
3206 return(
"MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80" );
3207 case MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32:
3208 return(
"MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32" );
3228 int support_mki_value );
3249int mbedtls_ssl_conf_dtls_srtp_protection_profiles
3251 const mbedtls_ssl_srtp_profile *profiles );
3270 unsigned char *mki_value,
3291 mbedtls_dtls_srtp_info *dtls_srtp_info );
3332#if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)
3355#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
3370#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
3385#if defined(MBEDTLS_ARC4_C)
3404#if defined(MBEDTLS_SSL_SRV_C)
3415 char cert_req_ca_list );
3418#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
3453int mbedtls_ssl_conf_max_frag_len(
mbedtls_ssl_config *conf,
unsigned char mfl_code );
3456#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
3468#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
3483#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
3497#if defined(MBEDTLS_SSL_RENEGOTIATION)
3547#if defined(MBEDTLS_SSL_RENEGOTIATION)
3585void mbedtls_ssl_conf_renegotiation_enforced(
mbedtls_ssl_config *conf,
int max_records );
3613 const unsigned char period[8] );
3720#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
3752#if !defined(MBEDTLS_DEPRECATED_REMOVED)
3754#if defined(MBEDTLS_DEPRECATED_WARNING)
3755#define MBEDTLS_DEPRECATED __attribute__((deprecated))
3757#define MBEDTLS_DEPRECATED
3774MBEDTLS_DEPRECATED
size_t mbedtls_ssl_get_max_frag_len(
3808#if defined(MBEDTLS_X509_CRT_PARSE_C)
3842#if defined(MBEDTLS_SSL_CLI_C)
3946#if defined(MBEDTLS_SSL_RENEGOTIATION)
4131 unsigned char level,
4132 unsigned char message );
4155#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
4275 const unsigned char *buf,
4307 int endpoint,
int transport,
int preset );
4350 const unsigned char *secret,
size_t slen,
4352 const unsigned char *random,
size_t rlen,
4353 unsigned char *dstbuf,
size_t dlen );
Multi-precision integer library.
#define MBEDTLS_MPI_MAX_SIZE
Maximum number of bytes for usable MPIs.
Configuration options (set of defines)
Platform Security Architecture cryptography module.
This file contains Diffie-Hellman-Merkle (DHM) key exchange definitions and functions.
This file contains ECDH definitions and functions.
uint32_t psa_key_id_t
Encoding of identifiers of persistent keys.
mbedtls_ecp_group_id
Domain-parameter identifiers: curve, subgroup, and generator.
mbedtls_md_type_t
Supported message digests.
void mbedtls_ssl_conf_read_timeout(mbedtls_ssl_config *conf, uint32_t timeout)
Set the timeout period for mbedtls_ssl_read() (Default: no timeout.)
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)
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.
void mbedtls_ssl_conf_legacy_renegotiation(mbedtls_ssl_config *conf, int allow_legacy)
Prevent or allow legacy renegotiation.
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.
int mbedtls_ssl_session_reset(mbedtls_ssl_context *ssl)
Reset an already initialized SSL context for re-use while retaining application-set variables,...
void mbedtls_ssl_free(mbedtls_ssl_context *ssl)
Free referenced items in an SSL context and clear memory.
void mbedtls_ssl_conf_transport(mbedtls_ssl_config *conf, int transport)
Set the transport type (TLS or DTLS).
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.)
int mbedtls_ssl_send_t(void *ctx, const unsigned char *buf, size_t len)
Callback type: send data on the network.
void mbedtls_ssl_conf_endpoint(mbedtls_ssl_config *conf, int endpoint)
Set the current endpoint type.
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.
int mbedtls_ssl_send_alert_message(mbedtls_ssl_context *ssl, unsigned char level, unsigned char message)
Send an alert message.
const char * mbedtls_ssl_get_version(const mbedtls_ssl_context *ssl)
Return the current SSL version (SSLv3/TLSv1/etc)
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 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.
int mbedtls_ssl_handshake(mbedtls_ssl_context *ssl)
Perform the SSL handshake.
uint32_t mbedtls_ssl_get_verify_result(const mbedtls_ssl_context *ssl)
Return the result of the certificate verification.
int mbedtls_ssl_session_load(mbedtls_ssl_session *session, const unsigned char *buf, size_t len)
Load serialized session data into a session structure.
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.
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_get_max_out_record_payload(const mbedtls_ssl_context *ssl)
Return the current maximum outgoing record payload in bytes.
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_set_timer_t(void *ctx, uint32_t int_ms, uint32_t fin_ms)
Callback type: set a pair of timers/delays to watch.
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.
void mbedtls_ssl_config_free(mbedtls_ssl_config *conf)
Free an SSL configuration context.
void mbedtls_ssl_session_init(mbedtls_ssl_session *session)
Initialize SSL session structure.
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()
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.
const char * mbedtls_ssl_get_ciphersuite(const mbedtls_ssl_context *ssl)
Return the name of the current ciphersuite.
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...
int mbedtls_ssl_get_ciphersuite_id(const char *ciphersuite_name)
Return the ID of the ciphersuite associated with the given name.
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.
int mbedtls_ssl_config_defaults(mbedtls_ssl_config *conf, int endpoint, int transport, int preset)
Load reasonnable default SSL configuration values.
int mbedtls_ssl_read(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len)
Read at most 'len' application data bytes.
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.
int mbedtls_ssl_handshake_step(mbedtls_ssl_context *ssl)
Perform a single step of the SSL handshake.
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.
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_config_init(mbedtls_ssl_config *conf)
Initialize an SSL configuration context Just makes the context ready for mbedtls_ssl_config_defaults(...
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.
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.
int mbedtls_ssl_recv_t(void *ctx, unsigned char *buf, size_t len)
Callback type: receive data from the network.
void mbedtls_ssl_session_free(mbedtls_ssl_session *session)
Free referenced items in an SSL session including the peer certificate and clear memory.
int mbedtls_ssl_close_notify(mbedtls_ssl_context *ssl)
Notify the peer that the connection is being closed.
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_bytes_avail(const mbedtls_ssl_context *ssl)
Return the number of application data bytes remaining to be read from the current record.
int mbedtls_ssl_get_timer_t(void *ctx)
Callback type: get status of timers/delays.
int mbedtls_ssl_setup(mbedtls_ssl_context *ssl, const mbedtls_ssl_config *conf)
Set up an SSL context for use.
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...
This file provides an API for Elliptic Curves over GF(P) (ECP).
SSL Ciphersuites for mbed TLS.
The DHM context structure.
SSL/TLS configuration to be shared between mbedtls_ssl_context structures.
unsigned char min_major_ver
unsigned char max_minor_ver
unsigned char max_major_ver
int(* f_set_cache)(void *, const mbedtls_ssl_session *)
Callback to store a session into the cache
const int * ciphersuite_list[4]
void(* f_dbg)(void *, int, const char *, int, const char *)
Callback for printing debug output
int(* f_rng)(void *, unsigned char *, size_t)
Callback for getting (pseudo-)random numbers
unsigned char min_minor_ver
int(* f_get_cache)(void *, mbedtls_ssl_session *)
Callback to retrieve a session from the cache
unsigned int allow_legacy_renegotiation
mbedtls_ssl_set_timer_t * f_set_timer
mbedtls_ssl_recv_timeout_t * f_recv_timeout
mbedtls_ssl_session * session_negotiate
unsigned char cur_out_ctr[8]
mbedtls_ssl_transform * transform
mbedtls_ssl_recv_t * f_recv
mbedtls_ssl_transform * transform_negotiate
mbedtls_ssl_get_timer_t * f_get_timer
mbedtls_ssl_session * session_in
mbedtls_ssl_handshake_params * handshake
mbedtls_ssl_session * session_out
mbedtls_ssl_send_t * f_send
mbedtls_ssl_transform * transform_out
mbedtls_ssl_transform * transform_in
mbedtls_ssl_session * session
const mbedtls_ssl_config * conf
Certificate revocation list structure.
Security profile for certificate verification.
Container for an X.509 certificate.
X.509 certificate revocation list parsing.
X.509 certificate parsing and writing.