ssl_srv.c File Reference

#include "polarssl/config.h"
#include "polarssl/debug.h"
#include "polarssl/ssl.h"
#include "polarssl/ecp.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
Include dependency graph for ssl_srv.c:

Go to the source code of this file.

Defines

#define polarssl_malloc   malloc
#define polarssl_free   free

Functions

static int ssl_save_session (const ssl_session *session, unsigned char *buf, size_t buf_len, size_t *olen)
static int ssl_load_session (ssl_session *session, const unsigned char *buf, size_t len)
static int ssl_write_ticket (ssl_context *ssl, size_t *tlen)
static int ssl_parse_ticket (ssl_context *ssl, unsigned char *buf, size_t len)
static int ssl_sni_wrapper (ssl_context *ssl, const unsigned char *name, size_t len)
static int ssl_parse_servername_ext (ssl_context *ssl, const unsigned char *buf, size_t len)
static int ssl_parse_renegotiation_info (ssl_context *ssl, const unsigned char *buf, size_t len)
static int ssl_parse_signature_algorithms_ext (ssl_context *ssl, const unsigned char *buf, size_t len)
static int ssl_parse_supported_elliptic_curves (ssl_context *ssl, const unsigned char *buf, size_t len)
static int ssl_parse_supported_point_formats (ssl_context *ssl, const unsigned char *buf, size_t len)
static int ssl_parse_max_fragment_length_ext (ssl_context *ssl, const unsigned char *buf, size_t len)
static int ssl_parse_truncated_hmac_ext (ssl_context *ssl, const unsigned char *buf, size_t len)
static int ssl_parse_session_ticket_ext (ssl_context *ssl, unsigned char *buf, size_t len)
static int ssl_parse_client_hello_v2 (ssl_context *ssl)
static int ssl_key_matches_curves (pk_context *pk, const ecp_curve_info **curves)
static int ssl_pick_cert (ssl_context *ssl, const ssl_ciphersuite_t *ciphersuite_info)
static int ssl_parse_client_hello (ssl_context *ssl)
static void ssl_write_truncated_hmac_ext (ssl_context *ssl, unsigned char *buf, size_t *olen)
static void ssl_write_session_ticket_ext (ssl_context *ssl, unsigned char *buf, size_t *olen)
static void ssl_write_renegotiation_ext (ssl_context *ssl, unsigned char *buf, size_t *olen)
static void ssl_write_max_fragment_length_ext (ssl_context *ssl, unsigned char *buf, size_t *olen)
static void ssl_write_supported_point_formats_ext (ssl_context *ssl, unsigned char *buf, size_t *olen)
static int ssl_write_server_hello (ssl_context *ssl)
static int ssl_write_certificate_request (ssl_context *ssl)
static int ssl_write_server_key_exchange (ssl_context *ssl)
static int ssl_write_server_hello_done (ssl_context *ssl)
static int ssl_parse_client_dh_public (ssl_context *ssl, unsigned char **p, const unsigned char *end)
static int ssl_parse_encrypted_pms (ssl_context *ssl, const unsigned char *p, const unsigned char *end, size_t pms_offset)
static int ssl_parse_client_psk_identity (ssl_context *ssl, unsigned char **p, const unsigned char *end)
static int ssl_parse_client_key_exchange (ssl_context *ssl)
static int ssl_parse_certificate_verify (ssl_context *ssl)
static int ssl_write_new_session_ticket (ssl_context *ssl)
int ssl_handshake_server_step (ssl_context *ssl)

Define Documentation

#define polarssl_free   free

Definition at line 40 of file ssl_srv.c.

#define polarssl_malloc   malloc

Definition at line 39 of file ssl_srv.c.


Function Documentation

int ssl_handshake_server_step ( ssl_context ssl  ) 
static int ssl_key_matches_curves ( pk_context pk,
const ecp_curve_info **  curves 
) [static]

Definition at line 916 of file ssl_srv.c.

References pk_ec.

Referenced by ssl_pick_cert().

static int ssl_load_session ( ssl_session session,
const unsigned char *  buf,
size_t  len 
) [static]
static int ssl_parse_certificate_verify ( ssl_context ssl  )  [static]
static int ssl_parse_client_dh_public ( ssl_context ssl,
unsigned char **  p,
const unsigned char *  end 
) [static]
static int ssl_parse_client_hello ( ssl_context ssl  )  [static]

Definition at line 977 of file ssl_srv.c.

References _ssl_context::allow_legacy_renegotiation, _ssl_session::ciphersuite, _ssl_transform::ciphersuite_info, _ssl_context::ciphersuite_list, _ssl_handshake_params::cli_exts, _ssl_session::compression, _ssl_handshake_params::curves, _ssl_context::f_psk, _ssl_context::f_sni, _ssl_context::handshake, _ssl_session::id, _ssl_context::in_hdr, _ssl_context::in_left, _ssl_context::in_msg, _ssl_context::in_msglen, _ssl_session::length, _ssl_context::major_ver, _ssl_handshake_params::max_major_ver, _ssl_ciphersuite_t::max_minor_ver, _ssl_handshake_params::max_minor_ver, _ssl_context::max_minor_ver, _ssl_context::min_major_ver, _ssl_ciphersuite_t::min_minor_ver, _ssl_context::min_minor_ver, _ssl_context::minor_ver, POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO, POLARSSL_ERR_SSL_BAD_HS_PROTOCOL_VERSION, POLARSSL_ERR_SSL_BAD_INPUT_DATA, POLARSSL_ERR_SSL_NO_CIPHER_CHOSEN, _ssl_context::psk, _ssl_context::psk_identity, _ssl_context::psk_identity_len, _ssl_context::psk_len, _ssl_handshake_params::randbytes, _ssl_context::renegotiation, _ssl_context::secure_renegotiation, _ssl_context::session_negotiate, SSL_ALERT_LEVEL_FATAL, SSL_ALERT_MSG_PROTOCOL_VERSION, ssl_ciphersuite_from_id(), ssl_ciphersuite_uses_ec(), ssl_ciphersuite_uses_psk(), SSL_COMPRESS_DEFLATE, SSL_COMPRESS_NULL, SSL_DEBUG_BUF, SSL_DEBUG_MSG, SSL_DEBUG_RET, SSL_EMPTY_RENEGOTIATION_INFO, ssl_fetch_input(), SSL_HS_CLIENT_HELLO, SSL_INITIAL_HANDSHAKE, SSL_LEGACY_BREAK_HANDSHAKE, SSL_LEGACY_NO_RENEGOTIATION, SSL_LEGACY_RENEGOTIATION, SSL_MAJOR_VERSION_3, SSL_MSG_HANDSHAKE, ssl_optimize_checksum(), ssl_parse_client_hello_v2(), ssl_parse_max_fragment_length_ext(), ssl_parse_renegotiation_info(), ssl_parse_servername_ext(), ssl_parse_session_ticket_ext(), ssl_parse_signature_algorithms_ext(), ssl_parse_supported_elliptic_curves(), ssl_parse_supported_point_formats(), ssl_parse_truncated_hmac_ext(), ssl_pick_cert(), SSL_RENEGOTIATION, SSL_SECURE_RENEGOTIATION, ssl_send_alert_message(), ssl_send_fatal_handshake_failure(), _ssl_context::state, TLS_EXT_MAX_FRAGMENT_LENGTH, TLS_EXT_RENEGOTIATION_INFO, TLS_EXT_SERVERNAME, TLS_EXT_SESSION_TICKET, TLS_EXT_SIG_ALG, TLS_EXT_SUPPORTED_ELLIPTIC_CURVES, TLS_EXT_SUPPORTED_POINT_FORMATS, TLS_EXT_SUPPORTED_POINT_FORMATS_PRESENT, TLS_EXT_TRUNCATED_HMAC, _ssl_context::transform_negotiate, and _ssl_handshake_params::update_checksum.

Referenced by ssl_handshake_server_step().

static int ssl_parse_client_hello_v2 ( ssl_context ssl  )  [static]
static int ssl_parse_client_key_exchange ( ssl_context ssl  )  [static]
static int ssl_parse_client_psk_identity ( ssl_context ssl,
unsigned char **  p,
const unsigned char *  end 
) [static]
static int ssl_parse_encrypted_pms ( ssl_context ssl,
const unsigned char *  p,
const unsigned char *  end,
size_t  pms_offset 
) [static]
static int ssl_parse_max_fragment_length_ext ( ssl_context ssl,
const unsigned char *  buf,
size_t  len 
) [static]
static int ssl_parse_renegotiation_info ( ssl_context ssl,
const unsigned char *  buf,
size_t  len 
) [static]
static int ssl_parse_servername_ext ( ssl_context ssl,
const unsigned char *  buf,
size_t  len 
) [static]
static int ssl_parse_session_ticket_ext ( ssl_context ssl,
unsigned char *  buf,
size_t  len 
) [static]
static int ssl_parse_signature_algorithms_ext ( ssl_context ssl,
const unsigned char *  buf,
size_t  len 
) [static]
static int ssl_parse_supported_elliptic_curves ( ssl_context ssl,
const unsigned char *  buf,
size_t  len 
) [static]
static int ssl_parse_supported_point_formats ( ssl_context ssl,
const unsigned char *  buf,
size_t  len 
) [static]
static int ssl_parse_ticket ( ssl_context ssl,
unsigned char *  buf,
size_t  len 
) [static]
static int ssl_parse_truncated_hmac_ext ( ssl_context ssl,
const unsigned char *  buf,
size_t  len 
) [static]
static int ssl_pick_cert ( ssl_context ssl,
const ssl_ciphersuite_t ciphersuite_info 
) [static]
static int ssl_save_session ( const ssl_session session,
unsigned char *  buf,
size_t  buf_len,
size_t *  olen 
) [static]

Definition at line 59 of file ssl_srv.c.

References _asn1_buf::len, _asn1_buf::p, _ssl_session::peer_cert, and _x509_crt::raw.

Referenced by ssl_write_ticket().

static int ssl_sni_wrapper ( ssl_context ssl,
const unsigned char *  name,
size_t  len 
) [static]
static int ssl_write_certificate_request ( ssl_context ssl  )  [static]
static void ssl_write_max_fragment_length_ext ( ssl_context ssl,
unsigned char *  buf,
size_t *  olen 
) [static]
static int ssl_write_new_session_ticket ( ssl_context ssl  )  [static]
static void ssl_write_renegotiation_ext ( ssl_context ssl,
unsigned char *  buf,
size_t *  olen 
) [static]
static int ssl_write_server_hello ( ssl_context ssl  )  [static]
static int ssl_write_server_hello_done ( ssl_context ssl  )  [static]
static int ssl_write_server_key_exchange ( ssl_context ssl  )  [static]

Definition at line 1930 of file ssl_srv.c.

References _ssl_transform::ciphersuite_info, _ssl_handshake_params::curves, _ssl_handshake_params::dhm_ctx, _ssl_context::dhm_G, dhm_make_params(), _ssl_context::dhm_P, _ssl_handshake_params::ecdh_ctx, ecdh_make_params(), ecp_use_known_dp(), _ssl_context::f_rng, dhm_context::G, ecdh_context::grp, ecp_curve_info::grp_id, dhm_context::GX, _ssl_context::handshake, _ssl_ciphersuite_t::key_exchange, md5(), md5_finish(), md5_starts(), md5_update(), md_finish(), md_free_ctx(), md_info_from_type(), md_init_ctx(), md_starts(), md_update(), _ssl_context::minor_ver, mpi_copy(), mpi_size(), ecp_group::nbits, _ssl_context::out_msg, _ssl_context::out_msglen, _ssl_context::out_msgtype, dhm_context::P, _ssl_context::p_rng, pk_sign(), POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE, POLARSSL_ERR_SSL_PRIVATE_KEY_REQUIRED, POLARSSL_KEY_EXCHANGE_DHE_PSK, POLARSSL_KEY_EXCHANGE_DHE_RSA, POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA, POLARSSL_KEY_EXCHANGE_ECDHE_PSK, POLARSSL_KEY_EXCHANGE_ECDHE_RSA, POLARSSL_KEY_EXCHANGE_PSK, POLARSSL_KEY_EXCHANGE_RSA, POLARSSL_KEY_EXCHANGE_RSA_PSK, POLARSSL_MD_NONE, POLARSSL_MD_SHA1, ecdh_context::Q, _ssl_handshake_params::randbytes, sha1(), sha1_finish(), sha1_starts(), sha1_update(), _ssl_handshake_params::sig_alg, SSL_DEBUG_BUF, SSL_DEBUG_ECP, SSL_DEBUG_MPI, SSL_DEBUG_MSG, SSL_DEBUG_RET, SSL_HS_SERVER_KEY_EXCHANGE, SSL_MAX_CONTENT_LEN, ssl_md_alg_from_hash(), SSL_MINOR_VERSION_3, SSL_MSG_HANDSHAKE, ssl_own_key(), ssl_sig_from_pk(), ssl_write_record(), _ssl_context::state, _ssl_context::transform_negotiate, and dhm_context::X.

Referenced by ssl_handshake_server_step().

static void ssl_write_session_ticket_ext ( ssl_context ssl,
unsigned char *  buf,
size_t *  olen 
) [static]
static void ssl_write_supported_point_formats_ext ( ssl_context ssl,
unsigned char *  buf,
size_t *  olen 
) [static]
static int ssl_write_ticket ( ssl_context ssl,
size_t *  tlen 
) [static]
static void ssl_write_truncated_hmac_ext ( ssl_context ssl,
unsigned char *  buf,
size_t *  olen 
) [static]

Generated on 9 Apr 2014 for PolarSSL v1.3.2 by  doxygen 1.6.1