From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id B835694C2E for ; Fri, 23 Feb 2024 10:26:21 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A13381524D for ; Fri, 23 Feb 2024 10:26:21 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 23 Feb 2024 10:26:21 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E192344EB7 for ; Fri, 23 Feb 2024 10:26:20 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 23 Feb 2024 10:26:20 +0100 Message-Id: From: "Stefan Sterz" To: "Proxmox Backup Server development discussion" X-Mailer: aerc 0.17.0-57-g782a17dfb056 References: <20240215152001.269490-1-s.sterz@proxmox.com> <20240215152001.269490-7-s.sterz@proxmox.com> <29e05069-547e-46a5-9ed2-befbfbe0e4b5@proxmox.com> In-Reply-To: <29e05069-547e-46a5-9ed2-befbfbe0e4b5@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.079 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pbs-devel] [PATCH proxmox 06/12] sys: crypt: use constant time comparison for password verification X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2024 09:26:21 -0000 On Mon Feb 19, 2024 at 5:11 PM CET, Max Carrara wrote: > On 2/15/24 16:19, Stefan Sterz wrote: > > by using `openssl::memcmp::eq()` we can avoid potential timing side > > channels as its runtime only depends on the length of the arrays, not > > the contents. this requires the two arrays to have the same length, but > > that should be a given since the hashes should always have the same > > length. > > > > Signed-off-by: Stefan Sterz > > See my reply to patch 04 - the usage of `openssl::memcmp::eq()` in the le= gacy > code block there could be merged with this commit first before moving to = / implementing > HMAC. > i'd like to keep the `proxmox-sys` and `proxmox-auth-api` commits seperate. imo this makes the git history a bit "cleaner". > LGTM otherwise, but see the comment inline. > -- >8 snip 8< -- > > + // `openssl::memcmp::eq()`'s runtime does not depend on the conten= t of the arrays only the > > + // length, this makes it harder to exploit timing side-channels. > > + if verify.len() !=3D enc_password.len() > > + || !openssl::memcmp::eq(verify.as_bytes(), enc_password.as_byt= es()) > > Like in my comment on patch 04, would it make sense here to split these c= hecks into two > for more fine-grained error messaging? Or are there any reasons why they = should be together? > see my response to your comment in patch 04. we don't want to give an attacker more info than we have to imo. -- >8 snip 8< --