Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0160C88E65 for ; Sun, 13 Sep 2026 13:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Type:Cc:Reply-To:From: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:Message-ID:References:In-Reply-To:To:Date:Sender: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rmqk//oqDp44dCJHcqfJEWJcO6AWPJszIHPw23IUzys=; b=QEx4HpI536Iu1vPOEl20x35uQE NhI5SM0riEEScsAyzIkCRFIPm3K21egkQUX8CZeLNrwJ1EoGZJ2FgZcoqsk+Hf1ZwjHVerYSNAmB1 NYGUNOShGSW2S+YEB6ZHPfBSusGvORXaP2xoXAkP/lUa3Uzf8fhthmxxwQCyYDqIhDI8=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1x5jun-00031m-3q; Sun, 13 Sep 2026 13:06:37 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1x5jul-00031e-JN for openvpn-devel@lists.sourceforge.net; Sun, 13 Sep 2026 13:06:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:Subject:References:In-Reply-To:List-Unsubscribe:List-Id: Cc:To:Date:From:Sender:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Help:List-Subscribe :List-Post:List-Owner:List-Archive; bh=EIOhYkI53lf6D3QWCeM8Xh55L7ZlHCQS0WeQKPwuEi4=; b=ixy4ZxoEsEkkwPrkgfkXkwiO+m vRNhnAoa5OOSVCgHc9aiRgadYuWJ54Wb2U7RtHf33fpoKI1FgdA+cJwM81uueiTsHU6BlODM9t6gf C59/Yun5wDV+L6zQRSgLULKIE/t3EWAGpqztgFHf1+Yp6VxoF4NafaS0LY8tmJLON5Mc=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: Subject:References:In-Reply-To:List-Unsubscribe:List-Id:Cc:To:Date:From: Sender:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=EIOhYkI53lf6D3QWCeM8Xh55L7ZlHCQS0WeQKPwuEi4=; b=X Zcwx2J47FCqiDZKRwODKDpaOupEjfUXkjGd5YUfwyNwkVUimeeKSSUKbDf4lK02YwTx4plNSHZb0h 8g9+A/yfKs3q+6mlPSwma6DINO61fCH2ADo/4H/furbFf3ahuLZ1DSXJ0s7JJUaHhXYJJARIWkqtm D3AymC5/LaNFGwhU=; Received: from mail-wm2-f12.google.com ([74.125.225.140]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1x5juh-0006Co-Lu for openvpn-devel@lists.sourceforge.net; Sun, 13 Sep 2026 13:06:35 +0000 Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49b912d8239so6130315e9.0 for ; Sun, 13 Sep 2026 06:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1789304785; x=1789909585; darn=lists.sourceforge.net; h=content-type:user-agent:content-disposition :content-transfer-encoding:mime-version:message-id:reply-to:subject :thread-index:references:in-reply-to:list-unsubscribe:list-id :auto-submitted:cc:to:date:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=EIOhYkI53lf6D3QWCeM8Xh55L7ZlHCQS0WeQKPwuEi4=; b=RKwt/EQ/hpDL9f2ybYzv2zXOmapylrLXy8XGCTVCoUea0uMgx1oJn0i8j4uLeHJAei W6yMJWVPSEPZ3W55AeSyEv7jzHimAQ47JwZQ2NkkfDr2VHY1W62eJQ5kDMs2Bd9rjtXZ fjjryI7stw0NqlIhCuMreFXeP0bJBmGZ6zI2UUeLw+Hf1z2lrWVGm5RqDEXLGAXPmk3M JBhZUcmSpoY0LnqomLKECcbqGsof6/RC+uNFlrPy4+LeXtnNLFjsVVM5TPV+yc5lydtt fh7ZNSB2A3ju4/2yFCfLe2BDr/fdf+YjAbYycHxdl8iTkGx0/VeiIj0zxUqHm5lejbHF W5Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789304785; x=1789909585; h=content-type:user-agent:content-disposition :content-transfer-encoding:mime-version:message-id:reply-to:subject :thread-index:references:in-reply-to:list-unsubscribe:list-id :auto-submitted:cc:to:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=EIOhYkI53lf6D3QWCeM8Xh55L7ZlHCQS0WeQKPwuEi4=; b=o3L+Gjh42WhScftK6cQG3UXLE9DcoZU0F8OUmRKRwJ6TASD4kTTiOPbA7LmmgAKvPq 5tCevRhajdO3UI08a0HtUU+Rjn0h+PKzgvPmR8mtQm+LrGXsSbUWiwOJU7eWrO8xsB4d e1Iw3xJ0EXsvt/bDafjwcLPoHQWzgii67pVoxm2wSBt1h7DwSDtaxv+YSEpPEzXFCzCt +NIiIfBXQc/5Kwf335BblLK3FATWuNZsxXDTjfuJj9H0pXmRv2HDDrvLeGe7GlAKxW9M 4LFJMdHS6/TgrKlQY/4mDCXUFQihFjgz9niN5lpLqtPwUT7VqN31Vf/6ebx810kPGIYZ BiQg== X-Gm-Message-State: AFuF++nODU3h8pjjyYyXP+WeH106dNnKDY4VuhKJyg/igvNiGBO0nMON 6m4qm1uVKnHEuOclNOXxhiQevWYD2Z1t5veL6lR8Sz4EH7+n/iTZubN+gj0Ioi2kObR2dHq1KM/ HY8zrfrwa072JHg7OykPhGW8ECfbI6xGBo4q3VHX2SoHBFouQfwscdTXDlM1wKvXOdZ2W X-Gm-Gg: AYBFou2i565Jb8TNV+KtDFn0I/zHrfd1JrvkB+Lmg9uhM0njoQL8ixY355jzuVtd3ra Xm2frCtr1urrxWcyZVF06SwI683srQ9U2XxSARLKBaoBrl+R4m4yWKmdg/afNdoPVNqM6OUV5+L W4apa+rvrHwp5SWhqULZ1xVs3gizd8RQfYBDkuEhUbI8CVeW16W5Ii6q9jK7Z1xvw5RZuNaE8qU y6KQY7A+hspZWW+bjKQ5MnGC9fxbkqRkyBCgjFDQyRkkL1sDZwXVaRBvzPodkNh3SN93FNFu+Ib 7wEFMcci1C2Rt8p2K8YLz81UvbCMSZQctxiT60BtTSsZHk6DtKRDeKT+JvZIWr95EgQkOCjC943 3yVt8RG4pA7B+VfMA0kKYU8MpKpGKMO+6nh6pI1T+iSCyVhKK1ZdetWh0AzQT54g0RoL3O01+1D eYPRa7S43pBezwrTnvd2E93twfU7/yoxqVajB9j41ztH0boDkDRTsrbm1TIdmHX/ITioixZ5+t2 Kr203SlvbQjWJJWKLyMTwrwxOZ9TxZudXWrl+9L+uZR1qGYL3xpGPB/I1dP3iLo93xbnnLBdNLg USdbuavKLNGuEqVzqA7SnG2mdOPsu20deflgUrdeFZhZoknjsbNw+yUrYgL2dg== X-Received: by 2002:a05:600c:3f16:b0:49c:e1cd:536 with SMTP id 5b1f17b1804b1-49e6caca0b3mr72753505e9.12.1789304784842; Sun, 13 Sep 2026 06:06:24 -0700 (PDT) Received: from ip-10-18-1-162.eu-central-1.compute.internal (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49d26b7332asm314923275e9.0.2026.09.13.06.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2026 06:06:24 -0700 (PDT) X-Google-Original-From: "cron2 (Code Review)" Date: Sun, 13 Sep 2026 13:06:22 +0000 To: flichtenheld , plaisthos , razvanc Auto-Submitted: auto-generated X-Gerrit-MessageType: newpatchset X-Gerrit-PatchSet: 22 X-Gerrit-Change-Id: Id0caa497c4ff1ad8743cb23f332f003b2d3393ed X-Gerrit-Change-Number: 1617 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: a57e39923d55987336f544ce0c1b3b42c35f0ec0 In-Reply-To: References: Thread-Index: PGdlcnJpdC4xNzc1NDIxNTU4MDAwLklkMGNhYTQ5N2M0ZmYxYWQ4NzQzY2IyM2YzMzJmMDAzYjJkMzM5M2VkQGdlcnJpdC5vcGVudnBuLm5ldD4= Message-ID: <5648005050205e57aee1c5f40b81b5835fe47277-EmailReplacePatchSet-HTML@gerrit.openvpn.net> MIME-Version: 1.0 User-Agent: Gerrit/3.11.5 X-Headers-End: 1x5juh-0006Co-Lu Subject: [Openvpn-devel] [M] Change in openvpn[master]: Remove various useless assignments X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "cron2 \(Code Review\) via Openvpn-devel" Reply-To: gert@greenie.muc.de, arne-openvpn@rfc2549.org, razvanc@mailbox.org, openvpn-devel@lists.sourceforge.net, frank@lichtenheld.com, lstipakov@gmail.com Cc: "cron2 \(Code Review\)" , openvpn-devel Content-Type: multipart/mixed; boundary="===============3232974718911179460==" Errors-To: openvpn-devel-bounces@lists.sourceforge.net --===============3232974718911179460== Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="GPHy1IitD7w="; charset=UTF-8 --GPHy1IitD7w= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#22) to the change originally created b= y flichtenheld=2E ( http://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1617?usp=3Dem= ail ) The following approvals got outdated and were removed: Code-Review+2= by razvanc Change subject: Remove various useless assignments =2E=2E=2E= =2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E= =2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E= =2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E Remove various useless= assignments The values assigned by these are never actually used for some= thing=2E Identified by cppcheck=2E Change-Id: Id0caa497c4ff1ad8743cb23f33= 2f003b2d3393ed Signed-off-by: Frank Lichtenheld A= cked-by: Razvan Cojocaru Gerrit URL: https://gerrit= =2Eopenvpn=2Enet/c/openvpn/+/1617 Message-Id: <20260912200747=2E26711-1-ger= t@greenie=2Emuc=2Ede> URL: https://www=2Email-archive=2Ecom/openvpn-devel@l= ists=2Esourceforge=2Enet/msg39142=2Ehtml Signed-off-by: Gert Doering --- M dev-tools/cppcheck-suppression M src/openvpn/cons= ole_builtin=2Ec M src/openvpn/crypto=2Ec M src/openvpn/error=2Eh M src/open= vpn/forward=2Ec M src/openvpn/manage=2Ec M src/openvpn/options=2Ec M src/op= envpn/pkcs11=2Ec M src/openvpn/pkcs11_openssl=2Ec M src/openvpn/push_util= =2Ec M src/openvpn/socket=2Ec M src/openvpn/ssl_openssl=2Ec M src/openvpn/w= in32=2Ec M src/openvpnmsica/openvpnmsica=2Ec M src/tapctl/tap=2Ec M tests/u= nit_tests/openvpn/test_ssl=2Ec 16 files changed, 43 insertions(+), 63 delet= ions(-) git pull ssh://gerrit=2Eopenvpn=2Enet:29418/openvpn refs/change= s/17/1617/22 diff --git a/dev-tools/cppcheck-suppression b/dev-tools/cppch= eck-suppression index e1ffe37=2E=2E299d7a3 100644 --- a/dev-tools/cppcheck-= suppression +++ b/dev-tools/cppcheck-suppression @@ -5,9 +5,6 @@ constPara= meterPointer invalidPrintfArgType_sint invalidPrintfArgType_uint -redunda= ntAssignment -redundantInitialization -unreadVariable unusedFunction usle= epCalled variableScope @@ -74,7 +71,7 @@ # IGN: strlen(NULL) is not nice = code, but seems to work nullPointerRedundantCheck:src/openvpn/init=2Ec:301= # FP: cppcheck doesn't understand ZeroMemory -redundantAssignment:src/ope= nvpnserv/interactive=2Ec:203 +redundantAssignment:src/openvpnserv/interacti= ve=2Ec:204 # IGN: We reuse the same variable name due to macro usage shad= owVariable:src/openvpn/options=2Ec:1948 shadowVariable:src/openvpn/options= =2Ec:1966 diff --git a/src/openvpn/console_builtin=2Ec b/src/openvpn/consol= e_builtin=2Ec index 2a9f3b6=2E=2E9c8d72a 100644 --- a/src/openvpn/console_b= uiltin=2Ec +++ b/src/openvpn/console_builtin=2Ec @@ -192,7 +192,6 @@ stati= c bool get_console_input(const char *prompt, const bool echo, char *input,= const int capacity) { - bool ret =3D false; ASSERT(prompt); = ASSERT(input); ASSERT(capacity > 0); @@ -200,8 +199,11 @@ #if defin= ed(_WIN32) return get_console_input_win32(prompt, echo, input, capacit= y); -#elif defined(HAVE_TERMIOS_H) +#elif !defined(HAVE_TERMIOS_H) + msg= (M_FATAL, "Sorry, but I can't get console input on this OS (%s)", prompt); = +#else bool restore_tty =3D false; + bool ret =3D false; struc= t termios tty_tmp, tty_save; /* did we --daemon'ize before asking fo= r passwords? @@ -258,10 +260,8 @@ } close_tty(fp); -#else /* i= f defined(_WIN32) */ - msg(M_FATAL, "Sorry, but I can't get console inpu= t on this OS (%s)", prompt); -#endif /* if defined(_WIN32) */ return r= et; +#endif /* if defined(_WIN32) */ } /** diff --git a/src/openvpn/cry= pto=2Ec b/src/openvpn/crypto=2Ec index 8bbc566=2E=2Ee5ad31a 100644 --- a/sr= c/openvpn/crypto=2Ec +++ b/src/openvpn/crypto=2Ec @@ -1204,8 +1204,6 @@ = struct buffer work =3D alloc_buf_gc(BUF_SIZE(frame), &gc); struct bu= ffer encrypt_workspace =3D alloc_buf_gc(BUF_SIZE(frame), &gc); struct = buffer decrypt_workspace =3D alloc_buf_gc(BUF_SIZE(frame), &gc); - struc= t buffer buf =3D clear_buf(); - void *buf_p; /* init work */ = ASSERT(buf_init(&work, frame->buf=2Eheadroom)); @@ -1242,8 +1240,8 @@ = prng_bytes(BPTR(&src), BLEN(&src)); /* copy source to input= buf */ - buf =3D work; - buf_p =3D buf_write_alloc(&buf, BLE= NZ(&src)); + struct buffer buf =3D work; + void *buf_p =3D bu= f_write_alloc(&buf, BLENZ(&src)); ASSERT(buf_p); memcpy(b= uf_p, BPTR(&src), BLENZ(&src)); diff --git a/src/openvpn/error=2Eh b/src/= openvpn/error=2Eh index 45826a2=2E=2Ea887fc7 100644 --- a/src/openvpn/error= =2Eh +++ b/src/openvpn/error=2Eh @@ -408,8 +408,8 @@ openvpn_errno_maybe_c= rt(bool *crt_error) { int err =3D 0; - *crt_error =3D false; #ifd= ef _WIN32 + *crt_error =3D false; err =3D GetLastError(); if (= err =3D=3D ERROR_SUCCESS) { diff --git a/src/openvpn/forward=2Ec b/src= /openvpn/forward=2Ec index ad43d40=2E=2E83cd113 100644 --- a/src/openvpn/fo= rward=2Ec +++ b/src/openvpn/forward=2Ec @@ -1746,7 +1746,6 @@ process_outg= oing_link(struct context *c, struct link_socket *sock) { struct gc_ar= ena gc =3D gc_new(); - int error_code =3D 0; if (c->c2=2Eto_link= =2Elen > 0 && c->c2=2Eto_link=2Elen <=3D c->c2=2Eframe=2Ebuf=2Epayload_size= ) { @@ -1821,7 +1820,7 @@ } /* Check return status= */ - error_code =3D openvpn_errno(); + int error_code =3D op= envpn_errno(); check_status(size, "write", sock, NULL); = if (size > 0) diff --git a/src/openvpn/manage=2Ec b/src/openvpn/manage=2Ec= index 3039f24=2E=2Ee121b38 100644 --- a/src/openvpn/manage=2Ec +++ b/src/o= penvpn/manage=2Ec @@ -916,10 +916,9 @@ static void man_remote_entry_count= (struct management *man) { - unsigned count =3D 0; if (man->persis= t=2Ecallback=2Eremote_entry_count) { - count =3D (*man->persist= =2Ecallback=2Eremote_entry_count)(man->persist=2Ecallback=2Earg); + = unsigned int count =3D (*man->persist=2Ecallback=2Eremote_entry_count)(man-= >persist=2Ecallback=2Earg); msg(M_CLIENT, "%u", count); m= sg(M_CLIENT, "END"); } @@ -3743,7 +3742,6 @@ struct gc_arena gc = =3D gc_new(); int ret =3D 0; volatile int signal_received =3D 0; = - struct buffer alert_msg =3D clear_buf(); const bool standalone_di= sabled_save =3D man->persist=2Estandalone_disabled; struct man_connect= ion *mc =3D &man->connection; @@ -3755,6 +3753,7 @@ *state =3D= EKS_SOLICIT; + struct buffer alert_msg; if (b64_data) = { alert_msg =3D alloc_buf_gc(strlen(b64_data) + strlen(= prompt) + 3, &gc); diff --git a/src/openvpn/options=2Ec b/src/openvpn/optio= ns=2Ec index 25a3746=2E=2E15f2fcd 100644 --- a/src/openvpn/options=2Ec +++ = b/src/openvpn/options=2Ec @@ -4157,8 +4157,7 @@ bool key_is_external(cons= t struct options *options) { - bool ret =3D false; - ret =3D ret || = (options->management_flags & MF_EXTERNAL_KEY); + bool ret =3D options->m= anagement_flags & MF_EXTERNAL_KEY; #ifdef ENABLE_PKCS11 ret =3D ret |= | (options->pkcs11_providers[0] !=3D NULL); #endif @@ -5697,7 +5696,6 @@ = if (streq(p[1], "FORWARD_COMPATIBLE") && p[2] && streq(p[2], "1= ")) { options->forward_compatible =3D true; -= msglevel_fc =3D msglevel_forward_compatible(options, msglev= el); } setenv_str(es, p[1], p[2] ? p[2] : ""); = } diff --git a/src/openvpn/pkcs11=2Ec b/src/openvpn/pkcs11=2Ec index= 8b06fd0=2E=2Ed7dee97 100644 --- a/src/openvpn/pkcs11=2Ec +++ b/src/openvpn= /pkcs11=2Ec @@ -80,6 +80,9 @@ static msglvl_t _pkcs11_msg_pkcs112openvpn(= const unsigned flags) { +#ifdef ENABLE_PKCS11_FORCE_DEBUG + return M_IN= FO; +#else msglvl_t openvpn_flags; switch (flags) @@ -109,16 +1= 12,16 @@ break; } -#if defined(ENABLE_PKCS11_FORCE_DEBU= G) - openvpn_flags =3D M_INFO; -#endif - return openvpn_flags; +#en= dif } static unsigned _pkcs11_msg_openvpn2pkcs11(const msglvl_t flags)= { +#ifdef ENABLE_PKCS11_FORCE_DEBUG + return PKCS11H_LOG_DEBUG2; +#els= e unsigned pkcs11_flags; if ((flags & D_PKCS11_DEBUG) !=3D 0) @= @ -146,11 +149,8 @@ pkcs11_flags =3D PKCS11H_LOG_ERROR; } -= #if defined(ENABLE_PKCS11_FORCE_DEBUG) - pkcs11_flags =3D PKCS11H_LOG_DE= BUG2; -#endif - return pkcs11_flags; +#endif } static void diff --= git a/src/openvpn/pkcs11_openssl=2Ec b/src/openvpn/pkcs11_openssl=2Ec index= b6c1624=2E=2E69c5a50 100644 --- a/src/openvpn/pkcs11_openssl=2Ec +++ b/src= /openvpn/pkcs11_openssl=2Ec @@ -384,7 +384,6 @@ if (certificate !=3D N= ULL) { pkcs11h_certificate_freeCertificate(certificate); - = certificate =3D NULL; } /* @@ -400,7 +399,6 @@ if (op= enssl_session !=3D NULL) { pkcs11h_openssl_freeSession(openss= l_session); - openssl_session =3D NULL; } return ret; #en= dif /* ifdef HAVE_= XKEY_PROVIDER */ diff --git a/src/openvpn/push_util=2Ec b/src/openvpn/push_= util=2Ec index fcc5411=2E=2E0213041 100644 --- a/src/openvpn/push_util=2Ec = +++ b/src/openvpn/push_util=2Ec @@ -99,7 +99,6 @@ } char *str = =3D gc_strdup(s, gc); - size_t i =3D 0; while (*str) { @@ -1= 12,11 +111,11 @@ /* if no commas were found go to fail, do= not send any message */ return false; } + = /* copy from current position to (ci - 1) */ str[ci] = =3D '\0'; - /* copy from i to (ci -1) */ struct buf= fer tmp =3D forge_msg(str, ",push-continuation 2", gc); buffer= _list_push(msgs, BSTR(&tmp)); - i =3D ci + 1; + str += =3D ci + 1; } else { @@ -130,9 +129,8 @@ = struct buffer tmp =3D forge_msg(str, NULL, gc); = buffer_list_push(msgs, BSTR(&tmp)); } - i =3D strle= n(str); + break; } - str =3D &str[i]; } = return true; } diff --git a/src/openvpn/socket=2Ec b/src/openvpn/socket= =2Ec index f6ebf10=2E=2E41c8bac 100644 --- a/src/openvpn/socket=2Ec +++ b/s= rc/openvpn/socket=2Ec @@ -790,7 +790,7 @@ */ socklen_t remote_le= n_af =3D af_addr_size(act->dest=2Eaddr=2Esa=2Esa_family); socklen_t re= mote_len =3D sizeof(act->dest=2Eaddr); - socket_descriptor_t new_sd =3D = SOCKET_UNDEFINED; + socket_descriptor_t new_sd; CLEAR(*act); di= ff --git a/src/openvpn/ssl_openssl=2Ec b/src/openvpn/ssl_openssl=2Ec index = 0b01634=2E=2E7cfe9f4 100644 --- a/src/openvpn/ssl_openssl=2Ec +++ b/src/ope= nvpn/ssl_openssl=2Ec @@ -2283,13 +2283,13 @@ } int typeid =3D E= VP_PKEY_id(pkey); + +#ifndef OPENSSL_NO_EC #if OPENSSL_VERSION_NUMBER < 0x= 30000000L bool is_ec =3D typeid =3D=3D EVP_PKEY_EC; #else bool i= s_ec =3D EVP_PKEY_is_a(pkey, "EC"); #endif - -#ifndef OPENSSL_NO_EC c= har groupname[64]; if (is_ec) { @@ -2593,15 +2593,13 @@ = "builtin EC curves=2E It does not list additional curves nor X448 or X25= 519\n"); #ifndef OPENSSL_NO_EC EC_builtin_curve *curves =3D NULL; - = size_t crv_len =3D 0; - size_t n =3D 0; - crv_len =3D EC_get_buil= tin_curves(NULL, 0); + size_t crv_len =3D EC_get_builtin_curves(NULL, 0)= ; ALLOC_ARRAY(curves, EC_builtin_curve, crv_len); if (EC_get_buil= tin_curves(curves, crv_len)) { printf("\nAvailable Elliptic c= urves/groups:\n"); - for (n =3D 0; n < crv_len; n++) + for (s= ize_t n =3D 0; n < crv_len; n++) { const char *sname;= sname =3D OBJ_nid2sn(curves[n]=2Enid); diff --git a/src/openv= pn/win32=2Ec b/src/openvpn/win32=2Ec index 94e79d5e=2E=2E618772d 100644 ---= a/src/openvpn/win32=2Ec +++ b/src/openvpn/win32=2Ec @@ -1340,9 +1340,6 @@ = is_wow64_process2_t is_wow64_process2 =3D (is_wow64_process2_= t)GetProcAddress(GetModuleHandle("Kernel32=2Edll"), "IsWow64Process2"); -= USHORT process_machine =3D 0; - USHORT native_machine =3D 0; - #ifd= ef _ARM64_ *process_arch =3D ARCH_ARM64; #elif defined(_WIN64) @@ -13= 50,6 +1347,8 @@ if (is_wow64_process2) { /* this could b= e amd64 on arm64 */ + USHORT process_machine =3D 0; + USHORT = native_machine =3D 0; BOOL is_wow64 =3D is_wow64_process2(GetCurre= ntProcess(), &process_machine, &native_machine); if (is_wow64 && n= ative_machine =3D=3D IMAGE_FILE_MACHINE_ARM64) { @@ -1362,6 +1361,= 8 @@ if (is_wow64_process2) { /* check if we're running = on arm64 or amd64 machine */ + USHORT process_machine =3D 0; + = USHORT native_machine =3D 0; BOOL is_wow64 =3D is_wow64_process2= (GetCurrentProcess(), &process_machine, &native_machine); if (is_w= ow64) { diff --git a/src/openvpnmsica/openvpnmsica=2Ec b/src/openv= pnmsica/openvpnmsica=2Ec index 3911006=2E=2Ea861e8a 100644 --- a/src/openvp= nmsica/openvpnmsica=2Ec +++ b/src/openvpnmsica/openvpnmsica=2Ec @@ -711,7 += 711,6 @@ uiResult =3D MsiViewFetch(hViewST, &hRecord); if= (uiResult =3D=3D ERROR_NO_MORE_ITEMS) { - uiResult =3D= ERROR_SUCCESS; break; } else if (uiResult != =3D ERROR_SUCCESS) diff --git a/src/tapctl/tap=2Ec b/src/tapctl/tap=2Ec ind= ex 769df6c=2E=2Edd22cc5 100644 --- a/src/tapctl/tap=2Ec +++ b/src/tapctl/ta= p=2Ec @@ -473,7 +473,7 @@ return ERROR_OUTOFMEMORY= ; } - dwCountExpResult =3D Expand= EnvironmentStrings(szValue, szValueExp, dwCountExp); + E= xpandEnvironmentStrings(szValue, szValueExp, dwCountExp); = free(szValue); *pszValue =3D szValueExp; = return ERROR_SUCCESS; @@ -601,8 +601,6 @@ = _In_ DWORD dwProperty, _Out_opt_ LPDWORD pdwPropertyRegDataType, = _Out_ LPVOID *ppData) { - DWORD dwResult =3D ERROR_B= AD_ARGUMENTS; - if (ppData =3D=3D NULL) { return ERROR_B= AD_ARGUMENTS; @@ -628,7 +626,7 @@ } else { - dwResult= =3D GetLastError(); + DWORD dwResult =3D GetLastError(); i= f (dwResult =3D=3D ERROR_INSUFFICIENT_BUFFER) { /* Al= locate on heap and retry=2E */ diff --git a/tests/unit_tests/openvpn/test_s= sl=2Ec b/tests/unit_tests/openvpn/test_ssl=2Ec index fcebcdb=2E=2E4baf8cc 1= 00644 --- a/tests/unit_tests/openvpn/test_ssl=2Ec +++ b/tests/unit_tests/op= envpn/test_ssl=2Ec @@ -217,7 +217,7 @@ #if !defined(HAVE_OPENSSL_STORE) = skip(); -#else /* HAVE_OPENSSL_STORE */ +#else /* HAVE_OPENSSL_STORE = */ struct tls_root_ctx ctx =3D { 0 }; const char *certfile =3D = global_state=2Ecertfile; @@ -228,9 +228,10 @@ struct buffer keyuri =3D= alloc_buf_gc(6 + strlen(keyfile) + 1, gc); /* 6 bytes for "file:/" */ = /* Windows temp file path starts with drive letter -- add a leading sl= ash for URI */ - const char *lead =3D ""; #ifdef _WIN32 - lead =3D "= /"; + const char *lead =3D "/"; +#else + const char *lead =3D ""; #e= ndif /* _WIN32 */ assert_true(buf_printf(&certuri, "file:%s%s", lead, = certfile)); assert_true(buf_printf(&keyuri, "file:%s%s", lead, keyfile= )); @@ -292,8 +293,6 @@ struct buffer work =3D alloc_buf_gc(BUF_SIZE(&= frame), &gc); struct buffer encrypt_workspace =3D alloc_buf_gc(BUF_SIZ= E(&frame), &gc); struct buffer decrypt_workspace =3D alloc_buf_gc(BUF_= SIZE(&frame), &gc); - struct buffer buf =3D clear_buf(); - void *buf_= p; /* init work */ ASSERT(buf_init(&work, frame=2Ebuf=2Eheadroo= m)); @@ -314,8 +313,8 @@ prng_bytes(BPTR(&src), BLEN(&src)); = /* copy source to input buf */ - buf =3D work; - buf_p = =3D buf_write_alloc(&buf, BLENZ(&src)); + struct buffer buf =3D work= ; + void *buf_p =3D buf_write_alloc(&buf, BLENZ(&src)); ASS= ERT(buf_p); memcpy(buf_p, BPTR(&src), BLENZ(&src)); @@ -345,7 +3= 44,6 @@ struct buffer encrypt_workspace =3D alloc_buf_gc(BUF_SIZE(&fra= me), &gc); struct buffer decrypt_workspace =3D alloc_buf_gc(BUF_SIZE(&= frame), &gc); struct buffer work =3D alloc_buf_gc(BUF_SIZE(&frame), &g= c); - struct buffer buf =3D clear_buf(); struct buffer src =3D allo= c_buf_gc(frame=2Ebuf=2Epayload_size, &gc); void *buf_p; @@ -360,7 +3= 58,7 @@ prng_bytes(BPTR(&src), BLEN(&src)); /* copy source to i= nput buf */ - buf =3D work; + struct buffer buf =3D work; buf_p = =3D buf_write_alloc(&buf, BLENZ(&src)); ASSERT(buf_p); memcpy(buf= _p, BPTR(&src), BLENZ(&src)); @@ -641,7 +639,6 @@ struct buffer work = =3D alloc_buf_gc(BUF_SIZE(&frame), &gc); struct buffer encrypt_workspa= ce =3D alloc_buf_gc(BUF_SIZE(&frame), &gc); struct buffer decrypt_work= space =3D alloc_buf_gc(BUF_SIZE(&frame), &gc); - struct buffer buf =3D c= lear_buf(); void *buf_p; /* init work */ @@ -658,7 +655,7 @@ = ASSERT(buf_write(&src, plaintext, strlen(plaintext))); /* copy so= urce to input buf */ - buf =3D work; + struct buffer buf =3D work; = buf_p =3D buf_write_alloc(&buf, BLENZ(&src)); ASSERT(buf_p); m= emcpy(buf_p, BPTR(&src), BLENZ(&src)); -- To view, visit http://gerrit=2E= openvpn=2Enet/c/openvpn/+/1617?usp=3Demail To unsubscribe, or for help writ= ing mail filters, visit http://gerrit=2Eopenvpn=2Enet/settings?usp=3Demail = Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: mas= ter Gerrit-Change-Id: Id0caa497c4ff1ad8743cb23f332f003b2d3393ed Gerrit-Chan= ge-Number: 1617 Gerrit-PatchSet: 22 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Revie= wer: plaisthos Gerrit-Reviewer: razvanc Gerrit-CC: openvpn-devel Gerrit-CC: stipa --GPHy1IitD7w= Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #22 to the change originally created by flichtenhe= ld=2E

View Change

The following approvals got outdated and we= re removed: Code-Review+2 by razvanc

Remove various useles=
s assignments

The values assigned by these are never actually usedfor something=2E

Identified by cppcheck=2E

Change-Id: Id0ca= a497c4ff1ad8743cb23f332f003b2d3393ed
Signed-off-by: Frank Lichtenheld &l= t;frank@lichtenheld=2Ecom>
Acked-by: Razvan Cojocaru <razvanc@mail= box=2Eorg>
Gerrit URL: https://gerrit=2Eopenvpn=2Enet/c/openvpn/+/161= 7
Message-Id: <20260912200747=2E26711-1-gert@greenie=2Emuc=2Ede>URL: https://www=2Email-archive=2Ecom/openvpn-devel@lists=2Esourceforge= =2Enet/msg39142=2Ehtml
Signed-off-by: Gert Doering <gert@greenie=2Emu= c=2Ede>
---
M dev-tools/cppcheck-suppression
M src/openvpn/cons= ole_builtin=2Ec
M src/openvpn/crypto=2Ec
M src/openvpn/error=2Eh
M= src/openvpn/forward=2Ec
M src/openvpn/manage=2Ec
M src/openvpn/optio= ns=2Ec
M src/openvpn/pkcs11=2Ec
M src/openvpn/pkcs11_openssl=2Ec
M= src/openvpn/push_util=2Ec
M src/openvpn/socket=2Ec
M src/openvpn/ssl= _openssl=2Ec
M src/openvpn/win32=2Ec
M src/openvpnmsica/openvpnmsica= =2Ec
M src/tapctl/tap=2Ec
M tests/unit_tests/openvpn/test_ssl=2Ec
= 16 files changed, 43 insertions(+), 63 deletions(-)

git pull ssh://gerrit=2Eopenvpn=2Enet:29418/openvpn refs/changes/17/161=
7/22
diff --git a/dev-tools/cppcheck-suppression b/dev-tools/cppche=
ck-suppression
index e1ffe37=2E=2E299d7a3 100644
= --- a/dev-tools/cppcheck-suppression
+++ b/dev-tools/= cppcheck-suppression
@@ -5,9 +5,6 @@
const= ParameterPointer
invalidPrintfArgType_sint
invalidPrintfArgType_uint
-redundantAssignment
-redundantInitialization
-unreadVariable
unusedFunction
uslee= pCalled
variableScope
@@ -74,7 +71,7 @@
# IGN: strlen(NULL) is not nice code, but seems to work
nullPointerRedundantCheck:src/openvpn/init=2Ec:301
<= span> # FP: cppcheck doesn't understand ZeroMemory

-redundantAssignment:src/openvpnserv/intera= ctive=2Ec:203
+redund= antAssignment:src/openvpnserv/interactive=2Ec:204
# IGN: W= e reuse the same variable name due to macro usage
shadowVa= riable:src/openvpn/options=2Ec:1948
shadowVariable:src/ope= nvpn/options=2Ec:1966
diff --git a/src/openvpn/console_buil= tin=2Ec b/src/openvpn/console_builtin=2Ec
index 2a9f3b6=2E= =2E9c8d72a 100644
--- a/src/openvpn/console_builtin=2Ec
+++ b/src/openvpn/console_builtin=2Ec
@@ -192,= 7 +192,6 @@
static bool
get_console_input= (const char *prompt, const bool echo, char *input, const int capacity)
{
- boo= l ret =3D false;
ASSERT(prompt);
= ASSERT(input);
ASSERT(capacity > 0);
@@ -200,8 +199,11 @@


#if defined(_WIN3= 2)
return get_console_input_win32(prompt, echo, input,= capacity);
-#elif defi= ned(HAVE_TERMIOS_H)
+= #elif !defined(HAVE_TERMIOS_H)
+ msg(M_FATAL, "Sorry, but I can't get console input = on this OS (%s)", prompt);
+#else
bool restore_tty =3D false;+ bool ret =3D false;
struct termios tty_tmp, tty_save;
=
/* did we --daemon'ize before asking for passwords?
@@ -258,10 +260,8 @@
}

close_tty(fp);
-#else /* if defined(_WIN32) */
- msg(M_FATAL, "Sorry, but I can't get co= nsole input on this OS (%s)", prompt);
-#endif /* if defined(_WIN32) */
= return ret;
+#endif /= * if defined(_WIN32) */
}

/**

diff --git a/src/openvpn/crypto=2Ec b/src/openvpn/cr= ypto=2Ec
index 8bbc566=2E=2Ee5ad31a 100644
= --- a/src/openvpn/crypto=2Ec
+++ b/src/openvpn/crypto=2Ec
@@ -1204,8 +1204,6 @@
struct buffer wor= k =3D alloc_buf_gc(BUF_SIZE(frame), &gc);
struct b= uffer encrypt_workspace =3D alloc_buf_gc(BUF_SIZE(frame), &gc);<= br> struct buffer decrypt_workspace =3D alloc_buf_gc(BUF_SIZE(fra= me), &gc);
- str= uct buffer buf =3D clear_buf();
- void *buf_p;

/* init w= ork */
ASSERT(buf_init(&work, frame->buf=2Ehead= room));
@@ -1242,8 +1240,8 @@
prng= _bytes(BPTR(&src), BLEN(&src));

= /* copy source to input buf */
- buf =3D work;
- buf_p =3D buf_write_alloc(&buf, BLENZ(&src= ));
+ struct b= uffer buf =3D work;
+= void *buf_p =3D buf_write_alloc(&buf, BLENZ(&src));<= br> ASSERT(buf_p);
memcpy(buf_p, BPT= R(&src), BLENZ(&src));

diff --git= a/src/openvpn/error=2Eh b/src/openvpn/error=2Eh
index 4582= 6a2=2E=2Ea887fc7 100644
--- a/src/openvpn/error=2Eh<= br>+++ b/src/openvpn/error=2Eh
@@ -408,8 +408,8 @@
openvpn_errno_maybe_crt(bool *crt_error)
{<= /span>
int err =3D 0;
- *crt_error =3D false;
#ifdef _WIN32
+ *crt_error =3D false= ;
err =3D GetLastError();
if (err= =3D=3D ERROR_SUCCESS)
{
diff --git a/= src/openvpn/forward=2Ec b/src/openvpn/forward=2Ec
index ad4= 3d40=2E=2E83cd113 100644
--- a/src/openvpn/forward=2Ec
+++ b/src/openvpn/forward=2Ec
@@ -1746,7 +1746,= 6 @@
process_outgoing_link(struct context *c, struct link_= socket *sock)
{
struct gc_arena gc = =3D gc_new();
- int = error_code =3D 0;

if (c->c2=2Eto_= link=2Elen > 0 && c->c2=2Eto_link=2Elen <=3D c->c2=2Efr= ame=2Ebuf=2Epayload_size)
{
@@ -1821,7= +1820,7 @@
}

= /* Check return status */
- error_code =3D openvpn_errno();
+ int error_code =3D openvpn_errno();<= /span>
check_status(size, "write", sock, NULL);=

if (size > 0)
diff --git a/src/openvpn/manage=2Ec b/src/openvpn/manage=2Ec

index 3039f24=2E=2Ee121b38 100644

--- a/src/openvpn/man= age=2Ec
+++ b/src/openvpn/manage=2Ec
@@ -91= 6,10 +916,9 @@
static void
man_remote_ent= ry_count(struct management *man)
{
- unsigned count =3D 0;
= if (man->persist=2Ecallback=2Eremote_entry_count)
= {
- count =3D= (*man->persist=2Ecallback=2Eremote_entry_count)(man->persist=2Ecallb= ack=2Earg);
+ = unsigned int count =3D (*man->persist=2Ecallback=2Eremote_entry_count)(m= an->persist=2Ecallback=2Earg);
msg(M_CLIENT, &q= uot;%u", count);
msg(M_CLIENT, "END"= ;);
}
@@ -3743,7 +3742,6 @@
= struct gc_arena gc =3D gc_new();
int ret = =3D 0;
volatile int signal_received =3D 0;
<= span style=3D"color: hsl(0, 100%, 40%);">- struct buffer alert_msg =3D c= lear_buf();

const bool standalone_disabled_save =3D ma= n->persist=2Estandalone_disabled;
struct man_connec= tion *mc =3D &man->connection;

@@ = -3755,6 +3753,7 @@

*state =3D EK= S_SOLICIT;

+ struct buffer alert_msg;
if (b64_= data)
{
alert_msg =3D= alloc_buf_gc(strlen(b64_data) + strlen(prompt) + 3, &gc);
diff --git a/src/openvpn/options=2Ec b/src/openvpn/options=2Ec
index 25a3746=2E=2E15f2fcd 100644
--- a/src/openvpn= /options=2Ec
+++ b/src/openvpn/options=2Ec
= @@ -4157,8 +4157,7 @@
bool
key_is_externa= l(const struct options *options)
{
- bool ret =3D false;
- ret =3D ret || (options->managemen= t_flags & MF_EXTERNAL_KEY);
+ bool ret =3D options->management_flags & MF_EXTERNAL= _KEY;
#ifdef ENABLE_PKCS11
ret =3D re= t || (options->pkcs11_providers[0] !=3D NULL);
#endif
@@ -5697,7 +5696,6 @@
if (streq= (p[1], "FORWARD_COMPATIBLE") && p[2] && streq(p[2= ], "1"))
{
= options->forward_compatible =3D true;
- msglevel_fc =3D msglevel_forward= _compatible(options, msglevel);
}
setenv_str(es, p[1], p[2] ? p[2] : "");
}
diff --git a/src/openvpn/pkcs11=2Ec b/sr= c/openvpn/pkcs11=2Ec
index 8b06fd0=2E=2Ed7dee97 100644
--- a/src/openvpn/pkcs11=2Ec
+++ b/src/openvpn/= pkcs11=2Ec
@@ -80,6 +80,9 @@
static msglvl= _t
_pkcs11_msg_pkcs112openvpn(const unsigned flags)=
{
+#ifdef = ENABLE_PKCS11_FORCE_DEBUG
+ return M_INFO;
+#else
msglvl_t openvpn_flags;

switch (flags)
@@ -109,16 +112,16 @@
break;
}
<= /span>
-#if defined(ENABLE_PKC= S11_FORCE_DEBUG)
- o= penvpn_flags =3D M_INFO;
-
<= span> return openvpn_flags;

+#endif
}

st= atic unsigned
_pkcs11_msg_openvpn2pkcs11(const msglvl_t fl= ags)
{
+#ifdef ENABLE_PKCS11_FORCE_DEBUG
+ return PKCS11H_LOG_DEBUG2;
+#else
unsigned pkcs11_flag= s;

if ((flags & D_PKCS11_DEBUG) = !=3D 0)
@@ -146,11 +149,8 @@
pkcs1= 1_flags =3D PKCS11H_LOG_ERROR;
}

-#if defined(ENABLE_PKCS11= _FORCE_DEBUG)
- pkcs= 11_flags =3D PKCS11H_LOG_DEBUG2;
-#endif
-
return pkcs11_flags;
+#endif
}

static void

diff --git a/src/openvpn/pkcs11_openssl=2E= c b/src/openvpn/pkcs11_openssl=2Ec
index b6c1624=2E=2E69c5a= 50 100644
--- a/src/openvpn/pkcs11_openssl=2Ec
+++ b/src/openvpn/pkcs11_openssl=2Ec

@@ -384,7 +384,6 @= @
if (certificate !=3D NULL)
{
pkcs11h_certificate_freeCertificate(certificate);
- certificate =3D = NULL;
}

/*
@@ -400,7 +399,6 @@
if (openssl_session != =3D NULL)
{
pkcs11h_openssl_f= reeSession(openssl_session);
- openssl_session =3D NULL;
}
<= span> return ret;

#endif = /* ifdef HAVE_XKEY_PROVIDER */
= diff --git a/src/openvpn/push_util=2Ec b/src/openvpn/push_util=2Ecindex fcc5411=2E=2E0213041 100644
--- a/src/openvpn= /push_util=2Ec
+++ b/src/openvpn/push_util=2Ec
@@ -99,7 +99,6 @@

}

char *str =3D gc_strdup(s, gc);

- size_t i =3D 0;

= while (*str)
{
@@ -112,11 +111,11 @= @
/* if no commas were found go to fail, d= o not send any message */
return false;
}
+ /* copy from current position to (ci - 1) */ str[ci] =3D '\0';
- /* copy from i to (ci -1) */
= struct buffer tmp =3D forge_msg(str, ",push-continu= ation 2", gc);
buffer_list_push(msgs, BST= R(&tmp));
- = i =3D ci + 1;
+ = str +=3D ci + 1;
}
= else
{
@@ -130,9 +129,8 @@
struct buffer tmp =3D forge_msg(str, NULL, gc= );
buffer_list_push(msgs, BSTR(&tmp));=
}
- i =3D strlen(str);
+ break;
}- str =3D &str[i];
}
return true;
}<= /span>
diff --git a/src/openvpn/socket=2Ec b/src/openvpn/socket=2E= c
index f6ebf10=2E=2E41c8bac 100644
--- a/s= rc/openvpn/socket=2Ec
+++ b/src/openvpn/socket=2Ec@@ -790,7 +790,7 @@
*/
s= ocklen_t remote_len_af =3D af_addr_size(act->dest=2Eaddr=2Esa=2Esa_famil= y);
socklen_t remote_len =3D sizeof(act->dest=2Eadd= r);
- socket_descrip= tor_t new_sd =3D SOCKET_UNDEFINED;
+ socket_descriptor_t new_sd;

= CLEAR(*act);

diff --git a/src/= openvpn/ssl_openssl=2Ec b/src/openvpn/ssl_openssl=2Ec
index= 0b01634=2E=2E7cfe9f4 100644
--- a/src/openvpn/ssl_openssl= =2Ec
+++ b/src/openvpn/ssl_openssl=2Ec
@@ -= 2283,13 +2283,13 @@
}

int typeid =3D EVP_PKEY_id(pkey);

+
+#ifndef OPENSSL_NO_EC
#if OPENSSL_VERSION_NUMBER < 0x= 30000000L
bool is_ec =3D typeid =3D=3D EVP_PKEY_EC;
#else
bool is_ec =3D EVP_PKEY_is_a(pkey= , "EC");
#endif
-
-= #ifndef OPENSSL_NO_EC
char groupname[64];
if (is_ec)

{
@@ -2593,15 +259= 3,13 @@
"builtin EC curves=2E It does not = list additional curves nor X448 or X25519\n");
#ifnde= f OPENSSL_NO_EC
EC_builtin_curve *curves =3D NULL;
- size_t crv_len =3D 0;=
- size_t n =3D 0;

- c= rv_len =3D EC_get_builtin_curves(NULL, 0);
+ size_t crv_len =3D EC_get_builtin_curves(NULL, 0= );
ALLOC_ARRAY(curves, EC_builtin_curve, crv_len);
if (EC_get_builtin_curves(curves, crv_len))
{

printf("\nAvailable Elliptic curves= /groups:\n");
- = for (n =3D 0; n < crv_len; n++)
+ for (size_t n =3D 0; n < crv_len; n++)

{
const char *sname;
sname =3D OBJ_nid2sn(curves[n]=2Enid);
diff --git a/src/openvpn/win32=2Ec b/src/openvpn/win32=2Ec

index 94e79d5e=2E=2E618772d 100644
--- a/src/openvpn/wi= n32=2Ec
+++ b/src/openvpn/win32=2Ec
@@ -134= 0,9 +1340,6 @@
is_wow64_process2_t is_wow64_process2 = =3D
(is_wow64_process2_t)GetProcAddress(GetModuleH= andle("Kernel32=2Edll"), "IsWow64Process2");
=
- USHORT pro= cess_machine =3D 0;
- = USHORT native_machine =3D 0;
-
#ifdef _ARM64_
*process_arc= h =3D ARCH_ARM64;
#elif defined(_WIN64)
@@= -1350,6 +1347,8 @@
if (is_wow64_process2)
<= span> {
/* this could be amd64 on arm64 */
+ USHORT process_= machine =3D 0;
+ = USHORT native_machine =3D 0;
BOOL is_wow64 =3D = is_wow64_process2(GetCurrentProcess(), &process_machine, &native_ma= chine);
if (is_wow64 && native_machine =3D= =3D IMAGE_FILE_MACHINE_ARM64)
{
@@= -1362,6 +1361,8 @@
if (is_wow64_process2)
<= span> {

/* check if we're running on arm64= or amd64 machine */
= + USHORT process_machine =3D 0;
+ USHORT native_machine =3D 0;
= BOOL is_wow64 =3D is_wow64_process2(GetCurrentProcess(), &process= _machine, &native_machine);
if (is_wow64)
{
diff --git a/src/openvpnmsica/openvp= nmsica=2Ec b/src/openvpnmsica/openvpnmsica=2Ec
index 391100= 6=2E=2Ea861e8a 100644
--- a/src/openvpnmsica/openvpnmsica= =2Ec
+++ b/src/openvpnmsica/openvpnmsica=2Ec
@@ -711,7 +711,6 @@

uiResult =3D MsiViewFetch(hV= iewST, &hRecord);
if (uiResult =3D=3D ERROR_NO= _MORE_ITEMS)
{
- uiResult =3D ERROR_SUCCESS;
= break;
}
else= if (uiResult !=3D ERROR_SUCCESS)
diff --git a/src/tapctl/t= ap=2Ec b/src/tapctl/tap=2Ec
index 769df6c=2E=2Edd22cc5 1006= 44
--- a/src/tapctl/tap=2Ec
+++ b/src/tapct= l/tap=2Ec
@@ -473,7 +473,7 @@
= return ERROR_OUTOFMEMORY;
= }

- = dwCountExpResult =3D ExpandEnvironmentStrings(szValue, sz= ValueExp, dwCountExp);
- DWORD dwResult =3D ERROR_BAD_ARGUMENTS;
-
if (ppData =3D=3D NUL= L)
{
return ERROR_BAD_ARGUMEN= TS;
@@ -628,7 +626,7 @@
}
else
{
- dwResult =3D GetLastError();
+ DWORD dwResult =3D GetLastError()= ;
if (dwResult =3D=3D ERROR_INSUFFICIENT_BUFFER)
{
/* Allocate on heap = and retry=2E */
diff --git a/tests/unit_tests/openvpn/test_= ssl=2Ec b/tests/unit_tests/openvpn/test_ssl=2Ec
index fcebc= db=2E=2E4baf8cc 100644
--- a/tests/unit_tests/openvpn/test_= ssl=2Ec
+++ b/tests/unit_tests/openvpn/test_ssl=2Ec<= br>@@ -217,7 +217,7 @@

#if !define= d(HAVE_OPENSSL_STORE)
skip();
-#else /* HAVE_OPENSSL_STORE */
+#else /* HAVE_OPENSSL_STORE */

struct tls_root_ctx ctx =3D { 0 };

const char *certfile =3D global_state=2Ecertfile;@@ -228,9 +228,10 @@
struct buffer keyuri =3D = alloc_buf_gc(6 + strlen(keyfile) + 1, gc); /* 6 bytes for "file:/&qu= ot; */

/* Windows temp file path sta= rts with drive letter -- add a leading slash for URI */
- const char *lead =3D "";

#ifdef _WIN32
- lead =3D "/";
+ const char *lead =3D "/";
+#else
+ const char *lead =3D "";
#endif /* _WIN32 */
assert_true(buf_printf(&cert= uri, "file:%s%s", lead, certfile));
assert_t= rue(buf_printf(&keyuri, "file:%s%s", lead, keyfile));<= br>@@ -292,8 +293,6 @@
struct buffer work =3D al= loc_buf_gc(BUF_SIZE(&frame), &gc);
struct buff= er encrypt_workspace =3D alloc_buf_gc(BUF_SIZE(&frame), &gc);

struct buffer decrypt_workspace =3D alloc_buf_gc(BUF_SIZE(&= amp;frame), &gc);
-= struct buffer buf =3D clear_buf();
- void *buf_p;

/*= init work */
ASSERT(buf_init(&work, frame=2Ebuf= =2Eheadroom));
@@ -314,8 +313,8 @@
= prng_bytes(BPTR(&src), BLEN(&src));

/* copy source to input buf */
- buf =3D work;
- buf_p =3D buf_write_alloc(&buf, BLENZ(&am= p;src));
+ str= uct buffer buf =3D work;
+ void *buf_p =3D buf_write_alloc(&buf, BLENZ(&src));

ASSERT(buf_p);
memcpy(buf_p= , BPTR(&src), BLENZ(&src));

@@ -3= 45,7 +344,6 @@
struct buffer encrypt_workspace =3D all= oc_buf_gc(BUF_SIZE(&frame), &gc);
struct buffe= r decrypt_workspace =3D alloc_buf_gc(BUF_SIZE(&frame), &gc);=
struct buffer work =3D alloc_buf_gc(BUF_SIZE(&frame), &a= mp;gc);
- struct buf= fer buf =3D clear_buf();
struct buffer src =3D alloc_b= uf_gc(frame=2Ebuf=2Epayload_size, &gc);
void *buf_= p;

@@ -360,7 +358,7 @@
= prng_bytes(BPTR(&src), BLEN(&src));

= /* copy source to input buf */
- buf =3D work;
+ struct buffer buf =3D work;
buf_= p =3D buf_write_alloc(&buf, BLENZ(&src));
ASSE= RT(buf_p);
memcpy(buf_p, BPTR(&src), BLENZ(&sr= c));
@@ -641,7 +639,6 @@
struct buffer= work =3D alloc_buf_gc(BUF_SIZE(&frame), &gc);
= struct buffer encrypt_workspace =3D alloc_buf_gc(BUF_SIZE(&frame), &am= p;gc);
struct buffer decrypt_workspace =3D alloc_buf_g= c(BUF_SIZE(&frame), &gc);
- struct buffer buf =3D clear_buf();
voi= d *buf_p;

/* init work */
= @@ -658,7 +655,7 @@
ASSERT(buf_write(&src, p= laintext, strlen(plaintext)));

/* co= py source to input buf */
- buf =3D work;
+ struct buffer buf =3D work;
buf_p =3D buf_write_= alloc(&buf, BLENZ(&src));
ASSERT(buf_p);
memcpy(buf_p, BPTR(&src), BLENZ(&src));
<= span>

To view, visit change 1617=2E To unsubscribe, or = for help writing mail filters, visit settings=2E

Gerri= t-MessageType: newpatchset
Gerrit-Proje= ct: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id0caa497c4ff1ad8743cb23f3= 32f003b2d3393ed
Gerrit-Change-Number: 1= 617
Gerrit-PatchSet: 22
Gerrit-Owner: flichtenheld <frank@lichtenheld=2Ecom= >
Gerrit-Reviewer: cron2 <gert@gr= eenie=2Emuc=2Ede>
Gerrit-Reviewer: p= laisthos <arne-openvpn@rfc2549=2Eorg>
Gerrit-Reviewer: razvanc <razvanc@mailbox=2Eorg>
Gerrit-CC: openvpn-devel <openvpn-devel@lists=2Esou= rceforge=2Enet>
Gerrit-CC: stipa <= ;lstipakov@gmail=2Ecom>
--GPHy1IitD7w=-- --===============3232974718911179460== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============3232974718911179460== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel --===============3232974718911179460==--