ssl_internal.h File Reference
`#include "ssl.h"`
`#include "md5.h"`
`#include "sha1.h"`
`#include "sha256.h"`
`#include "sha512.h"`
`#include "ecjpake.h"`
Include dependency graph for ssl_internal.h:

Go to the source code of this file.

## Data Structures

struct | mbedtls_ssl_handshake_params
struct | mbedtls_ssl_transform
struct | mbedtls_ssl_key_cert
struct | mbedtls_ssl_flight_item

## Macros

#define | MBEDTLS_SSL_MIN_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3
#define | MBEDTLS_SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_0
#define | MBEDTLS_SSL_MAX_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3
#define | MBEDTLS_SSL_MAX_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_3
#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) */
#define | MBEDTLS_SSL_RETRANS_PREPARING 0
#define | MBEDTLS_SSL_RETRANS_SENDING 1
#define | MBEDTLS_SSL_RETRANS_WAITING 2
#define | MBEDTLS_SSL_RETRANS_FINISHED 3
#define | MBEDTLS_SSL_COMPRESSION_ADD 1024
#define | MBEDTLS_SSL_MAC_ADD 48 /* SHA-384 used for HMAC */
#define | MBEDTLS_SSL_PADDING_ADD 256
#define | MBEDTLS_SSL_BUFFER_LEN
#define | MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS_PRESENT (1 << 0)
#define | MBEDTLS_TLS_EXT_ECJPAKE_KKPP_OK (1 << 1)

## Functions

void | mbedtls_ssl_transform_free (mbedtls_ssl_transform *transform)
| Free referenced items in an SSL transform context and clear memory. More...
void | mbedtls_ssl_handshake_free (mbedtls_ssl_handshake_params *handshake)
| Free referenced items in an SSL handshake context and clear memory. More...
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)
int | mbedtls_ssl_psk_derive_premaster (mbedtls_ssl_context *ssl, mbedtls_key_exchange_type_t key_ex)
unsigned char | mbedtls_ssl_sig_from_pk (mbedtls_pk_context *pk)
mbedtls_pk_type_t | mbedtls_ssl_pk_alg_from_sig (unsigned char sig)
mbedtls_md_type_t | mbedtls_ssl_md_alg_from_hash (unsigned char hash)
unsigned char | mbedtls_ssl_hash_from_md_alg (int md)
int | mbedtls_ssl_check_curve (const mbedtls_ssl_context *ssl, mbedtls_ecp_group_id grp_id)
int | mbedtls_ssl_check_sig_hash (const mbedtls_ssl_context *ssl, mbedtls_md_type_t md)
static mbedtls_pk_context * | mbedtls_ssl_own_key (mbedtls_ssl_context *ssl)
static mbedtls_x509_crt * | mbedtls_ssl_own_cert (mbedtls_ssl_context *ssl)
int | mbedtls_ssl_check_cert_usage (const mbedtls_x509_crt *cert, const mbedtls_ssl_ciphersuite_t *ciphersuite, int cert_endpoint, uint32_t *flags)
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 size_t | mbedtls_ssl_hdr_len (const mbedtls_ssl_context *ssl)
static size_t | mbedtls_ssl_hs_hdr_len (const mbedtls_ssl_context *ssl)
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)
int | mbedtls_ssl_dtls_replay_check (mbedtls_ssl_context *ssl)
void | mbedtls_ssl_dtls_replay_update (mbedtls_ssl_context *ssl)
static int | mbedtls_ssl_safer_memcmp (const void *a, const void *b, size_t n)

## Macro Definition Documentation

#define MBEDTLS_SSL_BUFFER_LEN

Value:
( MBEDTLS_SSL_MAX_CONTENT_LEN \
+ MBEDTLS_SSL_COMPRESSION_ADD \
+ 29 /* counter + header + IV */ \
+ MBEDTLS_SSL_MAC_ADD \
+ MBEDTLS_SSL_PADDING_ADD \
)
MBEDTLS_SSL_COMPRESSION_ADD
#define MBEDTLS_SSL_COMPRESSION_ADD
Definition: ssl_internal.h:116
MBEDTLS_SSL_MAC_ADD
#define MBEDTLS_SSL_MAC_ADD
Definition: ssl_internal.h:124
MBEDTLS_SSL_MAX_CONTENT_LEN
#define MBEDTLS_SSL_MAX_CONTENT_LEN
Size of the input / output buffer.
Definition: ssl.h:217
MBEDTLS_SSL_PADDING_ADD
#define MBEDTLS_SSL_PADDING_ADD
Definition: ssl_internal.h:136

Definition at line 141 of file ssl_internal.h.

#define MBEDTLS_SSL_COMPRESSION_ADD 1024

Definition at line 116 of file ssl_internal.h.

#define MBEDTLS_SSL_INITIAL_HANDSHAKE 0

Definition at line 91 of file ssl_internal.h.

#define MBEDTLS_SSL_MAC_ADD 48 /* SHA-384 used for HMAC */

Definition at line 124 of file ssl_internal.h.

#define MBEDTLS_SSL_MAX_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3

Definition at line 73 of file ssl_internal.h.

#define MBEDTLS_SSL_MAX_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_3

Definition at line 76 of file ssl_internal.h.

#define MBEDTLS_SSL_MIN_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3

Definition at line 54 of file ssl_internal.h.

#define MBEDTLS_SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_0

Definition at line 57 of file ssl_internal.h.

#define MBEDTLS_SSL_PADDING_ADD 256

Definition at line 136 of file ssl_internal.h.

#define MBEDTLS_SSL_RENEGOTIATION_DONE 2 /* Done or aborted */

Definition at line 93 of file ssl_internal.h.

#define MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS 1 /* In progress */

Definition at line 92 of file ssl_internal.h.

#define MBEDTLS_SSL_RENEGOTIATION_PENDING 3 /* Requested (server only) */

Definition at line 94 of file ssl_internal.h.

#define MBEDTLS_SSL_RETRANS_FINISHED 3

Definition at line 107 of file ssl_internal.h.

#define MBEDTLS_SSL_RETRANS_PREPARING 0

Definition at line 104 of file ssl_internal.h.

#define MBEDTLS_SSL_RETRANS_SENDING 1

Definition at line 105 of file ssl_internal.h.

#define MBEDTLS_SSL_RETRANS_WAITING 2

Definition at line 106 of file ssl_internal.h.

#define MBEDTLS_TLS_EXT_ECJPAKE_KKPP_OK (1 << 1)

Definition at line 154 of file ssl_internal.h.

#define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS_PRESENT (1 << 0)

Definition at line 153 of file ssl_internal.h.

## Function Documentation

int mbedtls_ssl_check_cert_usage | ( | const mbedtls_x509_crt * | cert,
|  | const mbedtls_ssl_ciphersuite_t * | ciphersuite,
|  | int | cert_endpoint,
|  | uint32_t * | flags
| ) |  |

Referenced by mbedtls_ssl_own_cert().

int mbedtls_ssl_check_curve | ( | const mbedtls_ssl_context * | ssl,
|  | mbedtls_ecp_group_id | grp_id
| ) |  |

int mbedtls_ssl_check_sig_hash | ( | const mbedtls_ssl_context * | ssl,
|  | mbedtls_md_type_t | md
| ) |  |

int mbedtls_ssl_derive_keys | ( | mbedtls_ssl_context * | ssl | ) |

int mbedtls_ssl_dtls_replay_check | ( | mbedtls_ssl_context * | ssl | ) |

Referenced by mbedtls_ssl_hs_hdr_len().

void mbedtls_ssl_dtls_replay_update | ( | mbedtls_ssl_context * | ssl | ) |

Referenced by mbedtls_ssl_hs_hdr_len().

int mbedtls_ssl_fetch_input | ( | mbedtls_ssl_context * | ssl,
|  | size_t | nb_want
| ) |  |

int mbedtls_ssl_flush_output | ( | mbedtls_ssl_context * | ssl | ) |

int mbedtls_ssl_handshake_client_step | ( | mbedtls_ssl_context * | ssl | ) |

void mbedtls_ssl_handshake_free | ( | mbedtls_ssl_handshake_params * | handshake | ) |

Free referenced items in an SSL handshake context and clear memory.

Parameters

  handshake | SSL handshake context

int mbedtls_ssl_handshake_server_step | ( | mbedtls_ssl_context * | ssl | ) |

void mbedtls_ssl_handshake_wrapup | ( | mbedtls_ssl_context * | ssl | ) |

unsigned char mbedtls_ssl_hash_from_md_alg | ( | int | md | ) |

static size_t mbedtls_ssl_hdr_len | ( | const mbedtls_ssl_context * | ssl | ) |

inline static

Definition at line 443 of file ssl_internal.h.

References mbedtls_ssl_context::conf, MBEDTLS_SSL_TRANSPORT_DATAGRAM, and mbedtls_ssl_config::transport.

static size_t mbedtls_ssl_hs_hdr_len | ( | const mbedtls_ssl_context * | ssl | ) |

inline static

Definition at line 454 of file ssl_internal.h.

References mbedtls_ssl_context::conf, mbedtls_ssl_dtls_replay_check(), mbedtls_ssl_dtls_replay_update(), mbedtls_ssl_recv_flight_completed(), mbedtls_ssl_resend(), mbedtls_ssl_send_flight_completed(), MBEDTLS_SSL_TRANSPORT_DATAGRAM, and mbedtls_ssl_config::transport.

mbedtls_md_type_t mbedtls_ssl_md_alg_from_hash | ( | unsigned char | hash | ) |

void mbedtls_ssl_optimize_checksum | ( | mbedtls_ssl_context * | ssl,
|  | const mbedtls_ssl_ciphersuite_t * | ciphersuite_info
| ) |  |

static mbedtls_x509_crt* mbedtls_ssl_own_cert | ( | mbedtls_ssl_context * | ssl | ) |

inline static

Definition at line 411 of file ssl_internal.h.

References mbedtls_ssl_key_cert::cert, mbedtls_ssl_context::conf, mbedtls_ssl_context::handshake, mbedtls_ssl_handshake_params::key_cert, mbedtls_ssl_config::key_cert, mbedtls_ssl_check_cert_usage(), mbedtls_ssl_read_version(), and mbedtls_ssl_write_version().

static mbedtls_pk_context* mbedtls_ssl_own_key | ( | mbedtls_ssl_context * | ssl | ) |

inline static

Definition at line 399 of file ssl_internal.h.

References mbedtls_ssl_context::conf, mbedtls_ssl_context::handshake, mbedtls_ssl_key_cert::key, mbedtls_ssl_handshake_params::key_cert, and mbedtls_ssl_config::key_cert.

int mbedtls_ssl_parse_certificate | ( | mbedtls_ssl_context * | ssl | ) |

int mbedtls_ssl_parse_change_cipher_spec | ( | mbedtls_ssl_context * | ssl | ) |

int mbedtls_ssl_parse_finished | ( | mbedtls_ssl_context * | ssl | ) |

mbedtls_pk_type_t mbedtls_ssl_pk_alg_from_sig | ( | unsigned char | sig | ) |

int mbedtls_ssl_psk_derive_premaster | ( | mbedtls_ssl_context * | ssl,
|  | mbedtls_key_exchange_type_t | key_ex
| ) |  |

int mbedtls_ssl_read_record | ( | mbedtls_ssl_context * | ssl | ) |

void mbedtls_ssl_read_version | ( | int * | major,
|  | int * | minor,
|  | int | transport,
|  | const unsigned char | ver[2]
| ) |  |

Referenced by mbedtls_ssl_own_cert().

void mbedtls_ssl_recv_flight_completed | ( | mbedtls_ssl_context * | ssl | ) |

Referenced by mbedtls_ssl_hs_hdr_len().

int mbedtls_ssl_resend | ( | mbedtls_ssl_context * | ssl | ) |

Referenced by mbedtls_ssl_hs_hdr_len().

void mbedtls_ssl_reset_checksum | ( | mbedtls_ssl_context * | ssl | ) |

static int mbedtls_ssl_safer_memcmp | ( | const void * | a,
|  | const void * | b,
|  | size_t | n
| ) |  |

inline static

Definition at line 478 of file ssl_internal.h.

int mbedtls_ssl_send_fatal_handshake_failure | ( | mbedtls_ssl_context * | ssl | ) |

void mbedtls_ssl_send_flight_completed | ( | mbedtls_ssl_context * | ssl | ) |

Referenced by mbedtls_ssl_hs_hdr_len().

unsigned char mbedtls_ssl_sig_from_pk | ( | mbedtls_pk_context * | pk | ) |

void mbedtls_ssl_transform_free | ( | mbedtls_ssl_transform * | transform | ) |

Free referenced items in an SSL transform context and clear memory.

Parameters

  transform | SSL transform context

int mbedtls_ssl_write_certificate | ( | mbedtls_ssl_context * | ssl | ) |

int mbedtls_ssl_write_change_cipher_spec | ( | mbedtls_ssl_context * | ssl | ) |

int mbedtls_ssl_write_finished | ( | mbedtls_ssl_context * | ssl | ) |

int mbedtls_ssl_write_record | ( | mbedtls_ssl_context * | ssl | ) |

void mbedtls_ssl_write_version | ( | int | major,
|  | int | minor,
|  | int | transport,
|  | unsigned char | ver[2]
| ) |  |

Referenced by mbedtls_ssl_own_cert().