From f16e52b67c9261bdc7e1284a50502a802921ac6d Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 29 Jan 2021 10:34:49 -0800 Subject: 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: Shane Lontis Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14023) --- crypto/bio/bss_conn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crypto/bio/bss_conn.c') diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index c7bd0a329f..5b0a69486b 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -536,7 +536,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: @@ -546,9 +546,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; -- cgit v1.2.3