Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2727820imi; Mon, 25 Jul 2022 06:48:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vTLKaNmWZuelURAXv94zhT8bREp80Ti1uP8/mwFm6gWaYasCZlXkloOFjebafmX5gb7Trd X-Received: by 2002:a05:6a00:158d:b0:52b:18a4:c73a with SMTP id u13-20020a056a00158d00b0052b18a4c73amr12826670pfk.51.1658756931590; Mon, 25 Jul 2022 06:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658756931; cv=none; d=google.com; s=arc-20160816; b=Px8J8QV6J2KF8yzL0avwsMFgM0MF5PPU+NTKjtDhw6Xz+mgtQufwHzn49+3hSXaD4l WQ+SXBFOThQE41CSPCPz9iXfDAjH/Q7Ol3doaNz7QzCkJULifCdVXW9jQc+cdTtfQKaT mHVOUnzSpWjmimGJQ42mEIy1xB5AzK7vW8U0osVFNQRITYTnO//AAHPWvhMPxhKXTBzX /fQDFH7XMeUHxuSIAyhPe8v47M1sxDhrH1WlAYpaGz5B7qmrwCiTw12+QLK1pGkR7iOw vG15cFj7IKkPENM56fGauhyIU2osbVTPB8R3SQ5Dw4QqSdtNxewSyatAnGWQPrRX8bMW MSbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7acSDg+FLApbk7YRG2ijgEmuKhqRCl2sNSvR2/TFFiQ=; b=HIYRZ9NUD9ggKL9pM5PiIq+JMZyErSswgq51bOGGwSTjiR0wcw+d9VqCQ4aOiBBkZ5 tUnIbXcmcynvxUMy6eN47Z78hgWK+qcACAQVQLUnTiIxt1yJ6wj97HB+HiHR2AICo4+V ACtr+YfLoVTYtMF+iwAvGiT3QPcI7iAAziwr++nyzzO/ApD4LItpRcnIoH0weiKtmSD9 ++SWQIveN6CLnXcTkQZoiV8QqW+8e2CQFo8ZAHNywNpy5BRksjRG4cKJmC2YHuATtOfH JwWM7stvtbThoT5vaLIXcDx/BO7JoVtRwJslkrjefgvWtgyDJmiaOjvXRQGKV64d8KXz nyhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b="Z3WX/CCD"; 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=QUARANTINE sp=QUARANTINE 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 bx19-20020a17090af49300b001efa292580bsi12887263pjb.187.2022.07.25.06.48.36; Mon, 25 Jul 2022 06:48:51 -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="Z3WX/CCD"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233238AbiGYNsR (ORCPT + 99 others); Mon, 25 Jul 2022 09:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbiGYNsQ (ORCPT ); Mon, 25 Jul 2022 09:48:16 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8149DEE3F for ; Mon, 25 Jul 2022 06:48:15 -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 sin.source.kernel.org (Postfix) with ESMTPS id 8F2F7CE1275 for ; Mon, 25 Jul 2022 13:48:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4455EC341C6; Mon, 25 Jul 2022 13:48:11 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="Z3WX/CCD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1658756889; 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=7acSDg+FLApbk7YRG2ijgEmuKhqRCl2sNSvR2/TFFiQ=; b=Z3WX/CCDmZqzUPtFUt2QDbVZP/wTVAFfGnyr6yoEDGZ7LITZgaAY6fckopF21SIK7K5qvf LtmwqhvscR1ljurXVAfi/z+4n27ehmDD8YIR0fCULALA9z3x3wMJ33rKY4w2GOoPisGqg7 A4ig2mKPzGc/iKm9oGV0qRdCiazw0K0= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 9016ef83 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 25 Jul 2022 13:48:09 +0000 (UTC) Date: Mon, 25 Jul 2022 15:48:07 +0200 From: "Jason A. Donenfeld" To: Jeffrey Walton Cc: Linux Crypto Mailing List , libc-alpha@sourceware.org Subject: Re: arc4random - are you sure we want these? Message-ID: References: <87bktdsdrk.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 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 Jeffrey, Please keep libc-alpha@sourceware.org CC'd. On Mon, Jul 25, 2022 at 09:25:58AM -0400, Jeffrey Walton wrote: > On Mon, Jul 25, 2022 at 7:08 AM Jason A. Donenfeld wrote: > > ... > > > The performance numbers suggest that we benefit from buffering in user > > > space. > > > > The question is whether it's safe and advisable to buffer this way in > > userspace. Does userspace have the right information now of when to > > discard the buffer and get a new one? I suspect it does not. > > I _think_ the sharp edge on userspace buffering is generator state. > Most generator threat models I have seen assume the attacker does not > know the generator's state. If buffering occurs in the application, > then it may be easier for an attacker to learn of the generator's > state. If buffering occurs in the kernel, then generator state should > be private from an userspace application's view. I guess that's one concern, if you're worried about heartbleed-like attacks, in which an undetected RNG state compromise might be easier to pull off. What I have in mind, though, are the various triggers and heuristics that the kernel uses for when it needs to reseed. These userspace doesn't know about. Jason