tlsv1_server_i.h
Go to the documentation of this file.00001
00016 #ifndef TLSV1_SERVER_I_H
00017 #define TLSV1_SERVER_I_H
00018
00019 struct tlsv1_server {
00020 enum {
00021 CLIENT_HELLO, SERVER_HELLO, SERVER_CERTIFICATE,
00022 SERVER_KEY_EXCHANGE, SERVER_CERTIFICATE_REQUEST,
00023 SERVER_HELLO_DONE, CLIENT_CERTIFICATE, CLIENT_KEY_EXCHANGE,
00024 CERTIFICATE_VERIFY, CHANGE_CIPHER_SPEC, CLIENT_FINISHED,
00025 SERVER_CHANGE_CIPHER_SPEC, SERVER_FINISHED,
00026 ESTABLISHED, FAILED
00027 } state;
00028
00029 struct tlsv1_record_layer rl;
00030
00031 u8 session_id[TLS_SESSION_ID_MAX_LEN];
00032 size_t session_id_len;
00033 u8 client_random[TLS_RANDOM_LEN];
00034 u8 server_random[TLS_RANDOM_LEN];
00035 u8 master_secret[TLS_MASTER_SECRET_LEN];
00036
00037 u8 alert_level;
00038 u8 alert_description;
00039
00040 struct crypto_public_key *client_rsa_key;
00041
00042 struct tls_verify_hash verify;
00043
00044 #define MAX_CIPHER_COUNT 30
00045 u16 cipher_suites[MAX_CIPHER_COUNT];
00046 size_t num_cipher_suites;
00047
00048 u16 cipher_suite;
00049
00050 struct tlsv1_credentials *cred;
00051
00052 int verify_peer;
00053 u16 client_version;
00054
00055 u8 *session_ticket;
00056 size_t session_ticket_len;
00057
00058 tlsv1_server_session_ticket_cb session_ticket_cb;
00059 void *session_ticket_cb_ctx;
00060
00061 int use_session_ticket;
00062
00063 u8 *dh_secret;
00064 size_t dh_secret_len;
00065 };
00066
00067
00068 void tlsv1_server_alert(struct tlsv1_server *conn, u8 level, u8 description);
00069 int tlsv1_server_derive_keys(struct tlsv1_server *conn,
00070 const u8 *pre_master_secret,
00071 size_t pre_master_secret_len);
00072 u8 * tlsv1_server_handshake_write(struct tlsv1_server *conn, size_t *out_len);
00073 u8 * tlsv1_server_send_alert(struct tlsv1_server *conn, u8 level,
00074 u8 description, size_t *out_len);
00075 int tlsv1_server_process_handshake(struct tlsv1_server *conn, u8 ct,
00076 const u8 *buf, size_t *len);
00077
00078 #endif
00079