Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp431114pxb; Thu, 13 Jan 2022 09:17:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzubpHqhTXNDsN7UoG7nhzag1WVZ089NG6oJRN03ptM2hZHEj0QqZdpCCuOxq23nYmO/Rpi X-Received: by 2002:a63:3705:: with SMTP id e5mr4512479pga.258.1642094239060; Thu, 13 Jan 2022 09:17:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642094239; cv=none; d=google.com; s=arc-20160816; b=RHDFFseGGw8GDJfEqHq13Txo5RcD2Cxy73xIMeGsk/oz11LswfUxHvOHcYRt0HOtaq e7T7zutguC34qghh+kCjw2d7TgnucmQbjY8RZYX3KHJQfmGYKCCOIoi0aphGFRK6g46q epuATuwYLecQzgibnf1uIIdE0FAZR3hwTh3o6CrqwnY13FB/QlGA53+jG7d6q62V/puN 3AbK2CiwsTa8MIo5qQRy8f3EnG3grEpVRnsLk7VwEXQ6PIlQ/sria2u+1XGKNxFAtEj9 i2IerFALAgSrZ/u4/xTJlMUpkADjmor//7MMD0YQ0TFnrruf8DB+jfyTZKH4IC0t92EJ Vy5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=RgWni6LqPjl7/Jpt8i2S8g4ZDYjkMn/V4Ho5ACe93Sg=; b=rWXtIQf1mgK2VeC2vPE5cadjJK2GpmHX1ic4MgQKcAJUe9GigXKOk2dcTmjVvF6O7+ RSjiwgBLCXHzAbSc3QAWJ11IVRmth4uts8BehaflBRM4dNNewT4ejZELtFtSuS9XOL04 y9u093CuyOUvwY2eLcW+AyGeVvJ+sDaKJNpswtrGgCgxGPIzfSWLPw8c2J1NQhcNde4r GMaDBUjEgMDMGqePx8wMbzM5bsYEm8PvnyfTwHhCzMvXYERIVUl0nOsLGYZ1VS5+OtGL OAo7/p8cDf1wqmC2aWaljbZ1w7+FpGuyEvlOCJ9BrZarjJu4W9W04MVi3U5A0N8NiFbw 9n7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oNVpHqPN; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q76si3510215pgq.691.2022.01.13.09.17.01; Thu, 13 Jan 2022 09:17:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oNVpHqPN; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234341AbiAMMGh (ORCPT + 99 others); Thu, 13 Jan 2022 07:06:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234337AbiAMMGg (ORCPT ); Thu, 13 Jan 2022 07:06:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D2A2C06173F; Thu, 13 Jan 2022 04:06:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D2C90619F7; Thu, 13 Jan 2022 12:06:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C97FC36AE9; Thu, 13 Jan 2022 12:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642075595; bh=RgWni6LqPjl7/Jpt8i2S8g4ZDYjkMn/V4Ho5ACe93Sg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=oNVpHqPNHOATYSR5XjkS6VOg2OnhzMuQH50/qmDCtZe9oAPiZvlznmwfPcsLn0AcD YWUdQMjzZP0fiJq7xZcsNaGMvjBWpnJP2pHhOWeapFCJpFptd0waFqDLFu5hLG0jJ9 xJBL3KkUyrdUX8VQpujKDuMVX40ljpMrh0cc7MIe2lnxbwA4BxH15+WgILRcUbZbeR /hm6GzcBls0KDxy9mKJ2N6G04h86ETlWRYgESpXEsMoo19EXszxd6vxxIxSs1rdoo2 RPu8q/W5V4wq9erWlNUsr0p2NFnn7XCt7uXFcbnenGtEBK693w9Sst9KrZgagDs+su qgp1o4z7rslAQ== Received: by mail-wr1-f48.google.com with SMTP id h10so9722751wrb.1; Thu, 13 Jan 2022 04:06:35 -0800 (PST) X-Gm-Message-State: AOAM53151ymfEd47hbWNWPQdcGg0jGTeDynWGKHZMf/SPPlWLcnLfnup hC82zu/hwHR5+VCwQRbjsZDinQupT+RhCdxTVBg= X-Received: by 2002:adf:f287:: with SMTP id k7mr3800465wro.417.1642075593549; Thu, 13 Jan 2022 04:06:33 -0800 (PST) MIME-Version: 1.0 References: <20220112131204.800307-1-Jason@zx2c4.com> <20220112131204.800307-3-Jason@zx2c4.com> <87r19cftbr.fsf@toke.dk> <55d185a8-31ea-51d0-d9be-debd490cd204@stressinduktion.org> In-Reply-To: <55d185a8-31ea-51d0-d9be-debd490cd204@stressinduktion.org> From: Ard Biesheuvel Date: Thu, 13 Jan 2022 13:06:22 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC v1 2/3] ipv6: move from sha1 to blake2s in address calculation To: Hannes Frederic Sowa Cc: "Jason A. Donenfeld" , =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , "open list:BPF JIT for MIPS (32-BIT AND 64-BIT)" , Linux Kernel Mailing List , Geert Uytterhoeven , Herbert Xu , Jean-Philippe Aumasson , Linux Crypto Mailing List , Erik Kline , Fernando Gont , Lorenzo Colitti , hideaki.yoshifuji@miraclelinux.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, 13 Jan 2022 at 12:15, Hannes Frederic Sowa wrote: > > Hello, > > On 13.01.22 00:31, Jason A. Donenfeld wrote: > > On 1/13/22, Toke H=C3=B8iland-J=C3=B8rgensen wrote: > >> However, if we make this change, systems setting a stable_secret and > >> using addr_gen_mode 2 or 3 will come up with a completely different > >> address after a kernel upgrade. Which would be bad for any operator > >> expecting to be able to find their machine again after a reboot, > >> especially if it is accessed remotely. > >> > >> I haven't ever used this feature myself, though, or seen it in use. So= I > >> don't know if this is purely a theoretical concern, or if the > >> stable_address feature is actually used in this way in practice. If it > >> is, I guess the switch would have to be opt-in, which kinda defeats th= e > >> purpose, no (i.e., we'd have to keep the SHA1 code around > > Yes, it is hard to tell if such a change would have real world impact > due to not knowing its actual usage in the field - but I would avoid > such a change. The reason for this standard is to have stable addresses > across reboots. The standard is widely used but most servers or desktops > might get their stable privacy addresses being generated by user space > network management systems (NetworkManager/networkd) nowadays. I would > guess it could be used in embedded installations. > > The impact of this change could be annoying though: users could suddenly > lose connectivity due to e.g. changes to the default gateway after an > upgrade. > > > I'm not even so sure that's true. That was my worry at first, but > > actually, looking at this more closely, DAD means that the address can > > be changed anyway - a byte counter is hashed in - so there's no > > gurantee there. > > The duplicate address detection counter is a way to merely provide basic > network connectivity in case of duplicate addresses on the network > (maybe some kind misconfiguration or L2 attack). Such detected addresses > would show up in the kernel log and an administrator should investigate > and clean up the situation. Afterwards bringing the interface down and > up again should revert the interface to its initial (dad_counter =3D=3D 0= ) > address. > > > There's also the other aspect that open coding sha1_transform like > > this and prepending it with the secret (rather than a better > > construction) isn't so great... Take a look at the latest version of > > this in my branch to see a really nice simplification and security > > improvement: > > > > https://git.zx2c4.com/linux-dev/log/?h=3Dremove-sha1 > > All in all, I consider the hash produced here as being part of uAPI > unfortunately and thus cannot be changed. It is unfortunate that it > can't easily be improved (I assume a separate mode for this is not > reasonable). The patches definitely look like a nice cleanup. > > Would this be the only user of sha_transform left? > The question is not whether but when we can/will change this. SHA-1 is broken and should be removed at *some* point, so unless the feature itself is going to be obsolete, its implementation will need to switch to a PRF that fulfils the requirements in RFC7217 once SHA-1 ceases to do so. And I should also point out that the current implementation does not even use SHA-1 correctly, as it omits the finalization step. This may or may not matter in practice, but it deviates from crypto best practices, as well as from RFC7217 I already pointed out to Jason (in private) that the PRF does not need to be based on a cryptographic hash, so as far as I can tell, siphash would be a suitable candidate here as well, and I already switched the TCP fastopen code to that in the past. But SHA-1 definitely has to go.