2 * TLSv1 client (RFC 2246)
3 * Copyright (c) 2006-2007, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #ifndef TLSV1_CLIENT_H
16 #define TLSV1_CLIENT_H
18 #include "tlsv1_cred.h"
22 int tlsv1_client_global_init(void);
23 void tlsv1_client_global_deinit(void);
24 struct tlsv1_client
* tlsv1_client_init(void);
25 void tlsv1_client_deinit(struct tlsv1_client
*conn
);
26 int tlsv1_client_established(struct tlsv1_client
*conn
);
27 int tlsv1_client_prf(struct tlsv1_client
*conn
, const char *label
,
28 int server_random_first
, u8
*out
, size_t out_len
);
29 u8
* 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
);
33 int tlsv1_client_encrypt(struct tlsv1_client
*conn
,
34 const u8
*in_data
, size_t in_len
,
35 u8
*out_data
, size_t out_len
);
36 int tlsv1_client_decrypt(struct tlsv1_client
*conn
,
37 const u8
*in_data
, size_t in_len
,
38 u8
*out_data
, size_t out_len
);
39 int tlsv1_client_get_cipher(struct tlsv1_client
*conn
, char *buf
,
41 int tlsv1_client_shutdown(struct tlsv1_client
*conn
);
42 int tlsv1_client_resumed(struct tlsv1_client
*conn
);
43 int tlsv1_client_hello_ext(struct tlsv1_client
*conn
, int ext_type
,
44 const u8
*data
, size_t data_len
);
45 int tlsv1_client_get_keys(struct tlsv1_client
*conn
, struct tls_keys
*keys
);
46 int tlsv1_client_get_keyblock_size(struct tlsv1_client
*conn
);
47 int tlsv1_client_set_cipher_list(struct tlsv1_client
*conn
, u8
*ciphers
);
48 int tlsv1_client_set_cred(struct tlsv1_client
*conn
,
49 struct tlsv1_credentials
*cred
);
51 typedef int (*tlsv1_client_session_ticket_cb
)
52 (void *ctx
, const u8
*ticket
, size_t len
, const u8
*client_random
,
53 const u8
*server_random
, u8
*master_secret
);
55 void tlsv1_client_set_session_ticket_cb(struct tlsv1_client
*conn
,
56 tlsv1_client_session_ticket_cb cb
,
59 #endif /* TLSV1_CLIENT_H */