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)
}
} 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);
}