2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2009, 2010 Free
3 * Software Foundation, Inc.
5 * Author: Nikos Mavrogiannopoulos
7 * This file is part of GnuTLS.
9 * The GnuTLS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
27 { OPTIONAL_PACKET
, MANDATORY_PACKET
} Optional
;
29 int _gnutls_send_handshake (gnutls_session_t session
, mbuffer_st
* bufel
,
30 gnutls_handshake_description_t type
);
31 int _gnutls_recv_hello_request (gnutls_session_t session
, void *data
,
33 int _gnutls_send_hello (gnutls_session_t session
, int again
);
34 int _gnutls_recv_hello (gnutls_session_t session
, opaque
* data
, int datalen
);
35 int _gnutls_recv_handshake (gnutls_session_t session
, uint8_t **, int *,
36 gnutls_handshake_description_t
,
38 int _gnutls_generate_session_id (opaque
* session_id
, uint8_t * len
);
39 int _gnutls_handshake_common (gnutls_session_t session
);
40 int _gnutls_handshake_client (gnutls_session_t session
);
41 int _gnutls_handshake_server (gnutls_session_t session
);
42 void _gnutls_set_server_random (gnutls_session_t session
, uint8_t * rnd
);
43 void _gnutls_set_client_random (gnutls_session_t session
, uint8_t * rnd
);
44 int _gnutls_tls_create_random (opaque
* dst
);
45 int _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session
,
46 cipher_suite_st
** cipherSuites
,
48 gnutls_pk_algorithm_t
);
49 int _gnutls_find_pk_algos_in_ciphersuites (opaque
* data
, int datalen
);
50 int _gnutls_server_select_suite (gnutls_session_t session
, opaque
* data
,
53 int _gnutls_negotiate_version (gnutls_session_t session
,
54 gnutls_protocol_t adv_version
);
55 int _gnutls_user_hello_func (gnutls_session_t session
,
56 gnutls_protocol_t adv_version
);
58 void _gnutls_handshake_hash_buffers_clear (gnutls_session_t session
);
60 #define STATE session->internals.handshake_state
61 /* This returns true if we have got there
62 * before (and not finished due to an interrupt).
64 #define AGAIN(target) (STATE==target?1:0)
65 #define AGAIN2(state, target) (state==target?1:0)