#include "xyssl/config.h"
#include "xyssl/debug.h"
#include "xyssl/ssl.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
Go to the source code of this file.
Functions | |
static int | ssl_write_client_hello (ssl_context *ssl) |
static int | ssl_parse_server_hello (ssl_context *ssl) |
static int | ssl_parse_server_key_exchange (ssl_context *ssl) |
static int | ssl_parse_certificate_request (ssl_context *ssl) |
static int | ssl_parse_server_hello_done (ssl_context *ssl) |
static int | ssl_write_client_key_exchange (ssl_context *ssl) |
static int | ssl_write_certificate_verify (ssl_context *ssl) |
int | ssl_handshake_client (ssl_context *ssl) |
int ssl_handshake_client | ( | ssl_context * | ssl | ) |
Definition at line 660 of file ssl_cli.c.
References SSL_CERTIFICATE_REQUEST, SSL_CERTIFICATE_VERIFY, SSL_CLIENT_CERTIFICATE, SSL_CLIENT_CHANGE_CIPHER_SPEC, SSL_CLIENT_FINISHED, SSL_CLIENT_HELLO, SSL_CLIENT_KEY_EXCHANGE, SSL_DEBUG_MSG, SSL_FLUSH_BUFFERS, ssl_flush_output(), SSL_HANDSHAKE_OVER, SSL_HELLO_REQUEST, ssl_parse_certificate(), ssl_parse_certificate_request(), ssl_parse_change_cipher_spec(), ssl_parse_finished(), ssl_parse_server_hello(), ssl_parse_server_hello_done(), ssl_parse_server_key_exchange(), SSL_SERVER_CERTIFICATE, SSL_SERVER_CHANGE_CIPHER_SPEC, SSL_SERVER_FINISHED, SSL_SERVER_HELLO, SSL_SERVER_HELLO_DONE, SSL_SERVER_KEY_EXCHANGE, ssl_write_certificate(), ssl_write_certificate_verify(), ssl_write_change_cipher_spec(), ssl_write_client_hello(), ssl_write_client_key_exchange(), ssl_write_finished(), _ssl_context::state, and XYSSL_ERR_SSL_BAD_INPUT_DATA.
Referenced by ssl_handshake().
static int ssl_parse_certificate_request | ( | ssl_context * | ssl | ) | [static] |
Definition at line 428 of file ssl_cli.c.
References _ssl_context::client_auth, _ssl_context::in_msg, _ssl_context::in_msgtype, SSL_DEBUG_MSG, SSL_DEBUG_RET, SSL_HS_CERTIFICATE_REQUEST, SSL_MSG_HANDSHAKE, ssl_read_record(), _ssl_context::state, and XYSSL_ERR_SSL_UNEXPECTED_MESSAGE.
Referenced by ssl_handshake_client().
static int ssl_parse_server_hello | ( | ssl_context * | ssl | ) | [static] |
Definition at line 168 of file ssl_cli.c.
References buf, _ssl_session::cipher, _ssl_context::ciphers, _ssl_session::id, _ssl_context::in_hslen, _ssl_context::in_msg, _ssl_context::in_msgtype, _ssl_session::length, _ssl_context::minor_ver, _ssl_context::randbytes, _ssl_context::resume, _ssl_context::session, SSL_COMPRESS_NULL, SSL_DEBUG_BUF, SSL_DEBUG_MSG, SSL_DEBUG_RET, ssl_derive_keys(), SSL_HS_SERVER_HELLO, SSL_MAJOR_VERSION_3, SSL_MINOR_VERSION_0, SSL_MINOR_VERSION_1, SSL_MSG_HANDSHAKE, ssl_read_record(), SSL_SERVER_CHANGE_CIPHER_SPEC, _ssl_session::start, _ssl_context::state, XYSSL_ERR_SSL_BAD_HS_SERVER_HELLO, and XYSSL_ERR_SSL_UNEXPECTED_MESSAGE.
Referenced by ssl_handshake_client().
static int ssl_parse_server_hello_done | ( | ssl_context * | ssl | ) | [static] |
Definition at line 471 of file ssl_cli.c.
References _ssl_context::client_auth, _ssl_context::in_hslen, _ssl_context::in_msg, _ssl_context::in_msgtype, SSL_DEBUG_MSG, SSL_DEBUG_RET, SSL_HS_SERVER_HELLO_DONE, SSL_MSG_HANDSHAKE, ssl_read_record(), _ssl_context::state, XYSSL_ERR_SSL_BAD_HS_SERVER_HELLO_DONE, and XYSSL_ERR_SSL_UNEXPECTED_MESSAGE.
Referenced by ssl_handshake_client().
static int ssl_parse_server_key_exchange | ( | ssl_context * | ssl | ) | [static] |
Definition at line 312 of file ssl_cli.c.
References _ssl_session::cipher, _ssl_context::dhm_ctx, dhm_read_params(), dhm_context::G, dhm_context::GY, _ssl_context::in_hslen, _ssl_context::in_msg, _ssl_context::in_msgtype, dhm_context::len, rsa_context::len, md5(), md5_finish(), md5_starts(), md5_update(), dhm_context::P, _ssl_context::peer_cert, _ssl_context::randbytes, _x509_cert::rsa, rsa_pkcs1_verify(), RSA_PUBLIC, RSA_RAW, _ssl_context::session, sha1(), sha1_finish(), sha1_starts(), sha1_update(), SSL_DEBUG_BUF, SSL_DEBUG_MPI, SSL_DEBUG_MSG, SSL_DEBUG_RET, SSL_EDH_RSA_AES_256_SHA, SSL_EDH_RSA_DES_168_SHA, SSL_HS_SERVER_KEY_EXCHANGE, SSL_MSG_HANDSHAKE, ssl_read_record(), _ssl_context::state, XYSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE, XYSSL_ERR_SSL_FEATURE_UNAVAILABLE, and XYSSL_ERR_SSL_UNEXPECTED_MESSAGE.
Referenced by ssl_handshake_client().
static int ssl_write_certificate_verify | ( | ssl_context * | ssl | ) | [static] |
Definition at line 604 of file ssl_cli.c.
References _ssl_context::client_auth, rsa_context::len, _ssl_context::out_msg, _ssl_context::out_msglen, _ssl_context::out_msgtype, _ssl_context::rsa_key, rsa_pkcs1_sign(), RSA_PRIVATE, RSA_RAW, ssl_calc_verify(), SSL_DEBUG_MSG, SSL_DEBUG_RET, SSL_HS_CERTIFICATE_VERIFY, SSL_MSG_HANDSHAKE, ssl_write_record(), _ssl_context::state, and XYSSL_ERR_SSL_PRIVATE_KEY_REQUIRED.
Referenced by ssl_handshake_client().
static int ssl_write_client_hello | ( | ssl_context * | ssl | ) | [static] |
Definition at line 33 of file ssl_cli.c.
References buf, _ssl_context::ciphers, _ssl_context::f_rng, _ssl_context::hostname, _ssl_context::hostname_len, _ssl_session::id, _ssl_session::length, _ssl_context::major_ver, _ssl_context::max_major_ver, _ssl_context::max_minor_ver, _ssl_context::minor_ver, _ssl_context::out_msg, _ssl_context::out_msglen, _ssl_context::out_msgtype, _ssl_context::p_rng, _ssl_context::randbytes, _ssl_context::resume, _ssl_context::session, SSL_COMPRESS_NULL, SSL_DEBUG_BUF, SSL_DEBUG_MSG, SSL_DEBUG_RET, SSL_HS_CLIENT_HELLO, SSL_MAJOR_VERSION_3, SSL_MINOR_VERSION_0, SSL_MINOR_VERSION_1, SSL_MSG_HANDSHAKE, ssl_write_record(), _ssl_session::start, _ssl_context::state, _ssl_context::timeout, TLS_EXT_SERVERNAME, and TLS_EXT_SERVERNAME_HOSTNAME.
Referenced by ssl_handshake_client().
static int ssl_write_client_key_exchange | ( | ssl_context * | ssl | ) | [static] |
Definition at line 506 of file ssl_cli.c.
References _ssl_session::cipher, dhm_calc_secret(), _ssl_context::dhm_ctx, dhm_make_public(), _ssl_context::f_rng, dhm_context::GX, dhm_context::K, rsa_context::len, dhm_context::len, _ssl_context::max_major_ver, _ssl_context::max_minor_ver, _ssl_context::minor_ver, _ssl_context::out_msg, _ssl_context::out_msglen, _ssl_context::out_msgtype, _ssl_context::p_rng, _ssl_context::peer_cert, _ssl_context::pmslen, _ssl_context::premaster, _x509_cert::rsa, rsa_pkcs1_encrypt(), RSA_PUBLIC, _ssl_context::session, SSL_DEBUG_MPI, SSL_DEBUG_MSG, SSL_DEBUG_RET, ssl_derive_keys(), SSL_EDH_RSA_AES_256_SHA, SSL_EDH_RSA_DES_168_SHA, SSL_HS_CLIENT_KEY_EXCHANGE, SSL_MINOR_VERSION_0, SSL_MSG_HANDSHAKE, ssl_write_record(), _ssl_context::state, dhm_context::X, and XYSSL_ERR_SSL_FEATURE_UNAVAILABLE.
Referenced by ssl_handshake_client().