Skip to content

Commit 2cecdc7

Browse files
committed
ssl: use SSL_get_rbio() to check if SSL is started or not
Use SSL_get_rbio() instead of SSL_get_fd(). SSL_get_fd() internally calls SSL_get_rbio() and it's enough for our purpose. In OpenSSL 3.0, SSL_get_fd() leaves an entry in the OpenSSL error queue if BIO has not been set up yet, and we would have to clean it up.
1 parent cd3971b commit 2cecdc7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/openssl/ossl_ssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,8 +1443,8 @@ ossl_sslctx_flush_sessions(int argc, VALUE *argv, VALUE self)
14431443
static inline int
14441444
ssl_started(SSL *ssl)
14451445
{
1446-
/* the FD is set in ossl_ssl_setup(), called by #connect or #accept */
1447-
return SSL_get_fd(ssl) >= 0;
1446+
/* BIO is created through ossl_ssl_setup(), called by #connect or #accept */
1447+
return SSL_get_rbio(ssl) != NULL;
14481448
}
14491449

14501450
static void

0 commit comments

Comments
 (0)