Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2211982pxb; Fri, 25 Mar 2022 13:08:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWKpEbzO/xxqlBLwq7qLgmP55e6yCZOvYbU6ixoSyUSMTcTwQ+v0tlyYJi57HUPAhVQlwY X-Received: by 2002:a17:903:248:b0:155:e8c6:8770 with SMTP id j8-20020a170903024800b00155e8c68770mr1349609plh.129.1648238911931; Fri, 25 Mar 2022 13:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648238911; cv=none; d=google.com; s=arc-20160816; b=xOTclFJg8FVC//c6DLMZAUZxzoeq72oXTk2/b76pFJj3LbcUX8jYQ9xmJj3GeVm+lB 2gcpMy557Mq7Ggb8Wgj6Awys91wAG5LN/RokELESxsRwpBpisyITH4YT7XQxNPoA9ALt TlBoFKiyATHc6R/RMoraYzlbuDHda8lDMtIc/OucRmaP0kKCRk3kQRwlzH86nQq3HAXN f6jdhlf0LCETXfMBJWdKdbsCXJbWcLtOehXfv3yMs6O2+52oJJ+1CUftbAKqh7N+gyv+ 8Q/lsEcwMQn3UAxwmSnqWQb0hlhEmqF4UjS40yZpus1al4G1X3xcN0Ugbf54nodPrjmB CzDw== 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=Jpvlvyj9ao+OhMQB6o8LnQdN+MDbR6s7x0e59J7p0ZY=; b=lc+htNquerIbW5rFszHJDr+zAS8shieYh5CnQPakriboWJvQL/JlVSnAuR9gczbcpq Sqd6LM2BbD6la5KEUpU861PtU3k4lbcNsbU1v/mZaW4y8s8AOvx/ImK+4cSIsNrPcicv VIxWytRrHqbO3RDVGb/xlUz2GbRoQv1gBaYfhUp519jPqWb3uI4TxXtlVNPUf4A+jBJM Rg8/hxWE475z0WjimIbzGLkV5GzqBAQ/qIPzQN6n5Ky0eIQgDQn5Kvlu9Pw8aXdhIuxf gOAKLkiMG5grZotHmFOqc0jGdgt2GRqwPzfq5rdzY4V3BkvMbbsuHjurnTIIHNMX/425 ZF7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=Mpm6rTOw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f10-20020a056a00228a00b004fa3a8dff4dsi4193666pfe.4.2022.03.25.13.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 13:08:31 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=Mpm6rTOw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0CED5391EDE; Fri, 25 Mar 2022 11:51:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349367AbiCXON0 (ORCPT + 99 others); Thu, 24 Mar 2022 10:13:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345387AbiCXONZ (ORCPT ); Thu, 24 Mar 2022 10:13:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3529F7CB02 for ; Thu, 24 Mar 2022 07:11:54 -0700 (PDT) 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 C1E06615B4 for ; Thu, 24 Mar 2022 14:11:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB90EC340EC for ; Thu, 24 Mar 2022 14:11:52 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="Mpm6rTOw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1648131110; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Jpvlvyj9ao+OhMQB6o8LnQdN+MDbR6s7x0e59J7p0ZY=; b=Mpm6rTOwHuGlKLWnUUL81ofDk1JhSMKKir9gkyRQ6OfPDnbNocZwkaJ0mOLZG7/0W9Fyuc hIeSUMlIex9yBYBviuXcKSZMWvWOGMPpBcrUNWrQhlSRKXXfBugqRc6HV5OZ8/Rj6LGnsk 3ifI6g5URM8jAoRazH0Rl5TPdAz9yOE= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id ba0ff622 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Thu, 24 Mar 2022 14:11:50 +0000 (UTC) Received: by mail-yb1-f169.google.com with SMTP id u103so8636358ybi.9 for ; Thu, 24 Mar 2022 07:11:50 -0700 (PDT) X-Gm-Message-State: AOAM532a6kHu7uD/iCXkaNaAR6OKu7/yw3l+An77xAKk9n8+Ku1FEM3y T/s2mybPXZgHBotHPw+EBBmbpfLktkjLYFBfbWU= X-Received: by 2002:a25:b854:0:b0:633:8a00:707a with SMTP id b20-20020a25b854000000b006338a00707amr4723427ybm.637.1648131109009; Thu, 24 Mar 2022 07:11:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Jason A. Donenfeld" Date: Thu, 24 Mar 2022 08:11:38 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Large post detailing recent Linux RNG improvements To: Sandy Harris Cc: LKML , Kernel Hardening , "Theodore Ts'o" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 24, 2022 at 4:29 AM Sandy Harris wrote: > > > Thought I should mention here that I've written up the various RNG > > > things I've been working on for 5.17 & 5.18 here: > > > https://www.zx2c4.com/projects/linux-rng-5.17-5.18/ . > > > > > > Feel free to discuss on list here if you'd like, or if you see > > > something you don't like, I'll happily review patches! > > > > Your code includes: > > > > enum { > > POOL_BITS = BLAKE2S_HASH_SIZE * 8, > > POOL_MIN_BITS = POOL_BITS /* No point in settling for less. */ > > }; > > > > static struct { > > struct blake2s_state hash; > > spinlock_t lock; > > unsigned int entropy_count; > > } input_pool = { > > .hash.h = { BLAKE2S_IV0 ^ (0x01010000 | BLAKE2S_HASH_SIZE), > > BLAKE2S_IV1, BLAKE2S_IV2, BLAKE2S_IV3, BLAKE2S_IV4, > > BLAKE2S_IV5, BLAKE2S_IV6, BLAKE2S_IV7 }, > > .hash.outlen = BLAKE2S_HASH_SIZE, > > .lock = __SPIN_LOCK_UNLOCKED(input_pool.lock), > > }; > > > > As far as I can tell, you have eliminated the 4K-bit input pool > > that this driver has always used & are just using the hash > > context as the input pool. To me, this looks like an error. > > > > A side effect of that is losing the latent-entropy attribute > > on input_pool[] so we no longer get initialisation from > > the plugin. Another error. > > I could see reasonable arguments for reducing the size of > the input pool since that would save both kernel memory > and time used by the hash. Personally, though, I would > not consider anything < 2Kbits without seeing strong > arguments to justify it. > > You seem to have gone to 512 bits without showing > any analysis to justify it. Have I just missed them? Explanation in . There's also a link to a paper in there. Jason