Message ID | 20210512131511.1309914-4-arne@rfc2549.org |
---|---|
State | Accepted |
Headers | show |
Series | Miscellaneous cleanup patches/small fixes | expand |
Acked-by: Gert Doering <gert@greenie.muc.de> It's really the same code moved "inline", with the "if()" condition turned around (from early-return to if(condition) { ... }). As discussed on IRC, I have massaged the commit message a bit :-) Your patch has been applied to the master branch. I've toyed with the idea of moving to 2.5 ("because it is so trivial, and keeps the code similar") but it's neither a bugfix nor a compat thing or a requirement, so our rules are fairly clear. Maybe if a relevant bugfix hits close to this. commit 6cf4fa5a4a686fa99ccdc8b1df48616853bc6be6 Author: Arne Schwabe Date: Wed May 12 15:15:05 2021 +0200 Inline do_init_auth_token_key Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20210512131511.1309914-4-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22341.html Signed-off-by: Gert Doering <gert@greenie.muc.de> -- kind regards, Gert Doering
diff --git a/src/openvpn/init.c b/src/openvpn/init.c index fa10d3d4f..1d77a9d42 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2671,22 +2671,6 @@ do_init_tls_wrap_key(struct context *c) } -/* - * Initialise the auth-token key context - */ -static void -do_init_auth_token_key(struct context *c) -{ - if (!c->options.auth_token_generate) - { - return; - } - - auth_token_init_secret(&c->c1.ks.auth_token_key, - c->options.auth_token_secret_file, - c->options.auth_token_secret_file_inline); -} - /* * Initialize the persistent component of OpenVPN's TLS mode, * which is preserved across SIGUSR1 resets. @@ -2761,7 +2745,12 @@ do_init_crypto_tls_c1(struct context *c) do_init_tls_wrap_key(c); /* initialise auth-token crypto support */ - do_init_auth_token_key(c); + if (c->options.auth_token_generate) + { + auth_token_init_secret(&c->c1.ks.auth_token_key, + c->options.auth_token_secret_file, + c->options.auth_token_secret_file_inline); + } #if 0 /* was: #if ENABLE_INLINE_FILES -- Note that enabling this code will break restarts */ if (options->priv_key_file_inline)
The extra function does give really give a better understanding of the code or does give any other benefit, inline it to make the code more streamlined. Signed-off-by: Arne Schwabe <arne@rfc2549.org> --- src/openvpn/init.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)