2 * TLSv1 client - internal structures
3 * Copyright (c) 2006-2011, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
9 #ifndef TLSV1_CLIENT_I_H
10 #define TLSV1_CLIENT_I_H
14 CLIENT_HELLO
, SERVER_HELLO
, SERVER_CERTIFICATE
,
15 SERVER_KEY_EXCHANGE
, SERVER_CERTIFICATE_REQUEST
,
16 SERVER_HELLO_DONE
, CLIENT_KEY_EXCHANGE
, CHANGE_CIPHER_SPEC
,
17 SERVER_CHANGE_CIPHER_SPEC
, SERVER_FINISHED
, ACK_FINISHED
,
21 struct tlsv1_record_layer rl
;
23 u8 session_id
[TLS_SESSION_ID_MAX_LEN
];
24 size_t session_id_len
;
25 u8 client_random
[TLS_RANDOM_LEN
];
26 u8 server_random
[TLS_RANDOM_LEN
];
27 u8 master_secret
[TLS_MASTER_SECRET_LEN
];
32 unsigned int flags
; /* TLS_CONN_* bitfield */
34 unsigned int certificate_requested
:1;
35 unsigned int session_resumed
:1;
36 unsigned int session_ticket_included
:1;
37 unsigned int use_session_ticket
:1;
38 unsigned int cert_in_cb
:1;
40 struct crypto_public_key
*server_rsa_key
;
42 struct tls_verify_hash verify
;
44 #define MAX_CIPHER_COUNT 30
45 u16 cipher_suites
[MAX_CIPHER_COUNT
];
46 size_t num_cipher_suites
;
48 u16 prev_cipher_suite
;
51 size_t client_hello_ext_len
;
53 /* The prime modulus used for Diffie-Hellman */
56 /* The generator used for Diffie-Hellman */
59 /* The server's Diffie-Hellman public value */
63 struct tlsv1_credentials
*cred
;
65 tlsv1_client_session_ticket_cb session_ticket_cb
;
66 void *session_ticket_cb_ctx
;
68 struct wpabuf
*partial_input
;
70 void (*event_cb
)(void *ctx
, enum tls_event ev
,
71 union tls_event_data
*data
);
76 void tls_alert(struct tlsv1_client
*conn
, u8 level
, u8 description
);
77 void tlsv1_client_free_dh(struct tlsv1_client
*conn
);
78 int tls_derive_pre_master_secret(u8
*pre_master_secret
);
79 int tls_derive_keys(struct tlsv1_client
*conn
,
80 const u8
*pre_master_secret
, size_t pre_master_secret_len
);
81 u8
* tls_send_client_hello(struct tlsv1_client
*conn
, size_t *out_len
);
82 u8
* tlsv1_client_send_alert(struct tlsv1_client
*conn
, u8 level
,
83 u8 description
, size_t *out_len
);
84 u8
* tlsv1_client_handshake_write(struct tlsv1_client
*conn
, size_t *out_len
,
86 int tlsv1_client_process_handshake(struct tlsv1_client
*conn
, u8 ct
,
87 const u8
*buf
, size_t *len
,
88 u8
**out_data
, size_t *out_len
);
90 #endif /* TLSV1_CLIENT_I_H */