#include "includes.h"
#include "common.h"
#include "crypto/sha1.h"
#include "crypto/tls.h"
#include "tlsv1_common.h"
#include "tlsv1_record.h"
#include "tlsv1_server.h"
#include "tlsv1_server_i.h"
Go to the source code of this file.
Functions | |
void | tlsv1_server_alert (struct tlsv1_server *conn, u8 level, u8 description) |
static void | tlsv1_server_clear_data (struct tlsv1_server *conn) |
int | tlsv1_server_decrypt (struct tlsv1_server *conn, const u8 *in_data, size_t in_len, u8 *out_data, size_t out_len) |
void | tlsv1_server_deinit (struct tlsv1_server *conn) |
int | tlsv1_server_derive_keys (struct tlsv1_server *conn, const u8 *pre_master_secret, size_t pre_master_secret_len) |
int | tlsv1_server_encrypt (struct tlsv1_server *conn, const u8 *in_data, size_t in_len, u8 *out_data, size_t out_len) |
int | tlsv1_server_established (struct tlsv1_server *conn) |
int | tlsv1_server_get_cipher (struct tlsv1_server *conn, char *buf, size_t buflen) |
int | tlsv1_server_get_keyblock_size (struct tlsv1_server *conn) |
int | tlsv1_server_get_keys (struct tlsv1_server *conn, struct tls_keys *keys) |
void | tlsv1_server_global_deinit (void) |
int | tlsv1_server_global_init (void) |
u8 * | tlsv1_server_handshake (struct tlsv1_server *conn, const u8 *in_data, size_t in_len, size_t *out_len) |
struct tlsv1_server * | tlsv1_server_init (struct tlsv1_credentials *cred) |
int | tlsv1_server_prf (struct tlsv1_server *conn, const char *label, int server_random_first, u8 *out, size_t out_len) |
int | tlsv1_server_resumed (struct tlsv1_server *conn) |
int | tlsv1_server_set_cipher_list (struct tlsv1_server *conn, u8 *ciphers) |
void | tlsv1_server_set_session_ticket_cb (struct tlsv1_server *conn, tlsv1_server_session_ticket_cb cb, void *ctx) |
int | tlsv1_server_set_verify (struct tlsv1_server *conn, int verify_peer) |
int | tlsv1_server_shutdown (struct tlsv1_server *conn) |
void tlsv1_server_alert | ( | struct tlsv1_server * | conn, |
u8 | level, | ||
u8 | description | ||
) |
Definition at line 30 of file tlsv1_server.c.
static void tlsv1_server_clear_data | ( | struct tlsv1_server * | conn | ) | [static] |
Definition at line 344 of file tlsv1_server.c.
int tlsv1_server_decrypt | ( | struct tlsv1_server * | conn, |
const u8 * | in_data, | ||
size_t | in_len, | ||
u8 * | out_data, | ||
size_t | out_len | ||
) |
tlsv1_server_decrypt - Decrypt data from TLS tunnel : TLSv1 server connection data from tlsv1_server_init() : Pointer to input buffer (encrypted TLS data) : Input buffer length : Pointer to output buffer (decrypted data from TLS tunnel) : Maximum out_data length Returns: Number of bytes written to out_data, -1 on failure
This function is used after TLS handshake has been completed successfully to receive data from the encrypted tunnel.
Definition at line 230 of file tlsv1_server.c.
void tlsv1_server_deinit | ( | struct tlsv1_server * | conn | ) |
tlsv1_server_deinit - Deinitialize TLSv1 server connection : TLSv1 server connection data from tlsv1_server_init()
Definition at line 369 of file tlsv1_server.c.
int tlsv1_server_derive_keys | ( | struct tlsv1_server * | conn, |
const u8 * | pre_master_secret, | ||
size_t | pre_master_secret_len | ||
) |
Definition at line 37 of file tlsv1_server.c.
int tlsv1_server_encrypt | ( | struct tlsv1_server * | conn, |
const u8 * | in_data, | ||
size_t | in_len, | ||
u8 * | out_data, | ||
size_t | out_len | ||
) |
tlsv1_server_encrypt - Encrypt data into TLS tunnel : TLSv1 server connection data from tlsv1_server_init() : Pointer to plaintext data to be encrypted : Input buffer length : Pointer to output buffer (encrypted TLS data) : Maximum out_data length Returns: Number of bytes written to out_data, -1 on failure
This function is used after TLS handshake has been completed successfully to send data in the encrypted tunnel.
Definition at line 195 of file tlsv1_server.c.
int tlsv1_server_established | ( | struct tlsv1_server * | conn | ) |
tlsv1_server_established - Check whether connection has been established : TLSv1 server connection data from tlsv1_server_init() Returns: 1 if connection is established, 0 if not
Definition at line 381 of file tlsv1_server.c.
int tlsv1_server_get_cipher | ( | struct tlsv1_server * | conn, |
char * | buf, | ||
size_t | buflen | ||
) |
tlsv1_server_get_cipher - Get current cipher name : TLSv1 server connection data from tlsv1_server_init() : Buffer for the cipher name : buf size Returns: 0 on success, -1 on failure
Get the name of the currently used cipher.
Definition at line 429 of file tlsv1_server.c.
int tlsv1_server_get_keyblock_size | ( | struct tlsv1_server * | conn | ) |
tlsv1_server_get_keyblock_size - Get TLS key_block size : TLSv1 server connection data from tlsv1_server_init() Returns: Size of the key_block for the negotiated cipher suite or -1 on failure
Definition at line 530 of file tlsv1_server.c.
int tlsv1_server_get_keys | ( | struct tlsv1_server * | conn, |
struct tls_keys * | keys | ||
) |
tlsv1_server_get_keys - Get master key and random data from TLS connection : TLSv1 server connection data from tlsv1_server_init() : Structure of key/random data (filled on success) Returns: 0 on success, -1 on failure
Definition at line 504 of file tlsv1_server.c.
void tlsv1_server_global_deinit | ( | void | ) |
tlsv1_server_global_deinit - Deinitialize TLSv1 server
This function can be used to deinitialize the TLSv1 server that was initialized by calling tlsv1_server_global_init(). No TLSv1 server functions can be called after this before calling tlsv1_server_global_init() again.
Definition at line 297 of file tlsv1_server.c.
int tlsv1_server_global_init | ( | void | ) |
tlsv1_server_global_init - Initialize TLSv1 server Returns: 0 on success, -1 on failure
This function must be called before using any other TLSv1 server functions.
Definition at line 284 of file tlsv1_server.c.
u8* tlsv1_server_handshake | ( | struct tlsv1_server * | conn, |
const u8 * | in_data, | ||
size_t | in_len, | ||
size_t * | out_len | ||
) |
tlsv1_server_handshake - Process TLS handshake : TLSv1 server connection data from tlsv1_server_init() : Input data from TLS peer : Input data length : Length of the output buffer. Returns: Pointer to output data, NULL on failure
Definition at line 111 of file tlsv1_server.c.
struct tlsv1_server* tlsv1_server_init | ( | struct tlsv1_credentials * | cred | ) | [read] |
tlsv1_server_init - Initialize TLSv1 server connection : Pointer to server credentials from tlsv1_server_cred_alloc() Returns: Pointer to TLSv1 server connection data or NULL on failure
Definition at line 308 of file tlsv1_server.c.
int tlsv1_server_prf | ( | struct tlsv1_server * | conn, |
const char * | label, | ||
int | server_random_first, | ||
u8 * | out, | ||
size_t | out_len | ||
) |
tlsv1_server_prf - Use TLS-PRF to derive keying material : TLSv1 server connection data from tlsv1_server_init() : Label (e.g., description of the key) for PRF : seed is 0 = client_random|server_random, 1 = server_random|client_random : Buffer for output data from TLS-PRF : Length of the output buffer Returns: 0 on success, -1 on failure
Definition at line 397 of file tlsv1_server.c.
int tlsv1_server_resumed | ( | struct tlsv1_server * | conn | ) |
tlsv1_server_resumed - Was session resumption used : TLSv1 server connection data from tlsv1_server_init() Returns: 1 if current session used session resumption, 0 if not
Definition at line 492 of file tlsv1_server.c.
int tlsv1_server_set_cipher_list | ( | struct tlsv1_server * | conn, |
u8 * | ciphers | ||
) |
tlsv1_server_set_cipher_list - Configure acceptable cipher suites : TLSv1 server connection data from tlsv1_server_init() : Zero (TLS_CIPHER_NONE) terminated list of allowed ciphers (TLS_CIPHER_*). Returns: 0 on success, -1 on failure
Definition at line 547 of file tlsv1_server.c.
void tlsv1_server_set_session_ticket_cb | ( | struct tlsv1_server * | conn, |
tlsv1_server_session_ticket_cb | cb, | ||
void * | ctx | ||
) |
Definition at line 584 of file tlsv1_server.c.
int tlsv1_server_set_verify | ( | struct tlsv1_server * | conn, |
int | verify_peer | ||
) |
Definition at line 577 of file tlsv1_server.c.
int tlsv1_server_shutdown | ( | struct tlsv1_server * | conn | ) |
tlsv1_server_shutdown - Shutdown TLS connection : TLSv1 server connection data from tlsv1_server_init() Returns: 0 on success, -1 on failure
Definition at line 471 of file tlsv1_server.c.