[Openvpn-devel,v2,3/3] ssl: remove unneeded if block

Message ID 20210405122827.16836-1-a@unstable.cc
State Accepted
Delegated to: Gert Doering
Headers show
Series None | expand

Commit Message

Antonio Quartulli April 5, 2021, 2:28 a.m. UTC
From: Antonio Quartulli <antonio@openvpn.net>

There is no need to check the result of a boolean function and then
assign a constant value to a variable based on that check.

Directly assign the return value of the function to the variable.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
---
 src/openvpn/ssl.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Gert Doering April 7, 2021, 2:58 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

*Such* a pretty patch!

Your patch has been applied to the master branch.

commit 8af7c6b2d79b63ef5587ef1bc4ec81834905698e
Author: Antonio Quartulli
Date:   Mon Apr 5 14:28:27 2021 +0200

     ssl: remove unneeded if block

     Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20210405122827.16836-1-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22045.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 9d18c6e5..d8662d00 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -1592,7 +1592,6 @@  openvpn_PRF(const uint8_t *secret,
             uint8_t *output,
             int output_len)
 {
-    bool ret = true;
     /* concatenate seed components */
 
     struct buffer seed = alloc_buf(strlen(label)
@@ -1614,10 +1613,8 @@  openvpn_PRF(const uint8_t *secret,
     }
 
     /* compute PRF */
-    if (!ssl_tls1_PRF(BPTR(&seed), BLEN(&seed), secret, secret_len, output, output_len))
-    {
-        ret = false;
-    }
+    bool ret = ssl_tls1_PRF(BPTR(&seed), BLEN(&seed), secret, secret_len,
+                            output, output_len);
 
     buf_clear(&seed);
     free_buf(&seed);