Skip to content

Commit

Permalink
Fix crash if no tls-auth section is present in the config
Browse files Browse the repository at this point in the history
We are now only initializing TLS-related objects if TLS auth mode
is enabled.

This fixes internal Jira issue PG-122.

Signed-off-by: Razvan Cojocaru <[email protected]>
  • Loading branch information
Razvan Cojocaru authored and Jenkins-dev committed Jul 12, 2024
1 parent e929058 commit f15261b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions openvpn/ssl/psid_cookie_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ class PsidCookieImpl : public PsidCookie
PsidCookieImpl(ServerProto::Factory *psfp)
: pcfg_(*psfp->proto_context_config),
not_tls_auth_mode_(!pcfg_.tls_auth_enabled()),
now_(pcfg_.now), handwindow_(pcfg_.handshake_window),
ta_hmac_recv_(pcfg_.tls_auth_context->new_obj()),
ta_hmac_send_(pcfg_.tls_auth_context->new_obj())
now_(pcfg_.now), handwindow_(pcfg_.handshake_window)
{
if (not_tls_auth_mode_)
return;

ta_hmac_recv_ = pcfg_.tls_auth_context->new_obj();
ta_hmac_send_ = pcfg_.tls_auth_context->new_obj();

// init tls_auth hmac (see ProtoContext.reset() case TLS_AUTH; also TLSAuthPreValidate ctor)
if (pcfg_.key_direction >= 0)
{
Expand Down

0 comments on commit f15261b

Please sign in to comment.