Re: [PATCH] Improve mutt's random data generator.

Greg KH <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <2026042343-onscreen-confiding-5740@gregkh>
On Thu, Apr 23, 2026 at 02:10:31PM +0800, Kevin J. McCarthy wrote:
> Use getrandom() if available, or else arc4random_buf().  Only fall
> back to using the built-in PRNG if those aren't found on the system.
> 
> For the sizes of data mutt typically requests, getrandom() should
> never fail, but nonetheless add code to make it retry on interrupt,
> and fall back to the built-in PRNG only if it has to.
> 
> FreeBSD and OpenBSD have rewritten arc4random() to use ChaCha20, which
> should provide more than sufficient randomness.  The call has no
> return value and always succeeds, so there is no error handling
> written for it.
> 
> Many thanks to Werner Koch, Greg KH, and Alejandro Colomar for their
> feedback.
> ---
> 
> This is passing sr.ht CI, and I'm using it on my computer right now.
> 
> Note that I adjusted the length_requested type for the old PRNG code to
> be size_t and tweeked the code slightly because of that.
> 
> Feedback welcome.

Looks sane to me!

thanks,

greg k-h
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.