From: Nikos Mavrogiannopoulos Date: Wed, 11 Jan 2012 19:22:14 +0000 (+0100) Subject: Added gnutls_session_resumption_requested(). X-Git-Tag: gnutls-3_0_12~47 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d22267bd36b76e5d72edd8fdb9b81bb901d6136f;p=thirdparty%2Fgnutls.git Added gnutls_session_resumption_requested(). --- diff --git a/NEWS b/NEWS index aa7f17fd1f..ef863198fa 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ return a descriptive name of a DN OID. ** API and ABI modifications: gnutls_pubkey_encrypt_data: Added gnutls_x509_dn_oid_name: Added +gnutls_session_resumption_requested: Added * Version 3.0.11 (released 2012-01-06) diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index 805bed586a..36cf8a7711 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -441,6 +441,8 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, session_id = &data[pos]; ret = _gnutls_server_restore_session (session, session_id, session_id_len); pos += session_id_len; + + if (session_id_len > 0) session->internals.resumption_requested = 1; if (ret == 0) { /* resumed using default TLS resumption! */ diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index 08954914bf..d2119e1742 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -683,7 +683,8 @@ typedef struct struct gnutls_priority_st priorities; /* resumed session */ - unsigned int resumed:1; /* RESUME_TRUE or FALSE - if we are resuming a session */ + unsigned int resumed:1; /* RESUME_TRUE or FALSE - if we are resuming a session */ + unsigned int resumption_requested:1; /* non-zero if resumption was requested by client */ security_parameters_st resumed_security_parameters; /* These buffers are used in the handshake diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c index 712ba1dadb..4f20465ebe 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -1,6 +1,5 @@ /* - * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 - * Free Software Foundation, Inc. + * Copyright (C) 2002-2012 Free Software Foundation, Inc. * * Author: Nikos Mavrogiannopoulos * @@ -1112,6 +1111,28 @@ gnutls_session_is_resumed (gnutls_session_t session) return 0; } +/** + * gnutls_session_resumption_requested: + * @session: is a #gnutls_session_t structure. + * + * Check whether the client has asked for session resumption. + * This function is valid only on server side. + * + * Returns: non zero if session resumption was asked, or a zero if not. + **/ +int +gnutls_session_resumption_requested(gnutls_session_t session) +{ + if (session->security_parameters.entity == GNUTLS_CLIENT) + { + return 0; + } + else + { + return session->internals.resumption_requested; + } +} + /*- * _gnutls_session_is_export - Used to check whether this session is of export grade * @session: is a #gnutls_session_t structure. diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in index 424deaecc8..296ca4adb9 100644 --- a/lib/includes/gnutls/gnutls.h.in +++ b/lib/includes/gnutls/gnutls.h.in @@ -1,5 +1,5 @@ /* -*- c -*- - * Copyright (C) 2000-2011 Free Software Foundation, Inc. + * Copyright (C) 2000-2012 Free Software Foundation, Inc. * * Author: Nikos Mavrogiannopoulos * @@ -959,6 +959,7 @@ gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t session); /* checks if this session is a resumed one */ int gnutls_session_is_resumed (gnutls_session_t session); + int gnutls_session_resumption_requested (gnutls_session_t session); typedef int (*gnutls_db_store_func) (void *, gnutls_datum_t key, gnutls_datum_t data); diff --git a/lib/libgnutls.map b/lib/libgnutls.map index d570cb1cb5..54179506bf 100644 --- a/lib/libgnutls.map +++ b/lib/libgnutls.map @@ -729,6 +729,7 @@ GNUTLS_3_0_0 { gnutls_random_art; gnutls_pubkey_encrypt_data; gnutls_x509_dn_oid_name; + gnutls_session_resumption_requested; } GNUTLS_2_12; GNUTLS_PRIVATE {