Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp831840pxb; Thu, 24 Mar 2022 07:47:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWRzhT0PVe7ORY3DXNwj4HlilSA3EFclk0UAle3lCBsg4UD2BOwR/7qxKblGB0Ro/zMIZD X-Received: by 2002:a17:906:60d4:b0:6db:f0a8:f39e with SMTP id f20-20020a17090660d400b006dbf0a8f39emr6192785ejk.54.1648133242921; Thu, 24 Mar 2022 07:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648133242; cv=none; d=google.com; s=arc-20160816; b=lD/89Yx531yYvFn4/McPzHZDrhwpFYlG4z/SiGx1SsVYw31g+yb3+utoAl8miHkxjt WuXf46BW5Gc3BRNYYzdEOWK5Cp38/pcV1epIqHAHy4YvDPtuZxq/E41nK+4yyphr+KxE wAeUm+jWAS2km2GCTnPDGtL6dkm0vdLdIYWp4cUKr0xlEZZiFhZNR2cwVgqZQBCOje+Y k/PpCAQJ4bByMbGNAb4l57ybfToLDmbxc7EwONpZp/vLRT4nbja1XWaIDzmgBHFpN2np 7GlUHzS3jh1ASng7HnB7CaTANppJqPC2eTodMsm3Oxlxwb8ASMh+wpU8f4FabiKzyPu4 0ZJA== 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=IIzr5thlPNjUyjVa4lUMwHixNT/M39WCVGTM0oAMfZU=; b=V4lio23auX+g4474/GjdzQk1RO4437viTfUlHMLTMWcLphEQcg8mjijLW5TIIkQvM6 1uWkIsHPleUAqxy3E8Chs9w2E6G/eVDvABKhAGQdkAVTQQwk8ZqvGCsPZ2aqkVQ4VvbH pkFckKeStaCz+gr+FrH3vb248TTU8MJFY0NcUPaye6P/JB9qcTpLe23BE1UjDcB+lBuu TVboFHvdWL771hRBbFpDOvSk+COd0TOcofA+cXkRCBb5BQd2vuSVYre6qXUasTmqtLsD 0Las98Ig0ESNZ9lL6973qAi6BsGyhE5AXlaGJWDHpkqKNsx0PojOwGb+2aQ5Osyy+0mh BMyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=JEtwjSNz; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a170906104400b006df76385f2csi16932035ejj.972.2022.03.24.07.46.47; Thu, 24 Mar 2022 07:47:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=JEtwjSNz; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344493AbiCXOOp (ORCPT + 99 others); Thu, 24 Mar 2022 10:14:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345387AbiCXOOp (ORCPT ); Thu, 24 Mar 2022 10:14:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24B0C1D0C6; Thu, 24 Mar 2022 07:13:12 -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 ams.source.kernel.org (Postfix) with ESMTPS id 1BF5DB8232E; Thu, 24 Mar 2022 14:13:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A92F3C340EC; Thu, 24 Mar 2022 14:13:09 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="JEtwjSNz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1648131186; 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=IIzr5thlPNjUyjVa4lUMwHixNT/M39WCVGTM0oAMfZU=; b=JEtwjSNz2LZg0tI9/HGyYOG1kc4uwj2Uvp29Jq5wtFo0xAWyhNgagOkMgTc4zG5ysqarcB Y+jb0O3X9MBWI/M3IAKtT4r1JftQD1OLYPw9+yyOKJqpG/lTCIBW07QKsxQyJ9XX5mpzIH qwiwRrWJ1MysJfEkRzbZPHw+js5e5Eg= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 1efc11bd (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Thu, 24 Mar 2022 14:13:06 +0000 (UTC) Received: by mail-yb1-f171.google.com with SMTP id m67so8682890ybm.4; Thu, 24 Mar 2022 07:13:05 -0700 (PDT) X-Gm-Message-State: AOAM533X+on28a+d6DeejMi/6V/T8Oe8kxKP0WHZrJjEc2uoMxsxiPZ/ H7C305H7w6KRD4wieAkCXKNartq5A5aqT7G671c= X-Received: by 2002:a5b:cd1:0:b0:633:6f7d:ef98 with SMTP id e17-20020a5b0cd1000000b006336f7def98mr4623574ybr.267.1648131184658; Thu, 24 Mar 2022 07:13:04 -0700 (PDT) MIME-Version: 1.0 References: <20220322191436.110963-1-Jason@zx2c4.com> <6716f3ffefae4ed8b5fd332bfcca8a9a@AcuMS.aculab.com> <3707a8f9-93e7-ee54-42a3-ac12a279c6bc@rasmusvillemoes.dk> In-Reply-To: <3707a8f9-93e7-ee54-42a3-ac12a279c6bc@rasmusvillemoes.dk> From: "Jason A. Donenfeld" Date: Thu, 24 Mar 2022 08:12:53 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] random: allow writes to /dev/urandom to influence fast init To: Rasmus Villemoes Cc: David Laight , "linux-kernel@vger.kernel.org" , "linux-crypto@vger.kernel.org" , Linus Torvalds , Guenter Roeck , Dominik Brodowski , "Theodore Ts'o" , Jann Horn Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-crypto@vger.kernel.org Hi Rasmus, On Wed, Mar 23, 2022 at 2:43 AM Rasmus Villemoes wrote: > > On 23/03/2022 03.50, Jason A. Donenfeld wrote: > > > - Since these seeding shell scripts have always been broken, because > > this is how the rng has always been, rather than trying to bolt on a > > very imperfect fix in the kernel for something that never worked > > right, we could suggest shell scripts take the path that I implemented > > for systemd: > > https://github.com/systemd/systemd/commit/da2862ef06f22fc8d31dafced6d2d6dc14f2ee0b > > In shell, this would look like: > > > > #!/bin/bash > > cat seedfile > /dev/urandom > > { cat seedfile; head -c 32 /dev/urandom; } | sha256sum | cut -d ' ' -f 1 > seedfile > > Maybe stating the obvious, but in the interest of preventing > proliferation of more broken shell scripts: The tail of the above should > be spelled > > ... > seedfile.tmp && mv seedfile.tmp seedfile > > or seedfile would be truncated before cat had a chance to read it. You're not wrong. The actual thing that got committed is: https://git.buildroot.net/buildroot/commit/?id=f0986de551f46e72268857fd817986e9be697cd0 which thankfully doesn't have this issue. Jason