]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps/s_time: reset reused SSL with SSL_clear in doConnection
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Mon, 13 Oct 2025 23:59:04 +0000 (07:59 +0800)
committerTodd Short <todd.short@me.com>
Mon, 27 Oct 2025 13:59:35 +0000 (09:59 -0400)
Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/28911)

(cherry picked from commit 6f6948b21503d0ef8bea3ea6321c40dbbf4e5c9c)
(cherry picked from commit 79e0c5a13e4c6421eeddfcc4bd01a3b06f4c6394)
(cherry picked from commit 81dcb0ef916a2aeeb15dbc0002ce49d143c709ce)

apps/s_time.c

index 598e1069ed05e7d8a6c432ab2ac7671833a5af6b..19d68ad2a8999ce5fe07c665c637a15876f69eb6 100644 (file)
@@ -435,6 +435,16 @@ static SSL *doConnection(SSL *scon, const char *host, SSL_CTX *ctx)
         }
     } else {
         serverCon = scon;
+        /*
+         * Reset the SSL object before reusing it for a new connection.
+         * This clears prior handshake and I/O state while keeping
+         * configuration inherited from the SSL_CTX.
+         */
+        if (!SSL_clear(serverCon)) {
+            ERR_print_errors(bio_err);
+            BIO_free(conn);
+            return NULL;
+        }
         SSL_set_connect_state(serverCon);
     }