ssl_internal.h
Go to the documentation of this file.
#ifndef MBEDTLS_SSL_INTERNAL_H
#define MBEDTLS_SSL_INTERNAL_H
#include "ssl.h"
#if defined(MBEDTLS_MD5_C)
#include "md5.h"
#endif
#if defined(MBEDTLS_SHA1_C)
#include "sha1.h"
#endif
#if defined(MBEDTLS_SHA256_C)
#include "sha256.h"
#endif
#if defined(MBEDTLS_SHA512_C)
#include "sha512.h"
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
#include "ecjpake.h"
#endif
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
!defined(inline) && !defined(__cplusplus)
#define inline __inline
#endif
/* Determine minimum supported version */
#define MBEDTLS_SSL_MIN_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3
#if defined(MBEDTLS_SSL_PROTO_SSL3)
#define MBEDTLS_SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_0
#else
#if defined(MBEDTLS_SSL_PROTO_TLS1)
#define MBEDTLS_SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_1
#else
#if defined(MBEDTLS_SSL_PROTO_TLS1_1)
#define MBEDTLS_SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_2
#else
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
#define MBEDTLS_SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_3
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
#endif /* MBEDTLS_SSL_PROTO_TLS1_1 */
#endif /* MBEDTLS_SSL_PROTO_TLS1 */
#endif /* MBEDTLS_SSL_PROTO_SSL3 */
/* Determine maximum supported version */
#define MBEDTLS_SSL_MAX_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
#define MBEDTLS_SSL_MAX_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_3
#else
#if defined(MBEDTLS_SSL_PROTO_TLS1_1)
#define MBEDTLS_SSL_MAX_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_2
#else
#if defined(MBEDTLS_SSL_PROTO_TLS1)
#define MBEDTLS_SSL_MAX_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_1
#else
#if defined(MBEDTLS_SSL_PROTO_SSL3)
#define MBEDTLS_SSL_MAX_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_0
#endif /* MBEDTLS_SSL_PROTO_SSL3 */
#endif /* MBEDTLS_SSL_PROTO_TLS1 */
#endif /* MBEDTLS_SSL_PROTO_TLS1_1 */
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
#define MBEDTLS_SSL_INITIAL_HANDSHAKE 0
#define MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS 1 /* In progress */
#define MBEDTLS_SSL_RENEGOTIATION_DONE 2 /* Done or aborted */
#define MBEDTLS_SSL_RENEGOTIATION_PENDING 3 /* Requested (server only) */
/*
* DTLS retransmission states, see RFC 6347 4.2.4
*
* The SENDING state is merged in PREPARING for initial sends,
* but is distinct for resends.
*
* Note: initial state is wrong for server, but is not used anyway.
*/
#define MBEDTLS_SSL_RETRANS_PREPARING 0
#define MBEDTLS_SSL_RETRANS_SENDING 1
#define MBEDTLS_SSL_RETRANS_WAITING 2
#define MBEDTLS_SSL_RETRANS_FINISHED 3
/*
* Allow extra bytes for record, authentication and encryption overhead:
* counter (8) + header (5) + IV(16) + MAC (16-48) + padding (0-256)
* and allow for a maximum of 1024 of compression expansion if
* enabled.
*/
#if defined(MBEDTLS_ZLIB_SUPPORT)
#define MBEDTLS_SSL_COMPRESSION_ADD 1024
#else
#define MBEDTLS_SSL_COMPRESSION_ADD 0
#endif
#if defined(MBEDTLS_ARC4_C) || defined(MBEDTLS_CIPHER_MODE_CBC)
/* Ciphersuites using HMAC */
#if defined(MBEDTLS_SHA512_C)
#define MBEDTLS_SSL_MAC_ADD 48 /* SHA-384 used for HMAC */
#elif defined(MBEDTLS_SHA256_C)
#define MBEDTLS_SSL_MAC_ADD 32 /* SHA-256 used for HMAC */
#else
#define MBEDTLS_SSL_MAC_ADD 20 /* SHA-1 used for HMAC */
#endif
#else
/* AEAD ciphersuites: GCM and CCM use a 128 bits tag */
#define MBEDTLS_SSL_MAC_ADD 16
#endif
#if defined(MBEDTLS_CIPHER_MODE_CBC)
#define MBEDTLS_SSL_PADDING_ADD 256
#else
#define MBEDTLS_SSL_PADDING_ADD 0
#endif
#define MBEDTLS_SSL_BUFFER_LEN ( MBEDTLS_SSL_MAX_CONTENT_LEN \
+ MBEDTLS_SSL_COMPRESSION_ADD \
+ 29 /* counter + header + IV */ \
+ MBEDTLS_SSL_MAC_ADD \
+ MBEDTLS_SSL_PADDING_ADD \
)
/*
* TLS extension flags (for extensions with outgoing ServerHello content
* that need it (e.g. for RENEGOTIATION_INFO the server already knows because
* of state of the renegotiation flag, so no indicator is required)
*/
#define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS_PRESENT (1 << 0)
#define MBEDTLS_TLS_EXT_ECJPAKE_KKPP_OK (1 << 1)
#ifdef __cplusplus
extern "C" {
#endif
/*
* This structure contains the parameters only needed during handshake.
*/
struct mbedtls_ssl_handshake_params
{
/*
* Handshake specific crypto variables
*/
int sig_alg;
int cert_type;
int verify_sig_alg;
#if defined(MBEDTLS_DHM_C)
mbedtls_dhm_context dhm_ctx;
#endif
#if defined(MBEDTLS_ECDH_C)
mbedtls_ecdh_context ecdh_ctx;
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
mbedtls_ecjpake_context ecjpake_ctx;
#if defined(MBEDTLS_SSL_CLI_C)
unsigned char *ecjpake_cache;
size_t ecjpake_cache_len;
#endif
#endif
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
const mbedtls_ecp_curve_info **curves;
#endif
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
unsigned char *psk;
size_t psk_len;
#endif
#if defined(MBEDTLS_X509_CRT_PARSE_C)
mbedtls_ssl_key_cert *key_cert;
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
int sni_authmode;
mbedtls_ssl_key_cert *sni_key_cert;
mbedtls_x509_crt *sni_ca_chain;
mbedtls_x509_crl *sni_ca_crl;
#endif
#endif /* MBEDTLS_X509_CRT_PARSE_C */
#if defined(MBEDTLS_SSL_PROTO_DTLS)
unsigned int out_msg_seq;
unsigned int in_msg_seq;
unsigned char *verify_cookie;
unsigned char verify_cookie_len;
unsigned char *hs_msg;
uint32_t retransmit_timeout;
unsigned char retransmit_state;
mbedtls_ssl_flight_item *flight;
mbedtls_ssl_flight_item *cur_msg;
unsigned int in_flight_start_seq;
mbedtls_ssl_transform *alt_transform_out;
unsigned char alt_out_ctr[8];
#endif
/*
* Checksum contexts
*/
#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
defined(MBEDTLS_SSL_PROTO_TLS1_1)
mbedtls_md5_context fin_md5;
mbedtls_sha1_context fin_sha1;
#endif
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
#if defined(MBEDTLS_SHA256_C)
mbedtls_sha256_context fin_sha256;
#endif
#if defined(MBEDTLS_SHA512_C)
mbedtls_sha512_context fin_sha512;
#endif
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
void (*update_checksum)(mbedtls_ssl_context *, const unsigned char *, size_t);
void (*calc_verify)(mbedtls_ssl_context *, unsigned char *);
void (*calc_finished)(mbedtls_ssl_context *, unsigned char *, int);
int (*tls_prf)(const unsigned char *, size_t, const char *,
const unsigned char *, size_t,
unsigned char *, size_t);
size_t pmslen;
unsigned char randbytes[64];
unsigned char premaster[MBEDTLS_PREMASTER_SIZE];
int resume;
int max_major_ver;
int max_minor_ver;
int cli_exts;
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
int new_session_ticket;
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
int extended_ms;
#endif
};
/*
* This structure contains a full set of runtime transform parameters
* either in negotiation or active.
*/
struct mbedtls_ssl_transform
{
/*
* Session specific crypto layer
*/
const mbedtls_ssl_ciphersuite_t *ciphersuite_info;
unsigned int keylen;
size_t minlen;
size_t ivlen;
size_t fixed_ivlen;
size_t maclen;
unsigned char iv_enc[16];
unsigned char iv_dec[16];
#if defined(MBEDTLS_SSL_PROTO_SSL3)
/* Needed only for SSL v3.0 secret */
unsigned char mac_enc[20];
unsigned char mac_dec[20];
#endif /* MBEDTLS_SSL_PROTO_SSL3 */
mbedtls_md_context_t md_ctx_enc;
mbedtls_md_context_t md_ctx_dec;
mbedtls_cipher_context_t cipher_ctx_enc;
mbedtls_cipher_context_t cipher_ctx_dec;
/*
* Session specific compression layer
*/
#if defined(MBEDTLS_ZLIB_SUPPORT)
z_stream ctx_deflate;
z_stream ctx_inflate;
#endif
};
#if defined(MBEDTLS_X509_CRT_PARSE_C)
/*
* List of certificate + private key pairs
*/
struct mbedtls_ssl_key_cert
{
mbedtls_x509_crt *cert;
mbedtls_pk_context *key;
mbedtls_ssl_key_cert *next;
};
#endif /* MBEDTLS_X509_CRT_PARSE_C */
#if defined(MBEDTLS_SSL_PROTO_DTLS)
/*
* List of handshake messages kept around for resending
*/
struct mbedtls_ssl_flight_item
{
unsigned char *p;
size_t len;
unsigned char type;
mbedtls_ssl_flight_item *next;
};
#endif /* MBEDTLS_SSL_PROTO_DTLS */
void mbedtls_ssl_transform_free( mbedtls_ssl_transform *transform );
void mbedtls_ssl_handshake_free( mbedtls_ssl_handshake_params *handshake );
int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl );
int mbedtls_ssl_handshake_server_step( mbedtls_ssl_context *ssl );
void mbedtls_ssl_handshake_wrapup( mbedtls_ssl_context *ssl );
int mbedtls_ssl_send_fatal_handshake_failure( mbedtls_ssl_context *ssl );
void mbedtls_ssl_reset_checksum( mbedtls_ssl_context *ssl );
int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl );
int mbedtls_ssl_read_record( mbedtls_ssl_context *ssl );
int mbedtls_ssl_fetch_input( mbedtls_ssl_context *ssl, size_t nb_want );
int mbedtls_ssl_write_record( mbedtls_ssl_context *ssl );
int mbedtls_ssl_flush_output( mbedtls_ssl_context *ssl );
int mbedtls_ssl_parse_certificate( mbedtls_ssl_context *ssl );
int mbedtls_ssl_write_certificate( mbedtls_ssl_context *ssl );
int mbedtls_ssl_parse_change_cipher_spec( mbedtls_ssl_context *ssl );
int mbedtls_ssl_write_change_cipher_spec( mbedtls_ssl_context *ssl );
int mbedtls_ssl_parse_finished( mbedtls_ssl_context *ssl );
int mbedtls_ssl_write_finished( mbedtls_ssl_context *ssl );
void mbedtls_ssl_optimize_checksum( mbedtls_ssl_context *ssl,
const mbedtls_ssl_ciphersuite_t *ciphersuite_info );
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
int mbedtls_ssl_psk_derive_premaster( mbedtls_ssl_context *ssl, mbedtls_key_exchange_type_t key_ex );
#endif
#if defined(MBEDTLS_PK_C)
unsigned char mbedtls_ssl_sig_from_pk( mbedtls_pk_context *pk );
mbedtls_pk_type_t mbedtls_ssl_pk_alg_from_sig( unsigned char sig );
#endif
mbedtls_md_type_t mbedtls_ssl_md_alg_from_hash( unsigned char hash );
unsigned char mbedtls_ssl_hash_from_md_alg( int md );
#if defined(MBEDTLS_ECP_C)
int mbedtls_ssl_check_curve( const mbedtls_ssl_context *ssl, mbedtls_ecp_group_id grp_id );
#endif
#if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED)
int mbedtls_ssl_check_sig_hash( const mbedtls_ssl_context *ssl,
mbedtls_md_type_t md );
#endif
#if defined(MBEDTLS_X509_CRT_PARSE_C)
static inline mbedtls_pk_context *mbedtls_ssl_own_key( mbedtls_ssl_context *ssl )
{
mbedtls_ssl_key_cert *key_cert;
if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL )
key_cert = ssl->handshake->key_cert;
else
key_cert = ssl->conf->key_cert;
return( key_cert == NULL ? NULL : key_cert->key );
}
static inline mbedtls_x509_crt *mbedtls_ssl_own_cert( mbedtls_ssl_context *ssl )
{
mbedtls_ssl_key_cert *key_cert;
if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL )
key_cert = ssl->handshake->key_cert;
else
key_cert = ssl->conf->key_cert;
return( key_cert == NULL ? NULL : key_cert->cert );
}
/*
* Check usage of a certificate wrt extensions:
* keyUsage, extendedKeyUsage (later), and nSCertType (later).
*
* Warning: cert_endpoint is the endpoint of the cert (ie, of our peer when we
* check a cert we received from them)!
*
* Return 0 if everything is OK, -1 if not.
*/
int mbedtls_ssl_check_cert_usage( const mbedtls_x509_crt *cert,
const mbedtls_ssl_ciphersuite_t *ciphersuite,
int cert_endpoint,
uint32_t *flags );
#endif /* MBEDTLS_X509_CRT_PARSE_C */
void mbedtls_ssl_write_version( int major, int minor, int transport,
unsigned char ver[2] );
void mbedtls_ssl_read_version( int *major, int *minor, int transport,
const unsigned char ver[2] );
static inline size_t mbedtls_ssl_hdr_len( const mbedtls_ssl_context *ssl )
{
#if defined(MBEDTLS_SSL_PROTO_DTLS)
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
return( 13 );
#else
((void) ssl);
#endif
return( 5 );
}
static inline size_t mbedtls_ssl_hs_hdr_len( const mbedtls_ssl_context *ssl )
{
#if defined(MBEDTLS_SSL_PROTO_DTLS)
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
return( 12 );
#else
((void) ssl);
#endif
return( 4 );
}
#if defined(MBEDTLS_SSL_PROTO_DTLS)
void mbedtls_ssl_send_flight_completed( mbedtls_ssl_context *ssl );
void mbedtls_ssl_recv_flight_completed( mbedtls_ssl_context *ssl );
int mbedtls_ssl_resend( mbedtls_ssl_context *ssl );
#endif
/* Visible for testing purposes only */
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
int mbedtls_ssl_dtls_replay_check( mbedtls_ssl_context *ssl );
void mbedtls_ssl_dtls_replay_update( mbedtls_ssl_context *ssl );
#endif
/* constant-time buffer comparison */
static inline int mbedtls_ssl_safer_memcmp( const void *a, const void *b, size_t n )
{
size_t i;
const unsigned char *A = (const unsigned char *) a;
const unsigned char *B = (const unsigned char *) b;
unsigned char diff = 0;
for( i = 0; i < n; i++ )
diff |= A[i] ^ B[i];
return( diff );
}
#ifdef __cplusplus
}
#endif
#endif /* ssl_internal.h */
mbedtls_ssl_send_flight_completed
void mbedtls_ssl_send_flight_completed(mbedtls_ssl_context *ssl)
mbedtls_ssl_transform::fixed_ivlen
size_t fixed_ivlen
Definition: ssl_internal.h:281
mbedtls_ssl_handshake_params::psk
unsigned char * psk
Definition: ssl_internal.h:189
mbedtls_ssl_config::transport
unsigned int transport
Definition: ssl.h:606
mbedtls_ssl_parse_finished
int mbedtls_ssl_parse_finished(mbedtls_ssl_context *ssl)
mbedtls_ssl_hash_from_md_alg
unsigned char mbedtls_ssl_hash_from_md_alg(int md)
mbedtls_ssl_transform::ivlen
size_t ivlen
Definition: ssl_internal.h:280
mbedtls_pk_context
Public key container.
Definition: pk.h:126
mbedtls_ssl_handshake_params::fin_sha1
mbedtls_sha1_context fin_sha1
Definition: ssl_internal.h:230
mbedtls_ssl_flight_item::type
unsigned char type
Definition: ssl_internal.h:328
mbedtls_ssl_handshake_params::update_checksum
void(* update_checksum)(mbedtls_ssl_context *, const unsigned char *, size_t)
Definition: ssl_internal.h:241
mbedtls_ssl_transform::minlen
size_t minlen
Definition: ssl_internal.h:279
mbedtls_ssl_handshake_params::sni_authmode
int sni_authmode
Definition: ssl_internal.h:195
mbedtls_ssl_read_version
void mbedtls_ssl_read_version(int *major, int *minor, int transport, const unsigned char ver[2])
mbedtls_ssl_handshake_params::sig_alg
int sig_alg
Definition: ssl_internal.h:168
mbedtls_ssl_handshake_params::key_cert
mbedtls_ssl_key_cert * key_cert
Definition: ssl_internal.h:193
mbedtls_ssl_handshake_server_step
int mbedtls_ssl_handshake_server_step(mbedtls_ssl_context *ssl)
mbedtls_ssl_handshake_params::alt_out_ctr
unsigned char alt_out_ctr[8]
Definition: ssl_internal.h:220
mbedtls_ssl_handshake_params::randbytes
unsigned char randbytes[64]
Definition: ssl_internal.h:250
mbedtls_ssl_write_change_cipher_spec
int mbedtls_ssl_write_change_cipher_spec(mbedtls_ssl_context *ssl)
mbedtls_ssl_handshake_params::cur_msg
mbedtls_ssl_flight_item * cur_msg
Definition: ssl_internal.h:215
mbedtls_ssl_transform::mac_enc
unsigned char mac_enc[20]
Definition: ssl_internal.h:289
mbedtls_ssl_handshake_params::fin_sha256
mbedtls_sha256_context fin_sha256
Definition: ssl_internal.h:234
mbedtls_ssl_write_finished
int mbedtls_ssl_write_finished(mbedtls_ssl_context *ssl)
mbedtls_x509_crl
Certificate revocation list structure.
Definition: x509_crl.h:69
mbedtls_ssl_handshake_params::ecdh_ctx
mbedtls_ecdh_context ecdh_ctx
Definition: ssl_internal.h:175
mbedtls_ssl_transform::maclen
size_t maclen
Definition: ssl_internal.h:282
mbedtls_cipher_context_t
Generic cipher context.
Definition: cipher.h:213
mbedtls_ssl_safer_memcmp
static int mbedtls_ssl_safer_memcmp(const void *a, const void *b, size_t n)
Definition: ssl_internal.h:478
mbedtls_ssl_flight_item::p
unsigned char * p
Definition: ssl_internal.h:326
mbedtls_ssl_handshake_params::fin_sha512
mbedtls_sha512_context fin_sha512
Definition: ssl_internal.h:237
mbedtls_pk_type_t
mbedtls_pk_type_t
Public key types.
Definition: pk.h:74
mbedtls_ssl_parse_certificate
int mbedtls_ssl_parse_certificate(mbedtls_ssl_context *ssl)
mbedtls_ssl_handshake_params::ecjpake_cache_len
size_t ecjpake_cache_len
Definition: ssl_internal.h:181
mbedtls_ssl_flight_item
Definition: ssl_internal.h:324
mbedtls_ssl_transform::cipher_ctx_enc
mbedtls_cipher_context_t cipher_ctx_enc
Definition: ssl_internal.h:296
ecjpake.h
Elliptic curve J-PAKE.
mbedtls_ssl_hs_hdr_len
static size_t mbedtls_ssl_hs_hdr_len(const mbedtls_ssl_context *ssl)
Definition: ssl_internal.h:454
MBEDTLS_SSL_TRANSPORT_DATAGRAM
#define MBEDTLS_SSL_TRANSPORT_DATAGRAM
Definition: ssl.h:121
mbedtls_ecp_curve_info
Curve information for use by other modules.
Definition: ecp.h:80
mbedtls_ssl_resend
int mbedtls_ssl_resend(mbedtls_ssl_context *ssl)
mbedtls_ssl_sig_from_pk
unsigned char mbedtls_ssl_sig_from_pk(mbedtls_pk_context *pk)
mbedtls_ssl_derive_keys
int mbedtls_ssl_derive_keys(mbedtls_ssl_context *ssl)
mbedtls_md_context_t
Generic message digest context.
Definition: md.h:66
mbedtls_ssl_handshake_params::sni_ca_chain
mbedtls_x509_crt * sni_ca_chain
Definition: ssl_internal.h:197
mbedtls_ssl_transform::ctx_deflate
z_stream ctx_deflate
Definition: ssl_internal.h:303
mbedtls_ssl_handshake_params::verify_sig_alg
int verify_sig_alg
Definition: ssl_internal.h:170
mbedtls_ssl_transform::md_ctx_dec
mbedtls_md_context_t md_ctx_dec
Definition: ssl_internal.h:294
mbedtls_ssl_handshake_free
void mbedtls_ssl_handshake_free(mbedtls_ssl_handshake_params *handshake)
Free referenced items in an SSL handshake context and clear memory.
mbedtls_ssl_handshake_params::extended_ms
int extended_ms
Definition: ssl_internal.h:263
mbedtls_ssl_transform::ctx_inflate
z_stream ctx_inflate
Definition: ssl_internal.h:304
mbedtls_ssl_transform::ciphersuite_info
const mbedtls_ssl_ciphersuite_t * ciphersuite_info
Definition: ssl_internal.h:276
mbedtls_ssl_handshake_params::max_major_ver
int max_major_ver
Definition: ssl_internal.h:255
mbedtls_ssl_handshake_params::fin_md5
mbedtls_md5_context fin_md5
Definition: ssl_internal.h:229
mbedtls_ssl_transform::iv_dec
unsigned char iv_dec[16]
Definition: ssl_internal.h:285
mbedtls_ssl_handshake_params
Definition: ssl_internal.h:163
mbedtls_ssl_fetch_input
int mbedtls_ssl_fetch_input(mbedtls_ssl_context *ssl, size_t nb_want)
mbedtls_ssl_context::handshake
mbedtls_ssl_handshake_params * handshake
Definition: ssl.h:681
mbedtls_ssl_dtls_replay_check
int mbedtls_ssl_dtls_replay_check(mbedtls_ssl_context *ssl)
mbedtls_ssl_handshake_params::out_msg_seq
unsigned int out_msg_seq
Definition: ssl_internal.h:202
mbedtls_ssl_handshake_params::curves
const mbedtls_ecp_curve_info ** curves
Definition: ssl_internal.h:186
mbedtls_ssl_handshake_params::alt_transform_out
mbedtls_ssl_transform * alt_transform_out
Definition: ssl_internal.h:218
mbedtls_ssl_read_record
int mbedtls_ssl_read_record(mbedtls_ssl_context *ssl)
mbedtls_ssl_flight_item::len
size_t len
Definition: ssl_internal.h:327
mbedtls_ssl_transform::iv_enc
unsigned char iv_enc[16]
Definition: ssl_internal.h:284
mbedtls_ssl_flight_item::next
mbedtls_ssl_flight_item * next
Definition: ssl_internal.h:329
mbedtls_ssl_handshake_params::retransmit_state
unsigned char retransmit_state
Definition: ssl_internal.h:213
mbedtls_ssl_config::key_cert
mbedtls_ssl_key_cert * key_cert
Definition: ssl.h:540
mbedtls_ssl_transform_free
void mbedtls_ssl_transform_free(mbedtls_ssl_transform *transform)
Free referenced items in an SSL transform context and clear memory.
mbedtls_ssl_check_cert_usage
int mbedtls_ssl_check_cert_usage(const mbedtls_x509_crt *cert, const mbedtls_ssl_ciphersuite_t *ciphersuite, int cert_endpoint, uint32_t *flags)
mbedtls_ssl_transform::mac_dec
unsigned char mac_dec[20]
Definition: ssl_internal.h:290
mbedtls_ssl_psk_derive_premaster
int mbedtls_ssl_psk_derive_premaster(mbedtls_ssl_context *ssl, mbedtls_key_exchange_type_t key_ex)
mbedtls_ssl_check_curve
int mbedtls_ssl_check_curve(const mbedtls_ssl_context *ssl, mbedtls_ecp_group_id grp_id)
mbedtls_ssl_md_alg_from_hash
mbedtls_md_type_t mbedtls_ssl_md_alg_from_hash(unsigned char hash)
mbedtls_ssl_handshake_params::calc_verify
void(* calc_verify)(mbedtls_ssl_context *, unsigned char *)
Definition: ssl_internal.h:242
mbedtls_ssl_send_fatal_handshake_failure
int mbedtls_ssl_send_fatal_handshake_failure(mbedtls_ssl_context *ssl)
mbedtls_key_exchange_type_t
mbedtls_key_exchange_type_t
Definition: ssl_ciphersuites.h:237
mbedtls_ssl_handshake_params::new_session_ticket
int new_session_ticket
Definition: ssl_internal.h:260
mbedtls_ssl_handshake_params::verify_cookie
unsigned char * verify_cookie
Definition: ssl_internal.h:205
mbedtls_ssl_own_cert
static mbedtls_x509_crt * mbedtls_ssl_own_cert(mbedtls_ssl_context *ssl)
Definition: ssl_internal.h:411
mbedtls_ssl_pk_alg_from_sig
mbedtls_pk_type_t mbedtls_ssl_pk_alg_from_sig(unsigned char sig)
mbedtls_ssl_handshake_params::pmslen
size_t pmslen
Definition: ssl_internal.h:248
mbedtls_ecp_group_id
mbedtls_ecp_group_id
Domain parameters (curve, subgroup and generator) identifiers.
Definition: ecp.h:53
mbedtls_ssl_handshake_params::ecjpake_cache
unsigned char * ecjpake_cache
Definition: ssl_internal.h:180
mbedtls_dhm_context
DHM context structure.
Definition: dhm.h:149
mbedtls_ssl_context::conf
const mbedtls_ssl_config * conf
Definition: ssl.h:645
mbedtls_ecdh_context
ECDH context structure.
Definition: ecdh.h:44
mbedtls_ssl_write_certificate
int mbedtls_ssl_write_certificate(mbedtls_ssl_context *ssl)
mbedtls_ssl_handshake_params::ecjpake_ctx
mbedtls_ecjpake_context ecjpake_ctx
Definition: ssl_internal.h:178
mbedtls_ssl_handshake_params::cert_type
int cert_type
Definition: ssl_internal.h:169
mbedtls_ssl_handshake_params::resume
int resume
Definition: ssl_internal.h:254
mbedtls_ssl_handshake_params::cli_exts
int cli_exts
Definition: ssl_internal.h:257
mbedtls_ssl_handshake_params::in_msg_seq
unsigned int in_msg_seq
Definition: ssl_internal.h:203
mbedtls_ssl_ciphersuite_t
This structure is used for storing ciphersuite information.
Definition: ssl_ciphersuites.h:289
mbedtls_ssl_handshake_params::retransmit_timeout
uint32_t retransmit_timeout
Definition: ssl_internal.h:212
MBEDTLS_PREMASTER_SIZE
#define MBEDTLS_PREMASTER_SIZE
Definition: ssl.h:381
mbedtls_ssl_transform::keylen
unsigned int keylen
Definition: ssl_internal.h:278
mbedtls_ssl_parse_change_cipher_spec
int mbedtls_ssl_parse_change_cipher_spec(mbedtls_ssl_context *ssl)
mbedtls_ssl_write_version
void mbedtls_ssl_write_version(int major, int minor, int transport, unsigned char ver[2])
mbedtls_ssl_transform::cipher_ctx_dec
mbedtls_cipher_context_t cipher_ctx_dec
Definition: ssl_internal.h:297
mbedtls_ssl_key_cert
Definition: ssl_internal.h:312
mbedtls_ssl_handshake_params::verify_cookie_len
unsigned char verify_cookie_len
Definition: ssl_internal.h:207
mbedtls_ssl_key_cert::next
mbedtls_ssl_key_cert * next
Definition: ssl_internal.h:316
mbedtls_ssl_recv_flight_completed
void mbedtls_ssl_recv_flight_completed(mbedtls_ssl_context *ssl)
sha1.h
SHA-1 cryptographic hash function.
mbedtls_ssl_flush_output
int mbedtls_ssl_flush_output(mbedtls_ssl_context *ssl)
mbedtls_ssl_optimize_checksum
void mbedtls_ssl_optimize_checksum(mbedtls_ssl_context *ssl, const mbedtls_ssl_ciphersuite_t *ciphersuite_info)
mbedtls_ssl_write_record
int mbedtls_ssl_write_record(mbedtls_ssl_context *ssl)
mbedtls_ssl_handshake_params::in_flight_start_seq
unsigned int in_flight_start_seq
Definition: ssl_internal.h:216
mbedtls_ssl_reset_checksum
void mbedtls_ssl_reset_checksum(mbedtls_ssl_context *ssl)
mbedtls_x509_crt
Container for an X.509 certificate.
Definition: x509_crt.h:52
sha512.h
SHA-384 and SHA-512 cryptographic hash function.
mbedtls_ssl_check_sig_hash
int mbedtls_ssl_check_sig_hash(const mbedtls_ssl_context *ssl, mbedtls_md_type_t md)
mbedtls_ssl_handshake_params::sni_key_cert
mbedtls_ssl_key_cert * sni_key_cert
Definition: ssl_internal.h:196
mbedtls_ssl_handshake_params::psk_len
size_t psk_len
Definition: ssl_internal.h:190
ssl.h
SSL/TLS functions.
mbedtls_ssl_key_cert::key
mbedtls_pk_context * key
Definition: ssl_internal.h:315
mbedtls_ssl_transform
Definition: ssl_internal.h:271
mbedtls_ssl_handshake_client_step
int mbedtls_ssl_handshake_client_step(mbedtls_ssl_context *ssl)
mbedtls_ecjpake_context
EC J-PAKE context structure.
Definition: ecjpake.h:69
mbedtls_ssl_handshake_params::premaster
unsigned char premaster[MBEDTLS_PREMASTER_SIZE]
Definition: ssl_internal.h:251
mbedtls_ssl_handshake_wrapup
void mbedtls_ssl_handshake_wrapup(mbedtls_ssl_context *ssl)
mbedtls_ssl_handshake_params::calc_finished
void(* calc_finished)(mbedtls_ssl_context *, unsigned char *, int)
Definition: ssl_internal.h:243
mbedtls_ssl_handshake_params::max_minor_ver
int max_minor_ver
Definition: ssl_internal.h:256
mbedtls_ssl_handshake_params::flight
mbedtls_ssl_flight_item * flight
Definition: ssl_internal.h:214
mbedtls_ssl_handshake_params::sni_ca_crl
mbedtls_x509_crl * sni_ca_crl
Definition: ssl_internal.h:198
mbedtls_ssl_handshake_params::tls_prf
int(* tls_prf)(const unsigned char *, size_t, const char *, const unsigned char *, size_t, unsigned char *, size_t)
Definition: ssl_internal.h:244
mbedtls_ssl_dtls_replay_update
void mbedtls_ssl_dtls_replay_update(mbedtls_ssl_context *ssl)
mbedtls_md_type_t
mbedtls_md_type_t
Definition: md.h:39
mbedtls_ssl_transform::md_ctx_enc
mbedtls_md_context_t md_ctx_enc
Definition: ssl_internal.h:293
md
#define md
Definition: compat-1.3.h:2031
md5.h
MD5 message digest algorithm (hash function)
sha256.h
SHA-224 and SHA-256 cryptographic hash function.
mbedtls_ssl_context
Definition: ssl.h:643
mbedtls_ssl_key_cert::cert
mbedtls_x509_crt * cert
Definition: ssl_internal.h:314
mbedtls_ssl_handshake_params::dhm_ctx
mbedtls_dhm_context dhm_ctx
Definition: ssl_internal.h:172
mbedtls_ssl_handshake_params::hs_msg
unsigned char * hs_msg
Definition: ssl_internal.h:210
mbedtls_ssl_own_key
static mbedtls_pk_context * mbedtls_ssl_own_key(mbedtls_ssl_context *ssl)
Definition: ssl_internal.h:399
mbedtls_ssl_hdr_len
static size_t mbedtls_ssl_hdr_len(const mbedtls_ssl_context *ssl)
Definition: ssl_internal.h:443