From: Nikos Mavrogiannopoulos Date: Fri, 30 Sep 2011 13:50:55 +0000 (+0200) Subject: simplified usage of resume_true and resume_false. X-Git-Tag: gnutls_3_0_4~52 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=228048a83e260e708f7bccaff2eaa637df8a164e;p=thirdparty%2Fgnutls.git simplified usage of resume_true and resume_false. --- diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index 5a4b4624c8..8363bf140e 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -552,7 +552,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, } /* resumed by session_ticket extension */ - if (session->internals.resumed == RESUME_TRUE) + if (session->internals.resumed != RESUME_FALSE) { /* to indicate the client that the current session is resumed */ memcpy (session->internals.resumed_security_parameters.session_id, @@ -643,7 +643,7 @@ _gnutls_send_finished (gnutls_session_t session, int again) if ((session->internals.resumed == RESUME_FALSE && session->security_parameters.entity == GNUTLS_CLIENT) - || (session->internals.resumed == RESUME_TRUE + || (session->internals.resumed != RESUME_FALSE && session->security_parameters.entity == GNUTLS_SERVER)) { /* if we are a client not resuming - or we are a server resuming */ @@ -740,7 +740,7 @@ _gnutls_recv_finished (gnutls_session_t session) goto cleanup; } - if ((session->internals.resumed == RESUME_TRUE + if ((session->internals.resumed != RESUME_FALSE && session->security_parameters.entity == GNUTLS_CLIENT) || (session->internals.resumed == RESUME_FALSE && session->security_parameters.entity == GNUTLS_SERVER)) @@ -2778,7 +2778,7 @@ _gnutls_handshake_common (gnutls_session_t session) int ret = 0; /* send and recv the change cipher spec and finished messages */ - if ((session->internals.resumed == RESUME_TRUE + if ((session->internals.resumed != RESUME_FALSE && session->security_parameters.entity == GNUTLS_CLIENT) || (session->internals.resumed == RESUME_FALSE && session->security_parameters.entity == GNUTLS_SERVER)) diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index d47ce5935d..8e15f4cc12 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -233,8 +233,8 @@ typedef enum extensions_t typedef enum { CIPHER_STREAM, CIPHER_BLOCK } cipher_type_t; -#define RESUME_TRUE 0 -#define RESUME_FALSE -1 +#define RESUME_TRUE 1 +#define RESUME_FALSE 0 /* Record Protocol */ typedef enum content_type_t @@ -641,7 +641,7 @@ typedef struct * the last received message */ gnutls_buffer_st handshake_hash_buffer; /* used to keep the last received handshake * message */ - int resumable:1; /* TRUE or FALSE - if we can resume that session */ + unsigned int resumable:1; /* TRUE or FALSE - if we can resume that session */ handshake_state_t handshake_state; /* holds * a number which indicates where * the handshake procedure has been @@ -667,7 +667,7 @@ typedef struct struct gnutls_priority_st priorities; /* resumed session */ - 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 */ 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 8eda274e90..3c12508cc5 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -1105,7 +1105,7 @@ gnutls_session_is_resumed (gnutls_session_t session) } else { - if (session->internals.resumed == RESUME_TRUE) + if (session->internals.resumed != RESUME_FALSE) return 1; }