]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix BIO_get_ktls_send/recv to return 0 or 1 only
authorTomas Mraz <tomas@openssl.org>
Tue, 26 Apr 2022 07:42:01 +0000 (09:42 +0200)
committerTomas Mraz <tomas@openssl.org>
Mon, 16 May 2022 08:45:48 +0000 (10:45 +0200)
Fixes #18176

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/18178)

doc/man3/BIO_ctrl.pod
include/openssl/bio.h.in

index 2cb2d955a98f2d47850ede98630b97b79d92d397..eb312bcd0cdb7bb735465e84c9dad7f973918162 100644 (file)
@@ -82,9 +82,9 @@ return a size_t type and are functions, BIO_pending() and BIO_wpending() are
 macros which call BIO_ctrl().
 
 BIO_get_ktls_send() returns 1 if the BIO is using the Kernel TLS data-path for
-sending. Otherwise, it returns zero. It also returns negative values for failure.
+sending. Otherwise, it returns zero.
 BIO_get_ktls_recv() returns 1 if the BIO is using the Kernel TLS data-path for
-receiving. Otherwise, it returns zero. It also returns negative values for failure.
+receiving. Otherwise, it returns zero.
 
 BIO_get_conn_mode() returns the BIO connection mode. BIO_set_conn_mode() sets
 the BIO connection mode.
@@ -166,8 +166,8 @@ the case of BIO_seek() on a file BIO for a successful operation.
 
 =head1 HISTORY
 
-The BIO_get_ktls_send() and BIO_get_ktls_recv() functions were added in
-OpenSSL 3.0.
+The BIO_get_ktls_send() and BIO_get_ktls_recv() macros were added in
+OpenSSL 3.0. They were modified to never return -1 in OpenSSL 3.0.4.
 
 The BIO_get_conn_mode(), BIO_set_conn_mode() and BIO_set_tfo() functions
 were added in OpenSSL 3.1.
index 4b11c777790e0db22263e83db88734bcf6016836..46697ce3d75319473167943375ab3a28ab39b17a 100644 (file)
@@ -174,9 +174,9 @@ extern "C" {
 
 # ifndef OPENSSL_NO_KTLS
 #  define BIO_get_ktls_send(b)         \
-     BIO_ctrl(b, BIO_CTRL_GET_KTLS_SEND, 0, NULL)
+     (BIO_ctrl(b, BIO_CTRL_GET_KTLS_SEND, 0, NULL) > 0)
 #  define BIO_get_ktls_recv(b)         \
-     BIO_ctrl(b, BIO_CTRL_GET_KTLS_RECV, 0, NULL)
+     (BIO_ctrl(b, BIO_CTRL_GET_KTLS_RECV, 0, NULL) > 0)
 # else
 #  define BIO_get_ktls_send(b)  (0)
 #  define BIO_get_ktls_recv(b)  (0)