From patchwork Fri Sep 26 16:51:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4456 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:7505:b0:72f:f16c:e055 with SMTP id r5csp889841mai; Fri, 26 Sep 2025 09:52:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXIXTQuCh2P6+11aMzk54Qm1PDejfX3s5F6CfobfAbbw764DHCXHD0xvBEUi1LKvMhppA8GgmSoeDM=@openvpn.net X-Google-Smtp-Source: AGHT+IHk4kfMmQQr1pG55LnGPtYxOHAEts1RtC10g9pzEvhkHcY6BUsWGmZ26ERJc4hLLKEWdiH7 X-Received: by 2002:a05:6830:915:b0:7aa:4e01:f57d with SMTP id 46e09a7af769-7aa4e01f655mr1622750a34.18.1758905522773; Fri, 26 Sep 2025 09:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1758905522; cv=none; d=google.com; s=arc-20240605; b=WJk2DxT69NZS8aZC5IWOlzEg8w9RYq+UfeVwCW/FUSNfFPy2yeBPIrYR7Wrj1bC42c wxCnkzkgvVMHEbLIErcxDRHdt1tzGShRWspGfjiW0aCkZFYu/IB/ENw3g0Unln0O4ZE/ hu28Ja6XhwxNGAIHys9Jr8IsYoTvO+1o4SI2+1rGkhifxFL7irPnfs9pzrPKdQ4cv+KE K6Xr0ohM2hCv67n5bcbBwPZeOpJQ6OiMvOVrDS9QyEQhsichvb9vN3GIlyeAsD9ApXMU jTDg/jYkXsk99ZvLTF9cRyBrAQ1wIoHdMrNJe8C/FnxTd+ZKTPc9bipJ+lMkzkFdPgZG exUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=kbCBvliQHEH/xmsgR+Ro+YU9ds31JwQBGh9VvuWAaTA=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=RQ/wiO+UHbp33wYUENiMT11hOuobSgmtHrI4L7nWsQcuret9bNkp9Ad805pVcXot82 +hJvimzT2MUsWOwvOeHWK+CWPkOdcuaaZiNKHm1tkWmVIfjD9gIhaAbmeXlspbv2ihmS DdPJhIPZxz4toW2V/j/odnXOQ4N8K6O7HluGC9Wqt7zkLJvBcw6RdKUp1qPtgB/2rLW0 0DsAtCGC4Bvp+UliQ6/+C4Zn7pJiCXXlkWj0iqhikgw6UJ37o7d6v0FybnpYs7EGeTPF FUWL5oh0tl7JEhRinifPIz2jK8D6AU2seT28+ov7KKTU+PU1HtEIQkRj9xnG4LVP1eoa ZG3w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=V58ehaJw; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=QkBUtGqr; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=RFTgnziW; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 46e09a7af769-7a2422798b0si1099126a34.475.2025.09.26.09.52.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Sep 2025 09:52:01 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=V58ehaJw; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=QkBUtGqr; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=RFTgnziW; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kbCBvliQHEH/xmsgR+Ro+YU9ds31JwQBGh9VvuWAaTA=; b=V58ehaJwmXkNXGADhnbOjuxaoK 5WqyywTq/oXJuy9mWzWpvA3xdGx8DtW+PQX1BQClR4f7VVlU8kIgpd2/ugNrXLXuYQGy2eGAwGzog 2kjUdm1Hn7C80OBHnUvJLmXB+4f8sk3Qx/g5okPhZppyaWB2V3ri3lQN1m1STL/ne+D0=; 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 1v2Bfs-0000YH-0R; Fri, 26 Sep 2025 16:52:00 +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 1v2Bfr-0000YB-E2 for openvpn-devel@lists.sourceforge.net; Fri, 26 Sep 2025 16:51:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Vca52Qmv3k9h01J1qzrU/atdCPjU4/r5eeX+JTXkmQs=; b=QkBUtGqrsEe+TZ8ri2kY45UWlV /DuEX9LrGn/tq5g6LflvpN+1H97tF2aqp5WsKqgc0sHRPrtAB8IWnMWsG9399kPshPkHe1v3hGbXt QaNBdMmCo45UVdrCReV6grwqmuWEUmT/kXOnFyFaPE/RgOfhq2SqxKl8rVB1qerMpIwA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Vca52Qmv3k9h01J1qzrU/atdCPjU4/r5eeX+JTXkmQs=; b=RFTgnziW0+26/xEqrC+OMlp5fo RdukMqMrKSk0X1EbZtbRphsCluGuJkiiPddJJIBVIGK3H33AzYzLyzSn/Cvi7xlHqEBAXPuMPZxm5 xnNFo1oTy/Aq+9xk8Oa84xfZ/qeM8GNNy4rIbkLWfIHonbsjh+UWeVFJ6Z95B7aGR3Ts=; Received: from [193.149.48.134] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1v2Bfq-0000ZW-Jw for openvpn-devel@lists.sourceforge.net; Fri, 26 Sep 2025 16:51:59 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 58QGpqf8001521 for ; Fri, 26 Sep 2025 18:51:52 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 58QGpqUD001520 for openvpn-devel@lists.sourceforge.net; Fri, 26 Sep 2025 18:51:52 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Fri, 26 Sep 2025 18:51:46 +0200 Message-ID: <20250926165151.1502-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Frank Lichtenheld And make all casts explicit so that compiler doesn't complain. Change-Id: I612bf3b1c56d70a89fc04fad6fe36fd9fadfd258 Signed-off-by: Frank Lichtenheld Acked-by: MaxF Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/ [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1v2Bfq-0000ZW-Jw Subject: [Openvpn-devel] [PATCH v1] dco_win: In dco_new_key, document size assumptions for the integer casts 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1844346116297280590?= X-GMAIL-MSGID: =?utf-8?q?1844346116297280590?= From: Frank Lichtenheld And make all casts explicit so that compiler doesn't complain. Change-Id: I612bf3b1c56d70a89fc04fad6fe36fd9fadfd258 Signed-off-by: Frank Lichtenheld Acked-by: MaxF Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1221 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1221 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): MaxF diff --git a/src/openvpn/dco_win.c b/src/openvpn/dco_win.c index 9e52859..7dd43d6 100644 --- a/src/openvpn/dco_win.c +++ b/src/openvpn/dco_win.c @@ -525,11 +525,6 @@ return 0; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - int dco_new_key(dco_context_t *dco, unsigned int peerid, int keyid, dco_key_slot_t slot, const uint8_t *encrypt_key, const uint8_t *encrypt_iv, const uint8_t *decrypt_key, @@ -540,21 +535,23 @@ const int nonce_len = 8; size_t key_len = cipher_kt_key_size(ciphername); + ASSERT(key_len <= 32); OVPN_CRYPTO_DATA crypto_data; ZeroMemory(&crypto_data, sizeof(crypto_data)); crypto_data.CipherAlg = dco_get_cipher(ciphername); - crypto_data.KeyId = keyid; + ASSERT(keyid > 0 && keyid <= UCHAR_MAX); + crypto_data.KeyId = (unsigned char)keyid; crypto_data.PeerId = peerid; crypto_data.KeySlot = slot; CopyMemory(crypto_data.Encrypt.Key, encrypt_key, key_len); - crypto_data.Encrypt.KeyLen = (char)key_len; + crypto_data.Encrypt.KeyLen = (unsigned char)key_len; CopyMemory(crypto_data.Encrypt.NonceTail, encrypt_iv, nonce_len); CopyMemory(crypto_data.Decrypt.Key, decrypt_key, key_len); - crypto_data.Decrypt.KeyLen = (char)key_len; + crypto_data.Decrypt.KeyLen = (unsigned char)key_len; CopyMemory(crypto_data.Decrypt.NonceTail, decrypt_iv, nonce_len); ASSERT(crypto_data.CipherAlg > 0); @@ -570,10 +567,6 @@ return 0; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - int dco_del_key(dco_context_t *dco, unsigned int peerid, dco_key_slot_t slot) {