From owner-dev-commits-src-main@freebsd.org Tue Aug 17 21:45:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 506D066C5FB; Tue, 17 Aug 2021 21:45:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq4N447hgz4TqF; Tue, 17 Aug 2021 21:45:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52FA225517; Tue, 17 Aug 2021 21:45:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HLju9c017721; Tue, 17 Aug 2021 21:45:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HLjuvm017720; Tue, 17 Aug 2021 21:45:56 GMT (envelope-from git) Date: Tue, 17 Aug 2021 21:45:56 GMT Message-Id: <202108172145.17HLjuvm017720@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 334d228a204c - main - OpenSSL: Correct the return value of BIO_get_ktls_*(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 334d228a204c16d1384a978ab9b209e4e7e33275 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 21:45:57 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=334d228a204c16d1384a978ab9b209e4e7e33275 commit 334d228a204c16d1384a978ab9b209e4e7e33275 Author: John Baldwin AuthorDate: 2021-08-17 21:37:47 +0000 Commit: John Baldwin CommitDate: 2021-08-17 21:41:12 +0000 OpenSSL: Correct the return value of BIO_get_ktls_*(). BIO_get_ktls_send() and BIO_get_ktls_recv() are documented as returning either 0 or 1. However, they were actually returning the internal value of the associated BIO flag for the true case instead of 1. Also trim redundant ternary operators. Reviewed by: jkim Obtained from: OpenSSL (f16e52b67c9261bdc7e1284a50502a802921ac6d) MFC after: 5 days Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31438 --- crypto/openssl/crypto/bio/bss_conn.c | 6 +++--- crypto/openssl/crypto/bio/bss_fd.c | 2 +- crypto/openssl/crypto/bio/bss_sock.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crypto/openssl/crypto/bio/bss_conn.c b/crypto/openssl/crypto/bio/bss_conn.c index d4786442803e..10cf20871cb0 100644 --- a/crypto/openssl/crypto/bio/bss_conn.c +++ b/crypto/openssl/crypto/bio/bss_conn.c @@ -539,7 +539,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) } break; case BIO_CTRL_EOF: - ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0; + ret = (b->flags & BIO_FLAGS_IN_EOF) != 0; break; # ifndef OPENSSL_NO_KTLS case BIO_CTRL_SET_KTLS: @@ -549,9 +549,9 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) BIO_set_ktls_flag(b, num); break; case BIO_CTRL_GET_KTLS_SEND: - return BIO_should_ktls_flag(b, 1); + return BIO_should_ktls_flag(b, 1) != 0; case BIO_CTRL_GET_KTLS_RECV: - return BIO_should_ktls_flag(b, 0); + return BIO_should_ktls_flag(b, 0) != 0; case BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG: BIO_set_ktls_ctrl_msg_flag(b); data->record_type = num; diff --git a/crypto/openssl/crypto/bio/bss_fd.c b/crypto/openssl/crypto/bio/bss_fd.c index ccbe1626baf2..8d03e48ce993 100644 --- a/crypto/openssl/crypto/bio/bss_fd.c +++ b/crypto/openssl/crypto/bio/bss_fd.c @@ -189,7 +189,7 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr) ret = 1; break; case BIO_CTRL_EOF: - ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0; + ret = (b->flags & BIO_FLAGS_IN_EOF) != 0; break; default: ret = 0; diff --git a/crypto/openssl/crypto/bio/bss_sock.c b/crypto/openssl/crypto/bio/bss_sock.c index a1fc23c7c938..8de1f5829207 100644 --- a/crypto/openssl/crypto/bio/bss_sock.c +++ b/crypto/openssl/crypto/bio/bss_sock.c @@ -191,9 +191,9 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr) BIO_set_ktls_flag(b, num); break; case BIO_CTRL_GET_KTLS_SEND: - return BIO_should_ktls_flag(b, 1); + return BIO_should_ktls_flag(b, 1) != 0; case BIO_CTRL_GET_KTLS_RECV: - return BIO_should_ktls_flag(b, 0); + return BIO_should_ktls_flag(b, 0) != 0; case BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG: BIO_set_ktls_ctrl_msg_flag(b); b->ptr = (void *)num; @@ -205,7 +205,7 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr) break; # endif case BIO_CTRL_EOF: - ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0; + ret = (b->flags & BIO_FLAGS_IN_EOF) != 0; break; default: ret = 0;