From e9fd9de3f0bca346fb21ca7b581389e6c681a587 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Fri, 19 Apr 2002 17:53:53 +0000 Subject: [PATCH] gnutls_session_resumed() was renamed to gnutls_session_is_resumed(), and changed semantics, to make the return value be the obvious one. --- NEWS | 2 ++ doc/TODO | 6 +++--- doc/tex/ex4.tex | 2 +- lib/gnutls.h.in.in | 2 +- lib/gnutls_state.c | 14 +++++++------- src/cli.c | 2 +- src/serv.c | 2 +- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index 253977b3d..32b166fba 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ Version ?.?.? documentation. - Added gnutls_handshake_set_rsa_pms() function, which disables the version check in RSA premaster secret. +- Added gnutls_session_is_resumed() function, which reports if a session + is a resumpted one. Version 0.4.1 (7/04/2002) - Now uses alloca() for temporary variables diff --git a/doc/TODO b/doc/TODO index 08f326830..9d796bb1e 100644 --- a/doc/TODO +++ b/doc/TODO @@ -3,11 +3,11 @@ anything), contact the developer's mailing list (gnutls-dev@lists.gnupg.org), in order to avoid having people working on the same thing. Current list: -+ Audit the code -* Add function(s) to get the DHE/A parameters -* Add function(s) to extract the certificate key's parameters +* Audit the code * Optimize functions which now return malloc'd data * Minimize footprint. +* Add function(s) to get the DHE/A parameters +* Add function(s) to extract the certificate key's parameters - Add Kerberos support (+) Means high priority diff --git a/doc/tex/ex4.tex b/doc/tex/ex4.tex index b61cb0ff7..fc20cb118 100644 --- a/doc/tex/ex4.tex +++ b/doc/tex/ex4.tex @@ -99,7 +99,7 @@ int main() } else { /* the second time we connect */ /* check if we actually resumed the previous session */ - if (gnutls_session_resumed( state) == 0) { + if (gnutls_session_is_resumed( state) != 0) { printf("- Previous session was resumed\n"); } else { fprintf(stderr, "*** Previous session was NOT resumed\n"); diff --git a/lib/gnutls.h.in.in b/lib/gnutls.h.in.in index 282afec7f..52363381e 100644 --- a/lib/gnutls.h.in.in +++ b/lib/gnutls.h.in.in @@ -169,7 +169,7 @@ int gnutls_session_get_id( GNUTLS_STATE state, void* session, int *session_size) /* checks if this session is a resumed one */ -int gnutls_session_resumed(GNUTLS_STATE state); +int gnutls_session_is_resumed(GNUTLS_STATE state); typedef int (*GNUTLS_DB_STORE_FUNC)(void*, gnutls_datum key, gnutls_datum data); typedef int (*GNUTLS_DB_REMOVE_FUNC)(void*, gnutls_datum key); diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c index b71a637f7..498f39a5d 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -598,24 +598,24 @@ int _gnutls_PRF( opaque * secret, int secret_size, uint8 * label, int label_size } /** - * gnutls_session_resumed - Used to check whether this session is a resumed one + * gnutls_session_is_resumed - Used to check whether this session is a resumed one * @state: is a &GNUTLS_STATE structure. * - * This function will return 0 if this session is a resumed one, - * or a negative number if this is a new session. + * This function will return non zero if this session is a resumed one, + * or a zero if this is a new session. * **/ -int gnutls_session_resumed(GNUTLS_STATE state) +int gnutls_session_is_resumed(GNUTLS_STATE state) { if (state->security_parameters.entity==GNUTLS_CLIENT) { if (memcmp( state->security_parameters.session_id, state->gnutls_internals.resumed_security_parameters.session_id, state->security_parameters.session_id_size)==0) - return 0; + return 1; } else { if (state->gnutls_internals.resumed==RESUME_TRUE) - return 0; + return 1; } - return GNUTLS_E_UNKNOWN_ERROR; + return 0; } diff --git a/src/cli.c b/src/cli.c index 325a7c303..1098e3101 100644 --- a/src/cli.c +++ b/src/cli.c @@ -306,7 +306,7 @@ int main(int argc, char **argv) return 1; } else { printf("- Handshake was completed\n"); - if (gnutls_session_resumed( state)==0) + if (gnutls_session_is_resumed( state)!=0) printf("*** This is a resumed session\n"); } diff --git a/src/serv.c b/src/serv.c index a2fb799bd..0727c0152 100644 --- a/src/serv.c +++ b/src/serv.c @@ -451,7 +451,7 @@ int main(int argc, char **argv) continue; } printf("- Handshake was completed\n"); - if ( gnutls_session_resumed( state)==0) + if ( gnutls_session_is_resumed( state)!=0) printf("*** This is a resumed session\n"); print_info(state); -- 2.11.4.GIT