From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by sourceware.org (Postfix) with ESMTPS id C226C38515F7 for ; Thu, 31 Mar 2022 22:51:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C226C38515F7 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 dfw.source.kernel.org (Postfix) with ESMTPS id 36C296162C for ; Thu, 31 Mar 2022 22:51:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C535C340EE for ; Thu, 31 Mar 2022 22:51:41 +0000 (UTC) Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 868f5fec (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Thu, 31 Mar 2022 22:51:39 +0000 (UTC) Received: by mail-yb1-f179.google.com with SMTP id y142so1923287ybe.11 for ; Thu, 31 Mar 2022 15:51:39 -0700 (PDT) X-Gm-Message-State: AOAM533rQSMMNng3aowvsj14QCb/rRxvJMsz8uF9180ZEmtClHXRtzZZ 7iTqUfJlvHNYKSkB3F0nH2wOxIJSja4sN6TFRow= X-Google-Smtp-Source: ABdhPJxqGGOptn4ULGLTk0HyT68axaH4na66towmYRak/AGzInh0fcNHkQUYuPWsk6Qux37hDMV5OFSB1f9FlaA7dik= X-Received: by 2002:a25:ad83:0:b0:633:abf6:5f69 with SMTP id z3-20020a25ad83000000b00633abf65f69mr5877982ybi.382.1648767097965; Thu, 31 Mar 2022 15:51:37 -0700 (PDT) MIME-Version: 1.0 References: <20220328220936.2724834-1-goldstein.w.n@gmail.com> <7b48ece6-392a-0850-c136-01ab751273ef@linaro.org> <72332228-093c-5186-789f-8616cfb93793@linaro.org> <0198ce75-8a8e-4355-eed1-f69dfb6f40f0@linaro.org> In-Reply-To: From: "Jason A. Donenfeld" Date: Thu, 31 Mar 2022 18:51:25 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 1/2] random-bits: Factor out entropy generating function To: =?UTF-8?Q?Cristian_Rodr=C3=ADguez?= Cc: Adhemerval Zanella , Noah Goldstein , GNU C Library , Florian Weimer Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 31 Mar 2022 22:51:44 -0000 Hi Cristian, On Thu, Mar 31, 2022 at 5:57 PM Cristian Rodr=C3=ADguez wrote: > > On Thu, Mar 31, 2022 at 12:32 PM Jason A. Donenfeld wro= te: > > > > Just so we're on the same page here, is this a discussion about > > optimizing https://code.woboq.org/userspace/glibc/include/random-bits.h= .html > > ? > > > > You just need a super fast random uint32_t for some future pthread chan= ges? > > > > If so, I can send a patch to return moderately secure integers here rea= lly fast. > > > > Jason > > That would be great if is better than the current solution. Alright, well, here's something: https://xn--4db.cc/YQOxDP6Z/c This is somewhat "secure", and maybe overkill. I can adjust this to have additional security properties (for example, preventing that counter from running backwards). Or I can adjust it to be even faster and have fewer security properties. Or maybe bench this and you'll find that it's fine. I suspect the only thing we really care about here is not leaking the AT_RANDOM value somehow, and siphash usually does a good job at that. Thoughts? Jason