]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
simplified usage of resume_true and resume_false.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 30 Sep 2011 13:50:55 +0000 (15:50 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 30 Sep 2011 13:50:55 +0000 (15:50 +0200)
lib/gnutls_handshake.c
lib/gnutls_int.h
lib/gnutls_state.c

index 5a4b4624c8412f2daa44aa82d9fd493295ac7660..8363bf140ef6d031f9ce0734841a096cbc0f1ce9 100644 (file)
@@ -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))
index d47ce5935d9e2898bc719079891e21d0e64810d6..8e15f4cc1212606b101a160c4f07d8d719c4a320 100644 (file)
@@ -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
index 8eda274e90c2195b2c08aeef836d8b1cf0a8ec5e..3c12508cc5e7cd012a9b1148a08f41bf6688f4bb 100644 (file)
@@ -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;
     }