From patchwork Thu Apr 8 04:02:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1728 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director15.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id cEkHNT8Nb2B0ZgAAIUCqbw (envelope-from ) for ; Thu, 08 Apr 2021 10:03:43 -0400 Received: from proxy19.mail.iad3b.rsapps.net ([172.31.255.6]) by director15.mail.ord1d.rsapps.net with LMTP id MKTJND8Nb2ABFgAAIcMcQg (envelope-from ) for ; Thu, 08 Apr 2021 10:03:43 -0400 Received: from smtp31.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy19.mail.iad3b.rsapps.net with LMTPS id qK/ZLT8Nb2CobAAAIG4riQ (envelope-from ) for ; Thu, 08 Apr 2021 10:03:43 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp31.gate.iad3b.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: 39bf0d06-9873-11eb-bd5f-52540005277f-1-1 Received: from [216.105.38.7] ([216.105.38.7:40272] helo=lists.sourceforge.net) by smtp31.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id C4/1C-29892-E3D0F606; Thu, 08 Apr 2021 10:03:43 -0400 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.90_1) (envelope-from ) id 1lUVFM-0005um-WF; Thu, 08 Apr 2021 14:03:01 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUVFK-0005uC-6b for openvpn-devel@lists.sourceforge.net; Thu, 08 Apr 2021 14:02:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:To: From:Sender:Reply-To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: 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=pkEg2eBe1Rhd1zZvr0pTgYP3fP/OH3tAVLLTrWvQC/0=; b=EaVhFl0hZU9KNn8SQ3SDfLUW0P LH/C9EFHccdd0pOEvAkF+IO92Nck9jfLeG4BRtdDRwVGwT9gU8rL517tSD4auvwMXmyF/+0xdlDKg ciKaNYMC1t17mwGF6wBlhLRn5qrgtV9XgXF/eIgtdkCbuUeJj2ppoxLhrP9qUdkWDQqo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc :MIME-Version:Content-Type:Content-Transfer-Encoding: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=pkEg2eBe1Rhd1zZvr0pTgYP3fP/OH3tAVLLTrWvQC/0=; b=OgawMXHygD/UKkgRrwWleFLrX1 zXSBNQF+5rkjt8u2O/Kt3ca0yqcq2rBj4s5pXlWiwBmavJRPTh+VgbZdjZpA1KBByl1mn3/dG+Pj2 CzVSFjnOQLplPWEkwiMsHRXzkfhWfY1TzkfDQKXyOdFoVbOZfOF+Ck2tFwvv8d3XpzTY=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lUVF4-0002nW-RB for openvpn-devel@lists.sourceforge.net; Thu, 08 Apr 2021 14:02:57 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1lUVEr-000DZD-9z for openvpn-devel@lists.sourceforge.net; Thu, 08 Apr 2021 16:02:29 +0200 Received: (nullmailer pid 31872 invoked by uid 10006); Thu, 08 Apr 2021 14:02:29 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 8 Apr 2021 16:02:26 +0200 Message-Id: <20210408140229.31824-2-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210408140229.31824-1-arne@rfc2549.org> References: <20210408140229.31824-1-arne@rfc2549.org> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 TIME_LIMIT_EXCEEDED Exceeded time limit / deadline X-Headers-End: 1lUVF4-0002nW-RB Subject: [Openvpn-devel] [PATCH 1/3] Change options->data_channel_use_ekm to flags 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox Instead maintaining two different representation of the data channel options in struct options and struct tls_options, use the same flags variable that tls_options uses. Signed-off-by: Arne Schwabe Acked-by: Antonio Quartulli --- src/openvpn/multi.c | 5 ++++- src/openvpn/options.c | 4 ++-- src/openvpn/options.h | 4 ++-- src/openvpn/push.c | 2 +- src/openvpn/ssl.c | 6 ++---- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index d5f34c349..e6eb34bfb 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -1783,7 +1783,10 @@ multi_client_set_protocol_options(struct context *c) } #ifdef HAVE_EXPORT_KEYING_MATERIAL - o->data_channel_use_ekm = (proto & IV_PROTO_TLS_KEY_EXPORT); + if (proto & IV_PROTO_TLS_KEY_EXPORT) + { + o->data_channel_crypto_flags |= CO_USE_TLS_KEY_MATERIAL_EXPORT; + } #endif /* Select cipher if client supports Negotiable Crypto Parameters */ diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 9e61b1e05..24d722fd5 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3651,7 +3651,7 @@ pre_pull_restore(struct options *o, struct gc_arena *gc) o->push_continuation = 0; o->push_option_types_found = 0; - o->data_channel_use_ekm = false; + o->data_channel_crypto_flags = 0; } /** @@ -7949,7 +7949,7 @@ add_option(struct options *options, #ifdef HAVE_EXPORT_KEYING_MATERIAL if (streq(p[1], "tls-ekm")) { - options->data_channel_use_ekm = true; + options->data_channel_crypto_flags |= CO_USE_TLS_KEY_MATERIAL_EXPORT; } else #endif diff --git a/src/openvpn/options.h b/src/openvpn/options.h index 65e5ffccf..b80cd3d1b 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -651,8 +651,8 @@ struct options * to the routing tables that would move packets into the tunnel. */ bool allow_recursive_routing; - /* Use RFC5705 key export to generate data channel keys */ - bool data_channel_use_ekm; + /* data channel crypto flags set by push/pull. Reuses the CO_* crypto_flags */ + unsigned int data_channel_crypto_flags; }; #define streq(x, y) (!strcmp((x), (y))) diff --git a/src/openvpn/push.c b/src/openvpn/push.c index 15a9141ee..2e92d8ee2 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -595,7 +595,7 @@ prepare_push_reply(struct context *c, struct gc_arena *gc, { push_option_fmt(gc, push_list, M_USAGE, "cipher %s", o->ciphername); } - if (o->data_channel_use_ekm) + if (o->data_channel_crypto_flags & CO_USE_TLS_KEY_MATERIAL_EXPORT) { push_option_fmt(gc, push_list, M_USAGE, "key-derivation tls-ekm"); } diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index d8662d000..5d65c3da5 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -1860,10 +1860,8 @@ tls_session_update_crypto_params(struct tls_session *session, return false; } - if (options->data_channel_use_ekm) - { - session->opt->crypto_flags |= CO_USE_TLS_KEY_MATERIAL_EXPORT; - } + /* Import crypto settings that might be set by pull/push */ + session->opt->crypto_flags |= options->data_channel_crypto_flags; if (strcmp(options->ciphername, session->opt->config_ciphername)) {