From patchwork Thu Jan 9 21:28:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4045 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:1539:b0:5e7:b9eb:58e8 with SMTP id a25csp1598277mar; Thu, 9 Jan 2025 13:28:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUZ3noAUBat2TiurUA4QbqE6bTuKQT/bausu4ThyEq6NrUoq0x+7HFESWdMkR0vTcS1tkUISq0QJlM=@openvpn.net X-Google-Smtp-Source: AGHT+IHZmuhJuresKXbakYhy/h7AVWY1beadNvaBzxocO+mrEyjqMZSnchPv9w5J8EiMuZx6Is5D X-Received: by 2002:a05:6871:800a:b0:29e:3bea:7e60 with SMTP id 586e51a60fabf-2aa0698375emr4153631fac.38.1736458102813; Thu, 09 Jan 2025 13:28:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736458102; cv=none; d=google.com; s=arc-20240605; b=UcvM2kidCrU9z5j19yVxbL0ATjtFwfaCtT8POGZeyH8/F0VjfVNOMCQ9cqLoHaJIIx KtNscZ6LkDktXObG4uL2hyNpFHSd+Q5XKn2MWhisUtl5DWUZ5rbJkhl/eeWcTijb1F6W iSFdEpGj9c9RoEoWLhyzyBV9JozGoQZS2aEfF1kh263lpaqHnC7aMRG8mOZXxTURFBZZ LHDpysgP9RheO/lgJsYyz5AJZwK8k36UJJiC9FO2jQU9Md/JS84NaYZQg4Yi9o+lKDFd g+5UtYeBAl4pmIXOcysU1MJ/irVSgEbQTUNxKYDzW7sEwwKUbaNyzJeDtcKbnws7ZLj2 0EDA== 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; bh=nNC0p7jBEivylir3o8I8Hm3bjipNNrWtpZ6NRgq3z9k=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=JJtWB7n6dJ2acMbQsqCqLlDSdMl+HUSELb1NIFu/EBxKtnZwLo6lsZBZQEP+E5221t qRv00egcGuhn3f1qjD0GgC64dt0CGUV+MhRSD2Z6erzaA8XvYhag8/umzBzAlZLQ7nCf YyDI6jWl+Os2Zk/71x50COXWCiCEfxf2idYQnj02uE6d97PXvMuH+jk9Nv21HyK2N/wW iZUmfRHeLu77GR/GPS1jNkS4idhQQQ69OUF75D4YsKPQYq1r4RJ9IGeiaHTiKDRrhtYD DqPMN4a8shkwL3oozV82zZcZpHP7smx4Ia0N4Fs5u9BE2EgUqFQ674aeEOPdQR55XZVR /UIw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=PDu2Xoir; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="Vd/YwUrH"; 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 586e51a60fabf-2ad80a4d02dsi1336411fac.219.2025.01.09.13.28.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jan 2025 13:28:22 -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=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=PDu2Xoir; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="Vd/YwUrH"; 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 [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tW04f-0003PI-R1; Thu, 09 Jan 2025 21:28:17 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tW04f-0003P7-2A for openvpn-devel@lists.sourceforge.net; Thu, 09 Jan 2025 21:28:17 +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=UbR5mo7g8hGR98GYYIss2d7HF4/4XOSYPATKEHWc7KQ=; b=PDu2XoiryHbRiEgoF8o7KtfN0D kd0jCaTYrQaTYWDWa4I10OtGUT9aWpP+tzT56qTY1jaFCLIGO77KTvU8/Y66ZT++QlfPlh/LyRlzo x1t+rZ5sKLibtOgw5mD0XHCfcqjdQf2kqAHWbqGFIB/jPg+DWw8WIBcSvv4j2wvMObYY=; 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=UbR5mo7g8hGR98GYYIss2d7HF4/4XOSYPATKEHWc7KQ=; b=Vd/YwUrHOxrT28FON2UMp5Rn3O qxtQD7suZdknEN6gUv2nfkQjv8NBPlYiisyWBcTm3VTcDEewMm2xLR7rQKJXTjlfUuC5PiGAnaEEk +rWbNMiadAGP99Le//qneMcC5Gv1I+NE53RAQVjCHPH5kh0ZFrgvlKUD6RRaz317S34I=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] 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 1tW04d-0007pO-QV for openvpn-devel@lists.sourceforge.net; Thu, 09 Jan 2025 21:28:16 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 509LS4gM011516 for ; Thu, 9 Jan 2025 22:28:04 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 509LS4pi011515 for openvpn-devel@lists.sourceforge.net; Thu, 9 Jan 2025 22:28:04 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 9 Jan 2025 22:28:03 +0100 Message-ID: <20250109212803.11505-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", 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: Arne Schwabe Since we introduce aead at the end and epoch data keys together and only allow the aead tag at the end if epoch data keys are used, we can use just one flag for both of them Content analysis details: (0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in bl.score.senderscore.com] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1tW04d-0007pO-QV Subject: [Openvpn-devel] [PATCH v12] Rename aead-tag-at-end to aead-epoch 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?1820808291706884809?= X-GMAIL-MSGID: =?utf-8?q?1820808291706884809?= From: Arne Schwabe Since we introduce aead at the end and epoch data keys together and only allow the aead tag at the end if epoch data keys are used, we can use just one flag for both of them Change-Id: I9e9433b56dcbaa538d9bed30e50cf74948c647cc Signed-off-by: Arne Schwabe Acked-by: MaxF --- 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/+/805 This mail reflects revision 12 of this Change. Acked-by according to Gerrit (reflected above): MaxF diff --git a/doc/man-sections/client-options.rst b/doc/man-sections/client-options.rst index 5ca85e0..0aee9e2 100644 --- a/doc/man-sections/client-options.rst +++ b/doc/man-sections/client-options.rst @@ -367,6 +367,7 @@ - bit 7: The client is capable of sending exit notification via control channel using ``EXIT`` message. Also, the client is accepting the protocol-flags pushed option for the EKM capability - bit 8: The client is capable of accepting ``AUTH_FAILED,TEMP`` messages - bit 9: The client is capable of dynamic tls-crypt + - bit 10: The client is capable of data epoch keys :code:`IV_NCP=2` Negotiable ciphers, client supports ``--cipher`` pushed by diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index b107f88..84ec436 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -127,7 +127,7 @@ dmsg(D_PACKET_CONTENT, "ENCRYPT AD: %s", format_hex(BPTR(&work), BLEN(&work), 0, &gc)); - if (!(opt->flags & CO_AEAD_TAG_AT_THE_END)) + if (!(opt->flags & CO_EPOCH_DATA_KEY_FORMAT)) { /* Reserve space for authentication tag */ mac_out = buf_write_alloc(&work, mac_len); @@ -148,7 +148,7 @@ ASSERT(buf_inc_len(&work, outlen)); /* if the tag is at end the end, allocate it now */ - if (opt->flags & CO_AEAD_TAG_AT_THE_END) + if (opt->flags & CO_EPOCH_DATA_KEY_FORMAT) { /* Reserve space for authentication tag */ mac_out = buf_write_alloc(&work, mac_len); @@ -479,7 +479,7 @@ uint8_t *tag_ptr = NULL; int data_len = 0; - if (opt->flags & CO_AEAD_TAG_AT_THE_END) + if (opt->flags & CO_EPOCH_DATA_KEY_FORMAT) { data_len = BLEN(buf) - tag_size; tag_ptr = BPTR(buf) + data_len; diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h index a98dca0..b58e4ef 100644 --- a/src/openvpn/crypto.h +++ b/src/openvpn/crypto.h @@ -373,9 +373,11 @@ /**< Bit-flag indicating that renegotiations are using tls-crypt * with a TLS-EKM derived key. */ -#define CO_AEAD_TAG_AT_THE_END (1<<8) - /**< Bit-flag indicating that the AEAD tag is at the end of the - * packet. +#define CO_EPOCH_DATA_KEY_FORMAT (1<<8) + /**< Bit-flag indicating the epoch the data format. This format + * has the AEAD tag is at the end of the packet and using a longer + * 64-bit packet id that is split into a 16 bit epoch and 48 bit + * epoch counter */ unsigned int flags; /**< Bit-flags determining behavior of diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 2bd5518..9d1048c 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2407,9 +2407,9 @@ { buf_printf(&out, " dyn-tls-crypt"); } - if (o->imported_protocol_flags & CO_AEAD_TAG_AT_THE_END) + if (o->imported_protocol_flags & CO_EPOCH_DATA_KEY_FORMAT) { - buf_printf(&out, " aead-tag-end"); + buf_printf(&out, " aead-epoch"); } } diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 1c35d67..eb0d9b5 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -8659,9 +8659,9 @@ options->imported_protocol_flags |= CO_USE_DYNAMIC_TLS_CRYPT; } #endif - else if (streq(p[j], "aead-tag-end")) + else if (streq(p[j], "aead-epoch")) { - options->imported_protocol_flags |= CO_AEAD_TAG_AT_THE_END; + options->imported_protocol_flags |= CO_EPOCH_DATA_KEY_FORMAT; } else { diff --git a/src/openvpn/push.c b/src/openvpn/push.c index de44eb2..a7cd3bf 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -689,9 +689,9 @@ buf_printf(&proto_flags, " dyn-tls-crypt"); } - if (o->imported_protocol_flags & CO_AEAD_TAG_AT_THE_END) + if (o->imported_protocol_flags & CO_EPOCH_DATA_KEY_FORMAT) { - buf_printf(&proto_flags, " aead-tag-end"); + buf_printf(&proto_flags, " aead-epoch"); } if (buf_len(&proto_flags) > 0) diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.h index 3561c41..c32cb6c 100644 --- a/src/openvpn/ssl.h +++ b/src/openvpn/ssl.h @@ -108,6 +108,9 @@ /** Support to dynamic tls-crypt (renegotiation with TLS-EKM derived tls-crypt key) */ #define IV_PROTO_DYN_TLS_CRYPT (1<<9) +/** Support the extended packet id and epoch format for data channel packets */ +#define IV_PROTO_DATA_EPOCH (1<<10) + /** Supports the --dns option after all the incompatible changes */ #define IV_PROTO_DNS_OPTION_V2 (1<<11) diff --git a/tests/unit_tests/openvpn/test_ssl.c b/tests/unit_tests/openvpn/test_ssl.c index caacd9e..845ca56 100644 --- a/tests/unit_tests/openvpn/test_ssl.c +++ b/tests/unit_tests/openvpn/test_ssl.c @@ -404,7 +404,7 @@ run_data_channel_with_cipher_end(const char *cipher) { struct crypto_options co = init_crypto_options(cipher, "none"); - co.flags |= CO_AEAD_TAG_AT_THE_END; + co.flags |= CO_EPOCH_DATA_KEY_FORMAT; do_data_channel_round_trip(&co); uninit_crypto_options(&co); }