Loading...
Searching...
No Matches
ssl.h
Go to the documentation of this file.
/*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SSL_H
#define MBEDTLS_SSL_H
#include "mbedtls/platform_util.h"
#include "mbedtls/private_access.h"
#include "mbedtls/build_info.h"
#include "mbedtls/bignum.h"
#include "mbedtls/ecp.h"
#include "mbedtls/ssl_ciphersuites.h"
#if defined(MBEDTLS_X509_CRT_PARSE_C)
#include "mbedtls/x509_crt.h"
#include "mbedtls/x509_crl.h"
#endif
#if defined(MBEDTLS_DHM_C)
#include "mbedtls/dhm.h"
#endif
#include "mbedtls/md.h"
#if defined(MBEDTLS_KEY_EXCHANGE_SOME_ECDH_OR_ECDHE_ANY_ENABLED)
#include "mbedtls/ecdh.h"
#endif
#if defined(MBEDTLS_HAVE_TIME)
#include "mbedtls/platform_time.h"
#endif
#include "psa/crypto.h"
/*
* SSL Error codes
*/
#define MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS -0x7000
#define MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE -0x7080
#define MBEDTLS_ERR_SSL_BAD_INPUT_DATA -0x7100
#define MBEDTLS_ERR_SSL_INVALID_MAC -0x7180
#define MBEDTLS_ERR_SSL_INVALID_RECORD -0x7200
#define MBEDTLS_ERR_SSL_CONN_EOF -0x7280
#define MBEDTLS_ERR_SSL_DECODE_ERROR -0x7300
/* Error space gap */
#define MBEDTLS_ERR_SSL_NO_RNG -0x7400
#define MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE -0x7480
#define MBEDTLS_ERR_SSL_UNSUPPORTED_EXTENSION -0x7500
#define MBEDTLS_ERR_SSL_NO_APPLICATION_PROTOCOL -0x7580
#define MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED -0x7600
#define MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED -0x7680
#define MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE -0x7700
#define MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE -0x7780
#define MBEDTLS_ERR_SSL_UNRECOGNIZED_NAME -0x7800
#define MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY -0x7880
/* Error space gap */
/* Error space gap */
#define MBEDTLS_ERR_SSL_BAD_CERTIFICATE -0x7A00
/* Error space gap */
#define MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET -0x7B00
#define MBEDTLS_ERR_SSL_CANNOT_READ_EARLY_DATA -0x7B80
#define MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA -0x7C00
#define MBEDTLS_ERR_SSL_CANNOT_WRITE_EARLY_DATA -0x7C80
/* Error space gap */
/* Error space gap */
/* Error space gap */
/* Error space gap */
#define MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND -0x7E80
#define MBEDTLS_ERR_SSL_ALLOC_FAILED -0x7F00
#define MBEDTLS_ERR_SSL_HW_ACCEL_FAILED -0x7F80
#define MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH -0x6F80
#define MBEDTLS_ERR_SSL_BAD_PROTOCOL_VERSION -0x6E80
#define MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE -0x6E00
#define MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED -0x6D80
#define MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH -0x6D00
#define MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY -0x6C80
#define MBEDTLS_ERR_SSL_INTERNAL_ERROR -0x6C00
#define MBEDTLS_ERR_SSL_COUNTER_WRAPPING -0x6B80
#define MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO -0x6B00
#define MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED -0x6A80
#define MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL -0x6A00
/* Error space gap */
#define MBEDTLS_ERR_SSL_WANT_READ -0x6900
#define MBEDTLS_ERR_SSL_WANT_WRITE -0x6880
#define MBEDTLS_ERR_SSL_TIMEOUT -0x6800
#define MBEDTLS_ERR_SSL_CLIENT_RECONNECT -0x6780
#define MBEDTLS_ERR_SSL_UNEXPECTED_RECORD -0x6700
#define MBEDTLS_ERR_SSL_NON_FATAL -0x6680
#define MBEDTLS_ERR_SSL_ILLEGAL_PARAMETER -0x6600
#define MBEDTLS_ERR_SSL_CONTINUE_PROCESSING -0x6580
#define MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS -0x6500
#define MBEDTLS_ERR_SSL_EARLY_MESSAGE -0x6480
/* Error space gap */
/* Error space gap */
/* Error space gap */
/* Error space gap */
/* Error space gap */
/* Error space gap */
/* Error space gap */
/* Error space gap */
#define MBEDTLS_ERR_SSL_UNEXPECTED_CID -0x6000
#define MBEDTLS_ERR_SSL_VERSION_MISMATCH -0x5F00
#define MBEDTLS_ERR_SSL_BAD_CONFIG -0x5E80
/*
* Constants from RFC 8446 for TLS 1.3 PSK modes
*
* Those are used in the Pre-Shared Key Exchange Modes extension.
* See Section 4.2.9 in RFC 8446.
*/
#define MBEDTLS_SSL_TLS1_3_PSK_MODE_PURE 0 /* Pure PSK-based exchange */
#define MBEDTLS_SSL_TLS1_3_PSK_MODE_ECDHE 1 /* PSK+ECDHE-based exchange */
/*
* TLS 1.3 NamedGroup values
*
* From RF 8446
* enum {
* // Elliptic Curve Groups (ECDHE)
* secp256r1(0x0017), secp384r1(0x0018), secp521r1(0x0019),
* x25519(0x001D), x448(0x001E),
* // Finite Field Groups (DHE)
* ffdhe2048(0x0100), ffdhe3072(0x0101), ffdhe4096(0x0102),
* ffdhe6144(0x0103), ffdhe8192(0x0104),
* // Reserved Code Points
* ffdhe_private_use(0x01FC..0x01FF),
* ecdhe_private_use(0xFE00..0xFEFF),
* (0xFFFF)
* } NamedGroup;
*
*/
/* Elliptic Curve Groups (ECDHE) */
#define MBEDTLS_SSL_IANA_TLS_GROUP_NONE 0
#define MBEDTLS_SSL_IANA_TLS_GROUP_SECP192K1 0x0012
#define MBEDTLS_SSL_IANA_TLS_GROUP_SECP192R1 0x0013
#define MBEDTLS_SSL_IANA_TLS_GROUP_SECP224K1 0x0014
#define MBEDTLS_SSL_IANA_TLS_GROUP_SECP224R1 0x0015
#define MBEDTLS_SSL_IANA_TLS_GROUP_SECP256K1 0x0016
#define MBEDTLS_SSL_IANA_TLS_GROUP_SECP256R1 0x0017
#define MBEDTLS_SSL_IANA_TLS_GROUP_SECP384R1 0x0018
#define MBEDTLS_SSL_IANA_TLS_GROUP_SECP521R1 0x0019
#define MBEDTLS_SSL_IANA_TLS_GROUP_BP256R1 0x001A
#define MBEDTLS_SSL_IANA_TLS_GROUP_BP384R1 0x001B
#define MBEDTLS_SSL_IANA_TLS_GROUP_BP512R1 0x001C
#define MBEDTLS_SSL_IANA_TLS_GROUP_X25519 0x001D
#define MBEDTLS_SSL_IANA_TLS_GROUP_X448 0x001E
/* Finite Field Groups (DHE) */
#define MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE2048 0x0100
#define MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE3072 0x0101
#define MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE4096 0x0102
#define MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE6144 0x0103
#define MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE8192 0x0104
/*
* TLS 1.3 Key Exchange Modes
*
* Mbed TLS internal identifiers for use with the SSL configuration API
* mbedtls_ssl_conf_tls13_key_exchange_modes().
*/
#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK (1u << 0)
#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL (1u << 1)
#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL (1u << 2)
/* Convenience macros for sets of key exchanges. */
#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_ALL \
(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK | \
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL | \
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL)
#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ALL \
(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK | \
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL)
#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ALL \
(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL | \
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL)
#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_NONE (0)
/*
* Various constants
*/
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
/* These are the high and low bytes of ProtocolVersion as defined by:
* - RFC 5246: ProtocolVersion version = { 3, 3 }; // TLS v1.2
* - RFC 8446: see section 4.2.1
*/
#define MBEDTLS_SSL_MAJOR_VERSION_3 3
#define MBEDTLS_SSL_MINOR_VERSION_3 3
#define MBEDTLS_SSL_MINOR_VERSION_4 4
#endif /* MBEDTLS_DEPRECATED_REMOVED */
#define MBEDTLS_SSL_TRANSPORT_STREAM 0
#define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1
#define MBEDTLS_SSL_MAX_HOST_NAME_LEN 255
#define MBEDTLS_SSL_MAX_ALPN_NAME_LEN 255
#define MBEDTLS_SSL_MAX_ALPN_LIST_LEN 65535
/* RFC 6066 section 4, see also mfl_code_to_length in ssl_tls.c
* NONE must be zero so that memset()ing structure to zero works */
#define MBEDTLS_SSL_MAX_FRAG_LEN_NONE 0
#define MBEDTLS_SSL_MAX_FRAG_LEN_512 1
#define MBEDTLS_SSL_MAX_FRAG_LEN_1024 2
#define MBEDTLS_SSL_MAX_FRAG_LEN_2048 3
#define MBEDTLS_SSL_MAX_FRAG_LEN_4096 4
#define MBEDTLS_SSL_MAX_FRAG_LEN_INVALID 5
#define MBEDTLS_SSL_IS_CLIENT 0
#define MBEDTLS_SSL_IS_SERVER 1
#define MBEDTLS_SSL_EXTENDED_MS_DISABLED 0
#define MBEDTLS_SSL_EXTENDED_MS_ENABLED 1
#define MBEDTLS_SSL_CID_DISABLED 0
#define MBEDTLS_SSL_CID_ENABLED 1
#define MBEDTLS_SSL_ETM_DISABLED 0
#define MBEDTLS_SSL_ETM_ENABLED 1
#define MBEDTLS_SSL_COMPRESS_NULL 0
#define MBEDTLS_SSL_VERIFY_NONE 0
#define MBEDTLS_SSL_VERIFY_OPTIONAL 1
#define MBEDTLS_SSL_VERIFY_REQUIRED 2
#define MBEDTLS_SSL_VERIFY_UNSET 3 /* Used only for sni_authmode */
#define MBEDTLS_SSL_LEGACY_RENEGOTIATION 0
#define MBEDTLS_SSL_SECURE_RENEGOTIATION 1
#define MBEDTLS_SSL_RENEGOTIATION_DISABLED 0
#define MBEDTLS_SSL_RENEGOTIATION_ENABLED 1
#define MBEDTLS_SSL_ANTI_REPLAY_DISABLED 0
#define MBEDTLS_SSL_ANTI_REPLAY_ENABLED 1
#define MBEDTLS_SSL_RENEGOTIATION_NOT_ENFORCED -1
#define MBEDTLS_SSL_RENEGO_MAX_RECORDS_DEFAULT 16
#define MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION 0
#define MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION 1
#define MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE 2
#define MBEDTLS_SSL_TRUNC_HMAC_DISABLED 0
#define MBEDTLS_SSL_TRUNC_HMAC_ENABLED 1
#define MBEDTLS_SSL_TRUNCATED_HMAC_LEN 10 /* 80 bits, rfc 6066 section 7 */
#define MBEDTLS_SSL_SESSION_TICKETS_DISABLED 0
#define MBEDTLS_SSL_SESSION_TICKETS_ENABLED 1
#define MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_DISABLED 0
#define MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_ENABLED 1
#define MBEDTLS_SSL_PRESET_DEFAULT 0
#define MBEDTLS_SSL_PRESET_SUITEB 2
#define MBEDTLS_SSL_CERT_REQ_CA_LIST_ENABLED 1
#define MBEDTLS_SSL_CERT_REQ_CA_LIST_DISABLED 0
#define MBEDTLS_SSL_EARLY_DATA_DISABLED 0
#define MBEDTLS_SSL_EARLY_DATA_ENABLED 1
#define MBEDTLS_SSL_DTLS_SRTP_MKI_UNSUPPORTED 0
#define MBEDTLS_SSL_DTLS_SRTP_MKI_SUPPORTED 1
#define MBEDTLS_SSL_SRV_CIPHERSUITE_ORDER_CLIENT 1
#define MBEDTLS_SSL_SRV_CIPHERSUITE_ORDER_SERVER 0
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
#if defined(PSA_WANT_ALG_SHA_384)
#define MBEDTLS_SSL_TLS1_3_TICKET_RESUMPTION_KEY_LEN 48
#elif defined(PSA_WANT_ALG_SHA_256)
#define MBEDTLS_SSL_TLS1_3_TICKET_RESUMPTION_KEY_LEN 32
#endif
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 && MBEDTLS_SSL_SESSION_TICKETS */
/*
* Default range for DTLS retransmission timer value, in milliseconds.
* RFC 6347 4.2.4.1 says from 1 second to 60 seconds.
*/
#define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MIN 1000
#define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MAX 60000
/*
* Whether early data record should be discarded or not and how.
*
* The client has indicated early data and the server has rejected them.
* The server has then to skip past early data by either:
* - attempting to deprotect received records using the handshake traffic
* key, discarding records which fail deprotection (up to the configured
* max_early_data_size). Once a record is deprotected successfully,
* it is treated as the start of the client's second flight and the
* server proceeds as with an ordinary 1-RTT handshake.
* - skipping all records with an external content type of
* "application_data" (indicating that they are encrypted), up to the
* configured max_early_data_size. This is the expected behavior if the
* server has sent an HelloRetryRequest message. The server ignores
* application data message before 2nd ClientHello.
*/
#define MBEDTLS_SSL_EARLY_DATA_NO_DISCARD 0
#define MBEDTLS_SSL_EARLY_DATA_TRY_TO_DEPROTECT_AND_DISCARD 1
#define MBEDTLS_SSL_EARLY_DATA_DISCARD 2
/*
* Maximum fragment length in bytes,
* determines the size of each of the two internal I/O buffers.
*
* Note: the RFC defines the default size of SSL / TLS messages. If you
* change the value here, other clients / servers may not be able to
* communicate with you anymore. Only change this value if you control
* both sides of the connection and have it reduced at both sides, or
* if you're using the Max Fragment Length extension and you know all your
* peers are using it too!
*/
#if !defined(MBEDTLS_SSL_IN_CONTENT_LEN)
#define MBEDTLS_SSL_IN_CONTENT_LEN 16384
#endif
#if !defined(MBEDTLS_SSL_OUT_CONTENT_LEN)
#define MBEDTLS_SSL_OUT_CONTENT_LEN 16384
#endif
/*
* Maximum number of heap-allocated bytes for the purpose of
* DTLS handshake message reassembly and future message buffering.
*/
#if !defined(MBEDTLS_SSL_DTLS_MAX_BUFFERING)
#define MBEDTLS_SSL_DTLS_MAX_BUFFERING 32768
#endif
/*
* Maximum length of CIDs for incoming and outgoing messages.
*/
#if !defined(MBEDTLS_SSL_CID_IN_LEN_MAX)
#define MBEDTLS_SSL_CID_IN_LEN_MAX 32
#endif
#if !defined(MBEDTLS_SSL_CID_OUT_LEN_MAX)
#define MBEDTLS_SSL_CID_OUT_LEN_MAX 32
#endif
#if !defined(MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY)
#define MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY 16
#endif
#if !defined(MBEDTLS_SSL_MAX_EARLY_DATA_SIZE)
#define MBEDTLS_SSL_MAX_EARLY_DATA_SIZE 1024
#endif
#if !defined(MBEDTLS_SSL_TLS1_3_TICKET_AGE_TOLERANCE)
#define MBEDTLS_SSL_TLS1_3_TICKET_AGE_TOLERANCE 6000
#endif
#if !defined(MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH)
#define MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH 32
#endif
#if !defined(MBEDTLS_SSL_TLS1_3_DEFAULT_NEW_SESSION_TICKETS)
#define MBEDTLS_SSL_TLS1_3_DEFAULT_NEW_SESSION_TICKETS 1
#endif
/*
* Default to standard CID mode
*/
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
!defined(MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT)
#define MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT 0
#endif
/*
* Length of the verify data for secure renegotiation
*/
#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 12
/*
* Signaling ciphersuite values (SCSV)
*/
#define MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO 0xFF
/*
* Supported Signature and Hash algorithms (For TLS 1.2)
* RFC 5246 section 7.4.1.4.1
*/
#define MBEDTLS_SSL_HASH_NONE 0
#define MBEDTLS_SSL_HASH_MD5 1
#define MBEDTLS_SSL_HASH_SHA1 2
#define MBEDTLS_SSL_HASH_SHA224 3
#define MBEDTLS_SSL_HASH_SHA256 4
#define MBEDTLS_SSL_HASH_SHA384 5
#define MBEDTLS_SSL_HASH_SHA512 6
#define MBEDTLS_SSL_SIG_ANON 0
#define MBEDTLS_SSL_SIG_RSA 1
#define MBEDTLS_SSL_SIG_ECDSA 3
/*
* TLS 1.3 signature algorithms
* RFC 8446, Section 4.2.3
*/
/* RSASSA-PKCS1-v1_5 algorithms */
#define MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA256 0x0401
#define MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA384 0x0501
#define MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA512 0x0601
/* ECDSA algorithms */
#define MBEDTLS_TLS1_3_SIG_ECDSA_SECP256R1_SHA256 0x0403
#define MBEDTLS_TLS1_3_SIG_ECDSA_SECP384R1_SHA384 0x0503
#define MBEDTLS_TLS1_3_SIG_ECDSA_SECP521R1_SHA512 0x0603
/* RSASSA-PSS algorithms with public key OID rsaEncryption */
#define MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA256 0x0804
#define MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA384 0x0805
#define MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA512 0x0806
/* EdDSA algorithms */
#define MBEDTLS_TLS1_3_SIG_ED25519 0x0807
#define MBEDTLS_TLS1_3_SIG_ED448 0x0808
/* RSASSA-PSS algorithms with public key OID RSASSA-PSS */
#define MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA256 0x0809
#define MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA384 0x080A
#define MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA512 0x080B
/* LEGACY ALGORITHMS */
#define MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA1 0x0201
#define MBEDTLS_TLS1_3_SIG_ECDSA_SHA1 0x0203
#define MBEDTLS_TLS1_3_SIG_NONE 0x0
/*
* Client Certificate Types
* RFC 5246 section 7.4.4 plus RFC 4492 section 5.5
*/
#define MBEDTLS_SSL_CERT_TYPE_RSA_SIGN 1
#define MBEDTLS_SSL_CERT_TYPE_ECDSA_SIGN 64
/*
* Message, alert and handshake types
*/
#define MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC 20
#define MBEDTLS_SSL_MSG_ALERT 21
#define MBEDTLS_SSL_MSG_HANDSHAKE 22
#define MBEDTLS_SSL_MSG_APPLICATION_DATA 23
#define MBEDTLS_SSL_MSG_CID 25
#define MBEDTLS_SSL_ALERT_LEVEL_WARNING 1
#define MBEDTLS_SSL_ALERT_LEVEL_FATAL 2
#define MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY 0 /* 0x00 */
#define MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE 10 /* 0x0A */
#define MBEDTLS_SSL_ALERT_MSG_BAD_RECORD_MAC 20 /* 0x14 */
#define MBEDTLS_SSL_ALERT_MSG_DECRYPTION_FAILED 21 /* 0x15 */
#define MBEDTLS_SSL_ALERT_MSG_RECORD_OVERFLOW 22 /* 0x16 */
#define MBEDTLS_SSL_ALERT_MSG_DECOMPRESSION_FAILURE 30 /* 0x1E */
#define MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE 40 /* 0x28 */
#define MBEDTLS_SSL_ALERT_MSG_NO_CERT 41 /* 0x29 */
#define MBEDTLS_SSL_ALERT_MSG_BAD_CERT 42 /* 0x2A */
#define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_CERT 43 /* 0x2B */
#define MBEDTLS_SSL_ALERT_MSG_CERT_REVOKED 44 /* 0x2C */
#define MBEDTLS_SSL_ALERT_MSG_CERT_EXPIRED 45 /* 0x2D */
#define MBEDTLS_SSL_ALERT_MSG_CERT_UNKNOWN 46 /* 0x2E */
#define MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER 47 /* 0x2F */
#define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_CA 48 /* 0x30 */
#define MBEDTLS_SSL_ALERT_MSG_ACCESS_DENIED 49 /* 0x31 */
#define MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR 50 /* 0x32 */
#define MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR 51 /* 0x33 */
#define MBEDTLS_SSL_ALERT_MSG_EXPORT_RESTRICTION 60 /* 0x3C */
#define MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION 70 /* 0x46 */
#define MBEDTLS_SSL_ALERT_MSG_INSUFFICIENT_SECURITY 71 /* 0x47 */
#define MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR 80 /* 0x50 */
#define MBEDTLS_SSL_ALERT_MSG_INAPROPRIATE_FALLBACK 86 /* 0x56 */
#define MBEDTLS_SSL_ALERT_MSG_USER_CANCELED 90 /* 0x5A */
#define MBEDTLS_SSL_ALERT_MSG_NO_RENEGOTIATION 100 /* 0x64 */
#define MBEDTLS_SSL_ALERT_MSG_MISSING_EXTENSION 109 /* 0x6d -- new in TLS 1.3 */
#define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT 110 /* 0x6E */
#define MBEDTLS_SSL_ALERT_MSG_UNRECOGNIZED_NAME 112 /* 0x70 */
#define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY 115 /* 0x73 */
#define MBEDTLS_SSL_ALERT_MSG_CERT_REQUIRED 116 /* 0x74 */
#define MBEDTLS_SSL_ALERT_MSG_NO_APPLICATION_PROTOCOL 120 /* 0x78 */
#define MBEDTLS_SSL_HS_HELLO_REQUEST 0
#define MBEDTLS_SSL_HS_CLIENT_HELLO 1
#define MBEDTLS_SSL_HS_SERVER_HELLO 2
#define MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST 3
#define MBEDTLS_SSL_HS_NEW_SESSION_TICKET 4
#define MBEDTLS_SSL_HS_END_OF_EARLY_DATA 5
#define MBEDTLS_SSL_HS_ENCRYPTED_EXTENSIONS 8
#define MBEDTLS_SSL_HS_CERTIFICATE 11
#define MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE 12
#define MBEDTLS_SSL_HS_CERTIFICATE_REQUEST 13
#define MBEDTLS_SSL_HS_SERVER_HELLO_DONE 14
#define MBEDTLS_SSL_HS_CERTIFICATE_VERIFY 15
#define MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE 16
#define MBEDTLS_SSL_HS_FINISHED 20
#define MBEDTLS_SSL_HS_MESSAGE_HASH 254
/*
* TLS extensions
*/
#define MBEDTLS_TLS_EXT_SERVERNAME 0
#define MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME 0
#define MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH 1
#define MBEDTLS_TLS_EXT_TRUNCATED_HMAC 4
#define MBEDTLS_TLS_EXT_STATUS_REQUEST 5 /* RFC 6066 TLS 1.2 and 1.3 */
#define MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES 10
#define MBEDTLS_TLS_EXT_SUPPORTED_GROUPS 10 /* RFC 8422,7919 TLS 1.2 and 1.3 */
#define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS 11
#define MBEDTLS_TLS_EXT_SIG_ALG 13 /* RFC 8446 TLS 1.3 */
#define MBEDTLS_TLS_EXT_USE_SRTP 14
#define MBEDTLS_TLS_EXT_HEARTBEAT 15 /* RFC 6520 TLS 1.2 and 1.3 */
#define MBEDTLS_TLS_EXT_ALPN 16
#define MBEDTLS_TLS_EXT_SCT 18 /* RFC 6962 TLS 1.2 and 1.3 */
#define MBEDTLS_TLS_EXT_CLI_CERT_TYPE 19 /* RFC 7250 TLS 1.2 and 1.3 */
#define MBEDTLS_TLS_EXT_SERV_CERT_TYPE 20 /* RFC 7250 TLS 1.2 and 1.3 */
#define MBEDTLS_TLS_EXT_PADDING 21 /* RFC 7685 TLS 1.2 and 1.3 */
#define MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC 22 /* 0x16 */
#define MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET 0x0017 /* 23 */
#define MBEDTLS_TLS_EXT_RECORD_SIZE_LIMIT 28 /* RFC 8449 (implemented for TLS 1.3 only) */
#define MBEDTLS_TLS_EXT_SESSION_TICKET 35
#define MBEDTLS_TLS_EXT_PRE_SHARED_KEY 41 /* RFC 8446 TLS 1.3 */
#define MBEDTLS_TLS_EXT_EARLY_DATA 42 /* RFC 8446 TLS 1.3 */
#define MBEDTLS_TLS_EXT_SUPPORTED_VERSIONS 43 /* RFC 8446 TLS 1.3 */
#define MBEDTLS_TLS_EXT_COOKIE 44 /* RFC 8446 TLS 1.3 */
#define MBEDTLS_TLS_EXT_PSK_KEY_EXCHANGE_MODES 45 /* RFC 8446 TLS 1.3 */
#define MBEDTLS_TLS_EXT_CERT_AUTH 47 /* RFC 8446 TLS 1.3 */
#define MBEDTLS_TLS_EXT_OID_FILTERS 48 /* RFC 8446 TLS 1.3 */
#define MBEDTLS_TLS_EXT_POST_HANDSHAKE_AUTH 49 /* RFC 8446 TLS 1.3 */
#define MBEDTLS_TLS_EXT_SIG_ALG_CERT 50 /* RFC 8446 TLS 1.3 */
#define MBEDTLS_TLS_EXT_KEY_SHARE 51 /* RFC 8446 TLS 1.3 */
#if MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT == 0
#define MBEDTLS_TLS_EXT_CID 54 /* RFC 9146 DTLS 1.2 CID */
#else
#define MBEDTLS_TLS_EXT_CID 254 /* Pre-RFC 9146 DTLS 1.2 CID */
#endif
#define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 256 /* experimental */
#define MBEDTLS_TLS_EXT_RENEGOTIATION_INFO 0xFF01
/*
* Size defines
*/
#if !defined(MBEDTLS_PSK_MAX_LEN)
/*
* If the library supports TLS 1.3 tickets and the cipher suite
* TLS1-3-AES-256-GCM-SHA384, set the PSK maximum length to 48 instead of 32.
* That way, the TLS 1.3 client and server are able to resume sessions where
* the cipher suite is TLS1-3-AES-256-GCM-SHA384 (pre-shared keys are 48
* bytes long in that case).
*/
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && \
defined(MBEDTLS_SSL_SESSION_TICKETS) && \
defined(MBEDTLS_SSL_HAVE_AES) && defined(MBEDTLS_SSL_HAVE_GCM) && \
defined(MBEDTLS_MD_CAN_SHA384)
#define MBEDTLS_PSK_MAX_LEN 48 /* 384 bits */
#else
#define MBEDTLS_PSK_MAX_LEN 32 /* 256 bits */
#endif
#endif /* !MBEDTLS_PSK_MAX_LEN */
/* Dummy type used only for its size */
union mbedtls_ssl_premaster_secret {
unsigned char dummy; /* Make the union non-empty even with SSL disabled */
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
unsigned char _pms_rsa[48]; /* RFC 5246 8.1.1 */
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)
unsigned char _pms_dhm[MBEDTLS_MPI_MAX_SIZE]; /* RFC 5246 8.1.2 */
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]; /* RFC 4492 5.10 */
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
unsigned char _pms_psk[4 + 2 * MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 2 */
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
unsigned char _pms_dhe_psk[4 + MBEDTLS_MPI_MAX_SIZE
+ MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 3 */
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)
unsigned char _pms_rsa_psk[52 + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 4 */
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
unsigned char _pms_ecdhe_psk[4 + MBEDTLS_ECP_MAX_BYTES
+ MBEDTLS_PSK_MAX_LEN]; /* RFC 5489 2 */
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
unsigned char _pms_ecjpake[32]; /* Thread spec: SHA-256 output */
#endif
};
#define MBEDTLS_PREMASTER_SIZE sizeof(union mbedtls_ssl_premaster_secret)
#define MBEDTLS_TLS1_3_MD_MAX_SIZE PSA_HASH_MAX_SIZE
/* Length in number of bytes of the TLS sequence number */
#define MBEDTLS_SSL_SEQUENCE_NUMBER_LEN 8
#ifdef __cplusplus
extern "C" {
#endif
/*
* SSL state machine
*/
typedef enum {
MBEDTLS_SSL_HELLO_REQUEST,
MBEDTLS_SSL_CLIENT_HELLO,
MBEDTLS_SSL_SERVER_HELLO,
MBEDTLS_SSL_SERVER_CERTIFICATE,
MBEDTLS_SSL_SERVER_KEY_EXCHANGE,
MBEDTLS_SSL_CERTIFICATE_REQUEST,
MBEDTLS_SSL_SERVER_HELLO_DONE,
MBEDTLS_SSL_CLIENT_CERTIFICATE,
MBEDTLS_SSL_CLIENT_KEY_EXCHANGE,
MBEDTLS_SSL_CERTIFICATE_VERIFY,
MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC,
MBEDTLS_SSL_CLIENT_FINISHED,
MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC,
MBEDTLS_SSL_SERVER_FINISHED,
MBEDTLS_SSL_FLUSH_BUFFERS,
MBEDTLS_SSL_HANDSHAKE_WRAPUP,
MBEDTLS_SSL_NEW_SESSION_TICKET,
MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT,
MBEDTLS_SSL_HELLO_RETRY_REQUEST,
MBEDTLS_SSL_ENCRYPTED_EXTENSIONS,
MBEDTLS_SSL_END_OF_EARLY_DATA,
MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY,
MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED,
MBEDTLS_SSL_CLIENT_CCS_BEFORE_2ND_CLIENT_HELLO,
MBEDTLS_SSL_SERVER_CCS_AFTER_SERVER_HELLO,
MBEDTLS_SSL_CLIENT_CCS_AFTER_CLIENT_HELLO,
MBEDTLS_SSL_SERVER_CCS_AFTER_HELLO_RETRY_REQUEST,
MBEDTLS_SSL_HANDSHAKE_OVER,
MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET,
MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH,
}
mbedtls_ssl_states;
/*
* Early data status, client side only.
*/
#if defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_CLI_C)
typedef enum {
/*
* See documentation of mbedtls_ssl_get_early_data_status().
*/
MBEDTLS_SSL_EARLY_DATA_STATUS_NOT_INDICATED,
MBEDTLS_SSL_EARLY_DATA_STATUS_ACCEPTED,
MBEDTLS_SSL_EARLY_DATA_STATUS_REJECTED,
} mbedtls_ssl_early_data_status;
#endif /* MBEDTLS_SSL_EARLY_DATA && MBEDTLS_SSL_CLI_C */
typedef int mbedtls_ssl_send_t(void *ctx,
const unsigned char *buf,
size_t len);
typedef int mbedtls_ssl_recv_t(void *ctx,
unsigned char *buf,
size_t len);
typedef int mbedtls_ssl_recv_timeout_t(void *ctx,
unsigned char *buf,
size_t len,
uint32_t timeout);
typedef void mbedtls_ssl_set_timer_t(void *ctx,
uint32_t int_ms,
uint32_t fin_ms);
typedef int mbedtls_ssl_get_timer_t(void *ctx);
/* Defined below */
typedef struct mbedtls_ssl_session mbedtls_ssl_session;
typedef struct mbedtls_ssl_context mbedtls_ssl_context;
typedef struct mbedtls_ssl_config mbedtls_ssl_config;
/* Defined in library/ssl_misc.h */
typedef struct mbedtls_ssl_transform mbedtls_ssl_transform;
typedef struct mbedtls_ssl_handshake_params mbedtls_ssl_handshake_params;
typedef struct mbedtls_ssl_sig_hash_set_t mbedtls_ssl_sig_hash_set_t;
#if defined(MBEDTLS_X509_CRT_PARSE_C)
typedef struct mbedtls_ssl_key_cert mbedtls_ssl_key_cert;
#endif
#if defined(MBEDTLS_SSL_PROTO_DTLS)
typedef struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item;
#endif
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
#define MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_RESUMPTION \
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK /* 1U << 0 */
#define MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_EPHEMERAL_RESUMPTION \
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL /* 1U << 2 */
#define MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_EARLY_DATA (1U << 3)
#define MBEDTLS_SSL_TLS1_3_TICKET_FLAGS_MASK \
(MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_RESUMPTION | \
MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_EPHEMERAL_RESUMPTION | \
MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_EARLY_DATA)
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 && MBEDTLS_SSL_SESSION_TICKETS */
typedef int mbedtls_ssl_cache_get_t(void *data,
unsigned char const *session_id,
size_t session_id_len,
mbedtls_ssl_session *session);
typedef int mbedtls_ssl_cache_set_t(void *data,
unsigned char const *session_id,
size_t session_id_len,
const mbedtls_ssl_session *session);
#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
#if defined(MBEDTLS_X509_CRT_PARSE_C)
typedef int mbedtls_ssl_async_sign_t(mbedtls_ssl_context *ssl,
mbedtls_x509_crt *cert,
mbedtls_md_type_t md_alg,
const unsigned char *hash,
size_t hash_len);
typedef int mbedtls_ssl_async_decrypt_t(mbedtls_ssl_context *ssl,
mbedtls_x509_crt *cert,
const unsigned char *input,
size_t input_len);
#endif /* MBEDTLS_X509_CRT_PARSE_C */
typedef int mbedtls_ssl_async_resume_t(mbedtls_ssl_context *ssl,
unsigned char *output,
size_t *output_len,
size_t output_size);
typedef void mbedtls_ssl_async_cancel_t(mbedtls_ssl_context *ssl);
#endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \
!defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
#define MBEDTLS_SSL_PEER_CERT_DIGEST_MAX_LEN 48
#if defined(MBEDTLS_MD_CAN_SHA256)
#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE MBEDTLS_MD_SHA256
#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN 32
#elif defined(MBEDTLS_MD_CAN_SHA384)
#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE MBEDTLS_MD_SHA384
#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN 48
#elif defined(MBEDTLS_MD_CAN_SHA1)
#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE MBEDTLS_MD_SHA1
#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN 20
#else
/* This is already checked in check_config.h, but be sure. */
#error "Bad configuration - need SHA-1, SHA-256 or SHA-512 enabled to compute digest of peer CRT."
#endif
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED &&
!MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
typedef struct {
unsigned char client_application_traffic_secret_N[MBEDTLS_TLS1_3_MD_MAX_SIZE];
unsigned char server_application_traffic_secret_N[MBEDTLS_TLS1_3_MD_MAX_SIZE];
unsigned char exporter_master_secret[MBEDTLS_TLS1_3_MD_MAX_SIZE];
unsigned char resumption_master_secret[MBEDTLS_TLS1_3_MD_MAX_SIZE];
} mbedtls_ssl_tls13_application_secrets;
#if defined(MBEDTLS_SSL_DTLS_SRTP)
#define MBEDTLS_TLS_SRTP_MAX_MKI_LENGTH 255
#define MBEDTLS_TLS_SRTP_MAX_PROFILE_LIST_LENGTH 4
/*
* For code readability use a typedef for DTLS-SRTP profiles
*
* Use_srtp extension protection profiles values as defined in
* http://www.iana.org/assignments/srtp-protection/srtp-protection.xhtml
*
* Reminder: if this list is expanded mbedtls_ssl_check_srtp_profile_value
* must be updated too.
*/
#define MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80 ((uint16_t) 0x0001)
#define MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32 ((uint16_t) 0x0002)
#define MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80 ((uint16_t) 0x0005)
#define MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32 ((uint16_t) 0x0006)
/* This one is not iana defined, but for code readability. */
#define MBEDTLS_TLS_SRTP_UNSET ((uint16_t) 0x0000)
typedef uint16_t mbedtls_ssl_srtp_profile;
typedef struct mbedtls_dtls_srtp_info_t {
mbedtls_ssl_srtp_profile MBEDTLS_PRIVATE(chosen_dtls_srtp_profile);
uint16_t MBEDTLS_PRIVATE(mki_len);
unsigned char MBEDTLS_PRIVATE(mki_value)[MBEDTLS_TLS_SRTP_MAX_MKI_LENGTH];
}
mbedtls_dtls_srtp_info;
#endif /* MBEDTLS_SSL_DTLS_SRTP */
typedef enum {
MBEDTLS_SSL_VERSION_UNKNOWN,
MBEDTLS_SSL_VERSION_TLS1_2 = 0x0303,
MBEDTLS_SSL_VERSION_TLS1_3 = 0x0304,
} mbedtls_ssl_protocol_version;
/*
* This structure is used for storing current session data.
*
* Note: when changing this definition, we need to check and update:
* - in tests/suites/test_suite_ssl.function:
* ssl_populate_session() and ssl_serialize_session_save_load()
* - in library/ssl_tls.c:
* mbedtls_ssl_session_init() and mbedtls_ssl_session_free()
* mbedtls_ssl_session_save() and ssl_session_load()
* ssl_session_copy()
*/
struct mbedtls_ssl_session {
#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
unsigned char MBEDTLS_PRIVATE(mfl_code);
#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
#if defined(MBEDTLS_SSL_RECORD_SIZE_LIMIT)
uint16_t MBEDTLS_PRIVATE(record_size_limit);
#endif /* MBEDTLS_SSL_RECORD_SIZE_LIMIT */
unsigned char MBEDTLS_PRIVATE(exported);
uint8_t MBEDTLS_PRIVATE(endpoint);
mbedtls_ssl_protocol_version MBEDTLS_PRIVATE(tls_version);
#if defined(MBEDTLS_HAVE_TIME)
mbedtls_time_t MBEDTLS_PRIVATE(start);
#endif
int MBEDTLS_PRIVATE(ciphersuite);
size_t MBEDTLS_PRIVATE(id_len);
unsigned char MBEDTLS_PRIVATE(id)[32];
unsigned char MBEDTLS_PRIVATE(master)[48];
#if defined(MBEDTLS_X509_CRT_PARSE_C)
#if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
mbedtls_x509_crt *MBEDTLS_PRIVATE(peer_cert);
#else /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
unsigned char *MBEDTLS_PRIVATE(peer_cert_digest);
size_t MBEDTLS_PRIVATE(peer_cert_digest_len);
mbedtls_md_type_t MBEDTLS_PRIVATE(peer_cert_digest_type);
#endif /* !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
#endif /* MBEDTLS_X509_CRT_PARSE_C */
uint32_t MBEDTLS_PRIVATE(verify_result);
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
unsigned char *MBEDTLS_PRIVATE(ticket);
size_t MBEDTLS_PRIVATE(ticket_len);
uint32_t MBEDTLS_PRIVATE(ticket_lifetime);
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C) && \
defined(MBEDTLS_HAVE_TIME)
mbedtls_ms_time_t MBEDTLS_PRIVATE(ticket_creation_time);
#endif
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
uint32_t MBEDTLS_PRIVATE(ticket_age_add);
uint8_t MBEDTLS_PRIVATE(ticket_flags);
uint8_t MBEDTLS_PRIVATE(resumption_key_len);
unsigned char MBEDTLS_PRIVATE(resumption_key)[MBEDTLS_SSL_TLS1_3_TICKET_RESUMPTION_KEY_LEN];
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && defined(MBEDTLS_SSL_CLI_C)
char *MBEDTLS_PRIVATE(hostname);
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION && MBEDTLS_SSL_CLI_C */
#if defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_ALPN) && defined(MBEDTLS_SSL_SRV_C)
char *ticket_alpn;
#endif
#if defined(MBEDTLS_HAVE_TIME) && defined(MBEDTLS_SSL_CLI_C)
mbedtls_ms_time_t MBEDTLS_PRIVATE(ticket_reception_time);
#endif
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 && MBEDTLS_SSL_SESSION_TICKETS */
#if defined(MBEDTLS_SSL_EARLY_DATA)
uint32_t MBEDTLS_PRIVATE(max_early_data_size);
#endif
#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
int MBEDTLS_PRIVATE(encrypt_then_mac);
#endif
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
mbedtls_ssl_tls13_application_secrets MBEDTLS_PRIVATE(app_secrets);
#endif
};
/*
* Identifiers for PRFs used in various versions of TLS.
*/
typedef enum {
MBEDTLS_SSL_TLS_PRF_NONE,
MBEDTLS_SSL_TLS_PRF_SHA384,
MBEDTLS_SSL_TLS_PRF_SHA256,
MBEDTLS_SSL_HKDF_EXPAND_SHA384,
MBEDTLS_SSL_HKDF_EXPAND_SHA256
}
mbedtls_tls_prf_types;
typedef enum {
MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET = 0,
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_EARLY_SECRET,
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_EARLY_EXPORTER_SECRET,
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_HANDSHAKE_TRAFFIC_SECRET,
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_HANDSHAKE_TRAFFIC_SECRET,
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_APPLICATION_TRAFFIC_SECRET,
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_APPLICATION_TRAFFIC_SECRET,
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
} mbedtls_ssl_key_export_type;
typedef void mbedtls_ssl_export_keys_t(void *p_expkey,
mbedtls_ssl_key_export_type type,
const unsigned char *secret,
size_t secret_len,
const unsigned char client_random[32],
const unsigned char server_random[32],
mbedtls_tls_prf_types tls_prf_type);
#if defined(MBEDTLS_SSL_SRV_C)
typedef int (*mbedtls_ssl_hs_cb_t)(mbedtls_ssl_context *ssl);
#endif
/* A type for storing user data in a library structure.
*
* The representation of type may change in future versions of the library.
* Only the behaviors guaranteed by documented accessor functions are
* guaranteed to remain stable.
*/
typedef union {
uintptr_t n; /* typically a handle to an associated object */
void *p; /* typically a pointer to extra data */
} mbedtls_ssl_user_data_t;
struct mbedtls_ssl_config {
/* Group items mostly by size. This helps to reduce memory wasted to
* padding. It also helps to keep smaller fields early in the structure,
* so that elements tend to be in the 128-element direct access window
* on Arm Thumb, which reduces the code size. */
mbedtls_ssl_protocol_version MBEDTLS_PRIVATE(max_tls_version);
mbedtls_ssl_protocol_version MBEDTLS_PRIVATE(min_tls_version);
/*
* Flags (could be bit-fields to save RAM, but separate bytes make
* the code smaller on architectures with an instruction for direct
* byte access).
*/
uint8_t MBEDTLS_PRIVATE(endpoint);
uint8_t MBEDTLS_PRIVATE(transport);
uint8_t MBEDTLS_PRIVATE(authmode);
/* needed even with renego disabled for LEGACY_BREAK_HANDSHAKE */
uint8_t MBEDTLS_PRIVATE(allow_legacy_renegotiation);
#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
uint8_t MBEDTLS_PRIVATE(mfl_code);
#endif
#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
uint8_t MBEDTLS_PRIVATE(encrypt_then_mac);
#endif
#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
uint8_t MBEDTLS_PRIVATE(extended_ms);
#endif
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
uint8_t MBEDTLS_PRIVATE(anti_replay);
#endif
#if defined(MBEDTLS_SSL_RENEGOTIATION)
uint8_t MBEDTLS_PRIVATE(disable_renegotiation);
#endif
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && \
defined(MBEDTLS_SSL_CLI_C)
uint8_t MBEDTLS_PRIVATE(session_tickets);
#endif
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && \
defined(MBEDTLS_SSL_SRV_C) && \
defined(MBEDTLS_SSL_PROTO_TLS1_3)
uint16_t MBEDTLS_PRIVATE(new_session_tickets_count);
#endif
#if defined(MBEDTLS_SSL_SRV_C)
uint8_t MBEDTLS_PRIVATE(cert_req_ca_list);
uint8_t MBEDTLS_PRIVATE(respect_cli_pref);
#endif
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
uint8_t MBEDTLS_PRIVATE(ignore_unexpected_cid);
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
#if defined(MBEDTLS_SSL_DTLS_SRTP)
uint8_t MBEDTLS_PRIVATE(dtls_srtp_mki_support); /* support having mki_value
in the use_srtp extension? */
#endif
/*
* Pointers
*/
const int *MBEDTLS_PRIVATE(ciphersuite_list);
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
int MBEDTLS_PRIVATE(tls13_kex_modes);
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
void(*MBEDTLS_PRIVATE(f_dbg))(void *, int, const char *, int, const char *);
void *MBEDTLS_PRIVATE(p_dbg);
int(*MBEDTLS_PRIVATE(f_rng))(void *, unsigned char *, size_t);
void *MBEDTLS_PRIVATE(p_rng);
mbedtls_ssl_cache_get_t *MBEDTLS_PRIVATE(f_get_cache);
mbedtls_ssl_cache_set_t *MBEDTLS_PRIVATE(f_set_cache);
void *MBEDTLS_PRIVATE(p_cache);
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
int(*MBEDTLS_PRIVATE(f_sni))(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
void *MBEDTLS_PRIVATE(p_sni);
#endif
#if defined(MBEDTLS_X509_CRT_PARSE_C)
int(*MBEDTLS_PRIVATE(f_vrfy))(void *, mbedtls_x509_crt *, int, uint32_t *);
void *MBEDTLS_PRIVATE(p_vrfy);
#endif
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_PSK_ENABLED)
#if defined(MBEDTLS_SSL_SRV_C)
int(*MBEDTLS_PRIVATE(f_psk))(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
void *MBEDTLS_PRIVATE(p_psk);
#endif
#endif
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
int(*MBEDTLS_PRIVATE(f_cookie_write))(void *, unsigned char **, unsigned char *,
const unsigned char *, size_t);
int(*MBEDTLS_PRIVATE(f_cookie_check))(void *, const unsigned char *, size_t,
const unsigned char *, size_t);
void *MBEDTLS_PRIVATE(p_cookie);
#endif
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
int(*MBEDTLS_PRIVATE(f_ticket_write))(void *, const mbedtls_ssl_session *,
unsigned char *, const unsigned char *, size_t *,
uint32_t *);
int(*MBEDTLS_PRIVATE(f_ticket_parse))(void *, mbedtls_ssl_session *, unsigned char *, size_t);
void *MBEDTLS_PRIVATE(p_ticket);
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
size_t MBEDTLS_PRIVATE(cid_len);
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
#if defined(MBEDTLS_X509_CRT_PARSE_C)
const mbedtls_x509_crt_profile *MBEDTLS_PRIVATE(cert_profile);
mbedtls_ssl_key_cert *MBEDTLS_PRIVATE(key_cert);
mbedtls_x509_crt *MBEDTLS_PRIVATE(ca_chain);
mbedtls_x509_crl *MBEDTLS_PRIVATE(ca_crl);
#if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
mbedtls_x509_crt_ca_cb_t MBEDTLS_PRIVATE(f_ca_cb);
void *MBEDTLS_PRIVATE(p_ca_cb);
#endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
#endif /* MBEDTLS_X509_CRT_PARSE_C */
#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
#if defined(MBEDTLS_X509_CRT_PARSE_C)
mbedtls_ssl_async_sign_t *MBEDTLS_PRIVATE(f_async_sign_start);
mbedtls_ssl_async_decrypt_t *MBEDTLS_PRIVATE(f_async_decrypt_start);
#endif /* MBEDTLS_X509_CRT_PARSE_C */
mbedtls_ssl_async_resume_t *MBEDTLS_PRIVATE(f_async_resume);
mbedtls_ssl_async_cancel_t *MBEDTLS_PRIVATE(f_async_cancel);
void *MBEDTLS_PRIVATE(p_async_config_data);
#endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
const int *MBEDTLS_PRIVATE(sig_hashes);
#endif
const uint16_t *MBEDTLS_PRIVATE(sig_algs);
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED */
#if defined(MBEDTLS_ECP_C) && !defined(MBEDTLS_DEPRECATED_REMOVED)
const mbedtls_ecp_group_id *MBEDTLS_PRIVATE(curve_list);
#endif
const uint16_t *MBEDTLS_PRIVATE(group_list);
#if defined(MBEDTLS_DHM_C)
mbedtls_mpi MBEDTLS_PRIVATE(dhm_P);
mbedtls_mpi MBEDTLS_PRIVATE(dhm_G);
#endif
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_PSK_ENABLED)
#if defined(MBEDTLS_USE_PSA_CRYPTO)
mbedtls_svc_key_id_t MBEDTLS_PRIVATE(psk_opaque);
#endif /* MBEDTLS_USE_PSA_CRYPTO */
unsigned char *MBEDTLS_PRIVATE(psk);
size_t MBEDTLS_PRIVATE(psk_len);
unsigned char *MBEDTLS_PRIVATE(psk_identity);
size_t MBEDTLS_PRIVATE(psk_identity_len);
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_PSK_ENABLED */
#if defined(MBEDTLS_SSL_EARLY_DATA)
int MBEDTLS_PRIVATE(early_data_enabled);
#if defined(MBEDTLS_SSL_SRV_C)
/* The maximum amount of 0-RTT data. RFC 8446 section 4.6.1 */
uint32_t MBEDTLS_PRIVATE(max_early_data_size);
#endif /* MBEDTLS_SSL_SRV_C */
#endif /* MBEDTLS_SSL_EARLY_DATA */
#if defined(MBEDTLS_SSL_ALPN)
const char **MBEDTLS_PRIVATE(alpn_list);
#endif
#if defined(MBEDTLS_SSL_DTLS_SRTP)
const mbedtls_ssl_srtp_profile *MBEDTLS_PRIVATE(dtls_srtp_profile_list);
size_t MBEDTLS_PRIVATE(dtls_srtp_profile_list_len);
#endif /* MBEDTLS_SSL_DTLS_SRTP */
/*
* Numerical settings (int)
*/
uint32_t MBEDTLS_PRIVATE(read_timeout);
#if defined(MBEDTLS_SSL_PROTO_DTLS)
uint32_t MBEDTLS_PRIVATE(hs_timeout_min);
uint32_t MBEDTLS_PRIVATE(hs_timeout_max);
#endif
#if defined(MBEDTLS_SSL_RENEGOTIATION)
int MBEDTLS_PRIVATE(renego_max_records);
unsigned char MBEDTLS_PRIVATE(renego_period)[8];
#endif
unsigned int MBEDTLS_PRIVATE(badmac_limit);
#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
unsigned int MBEDTLS_PRIVATE(dhm_min_bitlen);
#endif
mbedtls_ssl_user_data_t MBEDTLS_PRIVATE(user_data);
#if defined(MBEDTLS_SSL_SRV_C)
mbedtls_ssl_hs_cb_t MBEDTLS_PRIVATE(f_cert_cb);
#endif /* MBEDTLS_SSL_SRV_C */
#if defined(MBEDTLS_KEY_EXCHANGE_CERT_REQ_ALLOWED_ENABLED)
const mbedtls_x509_crt *MBEDTLS_PRIVATE(dn_hints);
#endif
};
struct mbedtls_ssl_context {
const mbedtls_ssl_config *MBEDTLS_PRIVATE(conf);
/*
* Miscellaneous
*/
int MBEDTLS_PRIVATE(state);
#if defined(MBEDTLS_SSL_RENEGOTIATION)
int MBEDTLS_PRIVATE(renego_status);
int MBEDTLS_PRIVATE(renego_records_seen);
#endif /* MBEDTLS_SSL_RENEGOTIATION */
mbedtls_ssl_protocol_version MBEDTLS_PRIVATE(tls_version);
#if defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_CLI_C)
int MBEDTLS_PRIVATE(early_data_state);
#endif
unsigned MBEDTLS_PRIVATE(badmac_seen);
#if defined(MBEDTLS_X509_CRT_PARSE_C)
int(*MBEDTLS_PRIVATE(f_vrfy))(void *, mbedtls_x509_crt *, int, uint32_t *);
void *MBEDTLS_PRIVATE(p_vrfy);
#endif
mbedtls_ssl_send_t *MBEDTLS_PRIVATE(f_send);
mbedtls_ssl_recv_t *MBEDTLS_PRIVATE(f_recv);
mbedtls_ssl_recv_timeout_t *MBEDTLS_PRIVATE(f_recv_timeout);
void *MBEDTLS_PRIVATE(p_bio);
/*
* Session layer
*/
mbedtls_ssl_session *MBEDTLS_PRIVATE(session_in);
mbedtls_ssl_session *MBEDTLS_PRIVATE(session_out);
mbedtls_ssl_session *MBEDTLS_PRIVATE(session);
mbedtls_ssl_session *MBEDTLS_PRIVATE(session_negotiate);
mbedtls_ssl_handshake_params *MBEDTLS_PRIVATE(handshake);
/*
* Record layer transformations
*/
mbedtls_ssl_transform *MBEDTLS_PRIVATE(transform_in);
mbedtls_ssl_transform *MBEDTLS_PRIVATE(transform_out);
mbedtls_ssl_transform *MBEDTLS_PRIVATE(transform);
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
mbedtls_ssl_transform *MBEDTLS_PRIVATE(transform_negotiate);
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
mbedtls_ssl_transform *MBEDTLS_PRIVATE(transform_application);
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
/*
* Timers
*/
void *MBEDTLS_PRIVATE(p_timer);
mbedtls_ssl_set_timer_t *MBEDTLS_PRIVATE(f_set_timer);
mbedtls_ssl_get_timer_t *MBEDTLS_PRIVATE(f_get_timer);
/*
* Record layer (incoming data)
*/
unsigned char *MBEDTLS_PRIVATE(in_buf);
unsigned char *MBEDTLS_PRIVATE(in_ctr);
unsigned char *MBEDTLS_PRIVATE(in_hdr);
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
unsigned char *MBEDTLS_PRIVATE(in_cid);
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
unsigned char *MBEDTLS_PRIVATE(in_len);
unsigned char *MBEDTLS_PRIVATE(in_iv);
unsigned char *MBEDTLS_PRIVATE(in_msg);
unsigned char *MBEDTLS_PRIVATE(in_offt);
int MBEDTLS_PRIVATE(in_msgtype);
size_t MBEDTLS_PRIVATE(in_msglen);
size_t MBEDTLS_PRIVATE(in_left);
#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
size_t MBEDTLS_PRIVATE(in_buf_len);
#endif
#if defined(MBEDTLS_SSL_PROTO_DTLS)
uint16_t MBEDTLS_PRIVATE(in_epoch);
size_t MBEDTLS_PRIVATE(next_record_offset);
#endif /* MBEDTLS_SSL_PROTO_DTLS */
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
uint64_t MBEDTLS_PRIVATE(in_window_top);
uint64_t MBEDTLS_PRIVATE(in_window);
#endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */
size_t MBEDTLS_PRIVATE(in_hslen);
int MBEDTLS_PRIVATE(nb_zero);
int MBEDTLS_PRIVATE(keep_current_message);
/* The following three variables indicate if and, if yes,
* what kind of alert is pending to be sent.
*/
unsigned char MBEDTLS_PRIVATE(send_alert);
unsigned char MBEDTLS_PRIVATE(alert_type);
int MBEDTLS_PRIVATE(alert_reason);
#if defined(MBEDTLS_SSL_PROTO_DTLS)
uint8_t MBEDTLS_PRIVATE(disable_datagram_packing);
#endif /* MBEDTLS_SSL_PROTO_DTLS */
#if defined(MBEDTLS_SSL_EARLY_DATA)
#if defined(MBEDTLS_SSL_SRV_C)
/*
* One of:
* MBEDTLS_SSL_EARLY_DATA_NO_DISCARD
* MBEDTLS_SSL_EARLY_DATA_TRY_TO_DEPROTECT_AND_DISCARD
* MBEDTLS_SSL_EARLY_DATA_DISCARD
*/
uint8_t MBEDTLS_PRIVATE(discard_early_data_record);
#endif
uint32_t MBEDTLS_PRIVATE(total_early_data_size);
#endif /* MBEDTLS_SSL_EARLY_DATA */
/*
* Record layer (outgoing data)
*/
unsigned char *MBEDTLS_PRIVATE(out_buf);
unsigned char *MBEDTLS_PRIVATE(out_ctr);
unsigned char *MBEDTLS_PRIVATE(out_hdr);
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
unsigned char *MBEDTLS_PRIVATE(out_cid);
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
unsigned char *MBEDTLS_PRIVATE(out_len);
unsigned char *MBEDTLS_PRIVATE(out_iv);
unsigned char *MBEDTLS_PRIVATE(out_msg);
int MBEDTLS_PRIVATE(out_msgtype);
size_t MBEDTLS_PRIVATE(out_msglen);
size_t MBEDTLS_PRIVATE(out_left);
#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
size_t MBEDTLS_PRIVATE(out_buf_len);
#endif
unsigned char MBEDTLS_PRIVATE(cur_out_ctr)[MBEDTLS_SSL_SEQUENCE_NUMBER_LEN];
#if defined(MBEDTLS_SSL_PROTO_DTLS)
uint16_t MBEDTLS_PRIVATE(mtu);
#endif /* MBEDTLS_SSL_PROTO_DTLS */
/*
* User settings
*/
#if defined(MBEDTLS_X509_CRT_PARSE_C)
char *MBEDTLS_PRIVATE(hostname);
#endif /* MBEDTLS_X509_CRT_PARSE_C */
#if defined(MBEDTLS_SSL_ALPN)
const char *MBEDTLS_PRIVATE(alpn_chosen);
#endif /* MBEDTLS_SSL_ALPN */
#if defined(MBEDTLS_SSL_DTLS_SRTP)
/*
* use_srtp extension
*/
mbedtls_dtls_srtp_info MBEDTLS_PRIVATE(dtls_srtp_info);
#endif /* MBEDTLS_SSL_DTLS_SRTP */
/*
* Information for DTLS hello verify
*/
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
unsigned char *MBEDTLS_PRIVATE(cli_id);
size_t MBEDTLS_PRIVATE(cli_id_len);
#endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY && MBEDTLS_SSL_SRV_C */
/*
* Secure renegotiation
*/
/* needed to know when to send extension on server */
int MBEDTLS_PRIVATE(secure_renegotiation);
#if defined(MBEDTLS_SSL_RENEGOTIATION)
size_t MBEDTLS_PRIVATE(verify_data_len);
char MBEDTLS_PRIVATE(own_verify_data)[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN];
char MBEDTLS_PRIVATE(peer_verify_data)[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN];
#endif /* MBEDTLS_SSL_RENEGOTIATION */
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
/* CID configuration to use in subsequent handshakes. */
unsigned char MBEDTLS_PRIVATE(own_cid)[MBEDTLS_SSL_CID_IN_LEN_MAX];
uint8_t MBEDTLS_PRIVATE(own_cid_len);
uint8_t MBEDTLS_PRIVATE(negotiate_cid);
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
mbedtls_ssl_export_keys_t *MBEDTLS_PRIVATE(f_export_keys);
void *MBEDTLS_PRIVATE(p_export_keys);
mbedtls_ssl_user_data_t MBEDTLS_PRIVATE(user_data);
};
const char *mbedtls_ssl_get_ciphersuite_name(const int ciphersuite_id);
int mbedtls_ssl_get_ciphersuite_id(const char *ciphersuite_name);
void mbedtls_ssl_init(mbedtls_ssl_context *ssl);
int mbedtls_ssl_setup(mbedtls_ssl_context *ssl,
const mbedtls_ssl_config *conf);
int mbedtls_ssl_session_reset(mbedtls_ssl_context *ssl);
void mbedtls_ssl_conf_endpoint(mbedtls_ssl_config *conf, int endpoint);
static inline int mbedtls_ssl_conf_get_endpoint(const mbedtls_ssl_config *conf)
{
return conf->MBEDTLS_PRIVATE(endpoint);
}
void mbedtls_ssl_conf_transport(mbedtls_ssl_config *conf, int transport);
void mbedtls_ssl_conf_authmode(mbedtls_ssl_config *conf, int authmode);
#if defined(MBEDTLS_SSL_EARLY_DATA)
void mbedtls_ssl_conf_early_data(mbedtls_ssl_config *conf,
int early_data_enabled);
#if defined(MBEDTLS_SSL_SRV_C)
void mbedtls_ssl_conf_max_early_data_size(
mbedtls_ssl_config *conf, uint32_t max_early_data_size);
#endif /* MBEDTLS_SSL_SRV_C */
#endif /* MBEDTLS_SSL_EARLY_DATA */
#if defined(MBEDTLS_X509_CRT_PARSE_C)
void mbedtls_ssl_conf_verify(mbedtls_ssl_config *conf,
int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
void *p_vrfy);
#endif /* MBEDTLS_X509_CRT_PARSE_C */
void mbedtls_ssl_conf_rng(mbedtls_ssl_config *conf,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng);
void mbedtls_ssl_conf_dbg(mbedtls_ssl_config *conf,
void (*f_dbg)(void *, int, const char *, int, const char *),
void *p_dbg);
static inline const mbedtls_ssl_config *mbedtls_ssl_context_get_config(
const mbedtls_ssl_context *ssl)
{
return ssl->MBEDTLS_PRIVATE(conf);
}
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);
#if defined(MBEDTLS_SSL_PROTO_DTLS)
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
int mbedtls_ssl_set_cid(mbedtls_ssl_context *ssl,
int enable,
unsigned char const *own_cid,
size_t own_cid_len);
int mbedtls_ssl_get_own_cid(mbedtls_ssl_context *ssl,
int *enabled,
unsigned char own_cid[MBEDTLS_SSL_CID_IN_LEN_MAX],
size_t *own_cid_len);
int mbedtls_ssl_get_peer_cid(mbedtls_ssl_context *ssl,
int *enabled,
unsigned char peer_cid[MBEDTLS_SSL_CID_OUT_LEN_MAX],
size_t *peer_cid_len);
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
void mbedtls_ssl_set_mtu(mbedtls_ssl_context *ssl, uint16_t mtu);
#endif /* MBEDTLS_SSL_PROTO_DTLS */
#if defined(MBEDTLS_X509_CRT_PARSE_C)
void mbedtls_ssl_set_verify(mbedtls_ssl_context *ssl,
int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
void *p_vrfy);
#endif /* MBEDTLS_X509_CRT_PARSE_C */
void mbedtls_ssl_conf_read_timeout(mbedtls_ssl_config *conf, uint32_t timeout);
int mbedtls_ssl_check_record(mbedtls_ssl_context const *ssl,
unsigned char *buf,
size_t buflen);
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);
#if defined(MBEDTLS_SSL_SRV_C)
static inline void mbedtls_ssl_conf_cert_cb(mbedtls_ssl_config *conf,
mbedtls_ssl_hs_cb_t f_cert_cb)
{
conf->MBEDTLS_PRIVATE(f_cert_cb) = f_cert_cb;
}
#endif /* MBEDTLS_SSL_SRV_C */
typedef 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);
typedef int mbedtls_ssl_ticket_parse_t(void *p_ticket,
mbedtls_ssl_session *session,
unsigned char *buf,
size_t len);
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
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);
#if defined(MBEDTLS_HAVE_TIME)
static inline int mbedtls_ssl_session_get_ticket_creation_time(
mbedtls_ssl_session *session, mbedtls_ms_time_t *ticket_creation_time)
{
if (session == NULL || ticket_creation_time == NULL ||
session->MBEDTLS_PRIVATE(endpoint) != MBEDTLS_SSL_IS_SERVER) {
return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
}
*ticket_creation_time = session->MBEDTLS_PRIVATE(ticket_creation_time);
return 0;
}
#endif /* MBEDTLS_HAVE_TIME */
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */
static inline unsigned const char (*mbedtls_ssl_session_get_id(const mbedtls_ssl_session *
session))[32]
{
return &session->MBEDTLS_PRIVATE(id);
}
static inline size_t mbedtls_ssl_session_get_id_len(const mbedtls_ssl_session *session)
{
return session->MBEDTLS_PRIVATE(id_len);
}
static inline int mbedtls_ssl_session_get_ciphersuite_id(const mbedtls_ssl_session *session)
{
return session->MBEDTLS_PRIVATE(ciphersuite);
}
void mbedtls_ssl_set_export_keys_cb(mbedtls_ssl_context *ssl,
mbedtls_ssl_export_keys_t *f_export_keys,
void *p_export_keys);
static inline void mbedtls_ssl_conf_set_user_data_p(
mbedtls_ssl_config *conf,
void *p)
{
conf->MBEDTLS_PRIVATE(user_data).p = p;
}
static inline void mbedtls_ssl_conf_set_user_data_n(
mbedtls_ssl_config *conf,
uintptr_t n)
{
conf->MBEDTLS_PRIVATE(user_data).n = n;
}
static inline void *mbedtls_ssl_conf_get_user_data_p(
mbedtls_ssl_config *conf)
{
return conf->MBEDTLS_PRIVATE(user_data).p;
}
static inline uintptr_t mbedtls_ssl_conf_get_user_data_n(
mbedtls_ssl_config *conf)
{
return conf->MBEDTLS_PRIVATE(user_data).n;
}
static inline void mbedtls_ssl_set_user_data_p(
mbedtls_ssl_context *ssl,
void *p)
{
ssl->MBEDTLS_PRIVATE(user_data).p = p;
}
static inline void mbedtls_ssl_set_user_data_n(
mbedtls_ssl_context *ssl,
uintptr_t n)
{
ssl->MBEDTLS_PRIVATE(user_data).n = n;
}
static inline void *mbedtls_ssl_get_user_data_p(
mbedtls_ssl_context *ssl)
{
return ssl->MBEDTLS_PRIVATE(user_data).p;
}
static inline uintptr_t mbedtls_ssl_get_user_data_n(
mbedtls_ssl_context *ssl)
{
return ssl->MBEDTLS_PRIVATE(user_data).n;
}
#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
void mbedtls_ssl_conf_async_private_cb(mbedtls_ssl_config *conf,
mbedtls_ssl_async_sign_t *f_async_sign,
mbedtls_ssl_async_decrypt_t *f_async_decrypt,
mbedtls_ssl_async_resume_t *f_async_resume,
mbedtls_ssl_async_cancel_t *f_async_cancel,
void *config_data);
void *mbedtls_ssl_conf_get_async_config_data(const mbedtls_ssl_config *conf);
void *mbedtls_ssl_get_async_operation_data(const mbedtls_ssl_context *ssl);
void mbedtls_ssl_set_async_operation_data(mbedtls_ssl_context *ssl,
void *ctx);
#endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
typedef int mbedtls_ssl_cookie_write_t(void *ctx,
unsigned char **p, unsigned char *end,
const unsigned char *info, size_t ilen);
typedef int mbedtls_ssl_cookie_check_t(void *ctx,
const unsigned char *cookie, size_t clen,
const unsigned char *info, size_t ilen);
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
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);
int mbedtls_ssl_set_client_transport_id(mbedtls_ssl_context *ssl,
const unsigned char *info,
size_t ilen);
#endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY && MBEDTLS_SSL_SRV_C */
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
void mbedtls_ssl_conf_dtls_anti_replay(mbedtls_ssl_config *conf, char mode);
#endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */
void mbedtls_ssl_conf_dtls_badmac_limit(mbedtls_ssl_config *conf, unsigned limit);
#if defined(MBEDTLS_SSL_PROTO_DTLS)
void mbedtls_ssl_set_datagram_packing(mbedtls_ssl_context *ssl,
unsigned allow_packing);
void mbedtls_ssl_conf_handshake_timeout(mbedtls_ssl_config *conf, uint32_t min, uint32_t max);
#endif /* MBEDTLS_SSL_PROTO_DTLS */
#if defined(MBEDTLS_SSL_SRV_C)
void mbedtls_ssl_conf_session_cache(mbedtls_ssl_config *conf,
void *p_cache,
mbedtls_ssl_cache_get_t *f_get_cache,
mbedtls_ssl_cache_set_t *f_set_cache);
#endif /* MBEDTLS_SSL_SRV_C */
#if defined(MBEDTLS_SSL_CLI_C)
int mbedtls_ssl_set_session(mbedtls_ssl_context *ssl, const mbedtls_ssl_session *session);
#endif /* MBEDTLS_SSL_CLI_C */
int mbedtls_ssl_session_load(mbedtls_ssl_session *session,
const unsigned char *buf,
size_t len);
int mbedtls_ssl_session_save(const mbedtls_ssl_session *session,
unsigned char *buf,
size_t buf_len,
size_t *olen);
void mbedtls_ssl_conf_ciphersuites(mbedtls_ssl_config *conf,
const int *ciphersuites);
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
void mbedtls_ssl_conf_tls13_key_exchange_modes(mbedtls_ssl_config *conf,
const int kex_modes);
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
#define MBEDTLS_SSL_UNEXPECTED_CID_IGNORE 0
#define MBEDTLS_SSL_UNEXPECTED_CID_FAIL 1
int mbedtls_ssl_conf_cid(mbedtls_ssl_config *conf, size_t len,
int ignore_other_cids);
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
#if defined(MBEDTLS_X509_CRT_PARSE_C)
void mbedtls_ssl_conf_cert_profile(mbedtls_ssl_config *conf,
const mbedtls_x509_crt_profile *profile);
void mbedtls_ssl_conf_ca_chain(mbedtls_ssl_config *conf,
mbedtls_x509_crt *ca_chain,
mbedtls_x509_crl *ca_crl);
#if defined(MBEDTLS_KEY_EXCHANGE_CERT_REQ_ALLOWED_ENABLED)
static inline
void mbedtls_ssl_conf_dn_hints(mbedtls_ssl_config *conf,
const mbedtls_x509_crt *crt)
{
conf->MBEDTLS_PRIVATE(dn_hints) = crt;
}
#endif /* MBEDTLS_KEY_EXCHANGE_CERT_REQ_ALLOWED_ENABLED */
#if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
void mbedtls_ssl_conf_ca_cb(mbedtls_ssl_config *conf,
mbedtls_x509_crt_ca_cb_t f_ca_cb,
void *p_ca_cb);
#endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
int mbedtls_ssl_conf_own_cert(mbedtls_ssl_config *conf,
mbedtls_x509_crt *own_cert,
mbedtls_pk_context *pk_key);
#endif /* MBEDTLS_X509_CRT_PARSE_C */
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_PSK_ENABLED)
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);
#if defined(MBEDTLS_USE_PSA_CRYPTO)
int mbedtls_ssl_conf_psk_opaque(mbedtls_ssl_config *conf,
mbedtls_svc_key_id_t psk,
const unsigned char *psk_identity,
size_t psk_identity_len);
#endif /* MBEDTLS_USE_PSA_CRYPTO */
int mbedtls_ssl_set_hs_psk(mbedtls_ssl_context *ssl,
const unsigned char *psk, size_t psk_len);
#if defined(MBEDTLS_USE_PSA_CRYPTO)
int mbedtls_ssl_set_hs_psk_opaque(mbedtls_ssl_context *ssl,
mbedtls_svc_key_id_t psk);
#endif /* MBEDTLS_USE_PSA_CRYPTO */
#if defined(MBEDTLS_SSL_SRV_C)
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);
#endif /* MBEDTLS_SSL_SRV_C */
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_PSK_ENABLED */
#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_SRV_C)
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);
int mbedtls_ssl_conf_dh_param_ctx(mbedtls_ssl_config *conf, mbedtls_dhm_context *dhm_ctx);
#endif /* MBEDTLS_DHM_C && defined(MBEDTLS_SSL_SRV_C) */
#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
void mbedtls_ssl_conf_dhm_min_bitlen(mbedtls_ssl_config *conf,
unsigned int bitlen);
#endif /* MBEDTLS_DHM_C && MBEDTLS_SSL_CLI_C */
#if defined(MBEDTLS_ECP_C)
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void MBEDTLS_DEPRECATED mbedtls_ssl_conf_curves(mbedtls_ssl_config *conf,
const mbedtls_ecp_group_id *curves);
#endif /* MBEDTLS_DEPRECATED_REMOVED */
#endif /* MBEDTLS_ECP_C */
void mbedtls_ssl_conf_groups(mbedtls_ssl_config *conf,
const uint16_t *groups);
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
#if !defined(MBEDTLS_DEPRECATED_REMOVED) && defined(MBEDTLS_SSL_PROTO_TLS1_2)
void MBEDTLS_DEPRECATED mbedtls_ssl_conf_sig_hashes(mbedtls_ssl_config *conf,
const int *hashes);
#endif /* !MBEDTLS_DEPRECATED_REMOVED && MBEDTLS_SSL_PROTO_TLS1_2 */
void mbedtls_ssl_conf_sig_algs(mbedtls_ssl_config *conf,
const uint16_t *sig_algs);
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED */
#if defined(MBEDTLS_X509_CRT_PARSE_C)
int mbedtls_ssl_set_hostname(mbedtls_ssl_context *ssl, const char *hostname);
static inline const char *mbedtls_ssl_get_hostname(mbedtls_ssl_context *ssl)
{
return ssl->MBEDTLS_PRIVATE(hostname);
}
#endif /* MBEDTLS_X509_CRT_PARSE_C */
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
const unsigned char *mbedtls_ssl_get_hs_sni(mbedtls_ssl_context *ssl,
size_t *name_len);
int mbedtls_ssl_set_hs_own_cert(mbedtls_ssl_context *ssl,
mbedtls_x509_crt *own_cert,
mbedtls_pk_context *pk_key);
void mbedtls_ssl_set_hs_ca_chain(mbedtls_ssl_context *ssl,
mbedtls_x509_crt *ca_chain,
mbedtls_x509_crl *ca_crl);
#if defined(MBEDTLS_KEY_EXCHANGE_CERT_REQ_ALLOWED_ENABLED)
void mbedtls_ssl_set_hs_dn_hints(mbedtls_ssl_context *ssl,
const mbedtls_x509_crt *crt);
#endif /* MBEDTLS_KEY_EXCHANGE_CERT_REQ_ALLOWED_ENABLED */
void mbedtls_ssl_set_hs_authmode(mbedtls_ssl_context *ssl,
int authmode);
void mbedtls_ssl_conf_sni(mbedtls_ssl_config *conf,
int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *,
size_t),
void *p_sni);
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
int mbedtls_ssl_set_hs_ecjpake_password(mbedtls_ssl_context *ssl,
const unsigned char *pw,
size_t pw_len);
int mbedtls_ssl_set_hs_ecjpake_password_opaque(mbedtls_ssl_context *ssl,
mbedtls_svc_key_id_t pwd);
#endif /*MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
#if defined(MBEDTLS_SSL_ALPN)
int mbedtls_ssl_conf_alpn_protocols(mbedtls_ssl_config *conf, const char **protos);
const char *mbedtls_ssl_get_alpn_protocol(const mbedtls_ssl_context *ssl);
#endif /* MBEDTLS_SSL_ALPN */
#if defined(MBEDTLS_SSL_DTLS_SRTP)
#if defined(MBEDTLS_DEBUG_C)
static inline const char *mbedtls_ssl_get_srtp_profile_as_string(mbedtls_ssl_srtp_profile profile)
{
switch (profile) {
case MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80:
return "MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80";
case MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32:
return "MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32";
case MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80:
return "MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80";
case MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32:
return "MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32";
default: break;
}
return "";
}
#endif /* MBEDTLS_DEBUG_C */
void mbedtls_ssl_conf_srtp_mki_value_supported(mbedtls_ssl_config *conf,
int support_mki_value);
int mbedtls_ssl_conf_dtls_srtp_protection_profiles
(mbedtls_ssl_config *conf,
const mbedtls_ssl_srtp_profile *profiles);
int mbedtls_ssl_dtls_srtp_set_mki_value(mbedtls_ssl_context *ssl,
unsigned char *mki_value,
uint16_t mki_len);
void mbedtls_ssl_get_dtls_srtp_negotiation_result(const mbedtls_ssl_context *ssl,
mbedtls_dtls_srtp_info *dtls_srtp_info);
#endif /* MBEDTLS_SSL_DTLS_SRTP */
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void MBEDTLS_DEPRECATED mbedtls_ssl_conf_max_version(mbedtls_ssl_config *conf, int major,
int minor);
#endif /* MBEDTLS_DEPRECATED_REMOVED */
static inline void mbedtls_ssl_conf_max_tls_version(mbedtls_ssl_config *conf,
mbedtls_ssl_protocol_version tls_version)
{
conf->MBEDTLS_PRIVATE(max_tls_version) = tls_version;
}
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void MBEDTLS_DEPRECATED mbedtls_ssl_conf_min_version(mbedtls_ssl_config *conf, int major,
int minor);
#endif /* MBEDTLS_DEPRECATED_REMOVED */
static inline void mbedtls_ssl_conf_min_tls_version(mbedtls_ssl_config *conf,
mbedtls_ssl_protocol_version tls_version)
{
conf->MBEDTLS_PRIVATE(min_tls_version) = tls_version;
}
#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
void mbedtls_ssl_conf_encrypt_then_mac(mbedtls_ssl_config *conf, char etm);
#endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */
#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
void mbedtls_ssl_conf_extended_master_secret(mbedtls_ssl_config *conf, char ems);
#endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */
#if defined(MBEDTLS_SSL_SRV_C)
void mbedtls_ssl_conf_cert_req_ca_list(mbedtls_ssl_config *conf,
char cert_req_ca_list);
#endif /* MBEDTLS_SSL_SRV_C */
#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
int mbedtls_ssl_conf_max_frag_len(mbedtls_ssl_config *conf, unsigned char mfl_code);
#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
#if defined(MBEDTLS_SSL_SRV_C)
void mbedtls_ssl_conf_preference_order(mbedtls_ssl_config *conf, int order);
#endif /* MBEDTLS_SSL_SRV_C */
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
void mbedtls_ssl_conf_session_tickets(mbedtls_ssl_config *conf, int use_tickets);
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
void mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets(
mbedtls_ssl_config *conf, int signal_new_session_tickets);
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && \
defined(MBEDTLS_SSL_SRV_C) && \
defined(MBEDTLS_SSL_PROTO_TLS1_3)
void mbedtls_ssl_conf_new_session_tickets(mbedtls_ssl_config *conf,
uint16_t num_tickets);
#endif /* MBEDTLS_SSL_SESSION_TICKETS &&
MBEDTLS_SSL_SRV_C &&
MBEDTLS_SSL_PROTO_TLS1_3*/
#if defined(MBEDTLS_SSL_RENEGOTIATION)
void mbedtls_ssl_conf_renegotiation(mbedtls_ssl_config *conf, int renegotiation);
#endif /* MBEDTLS_SSL_RENEGOTIATION */
void mbedtls_ssl_conf_legacy_renegotiation(mbedtls_ssl_config *conf, int allow_legacy);
#if defined(MBEDTLS_SSL_RENEGOTIATION)
void mbedtls_ssl_conf_renegotiation_enforced(mbedtls_ssl_config *conf, int max_records);
void mbedtls_ssl_conf_renegotiation_period(mbedtls_ssl_config *conf,
const unsigned char period[8]);
#endif /* MBEDTLS_SSL_RENEGOTIATION */
int mbedtls_ssl_check_pending(const mbedtls_ssl_context *ssl);
size_t mbedtls_ssl_get_bytes_avail(const mbedtls_ssl_context *ssl);
uint32_t mbedtls_ssl_get_verify_result(const mbedtls_ssl_context *ssl);
int mbedtls_ssl_get_ciphersuite_id_from_ssl(const mbedtls_ssl_context *ssl);
const char *mbedtls_ssl_get_ciphersuite(const mbedtls_ssl_context *ssl);
static inline mbedtls_ssl_protocol_version mbedtls_ssl_get_version_number(
const mbedtls_ssl_context *ssl)
{
return ssl->MBEDTLS_PRIVATE(tls_version);
}
const char *mbedtls_ssl_get_version(const mbedtls_ssl_context *ssl);
int mbedtls_ssl_get_record_expansion(const mbedtls_ssl_context *ssl);
int mbedtls_ssl_get_max_out_record_payload(const mbedtls_ssl_context *ssl);
int mbedtls_ssl_get_max_in_record_payload(const mbedtls_ssl_context *ssl);
#if defined(MBEDTLS_X509_CRT_PARSE_C)
const mbedtls_x509_crt *mbedtls_ssl_get_peer_cert(const mbedtls_ssl_context *ssl);
#endif /* MBEDTLS_X509_CRT_PARSE_C */
#if defined(MBEDTLS_SSL_CLI_C)
int mbedtls_ssl_get_session(const mbedtls_ssl_context *ssl,
mbedtls_ssl_session *session);
#endif /* MBEDTLS_SSL_CLI_C */
int mbedtls_ssl_handshake(mbedtls_ssl_context *ssl);
static inline int mbedtls_ssl_is_handshake_over(mbedtls_ssl_context *ssl)
{
return ssl->MBEDTLS_PRIVATE(state) >= MBEDTLS_SSL_HANDSHAKE_OVER;
}
int mbedtls_ssl_handshake_step(mbedtls_ssl_context *ssl);
#if defined(MBEDTLS_SSL_RENEGOTIATION)
int mbedtls_ssl_renegotiate(mbedtls_ssl_context *ssl);
#endif /* MBEDTLS_SSL_RENEGOTIATION */
int mbedtls_ssl_read(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len);
int mbedtls_ssl_write(mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len);
int mbedtls_ssl_send_alert_message(mbedtls_ssl_context *ssl,
unsigned char level,
unsigned char message);
int mbedtls_ssl_close_notify(mbedtls_ssl_context *ssl);
#if defined(MBEDTLS_SSL_EARLY_DATA)
#if defined(MBEDTLS_SSL_SRV_C)
int mbedtls_ssl_read_early_data(mbedtls_ssl_context *ssl,
unsigned char *buf, size_t len);
#endif /* MBEDTLS_SSL_SRV_C */
#if defined(MBEDTLS_SSL_CLI_C)
int mbedtls_ssl_write_early_data(mbedtls_ssl_context *ssl,
const unsigned char *buf, size_t len);
int mbedtls_ssl_get_early_data_status(mbedtls_ssl_context *ssl);
#endif /* MBEDTLS_SSL_CLI_C */
#endif /* MBEDTLS_SSL_EARLY_DATA */
void mbedtls_ssl_free(mbedtls_ssl_context *ssl);
#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
int mbedtls_ssl_context_save(mbedtls_ssl_context *ssl,
unsigned char *buf,
size_t buf_len,
size_t *olen);
int mbedtls_ssl_context_load(mbedtls_ssl_context *ssl,
const unsigned char *buf,
size_t len);
#endif /* MBEDTLS_SSL_CONTEXT_SERIALIZATION */
void mbedtls_ssl_config_init(mbedtls_ssl_config *conf);
int mbedtls_ssl_config_defaults(mbedtls_ssl_config *conf,
int endpoint, int transport, int preset);
void mbedtls_ssl_config_free(mbedtls_ssl_config *conf);
void mbedtls_ssl_session_init(mbedtls_ssl_session *session);
void mbedtls_ssl_session_free(mbedtls_ssl_session *session);
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);
#ifdef __cplusplus
}
#endif
#endif /* ssl.h */
bignum.h
Multi-precision integer library.
MBEDTLS_MPI_MAX_SIZE
#define MBEDTLS_MPI_MAX_SIZE
Definition bignum.h:73
crypto.h
Platform Security Architecture cryptography module.
dhm.h
This file contains Diffie-Hellman-Merkle (DHM) key exchange definitions and functions.
ecdh.h
This file contains ECDH definitions and functions.
ecp.h
This file provides an API for Elliptic Curves over GF(P) (ECP).
MBEDTLS_ECP_MAX_BYTES
#define MBEDTLS_ECP_MAX_BYTES
Definition ecp.h:354
mbedtls_ecp_group_id
mbedtls_ecp_group_id
Definition ecp.h:102
mbedtls_svc_key_id_t
psa_key_id_t mbedtls_svc_key_id_t
Definition crypto_types.h:292
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:784
build_info.h
Build-time configuration info.
md.h
This file contains the generic functions for message-digest (hashing) and HMAC.
mbedtls_md_type_t
mbedtls_md_type_t
Supported message digests.
Definition md.h:47
platform_time.h
Mbed TLS Platform time abstraction.
mbedtls_ms_time_t
int64_t mbedtls_ms_time_t
Definition platform_time.h:35
mbedtls_time_t
time_t mbedtls_time_t
Definition platform_time.h:27
platform_util.h
Common and shared functions used by multiple modules in the Mbed TLS library.
MBEDTLS_DEPRECATED
#define MBEDTLS_DEPRECATED
Definition platform_util.h:29
private_access.h
Macro wrapper for struct's members.
MBEDTLS_PRIVATE
#define MBEDTLS_PRIVATE(member)
Definition private_access.h:15
mbedtls_ssl_get_hostname
static const char * mbedtls_ssl_get_hostname(mbedtls_ssl_context *ssl)
Get the hostname that checked against the received server certificate. It is used to set the ServerNa...
Definition ssl.h:3998
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_PSK_MAX_LEN
#define MBEDTLS_PSK_MAX_LEN
Definition ssl.h:648
mbedtls_ssl_set_hs_dn_hints
void mbedtls_ssl_set_hs_dn_hints(mbedtls_ssl_context *ssl, const mbedtls_x509_crt *crt)
Set DN hints sent to client in CertificateRequest message.
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_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_cache_get_t
int mbedtls_ssl_cache_get_t(void *data, unsigned char const *session_id, size_t session_id_len, mbedtls_ssl_session *session)
Callback type: server-side session cache getter.
Definition ssl.h:914
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:2614
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_set_mtu
void mbedtls_ssl_set_mtu(mbedtls_ssl_context *ssl, uint16_t mtu)
Set the Maximum Transport Unit (MTU). Special value: 0 means unset (no limit). This represents the ma...
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_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_CID_OUT_LEN_MAX
#define MBEDTLS_SSL_CID_OUT_LEN_MAX
Definition ssl.h:419
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_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_export_keys_t
void mbedtls_ssl_export_keys_t(void *p_expkey, mbedtls_ssl_key_export_type type, const unsigned char *secret, size_t secret_len, const unsigned char client_random[32], const unsigned char server_random[32], mbedtls_tls_prf_types tls_prf_type)
Callback type: Export key alongside random values for session identification, and PRF for implementat...
Definition ssl.h:1370
mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets
void mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets(mbedtls_ssl_config *conf, int signal_new_session_tickets)
Enable / Disable handling of TLS 1.3 NewSessionTicket messages (client only, TLS 1....
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 pre-shared keys (PSKs) and their identities to be used in PSK-based ciphersuites.
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_conf_sig_hashes
void MBEDTLS_DEPRECATED mbedtls_ssl_conf_sig_hashes(mbedtls_ssl_config *conf, const int *hashes)
Set the allowed hashes for signatures during the handshake.
mbedtls_ssl_conf_get_user_data_p
static void * mbedtls_ssl_conf_get_user_data_p(mbedtls_ssl_config *conf)
Retrieve the user data in an SSL configuration as a pointer.
Definition ssl.h:2798
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_get_user_data_n
static uintptr_t mbedtls_ssl_get_user_data_n(mbedtls_ssl_context *ssl)
Retrieve the user data in an SSL context as an integer.
Definition ssl.h:2877
mbedtls_ssl_conf_set_user_data_n
static void mbedtls_ssl_conf_set_user_data_n(mbedtls_ssl_config *conf, uintptr_t n)
Set the user data in an SSL configuration to an integer.
Definition ssl.h:2781
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_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_transform
struct mbedtls_ssl_transform mbedtls_ssl_transform
Definition ssl.h:868
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_free
void mbedtls_ssl_free(mbedtls_ssl_context *ssl)
Free referenced items in an SSL context and clear memory.
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_CID_IN_LEN_MAX
#define MBEDTLS_SSL_CID_IN_LEN_MAX
Definition ssl.h:415
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_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_get_hs_sni
const unsigned char * mbedtls_ssl_get_hs_sni(mbedtls_ssl_context *ssl, size_t *name_len)
Retrieve SNI extension value for the current handshake. Available in f_cert_cb of mbedtls_ssl_conf_ce...
mbedtls_tls_prf_types
mbedtls_tls_prf_types
Definition ssl.h:1334
MBEDTLS_SSL_TLS_PRF_SHA384
@ MBEDTLS_SSL_TLS_PRF_SHA384
Definition ssl.h:1336
MBEDTLS_SSL_HKDF_EXPAND_SHA256
@ MBEDTLS_SSL_HKDF_EXPAND_SHA256
Definition ssl.h:1339
MBEDTLS_SSL_TLS_PRF_SHA256
@ MBEDTLS_SSL_TLS_PRF_SHA256
Definition ssl.h:1337
MBEDTLS_SSL_TLS_PRF_NONE
@ MBEDTLS_SSL_TLS_PRF_NONE
Definition ssl.h:1335
MBEDTLS_SSL_HKDF_EXPAND_SHA384
@ MBEDTLS_SSL_HKDF_EXPAND_SHA384
Definition ssl.h:1338
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:769
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_states
mbedtls_ssl_states
Definition ssl.h:703
MBEDTLS_SSL_CERTIFICATE_VERIFY
@ MBEDTLS_SSL_CERTIFICATE_VERIFY
Definition ssl.h:713
MBEDTLS_SSL_HANDSHAKE_OVER
@ MBEDTLS_SSL_HANDSHAKE_OVER
Definition ssl.h:731
MBEDTLS_SSL_SERVER_HELLO_DONE
@ MBEDTLS_SSL_SERVER_HELLO_DONE
Definition ssl.h:710
MBEDTLS_SSL_END_OF_EARLY_DATA
@ MBEDTLS_SSL_END_OF_EARLY_DATA
Definition ssl.h:724
MBEDTLS_SSL_NEW_SESSION_TICKET
@ MBEDTLS_SSL_NEW_SESSION_TICKET
Definition ssl.h:720
MBEDTLS_SSL_SERVER_FINISHED
@ MBEDTLS_SSL_SERVER_FINISHED
Definition ssl.h:717
MBEDTLS_SSL_SERVER_KEY_EXCHANGE
@ MBEDTLS_SSL_SERVER_KEY_EXCHANGE
Definition ssl.h:708
MBEDTLS_SSL_ENCRYPTED_EXTENSIONS
@ MBEDTLS_SSL_ENCRYPTED_EXTENSIONS
Definition ssl.h:723
MBEDTLS_SSL_SERVER_HELLO
@ MBEDTLS_SSL_SERVER_HELLO
Definition ssl.h:706
MBEDTLS_SSL_SERVER_CCS_AFTER_HELLO_RETRY_REQUEST
@ MBEDTLS_SSL_SERVER_CCS_AFTER_HELLO_RETRY_REQUEST
Definition ssl.h:730
MBEDTLS_SSL_CLIENT_KEY_EXCHANGE
@ MBEDTLS_SSL_CLIENT_KEY_EXCHANGE
Definition ssl.h:712
MBEDTLS_SSL_CLIENT_CCS_BEFORE_2ND_CLIENT_HELLO
@ MBEDTLS_SSL_CLIENT_CCS_BEFORE_2ND_CLIENT_HELLO
Definition ssl.h:727
MBEDTLS_SSL_CLIENT_HELLO
@ MBEDTLS_SSL_CLIENT_HELLO
Definition ssl.h:705
MBEDTLS_SSL_SERVER_CERTIFICATE
@ MBEDTLS_SSL_SERVER_CERTIFICATE
Definition ssl.h:707
MBEDTLS_SSL_CERTIFICATE_REQUEST
@ MBEDTLS_SSL_CERTIFICATE_REQUEST
Definition ssl.h:709
MBEDTLS_SSL_CLIENT_FINISHED
@ MBEDTLS_SSL_CLIENT_FINISHED
Definition ssl.h:715
MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC
@ MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC
Definition ssl.h:716
MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT
@ MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT
Definition ssl.h:721
MBEDTLS_SSL_HANDSHAKE_WRAPUP
@ MBEDTLS_SSL_HANDSHAKE_WRAPUP
Definition ssl.h:719
MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED
@ MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED
Definition ssl.h:726
MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC
@ MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC
Definition ssl.h:714
MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY
@ MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY
Definition ssl.h:725
MBEDTLS_SSL_HELLO_REQUEST
@ MBEDTLS_SSL_HELLO_REQUEST
Definition ssl.h:704
MBEDTLS_SSL_CLIENT_CERTIFICATE
@ MBEDTLS_SSL_CLIENT_CERTIFICATE
Definition ssl.h:711
MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH
@ MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH
Definition ssl.h:733
MBEDTLS_SSL_FLUSH_BUFFERS
@ MBEDTLS_SSL_FLUSH_BUFFERS
Definition ssl.h:718
MBEDTLS_SSL_CLIENT_CCS_AFTER_CLIENT_HELLO
@ MBEDTLS_SSL_CLIENT_CCS_AFTER_CLIENT_HELLO
Definition ssl.h:729
MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET
@ MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET
Definition ssl.h:732
MBEDTLS_SSL_HELLO_RETRY_REQUEST
@ MBEDTLS_SSL_HELLO_RETRY_REQUEST
Definition ssl.h:722
MBEDTLS_SSL_SERVER_CCS_AFTER_SERVER_HELLO
@ MBEDTLS_SSL_SERVER_CCS_AFTER_SERVER_HELLO
Definition ssl.h:728
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_endpoint
void mbedtls_ssl_conf_endpoint(mbedtls_ssl_config *conf, int endpoint)
Set the current endpoint type.
MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80
#define MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80
Definition ssl.h:1194
MBEDTLS_TLS_SRTP_MAX_MKI_LENGTH
#define MBEDTLS_TLS_SRTP_MAX_MKI_LENGTH
Definition ssl.h:1181
mbedtls_ssl_hs_cb_t
int(* mbedtls_ssl_hs_cb_t)(mbedtls_ssl_context *ssl)
Callback type: generic handshake callback.
Definition ssl.h:1394
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_protocol_version
mbedtls_ssl_protocol_version
Definition ssl.h:1214
MBEDTLS_SSL_VERSION_TLS1_2
@ MBEDTLS_SSL_VERSION_TLS1_2
Definition ssl.h:1216
MBEDTLS_SSL_VERSION_TLS1_3
@ MBEDTLS_SSL_VERSION_TLS1_3
Definition ssl.h:1217
MBEDTLS_SSL_VERSION_UNKNOWN
@ MBEDTLS_SSL_VERSION_UNKNOWN
Definition ssl.h:1215
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_get_version
const char * mbedtls_ssl_get_version(const mbedtls_ssl_context *ssl)
Return the current TLS version.
mbedtls_ssl_is_handshake_over
static int mbedtls_ssl_is_handshake_over(mbedtls_ssl_context *ssl)
After calling mbedtls_ssl_handshake() to start the SSL handshake you can call this function to check ...
Definition ssl.h:4987
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_TLS_SRTP_NULL_HMAC_SHA1_32
#define MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32
Definition ssl.h:1195
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_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_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:2644
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_conf_cert_cb
static void mbedtls_ssl_conf_cert_cb(mbedtls_ssl_config *conf, mbedtls_ssl_hs_cb_t f_cert_cb)
Set the certificate selection callback (server-side only).
Definition ssl.h:2588
mbedtls_ssl_handshake
int mbedtls_ssl_handshake(mbedtls_ssl_context *ssl)
Perform the SSL handshake.
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_conf_new_session_tickets
void mbedtls_ssl_conf_new_session_tickets(mbedtls_ssl_config *conf, uint16_t num_tickets)
Number of NewSessionTicket messages for the server to send after handshake completion.
mbedtls_ssl_sig_hash_set_t
struct mbedtls_ssl_sig_hash_set_t mbedtls_ssl_sig_hash_set_t
Definition ssl.h:870
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_get_verify_result
uint32_t mbedtls_ssl_get_verify_result(const mbedtls_ssl_context *ssl)
Return the result of the certificate verification.
MBEDTLS_SSL_SEQUENCE_NUMBER_LEN
#define MBEDTLS_SSL_SEQUENCE_NUMBER_LEN
Definition ssl.h:694
mbedtls_ssl_key_export_type
mbedtls_ssl_key_export_type
Definition ssl.h:1343
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_APPLICATION_TRAFFIC_SECRET
@ MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_APPLICATION_TRAFFIC_SECRET
Definition ssl.h:1350
MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET
@ MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET
Definition ssl.h:1344
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_APPLICATION_TRAFFIC_SECRET
@ MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_APPLICATION_TRAFFIC_SECRET
Definition ssl.h:1351
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_HANDSHAKE_TRAFFIC_SECRET
@ MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_HANDSHAKE_TRAFFIC_SECRET
Definition ssl.h:1349
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_HANDSHAKE_TRAFFIC_SECRET
@ MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_HANDSHAKE_TRAFFIC_SECRET
Definition ssl.h:1348
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_EARLY_EXPORTER_SECRET
@ MBEDTLS_SSL_KEY_EXPORT_TLS1_3_EARLY_EXPORTER_SECRET
Definition ssl.h:1347
MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_EARLY_SECRET
@ MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_EARLY_SECRET
Definition ssl.h:1346
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_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:2976
mbedtls_ssl_get_version_number
static mbedtls_ssl_protocol_version mbedtls_ssl_get_version_number(const mbedtls_ssl_context *ssl)
Return the (D)TLS protocol version negotiated in the given connection.
Definition ssl.h:4765
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_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_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.
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_handshake_params
struct mbedtls_ssl_handshake_params mbedtls_ssl_handshake_params
Definition ssl.h:869
mbedtls_ssl_get_max_in_record_payload
int mbedtls_ssl_get_max_in_record_payload(const mbedtls_ssl_context *ssl)
Return the current maximum incoming record payload in bytes.
mbedtls_ssl_conf_preference_order
void mbedtls_ssl_conf_preference_order(mbedtls_ssl_config *conf, int order)
Pick the ciphersuites order according to the second parameter in the SSL Server module (MBEDTLS_SSL_S...
mbedtls_ssl_conf_dtls_srtp_protection_profiles
int mbedtls_ssl_conf_dtls_srtp_protection_profiles(mbedtls_ssl_config *conf, const mbedtls_ssl_srtp_profile *profiles)
Set the supported DTLS-SRTP protection profiles.
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:845
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_ERR_SSL_BAD_INPUT_DATA
#define MBEDTLS_ERR_SSL_BAD_INPUT_DATA
Definition ssl.h:51
mbedtls_ssl_context_get_config
static const mbedtls_ssl_config * mbedtls_ssl_context_get_config(const mbedtls_ssl_context *ssl)
Return the SSL configuration structure associated with the given SSL context.
Definition ssl.h:2206
mbedtls_ssl_conf_srtp_mki_value_supported
void mbedtls_ssl_conf_srtp_mki_value_supported(mbedtls_ssl_config *conf, int support_mki_value)
Manage support for mki(master key id) value in use_srtp extension. MKI is an optional part of SRTP us...
mbedtls_ssl_conf_sig_algs
void mbedtls_ssl_conf_sig_algs(mbedtls_ssl_config *conf, const uint16_t *sig_algs)
Configure allowed signature algorithms for use in TLS.
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:819
MBEDTLS_SSL_IS_SERVER
#define MBEDTLS_SSL_IS_SERVER
Definition ssl.h:283
mbedtls_ssl_get_dtls_srtp_negotiation_result
void mbedtls_ssl_get_dtls_srtp_negotiation_result(const mbedtls_ssl_context *ssl, mbedtls_dtls_srtp_info *dtls_srtp_info)
Get the negotiated DTLS-SRTP information: Protection profile and MKI value.
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_free
void mbedtls_ssl_config_free(mbedtls_ssl_config *conf)
Free an SSL configuration context.
mbedtls_ssl_conf_dn_hints
static void mbedtls_ssl_conf_dn_hints(mbedtls_ssl_config *conf, const mbedtls_x509_crt *crt)
Set DN hints sent to client in CertificateRequest message.
Definition ssl.h:3507
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_own_cid
int mbedtls_ssl_get_own_cid(mbedtls_ssl_context *ssl, int *enabled, unsigned char own_cid[MBEDTLS_SSL_CID_IN_LEN_MAX], size_t *own_cid_len)
Get information about our request for usage of the CID extension in the current connection.
mbedtls_ssl_session_init
void mbedtls_ssl_session_init(mbedtls_ssl_session *session)
Initialize SSL session structure.
MBEDTLS_SSL_VERIFY_DATA_MAX_LEN
#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN
Definition ssl.h:455
mbedtls_ssl_get_peer_cid
int mbedtls_ssl_get_peer_cid(mbedtls_ssl_context *ssl, int *enabled, unsigned char peer_cid[MBEDTLS_SSL_CID_OUT_LEN_MAX], size_t *peer_cid_len)
Get information about the use of the CID extension in the current connection.
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_set_hs_authmode
void mbedtls_ssl_set_hs_authmode(mbedtls_ssl_context *ssl, int authmode)
Set authmode for the current handshake.
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_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_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.
mbedtls_ssl_conf_get_user_data_n
static uintptr_t mbedtls_ssl_conf_get_user_data_n(mbedtls_ssl_config *conf)
Retrieve the user data in an SSL configuration as an integer.
Definition ssl.h:2814
mbedtls_ssl_conf_cid
int mbedtls_ssl_conf_cid(mbedtls_ssl_config *conf, size_t len, int ignore_other_cids)
Specify the length of Connection IDs for incoming encrypted DTLS records, as well as the behaviour on...
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_get_ciphersuite
const char * mbedtls_ssl_get_ciphersuite(const mbedtls_ssl_context *ssl)
Return the name of the current ciphersuite.
mbedtls_ssl_set_session
int mbedtls_ssl_set_session(mbedtls_ssl_context *ssl, const mbedtls_ssl_session *session)
Load a session for session resumption.
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_TLS1_3_TICKET_RESUMPTION_KEY_LEN
#define MBEDTLS_SSL_TLS1_3_TICKET_RESUMPTION_KEY_LEN
Definition ssl.h:344
mbedtls_ssl_conf_session_cache
void mbedtls_ssl_conf_session_cache(mbedtls_ssl_config *conf, void *p_cache, mbedtls_ssl_cache_get_t *f_get_cache, mbedtls_ssl_cache_set_t *f_set_cache)
Set the session cache callbacks (server-side only) If not set, no session resuming is done (except if...
mbedtls_ssl_conf_session_tickets
void mbedtls_ssl_conf_session_tickets(mbedtls_ssl_config *conf, int use_tickets)
Enable / Disable TLS 1.2 session tickets (client only, TLS 1.2 only). Enabled by default.
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_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_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:2993
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_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_session_get_ciphersuite_id
static int mbedtls_ssl_session_get_ciphersuite_id(const mbedtls_ssl_session *session)
Get the ciphersuite-id.
Definition ssl.h:2730
mbedtls_ssl_config_defaults
int mbedtls_ssl_config_defaults(mbedtls_ssl_config *conf, int endpoint, int transport, int preset)
Load reasonable default SSL configuration values. (You need to call mbedtls_ssl_config_init() first....
mbedtls_ssl_get_srtp_profile_as_string
static const char * mbedtls_ssl_get_srtp_profile_as_string(mbedtls_ssl_srtp_profile profile)
Definition ssl.h:4186
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_conf_curves
void MBEDTLS_DEPRECATED mbedtls_ssl_conf_curves(mbedtls_ssl_config *conf, const mbedtls_ecp_group_id *curves)
Set the allowed curves in order of preference.
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_session_get_ticket_creation_time
static int mbedtls_ssl_session_get_ticket_creation_time(mbedtls_ssl_session *session, mbedtls_ms_time_t *ticket_creation_time)
Get the creation time of a session ticket.
Definition ssl.h:2683
mbedtls_ssl_conf_groups
void mbedtls_ssl_conf_groups(mbedtls_ssl_config *conf, const uint16_t *groups)
Set the allowed groups in order of preference.
mbedtls_ssl_conf_max_version
void MBEDTLS_DEPRECATED 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.
mbedtls_ssl_handshake_step
int mbedtls_ssl_handshake_step(mbedtls_ssl_context *ssl)
Perform a single step of the SSL handshake.
mbedtls_ssl_cache_set_t
int mbedtls_ssl_cache_set_t(void *data, unsigned char const *session_id, size_t session_id_len, const mbedtls_ssl_session *session)
Callback type: server-side session cache setter.
Definition ssl.h:936
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_dtls_srtp_info
struct mbedtls_dtls_srtp_info_t mbedtls_dtls_srtp_info
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_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_TLS_SRTP_AES128_CM_HMAC_SHA1_32
#define MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32
Definition ssl.h:1193
MBEDTLS_TLS1_3_MD_MAX_SIZE
#define MBEDTLS_TLS1_3_MD_MAX_SIZE
Definition ssl.h:690
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_conf_max_tls_version
static void mbedtls_ssl_conf_max_tls_version(mbedtls_ssl_config *conf, mbedtls_ssl_protocol_version tls_version)
Set the maximum supported version sent from the client side and/or accepted at the server side.
Definition ssl.h:4316
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_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_flight_item
struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item
Definition ssl.h:875
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:793
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_session_get_id
static unsigned const char(* mbedtls_ssl_session_get_id(const mbedtls_ssl_session *session))[32]
Get the session-id buffer.
Definition ssl.h:2705
mbedtls_ssl_close_notify
int mbedtls_ssl_close_notify(mbedtls_ssl_context *ssl)
Notify the peer that the connection is being closed.
mbedtls_ssl_conf_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_dtls_srtp_set_mki_value
int mbedtls_ssl_dtls_srtp_set_mki_value(mbedtls_ssl_context *ssl, unsigned char *mki_value, uint16_t mki_len)
Set the mki_value for the current DTLS-SRTP session.
mbedtls_ssl_get_ciphersuite_id_from_ssl
int mbedtls_ssl_get_ciphersuite_id_from_ssl(const mbedtls_ssl_context *ssl)
Return the id of the current ciphersuite.
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_TLS_SRTP_AES128_CM_HMAC_SHA1_80
#define MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80
Definition ssl.h:1192
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.
mbedtls_ssl_srtp_profile
uint16_t mbedtls_ssl_srtp_profile
Definition ssl.h:1199
mbedtls_ssl_get_session
int mbedtls_ssl_get_session(const mbedtls_ssl_context *ssl, mbedtls_ssl_session *session)
Export a session in order to resume it later.
mbedtls_ssl_conf_min_version
void MBEDTLS_DEPRECATED mbedtls_ssl_conf_min_version(mbedtls_ssl_config *conf, int major, int minor)
Set the minimum accepted SSL/TLS protocol version.
mbedtls_ssl_conf_set_user_data_p
static void mbedtls_ssl_conf_set_user_data_p(mbedtls_ssl_config *conf, void *p)
Set the user data in an SSL configuration to a pointer.
Definition ssl.h:2767
mbedtls_ssl_get_user_data_p
static void * mbedtls_ssl_get_user_data_p(mbedtls_ssl_context *ssl)
Retrieve the user data in an SSL context as a pointer.
Definition ssl.h:2861
mbedtls_ssl_get_timer_t
int mbedtls_ssl_get_timer_t(void *ctx)
Callback type: get status of timers/delays.
Definition ssl.h:860
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_set_user_data_n
static void mbedtls_ssl_set_user_data_n(mbedtls_ssl_context *ssl, uintptr_t n)
Set the user data in an SSL context to an integer.
Definition ssl.h:2844
mbedtls_ssl_conf_dh_param_ctx
int mbedtls_ssl_conf_dh_param_ctx(mbedtls_ssl_config *conf, mbedtls_dhm_context *dhm_ctx)
Set the Diffie-Hellman public P and G values, read from existing context (server-side only)
mbedtls_ssl_conf_min_tls_version
static void mbedtls_ssl_conf_min_tls_version(mbedtls_ssl_config *conf, mbedtls_ssl_protocol_version tls_version)
Set the minimum supported version sent from the client side and/or accepted at the server side.
Definition ssl.h:4373
mbedtls_ssl_key_cert
struct mbedtls_ssl_key_cert mbedtls_ssl_key_cert
Definition ssl.h:872
mbedtls_ssl_conf_tls13_key_exchange_modes
void mbedtls_ssl_conf_tls13_key_exchange_modes(mbedtls_ssl_config *conf, const int kex_modes)
Set the supported key exchange modes for TLS 1.3 connections.
mbedtls_ssl_session_get_id_len
static size_t mbedtls_ssl_session_get_id_len(const mbedtls_ssl_session *session)
Get the size of the session-id.
Definition ssl.h:2718
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_set_user_data_p
static void mbedtls_ssl_set_user_data_p(mbedtls_ssl_context *ssl, void *p)
Set the user data in an SSL context to a pointer.
Definition ssl.h:2830
mbedtls_ssl_conf_get_endpoint
static int mbedtls_ssl_conf_get_endpoint(const mbedtls_ssl_config *conf)
Get the current endpoint type.
Definition ssl.h:2036
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_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_set_export_keys_cb
void mbedtls_ssl_set_export_keys_cb(mbedtls_ssl_context *ssl, mbedtls_ssl_export_keys_t *f_export_keys, void *p_export_keys)
Configure a key export callback. (Default: none.)
mbedtls_ssl_set_cid
int mbedtls_ssl_set_cid(mbedtls_ssl_context *ssl, int enable, unsigned char const *own_cid, size_t own_cid_len)
Configure the use of the Connection ID (CID) extension in the next handshake.
ssl_ciphersuites.h
SSL Ciphersuites for Mbed TLS.
mbedtls_dhm_context
The DHM context structure.
Definition dhm.h:101
mbedtls_dtls_srtp_info_t
Definition ssl.h:1201
mbedtls_mpi
MPI structure.
Definition bignum.h:207
mbedtls_pk_context
Public key container.
Definition pk.h:220
mbedtls_ssl_config
Definition ssl.h:1411
mbedtls_ssl_context
Definition ssl.h:1687
mbedtls_ssl_session
Definition ssl.h:1231
mbedtls_ssl_tls13_application_secrets
Definition ssl.h:1172
mbedtls_x509_crl
Definition x509_crl.h:64
mbedtls_x509_crt_profile
Definition x509_crt.h:125
mbedtls_x509_crt
Definition x509_crt.h:41
mbedtls_ssl_premaster_secret
Definition ssl.h:655
mbedtls_ssl_premaster_secret::_pms_ecdhe_psk
unsigned char _pms_ecdhe_psk[4+MBEDTLS_ECP_MAX_BYTES+MBEDTLS_PSK_MAX_LEN]
Definition ssl.h:681
mbedtls_ssl_premaster_secret::_pms_dhm
unsigned char _pms_dhm[MBEDTLS_MPI_MAX_SIZE]
Definition ssl.h:661
mbedtls_ssl_premaster_secret::_pms_psk
unsigned char _pms_psk[4+2 *MBEDTLS_PSK_MAX_LEN]
Definition ssl.h:670
mbedtls_ssl_premaster_secret::_pms_rsa_psk
unsigned char _pms_rsa_psk[52+MBEDTLS_PSK_MAX_LEN]
Definition ssl.h:677
mbedtls_ssl_premaster_secret::dummy
unsigned char dummy
Definition ssl.h:656
mbedtls_ssl_premaster_secret::_pms_rsa
unsigned char _pms_rsa[48]
Definition ssl.h:658
mbedtls_ssl_premaster_secret::_pms_dhe_psk
unsigned char _pms_dhe_psk[4+MBEDTLS_MPI_MAX_SIZE+MBEDTLS_PSK_MAX_LEN]
Definition ssl.h:674
mbedtls_ssl_premaster_secret::_pms_ecdh
unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]
Definition ssl.h:667
mbedtls_ssl_user_data_t
Definition ssl.h:1403
mbedtls_ssl_user_data_t::n
uintptr_t n
Definition ssl.h:1404
mbedtls_ssl_user_data_t::p
void * p
Definition ssl.h:1405
x509_crl.h
X.509 certificate revocation list parsing.
x509_crt.h
X.509 certificate parsing and writing.