From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) by sourceware.org (Postfix) with ESMTPS id 354063858D33 for ; Tue, 27 Dec 2022 13:07:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 354063858D33 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=opensuse.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cristianrodriguez.net Received: by mail-il1-f174.google.com with SMTP id z18so6718498ils.3 for ; Tue, 27 Dec 2022 05:07:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Vl+D7rMY140OJtta1u43RQEwBkVN+rjXbWUodNxw+ME=; b=Fdoo9NJv6M5PjNUMDJ/omObTVys4AivdmICTVY4HEElaZ+GCxBbQmsep0XkZXrIZoU eBCiPJlVxTzxdMnQWSjNQpTYy8NKuMh/0Sn/i6y5ZPkBi4HF6+Lt+2FtigrUk9e7x+qT 4b1N7ohrRmyyZuZ/odEKuzZ8nJmBEBB79gCu3RtYfTgBWiPXkVpk9geP65LVJiseaDqb HJrg3T0NOjZ6Lc23m/hjw+szNaL3/pu+YEZ74Av4qNVtP14AHWzo1tZkss4ke6MKM3ge he3PphMKMG2jtyEp2P5kkVs79U6b9O3QODubmFGAGFJ9UOKqRU0XfDe141PSa5hWr53C rt2Q== X-Gm-Message-State: AFqh2kpiPeqv2SrtRxrntdlABMtdAbP83lf8ZQW/mwYWnBvWk6uzwTYY lSmDZbilKC//brz6Ftwtz+Ph6HURXm4+hOaK6iXWMQ== X-Google-Smtp-Source: AMrXdXsR9CrhXHKRWC6Jrio9vCEBUnZjNamLiJqH4enjG6Vy3Hy0TsdKB7y7UqCEfaiOn8d/c4Rd+FzOxheio4XukDo= X-Received: by 2002:a92:ab09:0:b0:30c:7ef:b9fa with SMTP id v9-20020a92ab09000000b0030c07efb9famr451661ilh.52.1672146470983; Tue, 27 Dec 2022 05:07:50 -0800 (PST) MIME-Version: 1.0 References: <105835f5-359c-2646-f609-e73459ee2d3b@jguk.org> <92e5ad68-d013-43f5-cc3e-459daea93a83@gmail.com> In-Reply-To: <92e5ad68-d013-43f5-cc3e-459daea93a83@gmail.com> From: =?UTF-8?Q?Cristian_Rodr=C3=ADguez?= Date: Tue, 27 Dec 2022 10:07:39 -0300 Message-ID: Subject: Re: [PATCH] Add example to rand.3 To: Alejandro Colomar Cc: Jonny Grant , Florian Weimer , Michael Kerrisk , linux-man , GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Dec 26, 2022 at 7:29 PM Alejandro Colomar via Libc-alpha wrote: > > Hi Jonny, > l it several times per second, you'll > find that it only changes the seed every second. There are better ways to > produce a good seed. > > However, I prefer suggesting arc4random() rather than workarounding rand(3) to > get good results. > > Florian, did you already merge arc4random() to glibc? arc4random is already on libc.. now to make it a replacement for everything random one has to hope for https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git/log/?h=vdso to be merged into the mainline kernel. That will make it as fast as possible and really,really cheap to call. Now it is just a wrapper that calls getrandom syscall. WRT the rand() example suggestion..it is bad.. The only addition I will make to this man page is strongly discouraging its use. Suggesting to use ar4random if available or one of https://prng.di.unimi.it/ PRNG if not for crypto.