summaryrefslogtreecommitdiff
path: root/lib/gnutls_handshake.c
diff options
context:
space:
mode:
authorNikos <nmav@crystal.(none)>2007-12-09 12:49:55 +0200
committerNikos <nmav@crystal.(none)>2007-12-09 12:49:55 +0200
commit3d5af6621fb49e326be35b99cec8556d8c8315ca (patch)
tree71c578c93bcd665a4ac55d204453cba3fa2574e4 /lib/gnutls_handshake.c
parentfd043564b805a1ee1823bfad28a967a6e49bc0d7 (diff)
downloadgnutls-3d5af6621fb49e326be35b99cec8556d8c8315ca.tar.gz
user_hello_func is call always. Even when resuming a session.
Diffstat (limited to 'lib/gnutls_handshake.c')
-rw-r--r--lib/gnutls_handshake.c55
1 files changed, 35 insertions, 20 deletions
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
index 40e118d359..737f5855fa 100644
--- a/lib/gnutls_handshake.c
+++ b/lib/gnutls_handshake.c
@@ -303,6 +303,29 @@ int ret;
return ret;
}
+int _gnutls_user_hello_func( gnutls_session session, gnutls_protocol_t adv_version)
+{
+int ret;
+
+ if (session->internals.user_hello_func != NULL)
+ {
+ ret = session->internals.user_hello_func( session);
+ if (ret < 0)
+ {
+ gnutls_assert();
+ return ret;
+ }
+ /* Here we need to renegotiate the version since the callee might
+ * have disabled some TLS versions.
+ */
+ ret = _gnutls_negotiate_version( session, adv_version);
+ if (ret < 0) {
+ gnutls_assert();
+ return ret;
+ }
+ }
+ return 0;
+}
/* Read a client hello packet.
* A client hello must be a known version client hello
@@ -335,10 +358,11 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data,
pos += 2;
neg_version = _gnutls_negotiate_version( session, adv_version);
- if (neg_version < 0) {
- gnutls_assert();
- return ret;
- }
+ if (neg_version < 0)
+ {
+ gnutls_assert();
+ return ret;
+ }
/* Read client random value.
*/
@@ -362,6 +386,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data,
return GNUTLS_E_UNEXPECTED_PACKET_LENGTH;
}
DECR_LEN (len, session_id_len);
+
ret = _gnutls_server_restore_session (session, &data[pos], session_id_len);
pos += session_id_len;
@@ -369,7 +394,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data,
{ /* resumed! */
resume_copy_required_values (session);
session->internals.resumed = RESUME_TRUE;
- return 0;
+ return _gnutls_user_hello_func( session, adv_version);
}
else
{
@@ -412,23 +437,13 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data,
}
}
- if (session->internals.user_hello_func != NULL)
+ ret = _gnutls_user_hello_func( session, adv_version);
+ if (ret < 0)
{
- ret = session->internals.user_hello_func( session);
- if (ret < 0)
- {
- gnutls_assert();
- return ret;
- }
- /* Here we need to renegotiate the version since the callee might
- * have disable some TLS versions.
- */
- ret = _gnutls_negotiate_version( session, adv_version);
- if (ret < 0) {
- gnutls_assert();
- return ret;
- }
+ gnutls_assert();
+ return ret;
}
+
/* select an appropriate cipher suite
*/