From patchwork Fri Oct 18 02:00:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "plaisthos (Code Review)" X-Patchwork-Id: 3899 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:29d4:b0:5b9:581e:f939 with SMTP id g20csp611299max; Thu, 17 Oct 2024 19:01:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW6Xmq0O+33VrAq1uSExQHxV+yl9Ucjl1n0Nt0IE8jMswkjRZ3tgCk8i1i2gVxwRnHV6Ifd33lw1Co=@openvpn.net X-Google-Smtp-Source: AGHT+IGIUruZ7MDGHFY8TO6KyxGgNBqLCjE0lNpumXEob6rLkFtdCX6hGK5YBPYIq8fTmSSJ8qWo X-Received: by 2002:a05:6602:6b89:b0:83a:942d:7ded with SMTP id ca18e2360f4ac-83aba5f08bfmr75316339f.6.1729216865787; Thu, 17 Oct 2024 19:01:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729216865; cv=none; d=google.com; s=arc-20240605; b=i/P9TAG3EWPZJttPiKB0bc8M3CIXKwKjSL50cOJv2dDbQ+jVfKch85MHhgQIkSYhql +K2o1Czi4BHRxFeFmhlazk0iSaVVzeJqvlfxLew+Zsquyl928izwTO3k4OM5OjSpvO7D 5b3J2so5VFdN7fSgXkZTbzmTjt1aM/fQwHh3a+f6KlhE7KIME52zQ8hW685+PDQ+/xXM y9AwhgmgWp5Gw8W7cJhBKH7TMeFHUfLxedKtj7N8RO32y7S9YBW9/gjgABrUmBZkv3qH /V1q1lju/sYeYdk1pGbUvypOXIoiX/8o86666blwCyyJqkqPR7vhBd0YQRiRyjxxXxw4 BRog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :mime-version:message-id:references:auto-submitted:to:date:from :dkim-signature:dkim-signature:dkim-signature; bh=X8d1hx2fmZ2rOZClnqIO8RtDDBda/x2sGQuVYXD0y7Y=; fh=lm0MLPW7DntlrDqRECIiC9JlE1uPxhepE0URYHIf+eE=; b=BomCzS7R3LDkmuiWz8JtM50ytdQjLL9NRlBcMT0NdZ08TSz4FDiHI5XmqXB0pUbhTR nlCmkjje5JPEahaV9ZVs6mgkGCGhOfj8cIZlF7KIhQA4SRPt9hrxZ9KHX7gJFdhD3O1f gRborrtvWesSCZBPITh/xK+ZJtPcC0FuBSe8E+G3U/4yeHCKwGYF7OZ4O/yBLfiJzyDe uC9ku2wZSuvl0zlyI5aWQCoDq3LwwY0ejiGeFWfbdRm/6/AxXshPlF0NEspj1EMD+9Rh gETFfaYRZslf4hxqSK4fPkKp6dTxHzN66zG2RYmsImEOfDEX9mjYkbpmm/9W6rT/YhgV pJBQ==; 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=IINZGT8g; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Z+EpSwei; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=JFqAeWgc; 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=openvpn.net; dara=fail header.i=@openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 8926c6da1cb9f-4dc10b5b162si308395173.26.2024.10.17.19.01.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Oct 2024 19:01:05 -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=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=IINZGT8g; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Z+EpSwei; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=JFqAeWgc; 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=openvpn.net; dara=fail header.i=@openvpn.net 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 1t1cIU-0001fh-3J; Fri, 18 Oct 2024 02:00:58 +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 1t1cIT-0001fb-BZ for openvpn-devel@lists.sourceforge.net; Fri, 18 Oct 2024 02:00:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:References:Subject:List-Unsubscribe:List-Id:Cc:To:Date: From:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help: List-Subscribe:List-Post:List-Owner:List-Archive; bh=g62WlEEyZmS4BYBOoxuJOAOm/zrWiQYkY/9/ztkShAY=; b=IINZGT8gIaqwfsyiw2nAX9Ox9d m5VXuN/G8p5rYUeROIHtNyTCXCD5D/XR++QpnFP42LdXx6TbxD5HwcDDEPkIUELJ9yUHHSNhDbKaw WNa+nFyx+cQN047iNd7zne5NdndkchIo9iz591SZ1JO+8b9uTo1n0ba3WNoNc6a+tu+w=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: References:Subject:List-Unsubscribe:List-Id:Cc:To:Date:From:Sender:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=g62WlEEyZmS4BYBOoxuJOAOm/zrWiQYkY/9/ztkShAY=; b=Z +EpSweic4BID3lYOW/DhjEeWu2xHEep+bJcwB0iZ0bUK0+bZN8thQzcubhwCdzQVDPvObpIF563GV FEDFBvvBZvhxBijuqMyrBUzsvg0SzsP/2EoEX0A8ol2DSiRkkWIYXyir56aevlkvCjdlpNT9AxUGF KXrXNKejbrePZAY4=; Received: from mail-wm1-f42.google.com ([209.85.128.42]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1t1cIS-0006WJ-A0 for openvpn-devel@lists.sourceforge.net; Fri, 18 Oct 2024 02:00:57 +0000 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4315e62afe0so9750585e9.1 for ; Thu, 17 Oct 2024 19:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1729216844; x=1729821644; darn=lists.sourceforge.net; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from:from:to:cc :subject:date:message-id:reply-to; bh=g62WlEEyZmS4BYBOoxuJOAOm/zrWiQYkY/9/ztkShAY=; b=JFqAeWgciYZMewIP/LDgNal4biqCDkM3/CukJzVtQviuNqvMcX0GsJrsxLadx/doUw PbbzpDOK6nKckxq4qPt6/ASXraO1yxpBifaohPUuX/Q8qzY26Clut8BdPXneO9kLry6H wKimm7+k7xZtPQ5VSWKgSMtoiSbFoTvRC0hgXb1eUoOg/Kdd/f4InpG+bU1yhJJ+rRBE 3NbRF6Myql8blzv838eY6CERMG0F45O1f0T4jRqpuSi1qY0vRID6f4kIZJB2dclg44wR Ky+uI27zfWBB1Ad2FzSdByEQDMk0YGgpX31xquan3AY48qHXMWo+B5yVwTID+3W0BF3D PXnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729216844; x=1729821644; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g62WlEEyZmS4BYBOoxuJOAOm/zrWiQYkY/9/ztkShAY=; b=vvlg8JWLVkbEBzU54vQIaqrsuit445rvbxgovrcttnUqy0RJRllD/5gLc7QvEyTguT yhxv4nDP0COnONuaxCUse1Xp3Tx5M7vz6WegWcrOAHQUal3TlEA+1CC9KI7A/Ox9DMwc oIQeN7OSH+/Gdm/WW3Xlu+aKH6eF6D7hmM4P65Y2gy+BGUicuBsg4ErtYYWhxa5EXYWl o4GZ3DmDvYUY/JgWPgynIblJCS223l82EW15EWMASbkP+lHHtYjj7/JcpkT4QoLjDBKS DN1MQ1QIMLS+ewNPWzNB3XQ7vMY1t+vH6NW/3ss2KCIl3FD2Y0qW9MBH7JtauroIHI8P +MKw== X-Gm-Message-State: AOJu0YyXREpb4uiVxjs/GTvjR/j0HcM4BTtFGYwfkzy4w5GIABt16J7m XJWwzIW+pihWLYjgQdZGyvVu+F24OdXd5XU2CAH34uCHzqhfMWo++X2JSutxK9RdPcUocGZUd/V 6 X-Received: by 2002:a05:600c:1c8d:b0:431:12a8:7f1a with SMTP id 5b1f17b1804b1-4316165d3acmr4926405e9.16.1729216844090; Thu, 17 Oct 2024 19:00:44 -0700 (PDT) Received: from gerrit.openvpn.in (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a87csm9433555e9.25.2024.10.17.19.00.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 19:00:42 -0700 (PDT) From: "plaisthos (Code Review)" X-Google-Original-From: "plaisthos (Code Review)" X-Gerrit-PatchSet: 1 Date: Fri, 18 Oct 2024 02:00:42 +0000 To: flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: Ib480e57b62ea33f2aea52bee895badaf5607b72d X-Gerrit-Change-Number: 784 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: 99042d0d2e260c4c59db5bcaaa2105dd69ad5885 References: Message-ID: MIME-Version: 1.0 User-Agent: Gerrit/3.8.2 X-Spam-Score: -1.5 (-) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.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: Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit Content analysis details: (-1.5 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.42 listed in list.dnswl.org] -1.3 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.42 listed in wl.mailspike.net] 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1t1cIS-0006WJ-A0 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Remove unused methods write_key/read_key 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: , Reply-To: arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net, frank@lichtenheld.com Cc: openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1813215303844986851?= X-GMAIL-MSGID: =?utf-8?q?1813215303844986851?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/784?usp=email to review the following change. Change subject: Remove unused methods write_key/read_key ...................................................................... Remove unused methods write_key/read_key These were used in the key-method 1 that we remove by commit 36bef1b52 in 2020. That commit unfortunately missed that these methods were only used for directly sending/receiving key material over the control channel. Change-Id: Ib480e57b62ea33f2aea52bee895badaf5607b72d Signed-off-by: Arne Schwabe --- M src/openvpn/crypto.c M src/openvpn/crypto.h 2 files changed, 0 insertions(+), 86 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/84/784/1 diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index 064e59e..8f34eaa 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -1540,87 +1540,6 @@ } } -/* given a key and key_type, write key to buffer */ -bool -write_key(const struct key *key, const struct key_type *kt, - struct buffer *buf) -{ - ASSERT(cipher_kt_key_size(kt->cipher) <= MAX_CIPHER_KEY_LENGTH - && md_kt_size(kt->digest) <= MAX_HMAC_KEY_LENGTH); - - const uint8_t cipher_length = (uint8_t)cipher_kt_key_size(kt->cipher); - if (!buf_write(buf, &cipher_length, 1)) - { - return false; - } - - uint8_t hmac_length = (uint8_t)md_kt_size(kt->digest); - - if (!buf_write(buf, &hmac_length, 1)) - { - return false; - } - if (!buf_write(buf, key->cipher, cipher_kt_key_size(kt->cipher))) - { - return false; - } - if (!buf_write(buf, key->hmac, hmac_length)) - { - return false; - } - - return true; -} - -/* - * Given a key_type and buffer, read key from buffer. - * Return: 1 on success - * -1 read failure - * 0 on key length mismatch - */ -int -read_key(struct key *key, const struct key_type *kt, struct buffer *buf) -{ - uint8_t cipher_length; - uint8_t hmac_length; - - CLEAR(*key); - if (!buf_read(buf, &cipher_length, 1)) - { - goto read_err; - } - if (!buf_read(buf, &hmac_length, 1)) - { - goto read_err; - } - - if (cipher_length != cipher_kt_key_size(kt->cipher) || hmac_length != md_kt_size(kt->digest)) - { - goto key_len_err; - } - - if (!buf_read(buf, key->cipher, cipher_length)) - { - goto read_err; - } - if (!buf_read(buf, key->hmac, hmac_length)) - { - goto read_err; - } - - return 1; - -read_err: - msg(D_TLS_ERRORS, "TLS Error: error reading key from remote"); - return -1; - -key_len_err: - msg(D_TLS_ERRORS, - "TLS Error: key length mismatch, local cipher/hmac %d/%d, remote cipher/hmac %d/%d", - cipher_kt_key_size(kt->cipher), md_kt_size(kt->digest), cipher_length, hmac_length); - return 0; -} - void prng_bytes(uint8_t *output, int len) { diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h index d91de74..074dad6 100644 --- a/src/openvpn/crypto.h +++ b/src/openvpn/crypto.h @@ -313,11 +313,6 @@ bool check_key(struct key *key, const struct key_type *kt); -bool write_key(const struct key *key, const struct key_type *kt, - struct buffer *buf); - -int read_key(struct key *key, const struct key_type *kt, struct buffer *buf); - /** * Initialize a key_type structure with. *