From: John Baldwin Date: Fri, 23 Aug 2019 23:42:48 +0000 (-0700) Subject: Fix BIO_get_ktls_send() and BIO_get_ktls_recv() to work again. X-Git-Tag: openssl-3.0.0-alpha1~1065 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1ca50aa975fb149a75a3b0411230761376cb5e33;p=oweals%2Fopenssl.git Fix BIO_get_ktls_send() and BIO_get_ktls_recv() to work again. This partially reverts 3119ab3c9e6d211c461a245f3744893e17b6c193. In the case of a simple openssl s_server instance, the bio in s->wbio is a BIO_TYPE_BUFFER BIO, not BIO_TYPE_SOCKET. This caused all of the checks to fail breaking KTLS. The default return value of control methods I have looked it is zero for unknown control requests, so invoking the control requests should be returning 0 for non-socket BIOs already. This does still map the requests to 0 at compile time for the non-KTLS case so that the compiler can optimize the checks away entirely. Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/10045) --- diff --git a/include/openssl/bio.h b/include/openssl/bio.h index 9fb8095014..bb289e6fa2 100644 --- a/include/openssl/bio.h +++ b/include/openssl/bio.h @@ -162,11 +162,9 @@ extern "C" { # ifndef OPENSSL_NO_KTLS # define BIO_get_ktls_send(b) \ - (BIO_method_type(b) == BIO_TYPE_SOCKET \ - && BIO_ctrl(b, BIO_CTRL_GET_KTLS_SEND, 0, NULL)) + BIO_ctrl(b, BIO_CTRL_GET_KTLS_SEND, 0, NULL) # define BIO_get_ktls_recv(b) \ - (BIO_method_type(b) == BIO_TYPE_SOCKET \ - && BIO_ctrl(b, BIO_CTRL_GET_KTLS_RECV, 0, NULL)) + BIO_ctrl(b, BIO_CTRL_GET_KTLS_RECV, 0, NULL) # else # define BIO_get_ktls_send(b) (0) # define BIO_get_ktls_recv(b) (0)