$search
#include "includes.h"
#include "common.h"
#include "crypto/sha1.h"
#include "crypto/tls.h"
#include "tlsv1_common.h"
#include "crypto/crypto.h"
Go to the source code of this file.
Functions | |
void | tls_alert (struct tlsv1_client *conn, u8 level, u8 description) |
int | tls_derive_keys (struct tlsv1_client *conn, const u8 *pre_master_secret, size_t pre_master_secret_len) |
int | tls_derive_pre_master_secret (u8 *pre_master_secret) |
int | tlsv1_client_decrypt (struct tlsv1_client *conn, const u8 *in_data, size_t in_len, u8 *out_data, size_t out_len) |
void | tlsv1_client_deinit (struct tlsv1_client *conn) |
int | tlsv1_client_encrypt (struct tlsv1_client *conn, const u8 *in_data, size_t in_len, u8 *out_data, size_t out_len) |
int | tlsv1_client_established (struct tlsv1_client *conn) |
void | tlsv1_client_free_dh (struct tlsv1_client *conn) |
int | tlsv1_client_get_cipher (struct tlsv1_client *conn, char *buf, size_t buflen) |
int | tlsv1_client_get_keyblock_size (struct tlsv1_client *conn) |
int | tlsv1_client_get_keys (struct tlsv1_client *conn, struct tls_keys *keys) |
void | tlsv1_client_global_deinit (void) |
int | tlsv1_client_global_init (void) |
u8 * | tlsv1_client_handshake (struct tlsv1_client *conn, const u8 *in_data, size_t in_len, size_t *out_len, u8 **appl_data, size_t *appl_data_len) |
int | tlsv1_client_hello_ext (struct tlsv1_client *conn, int ext_type, const u8 *data, size_t data_len) |
struct tlsv1_client * | tlsv1_client_init (void) |
int | tlsv1_client_prf (struct tlsv1_client *conn, const char *label, int server_random_first, u8 *out, size_t out_len) |
int | tlsv1_client_resumed (struct tlsv1_client *conn) |
int | tlsv1_client_set_cipher_list (struct tlsv1_client *conn, u8 *ciphers) |
int | tlsv1_client_set_cred (struct tlsv1_client *conn, struct tlsv1_credentials *cred) |
void | tlsv1_client_set_session_ticket_cb (struct tlsv1_client *conn, tlsv1_client_session_ticket_cb cb, void *ctx) |
int | tlsv1_client_shutdown (struct tlsv1_client *conn) |
void tls_alert | ( | struct tlsv1_client * | conn, | |
u8 | level, | |||
u8 | description | |||
) |
Definition at line 30 of file tlsv1_client.c.
int tls_derive_keys | ( | struct tlsv1_client * | conn, | |
const u8 * | pre_master_secret, | |||
size_t | pre_master_secret_len | |||
) |
Definition at line 56 of file tlsv1_client.c.
int tls_derive_pre_master_secret | ( | u8 * | pre_master_secret | ) |
Definition at line 46 of file tlsv1_client.c.
int tlsv1_client_decrypt | ( | struct tlsv1_client * | conn, | |
const u8 * | in_data, | |||
size_t | in_len, | |||
u8 * | out_data, | |||
size_t | out_len | |||
) |
tlsv1_client_decrypt - Decrypt data from TLS tunnel : TLSv1 client connection data from tlsv1_client_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 256 of file tlsv1_client.c.
void tlsv1_client_deinit | ( | struct tlsv1_client * | conn | ) |
tlsv1_client_deinit - Deinitialize TLSv1 client connection : TLSv1 client connection data from tlsv1_client_init()
Definition at line 371 of file tlsv1_client.c.
int tlsv1_client_encrypt | ( | struct tlsv1_client * | conn, | |
const u8 * | in_data, | |||
size_t | in_len, | |||
u8 * | out_data, | |||
size_t | out_len | |||
) |
tlsv1_client_encrypt - Encrypt data into TLS tunnel : TLSv1 client connection data from tlsv1_client_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 221 of file tlsv1_client.c.
int tlsv1_client_established | ( | struct tlsv1_client * | conn | ) |
tlsv1_client_established - Check whether connection has been established : TLSv1 client connection data from tlsv1_client_init() Returns: 1 if connection is established, 0 if not
Definition at line 390 of file tlsv1_client.c.
void tlsv1_client_free_dh | ( | struct tlsv1_client * | conn | ) |
Definition at line 37 of file tlsv1_client.c.
int tlsv1_client_get_cipher | ( | struct tlsv1_client * | conn, | |
char * | buf, | |||
size_t | buflen | |||
) |
tlsv1_client_get_cipher - Get current cipher name : TLSv1 client connection data from tlsv1_client_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 438 of file tlsv1_client.c.
int tlsv1_client_get_keyblock_size | ( | struct tlsv1_client * | conn | ) |
tlsv1_client_get_keyblock_size - Get TLS key_block size : TLSv1 client connection data from tlsv1_client_init() Returns: Size of the key_block for the negotiated cipher suite or -1 on failure
Definition at line 589 of file tlsv1_client.c.
int tlsv1_client_get_keys | ( | struct tlsv1_client * | conn, | |
struct tls_keys * | keys | |||
) |
tlsv1_client_get_keys - Get master key and random data from TLS connection : TLSv1 client connection data from tlsv1_client_init() : Structure of key/random data (filled on success) Returns: 0 on success, -1 on failure
Definition at line 563 of file tlsv1_client.c.
void tlsv1_client_global_deinit | ( | void | ) |
tlsv1_client_global_deinit - Deinitialize TLSv1 client
This function can be used to deinitialize the TLSv1 client that was initialized by calling tlsv1_client_global_init(). No TLSv1 client functions can be called after this before calling tlsv1_client_global_init() again.
Definition at line 323 of file tlsv1_client.c.
int tlsv1_client_global_init | ( | void | ) |
tlsv1_client_global_init - Initialize TLSv1 client Returns: 0 on success, -1 on failure
This function must be called before using any other TLSv1 client functions.
Definition at line 310 of file tlsv1_client.c.
u8* tlsv1_client_handshake | ( | struct tlsv1_client * | conn, | |
const u8 * | in_data, | |||
size_t | in_len, | |||
size_t * | out_len, | |||
u8 ** | appl_data, | |||
size_t * | appl_data_len | |||
) |
tlsv1_client_handshake - Process TLS handshake : TLSv1 client connection data from tlsv1_client_init() : Input data from TLS peer : Input data length : Length of the output buffer. : Pointer to application data pointer, or NULL if dropped : Pointer to variable that is set to appl_data length Returns: Pointer to output data, NULL on failure
Definition at line 131 of file tlsv1_client.c.
int tlsv1_client_hello_ext | ( | struct tlsv1_client * | conn, | |
int | ext_type, | |||
const u8 * | data, | |||
size_t | data_len | |||
) |
tlsv1_client_hello_ext - Set TLS extension for ClientHello : TLSv1 client connection data from tlsv1_client_init() : Extension type : Extension payload (NULL to remove extension) : Extension payload length Returns: 0 on success, -1 on failure
Definition at line 522 of file tlsv1_client.c.
struct tlsv1_client* tlsv1_client_init | ( | void | ) | [read] |
tlsv1_client_init - Initialize TLSv1 client connection Returns: Pointer to TLSv1 client connection data or NULL on failure
Definition at line 333 of file tlsv1_client.c.
int tlsv1_client_prf | ( | struct tlsv1_client * | conn, | |
const char * | label, | |||
int | server_random_first, | |||
u8 * | out, | |||
size_t | out_len | |||
) |
tlsv1_client_prf - Use TLS-PRF to derive keying material : TLSv1 client connection data from tlsv1_client_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 406 of file tlsv1_client.c.
int tlsv1_client_resumed | ( | struct tlsv1_client * | conn | ) |
tlsv1_client_resumed - Was session resumption used : TLSv1 client connection data from tlsv1_client_init() Returns: 1 if current session used session resumption, 0 if not
Definition at line 508 of file tlsv1_client.c.
int tlsv1_client_set_cipher_list | ( | struct tlsv1_client * | conn, | |
u8 * | ciphers | |||
) |
tlsv1_client_set_cipher_list - Configure acceptable cipher suites : TLSv1 client connection data from tlsv1_client_init() : Zero (TLS_CIPHER_NONE) terminated list of allowed ciphers (TLS_CIPHER_*). Returns: 0 on success, -1 on failure
Definition at line 606 of file tlsv1_client.c.
int tlsv1_client_set_cred | ( | struct tlsv1_client * | conn, | |
struct tlsv1_credentials * | cred | |||
) |
tlsv1_client_set_cred - Set client credentials : TLSv1 client connection data from tlsv1_client_init() : Credentials from tlsv1_cred_alloc() Returns: 0 on success, -1 on failure
On success, the client takes ownership of the credentials block and caller must not free it. On failure, caller is responsible for freeing the credential block.
Definition at line 650 of file tlsv1_client.c.
void tlsv1_client_set_session_ticket_cb | ( | struct tlsv1_client * | conn, | |
tlsv1_client_session_ticket_cb | cb, | |||
void * | ctx | |||
) |
Definition at line 659 of file tlsv1_client.c.
int tlsv1_client_shutdown | ( | struct tlsv1_client * | conn | ) |
tlsv1_client_shutdown - Shutdown TLS connection : TLSv1 client connection data from tlsv1_client_init() Returns: 0 on success, -1 on failure
Definition at line 480 of file tlsv1_client.c.