Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1724685pxb; Wed, 12 Jan 2022 23:46:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPd419xbaOX2VxDhmj3m0NZLTzexN1J4VLYPOvcf4AN9ZdbX1bwkl+P8Ej3vOSyRRSP9s6 X-Received: by 2002:a05:6402:2753:: with SMTP id z19mr3103248edd.306.1642059968826; Wed, 12 Jan 2022 23:46:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642059968; cv=none; d=google.com; s=arc-20160816; b=wlGiEFRqbzpgud0Xt4UJ55EzerFnSGX2g8Ccn3SBhGKGn1HQ7quUbUWD+vO/zQ6BHg 4qg1xGVo3DagHf6PVclOLL5RM+JXIwzAJQKqeUWLEt/1B5Vsozn+bKPbPyrtfTIlLzUm XdAq3wugBYc+cR8BELEtJzsX8RcpQ3a/9Gh5ehC2gPcRuVEWsX0SrTHfIfga1i2c7Ha0 pDDx6FkCGE3wMGxgpuEb292PU8HEiXTaJ1maMWPdPGsefvVD8KvfQSZz/heUOHryQPVr vmIH3HtSKFaf0+SDKRDf9bwoe/SwRnwXWi0XhymVHvcL+9qRzOPF91bM6tmwR0gYDTUj lPZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=JSMd2i1J9AcZD7Z3Rw6ULKwjTXX7SBdExO4O6TrXQeM=; b=h4H7JrSVmPE9hc51t4rZvmzvPt8hY868D0YZrVkvRAuiLMENSsw+MqMQFqHf7PSXJy qoli7ZhC2nIc8O+jxyihs887Jp+KQeyoaH0765WRzAFMgGAnC9FWDaJYDbuSMU2GzXP4 L7gtoPJ/Lqsj4z3+sK+NtBKp9IvhgKuKSDSmIr1RdjO0QK5aJNPrFgJlrdZwdAAol1q4 EdvQ7zsvUV+UTLsdE6ZJHgpg2/jPGT/8TQszJgXgMQ9hH/MAZlcPiIBtWut1pjNGFp89 gWWJb+Ri00O4RSNVdCZmXOvvxjD1remH0JXSPw9r7Cq3tusn+ZedwIY+RtSLpiaAzz5l gckA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Nwx5hbt1; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u3si95978edo.517.2022.01.12.23.45.29; Wed, 12 Jan 2022 23:46:08 -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=@gmail.com header.s=20210112 header.b=Nwx5hbt1; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232017AbiAMDYZ (ORCPT + 99 others); Wed, 12 Jan 2022 22:24:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231983AbiAMDYY (ORCPT ); Wed, 12 Jan 2022 22:24:24 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CC9EC06173F; Wed, 12 Jan 2022 19:24:24 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id ay4-20020a05600c1e0400b0034a81a94607so1889752wmb.1; Wed, 12 Jan 2022 19:24:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JSMd2i1J9AcZD7Z3Rw6ULKwjTXX7SBdExO4O6TrXQeM=; b=Nwx5hbt1nqbJLYEqQOrmek2+mHZHSkkaw2ys4lY0uxDxDe/urrP4UEXfjJhaRsaDas GbeUqwGlKLASaZaSCBa7JO6rkMIowlCaAmEo8S0bk1MdguYwNRtcDrkcHrS6m67UA/Ny RZ4AY69E254yQ7FtXIj8wJFDI/WNNTkHd1mgaSmCCipBs0I7XIEjZajBmemZE+BlPFUi OJiVlWRySfQvEg+VNiYRcBNaKy/wHTs3qqqvVxoy1Pz7VomzpxJraiM7iIBawTxlu+UW z5Hj1H5US9JFV+qVD/HpK4dfrM0CzF+lUgideijb+F8IAGcmqR3X8a+STShjikVc5Gp1 uKAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JSMd2i1J9AcZD7Z3Rw6ULKwjTXX7SBdExO4O6TrXQeM=; b=lYsXWlW2HV4ymDzqrNX3QKeaTp+jZRAiGamYLoft+n17q7HTLPUpz8V+Ro6tGxQS+X isRCrXF/MLY6qC7S4FpXVqAA6FAZhN4Tr9J5SGQb1HHx3KJei4Kt61iXv0rhsZDEiVQ3 w8CiryFEosV6I46cL947FG5ZBEtJ9+dp9RQFvDejpJr1dosxXjcLnitAgEzRtOaNF27N YVoWpGTIzjrEPa2QVUQT5FeTZSpUuY6rPwfc+2nqUS1A9MqXt1mb8NSCEPAYVA7Ub4Wv QZYjbLHkT5zFw63vTyROfxXCXlVJFi10/HmSv5iCKQSaEd4cqRx+c30iytmeqVuEfFe9 AZuw== X-Gm-Message-State: AOAM5322IiApIGW6ZnDm3yCguIfK78VX28kBRswAnbDWCESxxaAQlzun cEt0MlFgVuViB8KGOOdqpnWR0ISFTCXfOFgybf55/0JL X-Received: by 2002:a1c:7316:: with SMTP id d22mr9220707wmb.5.1642044262824; Wed, 12 Jan 2022 19:24:22 -0800 (PST) MIME-Version: 1.0 References: <20220112131204.800307-1-Jason@zx2c4.com> In-Reply-To: <20220112131204.800307-1-Jason@zx2c4.com> From: Sandy Harris Date: Thu, 13 Jan 2022 11:24:10 +0800 Message-ID: Subject: Re: [PATCH RFC v1 0/3] remove remaining users of SHA-1 To: "Jason A. Donenfeld" Cc: netdev@vger.kernel.org, LKML , Geert Uytterhoeven , Herbert Xu , Ard Biesheuvel , Jean-Philippe Aumasson , Linux Crypto Mailing List , "Ted Ts'o" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Jason A. Donenfeld wrote: > There are currently two remaining users of SHA-1 left in the kernel: bpf > tag generation, and ipv6 address calculation. I think there are three, since drivers/char/random.c also uses it. Moreover, there's some inefficiency there (or was last time I looked) since it produces a 160-bit hash then folds it in half to give an 80-bit output. A possible fix would be to use a more modern 512-bit hash. SHA3 would be the obvious one, but Blake2 would work, Blake3 might be faster & there are several other possibilities. Hash context size would then match ChaCha so you could update the whole CC context at once, maybe even use the same context for both. That approach has difficulties, Extracting 512 bits every time might drain the input pool too quickly & it is overkill for ChaCha which should be secure with smaller rekeyings. If you look at IPsec, SSL & other such protocols, many have now mostly replaced the hash-based HMAC constructions used in previous generations with things like Galois field calculations (e.g. AES-GCM) or other strange math (e,g. poly 1305). These have most of the desirable properties of hashes & are much faster. As far as I know, they all give 128-bit outputs. I think we should replace SHA-1 with GCM. Give ChaCha 128 bits somewhat more often than current code gives it 256.