tlsv1_client.h revision 1f69aa52ea2e0a73ac502565df8c666ee49cab6a
1/*
2 * TLS v1.0/v1.1/v1.2 client (RFC 2246, RFC 4346, RFC 5246)
3 * Copyright (c) 2006-2011, Jouni Malinen <j@w1.fi>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
13 */
14
15#ifndef TLSV1_CLIENT_H
16#define TLSV1_CLIENT_H
17
18#include "tlsv1_cred.h"
19
20struct tlsv1_client;
21
22int tlsv1_client_global_init(void);
23void tlsv1_client_global_deinit(void);
24struct tlsv1_client * tlsv1_client_init(void);
25void tlsv1_client_deinit(struct tlsv1_client *conn);
26int tlsv1_client_established(struct tlsv1_client *conn);
27int tlsv1_client_prf(struct tlsv1_client *conn, const char *label,
28		     int server_random_first, u8 *out, size_t out_len);
29u8 * tlsv1_client_handshake(struct tlsv1_client *conn,
30			    const u8 *in_data, size_t in_len,
31			    size_t *out_len, u8 **appl_data,
32			    size_t *appl_data_len, int *need_more_data);
33int tlsv1_client_encrypt(struct tlsv1_client *conn,
34			 const u8 *in_data, size_t in_len,
35			 u8 *out_data, size_t out_len);
36struct wpabuf * tlsv1_client_decrypt(struct tlsv1_client *conn,
37				     const u8 *in_data, size_t in_len,
38				     int *need_more_data);
39int tlsv1_client_get_cipher(struct tlsv1_client *conn, char *buf,
40			    size_t buflen);
41int tlsv1_client_shutdown(struct tlsv1_client *conn);
42int tlsv1_client_resumed(struct tlsv1_client *conn);
43int tlsv1_client_hello_ext(struct tlsv1_client *conn, int ext_type,
44			   const u8 *data, size_t data_len);
45int tlsv1_client_get_keys(struct tlsv1_client *conn, struct tls_keys *keys);
46int tlsv1_client_get_keyblock_size(struct tlsv1_client *conn);
47int tlsv1_client_set_cipher_list(struct tlsv1_client *conn, u8 *ciphers);
48int tlsv1_client_set_cred(struct tlsv1_client *conn,
49			  struct tlsv1_credentials *cred);
50void tlsv1_client_set_time_checks(struct tlsv1_client *conn, int enabled);
51
52typedef int (*tlsv1_client_session_ticket_cb)
53(void *ctx, const u8 *ticket, size_t len, const u8 *client_random,
54 const u8 *server_random, u8 *master_secret);
55
56void tlsv1_client_set_session_ticket_cb(struct tlsv1_client *conn,
57					tlsv1_client_session_ticket_cb cb,
58					void *ctx);
59
60#endif /* TLSV1_CLIENT_H */
61