Skip to content

Commit

Permalink
tls: Set session only once before Client Hello
Browse files Browse the repository at this point in the history
If the server rejects the session reusage then
the client should not re-set the session multiple
times in function tls_connect() => During the
TLS handshaking / After the new session ticket

Otherwise the first connection attempt in the
rejection-case will fail. Only the second attempt
succeeds.
  • Loading branch information
Johannes Natter authored and cspiel1 committed Dec 6, 2022
1 parent 7333977 commit f01207b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tls/openssl/tls_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ static int tls_connect(struct tls_conn *tc)

ERR_clear_error();

if (tls_get_session_reuse(tc))
(void) tls_reuse_session(tc);

r = SSL_connect(tc->ssl);
if (r <= 0) {
const int ssl_err = SSL_get_error(tc->ssl, r);
Expand Down Expand Up @@ -207,6 +204,9 @@ static bool estab_handler(int *err, bool active, void *arg)
return true;

tc->active = true;
if (tls_get_session_reuse(tc))
(void) tls_reuse_session(tc);

*err = tls_connect(tc);

return true;
Expand Down

0 comments on commit f01207b

Please sign in to comment.