]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
handshake: replace RESUME_TRUE and RESUME_FALSE with <stdbool.h>
authorDaiki Ueno <ueno@gnu.org>
Thu, 4 Feb 2021 07:30:30 +0000 (08:30 +0100)
committerDaiki Ueno <ueno@gnu.org>
Thu, 4 Feb 2021 08:24:28 +0000 (09:24 +0100)
Having those constants could cause wrong impression that there is a
third possible value.

To reproduce the changes other than lib/gnutls_int.h:

  for i in `git ls-files lib`; do
      sed -i
         -e 's/\(session->internals.\(resumed\|resumable\)\) *\(== *RESUME_FALSE\|!= *RESUME_TRUE\)/!\1/' \
  -e 's/\(session->internals.\(resumed\|resumable\)\) *\(== *RESUME_TRUE\|!= *RESUME_FALSE\)/\1/' \
  -e 's/RESUME_TRUE/true/' \
  -e 's/RESUME_FALSE/false/' \
      $i
  done

Signed-off-by: Daiki Ueno <ueno@gnu.org>
14 files changed:
lib/constate.c
lib/db.c
lib/dtls.h
lib/ext/pre_shared_key.c
lib/ext/session_ticket.c
lib/gnutls_int.h
lib/handshake-tls13.c
lib/handshake.c
lib/kx.c
lib/record.c
lib/session.c
lib/sslv2_compat.c
lib/state.c
lib/tls13/session_ticket.c

index 3717522d3808f4e22f2a0fc744f31abee59f363f..fc56a7569aac11e63ff805898f2b784d66e4eda2 100644 (file)
@@ -814,7 +814,7 @@ int _gnutls_read_connection_state_init(gnutls_session_t session)
        /* Update internals from CipherSuite selected.
         * If we are resuming just copy the connection session
         */
-       if (session->internals.resumed != RESUME_FALSE &&
+       if (session->internals.resumed &&
            session->security_parameters.entity == GNUTLS_CLIENT)
                _gnutls_set_resumed_parameters(session);
 
@@ -850,7 +850,7 @@ int _gnutls_write_connection_state_init(gnutls_session_t session)
 /* Update internals from CipherSuite selected.
  * If we are resuming just copy the connection session
  */
-       if (session->internals.resumed != RESUME_FALSE &&
+       if (session->internals.resumed &&
            session->security_parameters.entity == GNUTLS_SERVER)
                _gnutls_set_resumed_parameters(session);
 
index fc0699a4bdbdb19c23f61d0ee90194bea12dee67..4ff76126cd4f6109312e17d8616625038662fd49 100644 (file)
--- a/lib/db.c
+++ b/lib/db.c
@@ -272,7 +272,7 @@ int _gnutls_server_register_current_session(gnutls_session_t session)
        key.data = session->security_parameters.session_id;
        key.size = session->security_parameters.session_id_size;
 
-       if (session->internals.resumable == RESUME_FALSE) {
+       if (!session->internals.resumable) {
                gnutls_assert();
                return GNUTLS_E_INVALID_SESSION;
        }
index 88fba4f3d161b2dddb07421231d7e2e93ec6b0ac..7d9fb40094108d8b86993344eadd4821a59ba097 100644 (file)
@@ -68,9 +68,9 @@ int _dtls_wait_and_retransmit(gnutls_session_t session);
 inline static int _dtls_is_async(gnutls_session_t session)
 {
        if ((session->security_parameters.entity == GNUTLS_SERVER
-            && session->internals.resumed == RESUME_FALSE)
+            && !session->internals.resumed)
            || (session->security_parameters.entity == GNUTLS_CLIENT
-               && session->internals.resumed == RESUME_TRUE))
+               && session->internals.resumed))
                return 1;
        else
                return 0;
index b5a86b7db1f4f0a164972865d87e3506172eb758..a042c6488e6c8fd3c8fd973cca045fed7688914a 100644 (file)
@@ -696,7 +696,7 @@ static int server_recv_params(gnutls_session_t session,
                        }
                }
 
-               session->internals.resumed = RESUME_TRUE;
+               session->internals.resumed = true;
                _gnutls_handshake_log("EXT[%p]: selected resumption PSK identity (%d)\n", session, psk_index);
        }
 
@@ -819,7 +819,7 @@ static int _gnutls_psk_recv_params(gnutls_session_t session,
                        for (i=0;i<sizeof(session->key.binders)/sizeof(session->key.binders[0]);i++) {
                                if (session->key.binders[i].prf != NULL && session->key.binders[i].idx == selected_identity) {
                                        if (session->key.binders[i].resumption) {
-                                               session->internals.resumed = RESUME_TRUE;
+                                               session->internals.resumed = true;
                                                _gnutls_handshake_log("EXT[%p]: selected PSK-resumption mode\n", session);
                                        } else {
                                                _gnutls_handshake_log("EXT[%p]: selected PSK mode\n", session);
index 8f22462faeed8bb6c11792ac68f84e0dc7b99fc9..5877f8fa124d664b5a84e313eac9d18d5a1ef51e 100644 (file)
@@ -370,7 +370,7 @@ unpack_session(gnutls_session_t session, const gnutls_datum_t *state)
        if (ret < 0)
                return gnutls_assert_val(ret);
 
-       session->internals.resumed = RESUME_TRUE;
+       session->internals.resumed = true;
        return 0;
 }
 
@@ -656,7 +656,7 @@ int _gnutls_send_new_session_ticket(gnutls_session_t session, int again)
                /* Under TLS1.2 with session tickets, the session ID is used for different
                 * purposes than the TLS1.0 session ID. Ensure that there is an internally
                 * set value which the server will see on the original and resumed sessions */
-               if (session->internals.resumed != RESUME_TRUE) {
+               if (!session->internals.resumed) {
                        ret = _gnutls_generate_session_id(session->security_parameters.
                                                          session_id,
                                                          &session->security_parameters.
index b9134dcbdd0923677724a161d4718e6c381aa150..5eb47b4bdffe3b29fd1b73c9eb8f244e9d1812b5 100644 (file)
@@ -361,9 +361,6 @@ verify(GNUTLS_EXTENSION_MAX_VALUE - GNUTLS_EXTENSION_MAX >= 16);
 
 typedef enum { CIPHER_STREAM, CIPHER_BLOCK, CIPHER_AEAD } cipher_type_t;
 
-#define RESUME_TRUE 1
-#define RESUME_FALSE 0
-
 /* Record Protocol */
 typedef enum content_type_t {
        GNUTLS_CHANGE_CIPHER_SPEC = 20, GNUTLS_ALERT,
@@ -1086,7 +1083,7 @@ typedef struct {
        gnutls_buffer_st handshake_hash_buffer; /* used to keep the last received handshake
                                                 * message */
 
-       bool resumable; /* TRUE or FALSE - if we can resume that session */
+       bool resumable; /* if we can resume that session */
 
        send_ticket_state_t ticket_state; /* used by gnutls_session_ticket_send() */
        bye_state_t bye_state; /* used by gnutls_bye() */
@@ -1100,7 +1097,7 @@ typedef struct {
                                                 * no interruption has happened.
                                                 */
 
-       bool invalid_connection;        /* true or FALSE - if this session is valid */
+       bool invalid_connection;        /* if this session is valid */
 
        bool may_not_read;      /* if it's 0 then we can read/write, otherwise it's forbidden to read/write
                                 */
@@ -1135,7 +1132,7 @@ typedef struct {
        uint16_t dh_prime_bits; /* srp_prime_bits */
 
        /* resumed session */
-       bool resumed;   /* RESUME_TRUE or FALSE - if we are resuming a session */
+       bool resumed;   /* if we are resuming a session */
 
        /* server side: non-zero if resumption was requested by client
         * client side: non-zero if we set resumption parameters */
index ea236c803c7d8a3bd8a14077be767163dcad8020..7dd42becf1e3d432191ebbb355a65b22fc7a6696 100644 (file)
@@ -210,7 +210,7 @@ int _gnutls13_handshake_client(gnutls_session_t session)
 
        SAVE_TRANSCRIPT;
 
-       if (session->internals.resumed != RESUME_FALSE)
+       if (session->internals.resumed)
                _gnutls_set_resumed_parameters(session);
 
        return 0;
@@ -325,7 +325,7 @@ static int generate_hs_traffic_keys(gnutls_session_t session)
        if ((session->security_parameters.entity == GNUTLS_CLIENT &&
              (!(session->internals.hsk_flags & HSK_KEY_SHARE_RECEIVED) ||
                (!(session->internals.hsk_flags & HSK_PSK_KE_MODE_DHE_PSK) &&
-                  session->internals.resumed != RESUME_FALSE))) ||
+                  session->internals.resumed))) ||
            (session->security_parameters.entity == GNUTLS_SERVER &&
              !(session->internals.hsk_flags & HSK_KEY_SHARE_SENT))) {
 
@@ -506,7 +506,7 @@ int _gnutls13_handshake_server(gnutls_session_t session)
 
                FALLTHROUGH;
        case STATE109:
-               if (session->internals.resumed != RESUME_FALSE)
+               if (session->internals.resumed)
                        _gnutls_set_resumed_parameters(session);
 
                if (session->internals.hsk_flags & HSK_EARLY_START_USED) {
index 52bb20bfe220e87df3e4c5a8ec0aeb5b642e0364..0f305cd75ef54f1dee3a353b159ee96a014a4d49 100644 (file)
@@ -532,7 +532,7 @@ _gnutls_user_hello_func(gnutls_session_t session,
                 * server, and that includes switching version which we have already
                 * negotiated; note that this doesn't apply when resuming as the version
                 * negotiation is already complete. */
-               if (session->internals.resumed != RESUME_TRUE) {
+               if (!session->internals.resumed) {
                        new_max = _gnutls_version_max(session);
                        old_vers = get_version(session);
 
@@ -580,7 +580,7 @@ static int set_auth_types(gnutls_session_t session)
                /* Under TLS1.3 this returns a KX which matches the negotiated
                 * groups from the key shares; if we are resuming then the KX seen
                 * here doesn't match the original session. */
-               if (session->internals.resumed == RESUME_FALSE)
+               if (!session->internals.resumed)
                        kx = gnutls_kx_get(session);
                else
                        kx = GNUTLS_KX_UNKNOWN;
@@ -592,7 +592,7 @@ static int set_auth_types(gnutls_session_t session)
        if (kx != GNUTLS_KX_UNKNOWN) {
                session->security_parameters.server_auth_type = _gnutls_map_kx_get_cred(kx, 1);
                session->security_parameters.client_auth_type = _gnutls_map_kx_get_cred(kx, 0);
-       } else if (unlikely(session->internals.resumed == RESUME_FALSE)) {
+       } else if (unlikely(!session->internals.resumed)) {
                /* Here we can only arrive if something we received
                 * prevented the session from completing. */
                return gnutls_assert_val(GNUTLS_E_ILLEGAL_PARAMETER);
@@ -740,7 +740,7 @@ read_client_hello(gnutls_session_t session, uint8_t * data,
                        if (ret < 0)
                                return gnutls_assert_val(ret);
 
-                       session->internals.resumed = RESUME_TRUE;
+                       session->internals.resumed = true;
 
                        return _gnutls_user_hello_func(session, major, minor);
                } else {
@@ -751,7 +751,7 @@ read_client_hello(gnutls_session_t session, uint8_t * data,
                        if (ret < 0)
                                return gnutls_assert_val(ret);
 
-                       session->internals.resumed = RESUME_FALSE;
+                       session->internals.resumed = false;
                }
        } else { /* TLS1.3 */
                /* we echo client's session ID - length was checked previously */
@@ -792,7 +792,7 @@ read_client_hello(gnutls_session_t session, uint8_t * data,
        }
 
        /* resumed by session_ticket extension */
-       if (!vers->tls13_sem && session->internals.resumed != RESUME_FALSE) {
+       if (!vers->tls13_sem && session->internals.resumed) {
                session->internals.resumed_security_parameters.
                    max_record_recv_size =
                    session->security_parameters.max_record_recv_size;
@@ -930,10 +930,10 @@ int _gnutls_send_finished(gnutls_session_t session, int again)
                        return ret;
                }
 
-               if ((session->internals.resumed == RESUME_FALSE
+               if ((!session->internals.resumed
                     && session->security_parameters.entity ==
                     GNUTLS_CLIENT)
-                   || (session->internals.resumed != RESUME_FALSE
+                   || (session->internals.resumed
                        && session->security_parameters.entity ==
                        GNUTLS_SERVER)) {
                        /* if we are a client not resuming - or we are a server resuming */
@@ -1034,9 +1034,9 @@ int _gnutls_recv_finished(gnutls_session_t session)
                goto cleanup;
        }
 
-       if ((session->internals.resumed != RESUME_FALSE
+       if ((session->internals.resumed
             && session->security_parameters.entity == GNUTLS_CLIENT)
-           || (session->internals.resumed == RESUME_FALSE
+           || (!session->internals.resumed
                && session->security_parameters.entity == GNUTLS_SERVER)) {
                /* if we are a client resuming - or we are a server not resuming */
                _gnutls_handshake_log
@@ -1845,13 +1845,13 @@ client_check_if_resuming(gnutls_session_t session,
                        goto no_resume;
                }
 
-               session->internals.resumed = RESUME_TRUE;       /* we are resuming */
+               session->internals.resumed = true;      /* we are resuming */
 
                return 0;
        } else {
 no_resume:
                /* keep the new session id */
-               session->internals.resumed = RESUME_FALSE;      /* we are not resuming */
+               session->internals.resumed = false;     /* we are not resuming */
                return -1;
        }
 }
@@ -2393,7 +2393,7 @@ int _gnutls_send_server_hello(gnutls_session_t session, int again)
                        goto fail;
                }
 
-               if (!vers->tls13_sem && session->internals.resumed != RESUME_FALSE)
+               if (!vers->tls13_sem && session->internals.resumed)
                        etype = GNUTLS_EXT_MANDATORY;
                else
                        etype = GNUTLS_EXT_ANY;
@@ -3002,7 +3002,7 @@ static int handshake_client(gnutls_session_t session)
                FALLTHROUGH;
        case STATE6:
                /* RECV CERTIFICATE */
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret = _gnutls_recv_server_certificate(session);
                STATE = STATE6;
                IMED_RET("recv server certificate", ret, 1);
@@ -3010,7 +3010,7 @@ static int handshake_client(gnutls_session_t session)
        case STATE7:
 #ifdef ENABLE_OCSP
                /* RECV CERTIFICATE STATUS */
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret =
                            _gnutls_recv_server_certificate_status
                            (session);
@@ -3027,7 +3027,7 @@ static int handshake_client(gnutls_session_t session)
                FALLTHROUGH;
        case STATE9:
                /* receive the server key exchange */
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret = _gnutls_recv_server_kx_message(session);
                STATE = STATE9;
                IMED_RET("recv server kx message", ret, 1);
@@ -3036,7 +3036,7 @@ static int handshake_client(gnutls_session_t session)
                /* receive the server certificate request - if any
                 */
 
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret = _gnutls_recv_server_crt_request(session);
                STATE = STATE10;
                IMED_RET("recv server certificate request message", ret,
@@ -3044,7 +3044,7 @@ static int handshake_client(gnutls_session_t session)
                FALLTHROUGH;
        case STATE11:
                /* receive the server hello done */
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret =
                            _gnutls_recv_handshake(session,
                                                   GNUTLS_HANDSHAKE_SERVER_HELLO_DONE,
@@ -3064,7 +3064,7 @@ static int handshake_client(gnutls_session_t session)
        case STATE13:
                /* send our certificate - if any and if requested
                 */
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret =
                            _gnutls_send_client_certificate(session,
                                                            AGAIN
@@ -3073,7 +3073,7 @@ static int handshake_client(gnutls_session_t session)
                IMED_RET("send client certificate", ret, 0);
                FALLTHROUGH;
        case STATE14:
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret =
                            _gnutls_send_client_kx_message(session,
                                                           AGAIN(STATE14));
@@ -3082,7 +3082,7 @@ static int handshake_client(gnutls_session_t session)
                FALLTHROUGH;
        case STATE15:
                /* send client certificate verify */
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret =
                            _gnutls_send_client_certificate_verify(session,
                                                                   AGAIN
@@ -3092,7 +3092,7 @@ static int handshake_client(gnutls_session_t session)
                FALLTHROUGH;
        case STATE16:
                STATE = STATE16;
-               if (session->internals.resumed == RESUME_FALSE) {
+               if (!session->internals.resumed) {
                        ret = send_handshake_final(session, TRUE);
                        IMED_RET("send handshake final 2", ret, 1);
                } else {
@@ -3103,7 +3103,7 @@ static int handshake_client(gnutls_session_t session)
                FALLTHROUGH;
        case STATE17:
                STATE = STATE17;
-               if (session->internals.resumed == RESUME_FALSE && (session->internals.flags & GNUTLS_ENABLE_FALSE_START) && can_send_false_start(session)) {
+               if (!session->internals.resumed && (session->internals.flags & GNUTLS_ENABLE_FALSE_START) && can_send_false_start(session)) {
                        session->internals.hsk_flags |= HSK_FALSE_START_USED;
                        session->internals.recv_state = RECV_STATE_FALSE_START;
                        /* complete this phase of the handshake. We
@@ -3118,7 +3118,7 @@ static int handshake_client(gnutls_session_t session)
        case STATE18:
                STATE = STATE18;
 
-               if (session->internals.resumed == RESUME_FALSE) {
+               if (!session->internals.resumed) {
                        ret = _gnutls_recv_new_session_ticket(session);
                        IMED_RET("recv handshake new session ticket", ret,
                                 1);
@@ -3129,7 +3129,7 @@ static int handshake_client(gnutls_session_t session)
                FALLTHROUGH;
        case STATE19:
                STATE = STATE19;
-               if (session->internals.resumed == RESUME_FALSE) {
+               if (!session->internals.resumed) {
                        ret = recv_handshake_final(session, FALSE);
                        IMED_RET("recv handshake final 2", ret, 1);
                } else {
@@ -3438,7 +3438,7 @@ static int handshake_server(gnutls_session_t session)
        case STATE5:
                /* NOTE: these should not be send if we are resuming */
 
-               if (session->internals.resumed == RESUME_FALSE)
+               if (!session->internals.resumed)
                        ret =
                            _gnutls_send_server_certificate(session,
                                                            AGAIN(STATE5));
@@ -3447,7 +3447,7 @@ static int handshake_server(gnutls_session_t session)
                FALLTHROUGH;
        case STATE6:
 #ifdef ENABLE_OCSP
-               if (session->internals.resumed == RESUME_FALSE)
+               if (!session->internals.resumed)
                        ret =
                            _gnutls_send_server_certificate_status(session,
                                                                   AGAIN
@@ -3458,7 +3458,7 @@ static int handshake_server(gnutls_session_t session)
                FALLTHROUGH;
        case STATE7:
                /* send server key exchange (A) */
-               if (session->internals.resumed == RESUME_FALSE)
+               if (!session->internals.resumed)
                        ret =
                            _gnutls_send_server_kx_message(session,
                                                           AGAIN(STATE7));
@@ -3467,7 +3467,7 @@ static int handshake_server(gnutls_session_t session)
                FALLTHROUGH;
        case STATE8:
                /* Send certificate request - if requested to */
-               if (session->internals.resumed == RESUME_FALSE)
+               if (!session->internals.resumed)
                        ret =
                            _gnutls_send_server_crt_request(session,
                                                            AGAIN(STATE8));
@@ -3476,7 +3476,7 @@ static int handshake_server(gnutls_session_t session)
                FALLTHROUGH;
        case STATE9:
                /* send the server hello done */
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret =
                            _gnutls_send_empty_handshake(session,
                                                         GNUTLS_HANDSHAKE_SERVER_HELLO_DONE,
@@ -3494,7 +3494,7 @@ static int handshake_server(gnutls_session_t session)
                FALLTHROUGH;
        case STATE11:
                /* receive the client certificate message */
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret = _gnutls_recv_client_certificate(session);
                STATE = STATE11;
                IMED_RET("recv client certificate", ret, 1);
@@ -3507,14 +3507,14 @@ static int handshake_server(gnutls_session_t session)
                FALLTHROUGH;
        case STATE13:
                /* receive the client key exchange message */
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret = _gnutls_recv_client_kx_message(session);
                STATE = STATE13;
                IMED_RET("recv client kx", ret, 1);
                FALLTHROUGH;
        case STATE14:
                /* receive the client certificate verify message */
-               if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
+               if (!session->internals.resumed)        /* if we are not resuming */
                        ret =
                            _gnutls_recv_client_certificate_verify_message
                            (session);
@@ -3523,7 +3523,7 @@ static int handshake_server(gnutls_session_t session)
                FALLTHROUGH;
        case STATE15:
                STATE = STATE15;
-               if (session->internals.resumed == RESUME_FALSE) {       /* if we are not resuming */
+               if (!session->internals.resumed) {      /* if we are not resuming */
                        ret = recv_handshake_final(session, TRUE);
                        IMED_RET("recv handshake final", ret, 1);
                } else {
@@ -3540,7 +3540,7 @@ static int handshake_server(gnutls_session_t session)
                FALLTHROUGH;
        case STATE17:
                STATE = STATE17;
-               if (session->internals.resumed == RESUME_FALSE) {       /* if we are not resuming */
+               if (!session->internals.resumed) {      /* if we are not resuming */
                        ret = send_handshake_final(session, FALSE);
                        IMED_RET("send handshake final", ret, 1);
 
index 1eda14d3d6aec3133ebf30d2b15ea8a184e837a3..9f3c14b6dbcec355398bf6163dd4df7f2da3b0f6 100644 (file)
--- a/lib/kx.c
+++ b/lib/kx.c
@@ -54,7 +54,7 @@ static int generate_normal_master(gnutls_session_t session,
 
 int _gnutls_generate_master(gnutls_session_t session, int keep_premaster)
 {
-       if (session->internals.resumed == RESUME_FALSE)
+       if (!session->internals.resumed)
                return generate_normal_master(session, &session->key.key,
                                              keep_premaster);
        else if (session->internals.premaster_set) {
index 8b0d2bc60eebc171317eb76689214b11ba436ac7..cd9df80520febab64e25af3700360e2018e732e7 100644 (file)
@@ -341,7 +341,7 @@ int gnutls_bye(gnutls_session_t session, gnutls_close_request_t how)
 
 inline static void session_unresumable(gnutls_session_t session)
 {
-       session->internals.resumable = RESUME_FALSE;
+       session->internals.resumable = false;
 }
 
 /* returns 0 if session is valid
index b9a23e8d023fa16c40e3081bd96323a0d99bdea2..bdaf572b0ead6b08eb52c89c88175c3bda7e84cd 100644 (file)
@@ -166,7 +166,7 @@ gnutls_session_get_data2(gnutls_session_t session, gnutls_datum_t *data)
                }
        }
 
-       if (session->internals.resumable == RESUME_FALSE)
+       if (!session->internals.resumable)
                return GNUTLS_E_INVALID_SESSION;
 
        ret = _gnutls_session_pack(session, data);
index 4dd62d01c1eeea7c79b02869d35bc432033f7b4b..c4a0143b92678110a0df14d101e45c4a32cf208d 100644 (file)
@@ -238,7 +238,7 @@ _gnutls_read_client_hello_v2(gnutls_session_t session, uint8_t * data,
                       session->security_parameters.client_random,
                       GNUTLS_RANDOM_SIZE);
 
-               session->internals.resumed = RESUME_TRUE;
+               session->internals.resumed = true;
                return 0;
        } else {
                ret = _gnutls_generate_session_id(
@@ -247,7 +247,7 @@ _gnutls_read_client_hello_v2(gnutls_session_t session, uint8_t * data,
                if (ret < 0)
                        return gnutls_assert_val(ret);
 
-               session->internals.resumed = RESUME_FALSE;
+               session->internals.resumed = false;
        }
 
        return sret;
index fcf6183fa4305c2fdc3130936c447fa3a0b42182..1d53e9b99be13a2ded2f1636d2a4ccaacfa7649d 100644 (file)
@@ -419,7 +419,7 @@ static void handshake_internal_state_clear1(gnutls_session_t session)
        session->internals.last_handshake_in = -1;
        session->internals.last_handshake_out = -1;
 
-       session->internals.resumable = RESUME_TRUE;
+       session->internals.resumable = true;
 
        session->internals.handshake_suspicious_loops = 0;
        session->internals.dtls.hsk_read_seq = 0;
@@ -640,7 +640,7 @@ int gnutls_init(gnutls_session_t * session, unsigned int flags)
        return 0;
 }
 
-/* returns RESUME_FALSE or RESUME_TRUE.
+/* returns false or true.
  */
 int _gnutls_session_is_resumable(gnutls_session_t session)
 {
@@ -989,7 +989,7 @@ int gnutls_session_is_resumed(gnutls_session_t session)
        if (session->security_parameters.entity == GNUTLS_CLIENT) {
                const version_entry_st *ver = get_version(session);
                if (ver && ver->tls13_sem &&
-                   session->internals.resumed != RESUME_FALSE)
+                   session->internals.resumed)
                        return 1;
 
                if (session->security_parameters.session_id_size > 0 &&
@@ -1004,7 +1004,7 @@ int gnutls_session_is_resumed(gnutls_session_t session)
                              session_id_size) == 0)
                        return 1;
        } else {
-               if (session->internals.resumed != RESUME_FALSE)
+               if (session->internals.resumed)
                        return 1;
        }
 
index 072a56d9c142e0d5ca894a0b3ec0f29dbe3f4a49..3f64d8c32e17fb35ddbedb23b7c1865687e1d500 100644 (file)
@@ -201,7 +201,7 @@ generate_session_ticket(gnutls_session_t session, tls13_ticket_st *ticket)
        tls13_ticket_st ticket_data;
 
        gnutls_gettime(&now);
-       if (session->internals.resumed != RESUME_FALSE) {
+       if (session->internals.resumed) {
                /* If we are resuming ensure that we don't extend the lifetime
                 * of the ticket past the original session expiration time */
                if (now.tv_sec >= session->security_parameters.timestamp + session->internals.expire_time)