Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp724825imn; Tue, 26 Jul 2022 07:43:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uLOXCHA6f2Sy4yng/fA/bXwcks8T10Wl8W6Ce4IRfKyNhlQxENNY33h4XiWcIsKsktC4Gp X-Received: by 2002:a05:6402:26cd:b0:43b:e3eb:241b with SMTP id x13-20020a05640226cd00b0043be3eb241bmr15578167edd.133.1658846603224; Tue, 26 Jul 2022 07:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658846603; cv=none; d=google.com; s=arc-20160816; b=OfczPdGeL1c/fQVok5L9QlBAc+kKQzEb4KeMfKUVndaqeOZSwL6ryvhntWoaNIvlr4 LkpYGLO+knZcX4ahRdd1KRQ3/G0oCfswuEcmU2wcJ3qyur+NBAbxkPSFf1KyDGmUn7BU /HJWg+k5j+CU2lPS2fEoOdH8Xr4dmEZ7iF8f71Z4ixKkbNxw/43z4FInwkgz1hJMNqNS cZmlBO19tpCmtRUcLytmJGCJWeWg3Q5wZ10pKkZg3qBhRXH2K6+ouHLJAwKEh9QaSSkw lLyUMjXxwpGx8kUHxlXWItfXFhIoCXtZGjQgYUeGZASX2vBO1uXySJbecIxmdKRhltSj KPPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id; bh=Wt8ADLgzL7YM2PzwdogPwuNziHQwtaQbcUkZCbTc9OY=; b=kfKzs82j9HvqW3V7GM8MYLwVRw9+ltoPFuqXhhhQLMwIFP38C/y2KZq/REdY2dXoFz vbZ3/JD/7toHcu4UJQFAnt46+kuif4eSKWZykylpVph+LKg7KAH6sohuuy3sQkI377qH xywNVSQ2H+KBXJd+gTvf/p5aIFrJUuiZrgAZst9uiN3lsSVlah6ZCmIBNpnm/5DlN/x9 NjrJa1URhwy9dwWUp8W0fJVB2parosZ1qVwchq9NZ7fNYU9ziRcFyLNX0RfBtPvL5jWG 0QS6r6TBA7xKAeZ3SC9gNgd6aL1RbHZoMd+P/MQBLh3apQh3av/8BYIPKU/E2vr7mquF HsiQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he9-20020a1709073d8900b007123952b00dsi3308626ejc.100.2022.07.26.07.42.57; Tue, 26 Jul 2022 07:43:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230223AbiGZOgY (ORCPT + 99 others); Tue, 26 Jul 2022 10:36:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239218AbiGZOf7 (ORCPT ); Tue, 26 Jul 2022 10:35:59 -0400 Received: from smtp4-g21.free.fr (smtp4-g21.free.fr [IPv6:2a01:e0c:1:1599::13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44D1218375 for ; Tue, 26 Jul 2022 07:35:49 -0700 (PDT) Received: from [IPV6:2a01:e35:39f2:1220:a31f:dd28:d78d:59ef] (unknown [IPv6:2a01:e35:39f2:1220:a31f:dd28:d78d:59ef]) by smtp4-g21.free.fr (Postfix) with ESMTPS id 7C8D319F752; Tue, 26 Jul 2022 16:35:40 +0200 (CEST) Message-ID: Date: Tue, 26 Jul 2022 16:35:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: arc4random - are you sure we want these? Content-Language: en-US To: Florian Weimer , "Jason A. Donenfeld via Libc-alpha" Cc: "Jason A. Donenfeld" , Michael@phoronix.com, linux-crypto@vger.kernel.org, jann@thejh.net References: <87bktdsdrk.fsf@oldenburg.str.redhat.com> <87v8rlqscj.fsf@oldenburg.str.redhat.com> From: Yann Droneaud Organization: OPTEYA In-Reply-To: <87v8rlqscj.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,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, Le 25/07/2022 à 14:39, Florian Weimer a écrit : > * Jason A. Donenfeld via Libc-alpha: >>> 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. > Not completely, no, but we can cover many cases. I do not currently see > a way around that if we want to promote arc4random_uniform(limit) as a > replacement for random() % limit. +1 That the reason I've reviewed the implementation positively: for me arc4random is not about generating secret keys but small integers. I want to be able to divert developers from     srand(time(NULL))     identifier = rand() % 33 to     identifier = arc4random_uniform(33) Safe, fast, and reasonably secure. Regards. -- Yann Droneaud OPTEYA