From patchwork Tue Nov 3 12:40:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5579 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:4121:b0:118:2077:975e with SMTP id d33csp566151laa; Tue, 3 Nov 2026 04:40:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AKwUvBy4/ho81BiCz6w6e8CDU+GNS9QLrDh+vLnTW5BlQdBlxQ4sZ3vRL2lfyp4aWwpoHTyQ3fsc4sWYrqM=@openvpn.net X-Received: by 2002:a05:693c:415a:20b0:36a:50f2:a5a5 with SMTP id 5a478bee46e88-36a50f2a73emr17860583eec.2.1793709629012; Tue, 03 Nov 2026 04:40:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1793709629; cv=none; d=google.com; s=arc-20260327; b=ERUKDv0JLW+12lzzcxbtf4kozb+4l2Y7/p3F/gL0JkDd2F76G9wZMaxtbNA4OcpEvr QFI06sYau7wXFF4mS8hP0+aucDDVcU2obAnHpwlNwTx9gRokZXfoP5RFHMdnAxe2t3cq heXxmOnOfHSQGn6nAF1Baiha9i0R+AoAp/MTcKv9bCnMa05nCOgOOCg5AJ6jatVFCBFy //uuHznVQ5JVyZ989MVps2UvXinRRLDxv2y6KxE82y5F09QYAvnxWHcnUWwIUflGZz/B U+Q5csSHLqqO2ef6df2PbDjQUNglkYel23zVhacV064Si27XGrUJ6ZsYrOFG8YO+Hbs6 +Dog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; 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=043+iVBC1aTq3ibMS738qc22CNH952eWeGEaxYupn/4=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=E6ddmj+fqG4b+EyIWyMT2V4QebUjkrAsmRoPKoyNT+GYPJLCA6oi5TgQrAP8fxU+kM AQvyFA6WjJWifHz5xAeICwEDMv+XLgfxdiYfunjvQw9ZGbcUkwft37hUJRpQ89EtkcSP +YiPn2GXBp3lhGGYpEDuFAX2jqAfglm4IATMR97eh/AjH6ay22cI/mYHPZS8RvySKbFt OnvkGa+BsOuKuYVgSgPVU02FZchEkAfgJxKDKf2is6PLpfezogmAfA9M3s5LLnPWdIO+ zzCLJf8xwLnvYbbL9SlYu4AEXOErO+0p9va/lV/Y+Y0FBHH6Hzay/OlyDn1oT+56S2UP 2INQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=N8NHQonM; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="Ad/+Hysy"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=jpEY50wA; 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 5a478bee46e88-36a4281aadasi38377322eec.1.2026.11.03.04.40.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2026 04:40:29 -0800 (PST) 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=N8NHQonM; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="Ad/+Hysy"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=jpEY50wA; 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-Unsubscribe-Post: List-Owner; bh=043+iVBC1aTq3ibMS738qc22CNH952eWeGEaxYupn/4=; b=N8NHQonMjacIQ8 j3nnWAsa6o0eITbNa1bNYN1agugDKEKqzwVcRM4+SSyBYyJHmhdYBcqJG+R14UliIDqY2kpH68tXQ KxIWc/+PZmKf5B9fdhL5v/lQ/FjVnDWCanwx7iqb0JPcE+5FqZ4zmkKFy49m1m17ir7aavP/1ysL8 4n4=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xODoQ-000000000vs-20bG; Tue, 03 Nov 2026 12:40:26 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xODoN-000000000vj-2R1g for openvpn-devel@lists.sourceforge.net; Tue, 03 Nov 2026 12:40:23 +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-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=JMQnVYSjeX09C6XiR0Qlm7v1X82CwT4fN4Erv3zpAfo=; b=Ad/+Hysy2AuvfQKLPeSlcQq/kc QEHMeeVzUVdCBZ0wwmn/LClqrK1GyAPDh3bPXx/K18VbVO890kZwD3YN2DoCdNawYl3uG7IPwjFt7 K/bs1fERZzp9jPAG7dCAVYbhhwGzbBr3oxlosHiYIk4hWgqMZKkpYiF5Ufbll5bAj1zo=; 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-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=JMQnVYSjeX09C6XiR0Qlm7v1X82CwT4fN4Erv3zpAfo=; b=jpEY50wA1GOk7xbHXF6ZRKqj6Y 2a7yA7a7gvcwMcJBF226jzYg39typiyto9E5c63+AW6XDbucT+dS8p0JByIRuIzfPqySKvGxRi53c MRG21CpnAQs3KxaopxXtm2Ra80W6QAjkzKSPFUfCCT97aT3x+SwdvYo+LUzqK1ZuvPJ4=; Received: from [193.149.48.129] (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.100.1) id 1xODoK-000000003l6-03nG for openvpn-devel@lists.sourceforge.net; Tue, 03 Nov 2026 12:40:21 +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 6A3CeDNh004684 for ; Tue, 3 Nov 2026 13:40:13 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6A3CeD4m004683 for openvpn-devel@lists.sourceforge.net; Tue, 3 Nov 2026 13:40:13 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 3 Nov 2026 13:40:07 +0100 Message-ID: <20261103124012.4642-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.0 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: Razvan Cojocaru CLEAR() is a plain memset(), which the compiler may drop for stack variables that are not read afterwards. Use secure_memzero() for the derived send/recv data keys and the epoch keys freed in free_epo [...] 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: 1xODoK-000000003l6-03nG Subject: [Openvpn-devel] [PATCH v1] crypto_epoch: wipe key material with secure_memzero() 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: 1880840868133196148 X-GMAIL-MSGID: 1880840868133196148 From: Razvan Cojocaru CLEAR() is a plain memset(), which the compiler may drop for stack variables that are not read afterwards. Use secure_memzero() for the derived send/recv data keys and the epoch keys freed in free_epoch_key_ctx(). Change-Id: Ic7ca54d4e2ec667532c0052f110aaf2e9ad5bf82 Signed-off-by: Razvan Cojocaru Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2103 --- 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/+/2103 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/src/openvpn/crypto_epoch.c b/src/openvpn/crypto_epoch.c index 69a1852..35f9b55 100644 --- a/src/openvpn/crypto_epoch.c +++ b/src/openvpn/crypto_epoch.c @@ -181,7 +181,7 @@ init_key_bi_ctx_send(&co->key_ctx_bi.encrypt, &send_key, &co->epoch_key_type, name); reset_packet_id_send(&co->packet_id.send); - CLEAR(send_key); + secure_memzero(&send_key, sizeof(send_key)); } @@ -196,7 +196,7 @@ snprintf(name, sizeof(name), "Epoch Data key %" PRIu16, co->epoch_key_recv.epoch); init_key_bi_ctx_recv(ctx, &recv_key, &co->epoch_key_type, name); - CLEAR(recv_key); + secure_memzero(&recv_key, sizeof(recv_key)); } void @@ -346,8 +346,8 @@ free(co->epoch_data_keys_future); free_key_ctx(&co->epoch_retiring_data_receive_key); free(co->epoch_retiring_key_pid_recv.seq_list); - CLEAR(co->epoch_key_recv); - CLEAR(co->epoch_key_send); + secure_memzero(&co->epoch_key_recv, sizeof(co->epoch_key_recv)); + secure_memzero(&co->epoch_key_send, sizeof(co->epoch_key_send)); } void