From: David Laight <David.Laight@ACULAB.COM>
To: 'Sandy Harris' <sandyinchina@gmail.com>,
"Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Subject: RE: [PATCH] random: add 8-bit and 16-bit batches
Date: Fri, 25 Nov 2022 15:04:41 +0000 [thread overview]
Message-ID: <a171166422a545a99ac815541018d44f@AcuMS.aculab.com> (raw)
In-Reply-To: <CACXcFmkyoNu5fU=pAxPNY-bwGyJ5bd2LkmVkxHGOubZmbbzT_Q@mail.gmail.com>
From: Sandy Harris
> Sent: 25 November 2022 04:11
>
> On Thu, Sep 29, 2022 at 1:33 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> >
> > There are numerous places in the kernel that would be sped up by having
> > smaller batches. ...
>
> > void get_random_bytes(void *buf, size_t len);
> > +u8 get_random_u8(void);
> > +u16 get_random_u16(void);
> > u32 get_random_u32(void);
> > u64 get_random_u64(void);
> > static inline unsigned int get_random_int(void)
>
> To me, the 32-bit & 64-bit functions look like an
> obviously good idea. However, I cannot see
> that the 8-bit or 16-bit functions are needed.
>
> Even library functions like getchar() return an
> int & whatever you return, it is going to be
> handled as an int-sized item if it goes in a
> register, so what's the point?
They avoid 'using up' random values the callers wont use.
This can save expensive re-hashing (etc).
OTOH the return types should probably be u32 even though the
domain is smaller.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
prev parent reply other threads:[~2022-11-25 15:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 16:50 Jason A. Donenfeld
2022-11-25 4:10 ` Sandy Harris
2022-11-25 15:04 ` David Laight [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a171166422a545a99ac815541018d44f@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=Jason@zx2c4.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sandyinchina@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®