From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by sourceware.org (Postfix) with ESMTPS id 584F2385829F for ; Thu, 28 Jul 2022 00:40:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 584F2385829F Received: by mail-wr1-f50.google.com with SMTP id u5so282006wrm.4 for ; Wed, 27 Jul 2022 17:40:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=00VtRx17FOWjYwT1CKqFIGQhFvsSjII65T55g6qnIDU=; b=E5oLXNxcYcQwTkFU2eQRkcFauPCPaI6QNrJRroF9TeFrBUpmyu5UVK3wG7XppXaFcH stt6+I5G13pRdVbYHJVbLgAQfz+4xrXdeYsxz10kauR5jZX83fVvqOkPGJk/3m/N4rGf gH7b3YF7n89gTerYziNRf5QjITytq5atCSLJXlC20gWeophownbyuYIxpYGeSXpjzMFg aerrdTBDSEPiM6Qx/vF0R8MutBDkjVA7fIJta5xW1FJVytFt2oy+rS8mQMQhzQbVBnk0 1Cg6uO+PoDCMkXwhO0SZmAbsZUsJlzTsU4dPUJ1q4FRrb+YqwueG70vTDTDdmE0SZyr5 FNGg== X-Gm-Message-State: AJIora/8N0xIQXfrJ1WzuD1CiXA/HwHuD9VvhKFdYT+b0QKrUukkeNhg xSmmyUMy2yl5lJPi+vkxj1lqiMi2ImXlNRZEWnL6dA== X-Google-Smtp-Source: AGRyM1vEGf0Ey1h1sPA2iOZhHrCp8NNAAIPv5aN7Ua+QXM1B0fAxVCgC7WKHqj8QjOqT3yAObBpTksgeg0UzQ+hHSdg= X-Received: by 2002:a5d:65cd:0:b0:21e:6e3b:b1a8 with SMTP id e13-20020a5d65cd000000b0021e6e3bb1a8mr14586353wrw.470.1658968811242; Wed, 27 Jul 2022 17:40:11 -0700 (PDT) MIME-Version: 1.0 References: <6bf352e9-1312-40de-4733-3219721b343c@linaro.org> <20220725153303.GF7074@brightrain.aerifal.cx> <878rohp2ll.fsf@oldenburg.str.redhat.com> <20220725174430.GI7074@brightrain.aerifal.cx> <20220725184929.GJ7074@brightrain.aerifal.cx> <87v8rid8ju.fsf@oldenburg.str.redhat.com> In-Reply-To: From: =?UTF-8?Q?Cristian_Rodr=C3=ADguez?= Date: Wed, 27 Jul 2022 20:39:59 -0400 Message-ID: Subject: Re: arc4random - are you sure we want these? To: "Theodore Ts'o" Cc: Florian Weimer , Yann Droneaud , "Jason A. Donenfeld" , Rich Felker , libc-alpha@sourceware.org, Michael@phoronix.com, linux-crypto@vger.kernel.org, jann@thejh.net Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2022 00:40:13 -0000 On Wed, Jul 27, 2022 at 4:15 PM Theodore Ts'o via Libc-alpha wrote: > > On Wed, Jul 27, 2022 at 02:49:57PM +0200, Florian Weimer wrote: > > * Theodore Ts'o: > > > > > But even if you didn't take the latest kernels, I think you will find > > > that if you actually benchmark how many queries per second a real-life > > > secure web server or VPN gateway, even the original 5.15.0 /dev/random > > > driver was plenty fast enough for real world cryptographic use cases. > > > > The idea is to that arc4random() is suitable in pretty much all places > > that have historically used random() (outside of deterministic > > simulations). Straight calls to getrandom are much, much slower than > > random(), and it's not even the system call overhead. > > What are those places? Well pretty much everywhere a shared library is involved from the start.. On one very basic vm here there are 18 shared libraries using srandom, thus perturbing each other states if loaded by the same process, possibly in a catastrophic/predictable way. and nobody uses the random_r interfaces. > And what are their performance and security > requirements? Common programmers know nothing about this, even seasoned ones don't.. if it runs slow or is not CSPRNG then the average app will use one userspace PRNG or CSPRNG or buffer from the kernel somewhere.. I do not have to justify this assertion..it is just a matter you download libgcrypt, gnutls, openssl none of those libraries use the kernel entropy as the first option, all feed them to either proven or dubious s RNGs schemes and then pass that to users. Think on why that is and why we are discussing yet another interface in the first place..