Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2312779imi; Sun, 24 Jul 2022 15:20:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ub5cWuIdnTocTnIIxHxPX932sdUicteiBCNJm/aZZunDFO1IcqLMkHEM6vWbtSPVvBcnVx X-Received: by 2002:a17:902:7c88:b0:16d:3e1e:9ee1 with SMTP id y8-20020a1709027c8800b0016d3e1e9ee1mr9954629pll.102.1658701232746; Sun, 24 Jul 2022 15:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658701232; cv=none; d=google.com; s=arc-20160816; b=jWyfgdhxD65idnSjvLStbcafiT/9V68LLC9yJab28HIabLgvhj4rbUcj6wwCxpITRM JqWm+npldq2f+KElAt+J+BbW9q8Q+NM+FEiMtVzkQ7kaTC4f4EA1R+o7rQhpnKbMsxP1 Pqbg1FXEquAOMz/AVq8vE/5LEfh9hBenEDvW9TunF0mQ+SgKQ6XS/ge713IqVj/qAsgB EpL8dKJGVyFkPUtgl79JSGvHRj2emGLhWxA3PkAWDMqrvPxYSvpt1yMTc+aJNIszdeql nAZB11Rt/ZSchcdFFL1m51N0Ce79Mf0z0nHhfEtC+oPp7fcL+mTvhZda6yj9miQsBJmu uKHA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=iaGgJrv5lEqWDP853ScdMsLIfOIvOKHIKPti4xT91C0=; b=vcHnqs4X3O1G4i2hiGkeDRGomqjWe5jSgpIewTo1Ol8XFfPW6Jc4QJkdCREuJFlv6m 8YJ4wDe5JLxZf6+UGQwT5qgCCBFQHDnhG/YLE8WwQL+51sDxxtx+82Vc4Q3NDZfaV0/j X9ICWkRBzo4sGe1cg5R8zwrmZqCafwp4jrWsekiP9ePAZUvACo4Db5Vsn/qXUhsdzk59 pFiBaFNva+MUqNEcyWs6pylWz/UMZ+HyT8mWTJCwBVJSmZumTtOM1xwTfNBw3sEVXRQ1 jbjEF4xFbqakf9ulB4QrlIwIQUDRnmSbWasuQ+vfQslloBYYi13NigEyauwc7cbYFlVq AqUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=oyCoF+sx; 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 q12-20020a656a8c000000b003fc51453576si12935137pgu.545.2022.07.24.15.20.01; Sun, 24 Jul 2022 15:20:32 -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=oyCoF+sx; 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 S229797AbiGXV5W (ORCPT + 99 others); Sun, 24 Jul 2022 17:57:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbiGXV5V (ORCPT ); Sun, 24 Jul 2022 17:57:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C242BE014 for ; Sun, 24 Jul 2022 14:57:20 -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 81680B80D87 for ; Sun, 24 Jul 2022 21:57:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D8AEC3411E; Sun, 24 Jul 2022 21:57:17 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="oyCoF+sx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1658699835; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iaGgJrv5lEqWDP853ScdMsLIfOIvOKHIKPti4xT91C0=; b=oyCoF+sxkAWTS9fZdP2fIjdQb6cF9OVpXvwDbMdDZtyFeAVlcffoxwEq4W0/Yc1IEMowUo hOm9LjtPr6vs1ANyqwyI8Oh+t8cRRNBPG2pRvPv2iA20YaK7az8HWNyy5taubBHYP9mxvA boBW41F2rU16y74NzPLp7gcBnQGyrB8= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 60677a68 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Sun, 24 Jul 2022 21:57:14 +0000 (UTC) Date: Sun, 24 Jul 2022 23:57:10 +0200 From: "Jason A. Donenfeld" To: Cristian =?utf-8?Q?Rodr=C3=ADguez?= Cc: libc-alpha@sourceware.org, Adhemerval Zanella Netto , Florian Weimer , Yann Droneaud , jann@thejh.net, Michael@phoronix.com, linux-crypto@vger.kernel.org Subject: Re: arc4random - are you sure we want these? Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 Cristian, On Sun, Jul 24, 2022 at 12:23:43PM -0400, Cristian Rodríguez wrote: > On Sat, Jul 23, 2022 at 6:59 PM Jason A. Donenfeld wrote: > > > Doesn't getrandom() already basically have this quality? > > In current kernels. yes. problems with old kernels remain.. Can you outline specifically which kernels you think those are and what the problems you think there are? And how arc4random as currently implemented does away with those problems? I kind of suspect you don't have something specific in mind... > The syscall > overhead being too high for some use cases is still a remaining > problem, Really? Do you have any numbers? I would be very surprised to hear that this is affecting things that intend to use arc4random as a substitute. Could you give me specifics on this? Again, this sounds made up in the absence of something real, widespread, and particular. > if that was overcomed it could be used literally for everything, > including simulations and other stuff. You mentioned simulations, but actually simulations are one thing where you want repeatable randomness -- something insecure with a seed that gives a good distribution and is extremely fast, so that you can repeat your simulation with the same data need-be. For this there are various LFSRs and such that work fine and are well explored. But that's not what getrandom() is, nor arc4random(). More generally speaking, there are well-defined RNGs that are for simulations and take seeds, and there are well-defined RNGs that are sufficient for crypto, and then there's a massive valley of ill-defined junk in between that people keep shooting themselves in the foot with. The fact that you won't even call arc4random cryptographically secure (according to Adhemerval's comment) indicates to me that something has gone wrong here. So, please, I urge you to put the breaks on this a little bit. Come up with numbers. Let's lay out the interfaces and properties we want. And then we'll see what we can draw up together. But now I'm just repeating myself. See my earlier reply here: https://lore.kernel.org/linux-crypto/Ytx8GKSZfRt+ZrEO@zx2c4.com/ Jason