]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
serf: Fix the default return value of the BIO control method.
authorJohn Baldwin <jhb@FreeBSD.org>
Wed, 3 Feb 2021 22:59:32 +0000 (14:59 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Tue, 9 Feb 2021 17:35:21 +0000 (09:35 -0800)
commitf69cd089ccf4bf6afbb61fe84e1df2af2b037ec4
tree2be897eb84e7df7266e952e41eb8722168f96d6a
parent1f0bc379eb71af6d1cbc857a5b1316a115fbc649
serf: Fix the default return value of the BIO control method.

OpenSSL BIO classes provide an abstraction for dealing with I/O.
OpenSSL provides BIO classes for commonly used I/O primitives backed
by file descriptors, sockets, etc. as well as permitting consumers
of OpenSSL to define custom BIO classes.

One of the methods BIO classes implement is a control method invoked
by BIO_ctrl() for various ancilliary tasks somewhat analgous to
fcntl() and ioctl() on file descriptors.  According to the BIO_ctrl(3)
manual page, control methods should return 0 for unknown control
requests.

KTLS support in OpenSSL adds new control requests.  Two of those new
requests are queries to determine if KTLS is enabled for either
reading or writing.  These control reuquest return 1 if KTLS is
enabled and 0 if it is not.

serf includes two custom BIO classes for wrapping I/O requests from
files and from a buffer in memory.  These BIO classes both use a
custom control method.  However, this custom control method was
returning 1 for unknown or unsupported control requests instead of 0.
As a result, OpenSSL with KTLS believed that these BIOs were using
KTLS and were thus adding headers and doing encryption/decryption in
the BIO.  Correcting the return value removes this confusion.

PR: 253135
Reported by: Guido Falsi <mad@madpilot.net>
Approved by: re (gjb)
Sponsored by: Netflix

(cherry picked from commit cb7cc72c546e0f87598961c3860e17391f42866c)
(cherry picked from commit b122886de25a51e3587d94ab2988a6ccb1e6a4e7)
contrib/serf/buckets/ssl_buckets.c