From patchwork Thu Jun 23 22:38:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2539 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director14.mail.ord1d.rsapps.net ([172.30.191.6]) by backend41.mail.ord1d.rsapps.net with LMTP id SC2eLYJ/tWI4XgAAqwncew (envelope-from ) for ; Fri, 24 Jun 2022 05:10:26 -0400 Received: from proxy8.mail.ord1d.rsapps.net ([172.30.191.6]) by director14.mail.ord1d.rsapps.net with LMTP id 4OB1LYJ/tWJAaAAAeJ7fFg (envelope-from ) for ; Fri, 24 Jun 2022 05:10:26 -0400 Received: from smtp19.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy8.mail.ord1d.rsapps.net with LMTPS id kDZcLYJ/tWKkTQAAGdz6CA (envelope-from ) for ; Fri, 24 Jun 2022 05:10:26 -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: smtp19.gate.ord1d.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=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: 7bfdc8ac-f39d-11ec-bb18-525400d67fa8-1-1 Received: from [216.105.38.7] ([216.105.38.7:35496] helo=lists.sourceforge.net) by smtp19.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 3F/9E-02364-28F75B26; Fri, 24 Jun 2022 05:10:26 -0400 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.94.2) (envelope-from ) id 1o4fJl-0002Rd-9l; Fri, 24 Jun 2022 09:09:34 +0000 Received: from [172.30.20.202] (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.94.2) (envelope-from ) id 1o4fJk-0002RR-0Q for openvpn-devel@lists.sourceforge.net; Fri, 24 Jun 2022 09:09:32 +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:Cc:To:From:Sender:Reply-To: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=XtbobsGuFAqWRiDY4FJTDIYq+YuMoLPmFWzcUTmrAB8=; b=MbguPdzYieUF7E6cS6+cc3XZOq WQPeClO0XKWH8RkX7BSxsmA5WOmnzC5oZtcrGmNgshjFfi5LvINWjvdA06LUMSHXPuOrr5jbHCNCA kIo/aDriV2rxRz/idsEBx46YUPaDfpzFZjy7epULSKZI3TnjMTrfT6qTgdN344vjkjG0=; 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:Cc:To:From:Sender:Reply-To: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=XtbobsGuFAqWRiDY4FJTDIYq+YuMoLPmFWzcUTmrAB8=; b=gI4wHzDUVrPgylNXq9Bdgnaktg ZDsUiqVdOjpRi772XA7iLyFnJbh5WhoLx4T5sxNj82hxHQbQ/ovuRQslOtemutlSP5X3E+9gRp/8W 0o44+JHkFE1uZX7IPvMAJMHXGqv1KmY1biECoNbaFsw8od+lcaVPzIMJj5bw6QqCqUuU=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1o4fJe-00C431-UR for openvpn-devel@lists.sourceforge.net; Fri, 24 Jun 2022 09:09:27 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Fri, 24 Jun 2022 10:38:02 +0200 Message-Id: <20220624083809.23487-19-a@unstable.cc> In-Reply-To: <20220624083809.23487-1-a@unstable.cc> References: <20220624083809.23487-1-a@unstable.cc> MIME-Version: 1.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: Other platforms may need more complex logic to decide whether a cipher is supported or not, therefore turn hardcoded list into a function that can be implemented by each platform independently. Signed-off-by: Lev Stipakov Signed-off-by: Antonio Quartulli --- src/openvpn/dco.c | 4 ++-- src/openvpn/dco.h | 13 +++++++++++++ src/openvpn/dco_linux.c | 6 ++++++ sr [...] Content analysis details: (-0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1o4fJe-00C431-UR Subject: [Openvpn-devel] [PATCH 18/25] dco: turn supported ciphers list into a function 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: , Cc: Lev Stipakov , Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox Other platforms may need more complex logic to decide whether a cipher is supported or not, therefore turn hardcoded list into a function that can be implemented by each platform independently. Signed-off-by: Lev Stipakov Signed-off-by: Antonio Quartulli Acked-by: Heiko Hund --- src/openvpn/dco.c | 4 ++-- src/openvpn/dco.h | 13 +++++++++++++ src/openvpn/dco_linux.c | 6 ++++++ src/openvpn/dco_linux.h | 1 - 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c index 48e007ea..1612a64e 100644 --- a/src/openvpn/dco.c +++ b/src/openvpn/dco.c @@ -236,7 +236,7 @@ dco_check_option_conflict(int msglevel, const struct options *o) /* At this point the ciphers have already been normalised */ if (o->enable_ncp_fallback - && !tls_item_in_cipher_list(o->ciphername, DCO_SUPPORTED_CIPHERS)) + && !tls_item_in_cipher_list(o->ciphername, dco_get_supported_ciphers())) { msg(msglevel, "Note: --data-cipher-fallback with cipher '%s' " "disables data channel offload.", o->ciphername); @@ -288,7 +288,7 @@ dco_check_option_conflict(int msglevel, const struct options *o) const char *token; while ((token = strsep(&tmp_ciphers, ":"))) { - if (!tls_item_in_cipher_list(token, DCO_SUPPORTED_CIPHERS)) + if (!tls_item_in_cipher_list(token, dco_get_supported_ciphers())) { msg(msglevel, "Note: cipher '%s' in --data-ciphers is not supported " "by ovpn-dco, disabling data channel offload.", token); diff --git a/src/openvpn/dco.h b/src/openvpn/dco.h index 4b945b50..66ae444f 100644 --- a/src/openvpn/dco.h +++ b/src/openvpn/dco.h @@ -200,6 +200,13 @@ void dco_install_iroute(struct multi_context *m, struct multi_instance *mi, */ void dco_delete_iroutes(struct multi_context *m, struct multi_instance *mi); +/** + * Retrieve the list of ciphers supported by the current platform + * + * @return list of colon-separated ciphers + */ +const char *dco_get_supported_ciphers(); + #else /* if defined(ENABLE_DCO) */ typedef void *dco_context_t; @@ -301,5 +308,11 @@ dco_delete_iroutes(struct multi_context *m, struct multi_instance *mi) { } +static inline const char * +dco_get_supported_ciphers() +{ + return ""; +} + #endif /* defined(ENABLE_DCO) */ #endif /* ifndef DCO_H */ diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 5e77139a..f86ea819 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -931,4 +931,10 @@ dco_event_set(dco_context_t *dco, struct event_set *es, void *arg) } } +const char * +dco_get_supported_ciphers() +{ + return "AES-128-GCM:AES-256-GCM:AES-192-GCM:CHACHA20-POLY1305"; +} + #endif /* defined(ENABLE_DCO) && defined(TARGET_LINUX) */ diff --git a/src/openvpn/dco_linux.h b/src/openvpn/dco_linux.h index e0e59fa6..416ea30a 100644 --- a/src/openvpn/dco_linux.h +++ b/src/openvpn/dco_linux.h @@ -34,7 +34,6 @@ typedef enum ovpn_key_slot dco_key_slot_t; typedef enum ovpn_cipher_alg dco_cipher_t; -#define DCO_SUPPORTED_CIPHERS "AES-128-GCM:AES-256-GCM:AES-192-GCM:CHACHA20-POLY1305" typedef struct {