diff options
author | Daiki Ueno <ueno@gnu.org> | 2021-02-04 08:30:30 +0100 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2021-02-04 09:24:28 +0100 |
commit | 4cea6b2fe9566238949157d821bd31f0e1fd2816 (patch) | |
tree | 9c7f78f1cd5730f22c2131d613e37ab368d49582 | |
parent | 0295456d9e3149d4b55f013cd681df8b93093d09 (diff) | |
download | gnutls-4cea6b2fe9566238949157d821bd31f0e1fd2816.tar.gz |
handshake: replace RESUME_TRUE and RESUME_FALSE with <stdbool.h>
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>
-rw-r--r-- | lib/constate.c | 4 | ||||
-rw-r--r-- | lib/db.c | 2 | ||||
-rw-r--r-- | lib/dtls.h | 4 | ||||
-rw-r--r-- | lib/ext/pre_shared_key.c | 4 | ||||
-rw-r--r-- | lib/ext/session_ticket.c | 4 | ||||
-rw-r--r-- | lib/gnutls_int.h | 9 | ||||
-rw-r--r-- | lib/handshake-tls13.c | 6 | ||||
-rw-r--r-- | lib/handshake.c | 70 | ||||
-rw-r--r-- | lib/kx.c | 2 | ||||
-rw-r--r-- | lib/record.c | 2 | ||||
-rw-r--r-- | lib/session.c | 2 | ||||
-rw-r--r-- | lib/sslv2_compat.c | 4 | ||||
-rw-r--r-- | lib/state.c | 8 | ||||
-rw-r--r-- | lib/tls13/session_ticket.c | 2 |
14 files changed, 60 insertions, 63 deletions
diff --git a/lib/constate.c b/lib/constate.c index 3717522d38..fc56a7569a 100644 --- a/lib/constate.c +++ b/lib/constate.c @@ -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); @@ -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; } diff --git a/lib/dtls.h b/lib/dtls.h index 88fba4f3d1..7d9fb40094 100644 --- a/lib/dtls.h +++ b/lib/dtls.h @@ -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; diff --git a/lib/ext/pre_shared_key.c b/lib/ext/pre_shared_key.c index b5a86b7db1..a042c6488e 100644 --- a/lib/ext/pre_shared_key.c +++ b/lib/ext/pre_shared_key.c @@ -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); diff --git a/lib/ext/session_ticket.c b/lib/ext/session_ticket.c index 8f22462fae..5877f8fa12 100644 --- a/lib/ext/session_ticket.c +++ b/lib/ext/session_ticket.c @@ -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. diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index b9134dcbdd..5eb47b4bdf 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -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 */ diff --git a/lib/handshake-tls13.c b/lib/handshake-tls13.c index ea236c803c..7dd42becf1 100644 --- a/lib/handshake-tls13.c +++ b/lib/handshake-tls13.c @@ -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) { diff --git a/lib/handshake.c b/lib/handshake.c index 52bb20bfe2..0f305cd75e 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -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); @@ -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) { diff --git a/lib/record.c b/lib/record.c index 8b0d2bc60e..cd9df80520 100644 --- a/lib/record.c +++ b/lib/record.c @@ -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 diff --git a/lib/session.c b/lib/session.c index b9a23e8d02..bdaf572b0e 100644 --- a/lib/session.c +++ b/lib/session.c @@ -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); diff --git a/lib/sslv2_compat.c b/lib/sslv2_compat.c index 4dd62d01c1..c4a0143b92 100644 --- a/lib/sslv2_compat.c +++ b/lib/sslv2_compat.c @@ -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; diff --git a/lib/state.c b/lib/state.c index fcf6183fa4..1d53e9b99b 100644 --- a/lib/state.c +++ b/lib/state.c @@ -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; } diff --git a/lib/tls13/session_ticket.c b/lib/tls13/session_ticket.c index 072a56d9c1..3f64d8c32e 100644 --- a/lib/tls13/session_ticket.c +++ b/lib/tls13/session_ticket.c @@ -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) |