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

"Kevin J. McCarthy" <[email protected]> Tue, 28 Apr 2026 10:42:08 +0800
Newsgroups gmane.mail.mutt.devel
Message-ID <afAegIC67aiDHFmN@qinghai>
On Fri, Apr 24, 2026 at 01:15:52PM +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, Alejandro Colomar, and Kurt
>Hackenberg for their feedback.

I've pushed this up.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEiXWpszqjeRA4XFMIre92hIAxa9oFAmnwHoAACgkQre92hIAx
a9rjIg//RW/Cb395XXsBsLQg6KjWpu9ssYyKf/doyRKNo70eITPvbqRLL+kmlzbm
rwZCShtS+TcENeG0FXALIo9OaNSS1gLVzMkj5Te58ZITwDN9vAXrPYsrUkcEdSAu
cpN4yNNum24dLbnpX76YYALHG7ZZERx2dHsZWjq3vyERNc4XBHna0p7IobbYR4pU
3n5YcoqKWuLcBmGhI+KOlwh5eV486ImlHWqa+24MlkppDUEiRjCPBQpRv72FT7Ge
r+JstcBntxele7F4OPH2q6bSUD8zOd49tXl9ti52fG6c5pJmQqGXuHbCfKYNOcUA
VNiBKkeUPrZ6RwMPljjr/G+LRwcoUJRhWLbZfFySkpq155HsvyjrH5hVG7qQW2dT
SARGJMH2JXnSIGTwA39IdjFW8A0izi9BAD11arSgyAypzeOZGDIozQinnY+ENU9j
cLQ3ponJKz2+jTPi1PQU9gbs2DPF9oG2EFrAh15cCyzJRvlQ58dsVaSfVQ8bE2wi
sZQ+O0DmGzZRPYojazYr6M5DtcglLV7iIHbZQU/r+OCd/vq5c7ZwcuUWG4gJHmpZ
DMtHgFRGPaRe5rMFpMfz2Wiw9xyheIPOg49vuhn4fkbV9JMp3QXZEeSP1w3cx+qj
E1+1vz5JPDZhNDq46qXW+Qe7RrMFO037oFgMpKTnAYqFy2+eJz8=
=30Zl
-----END PGP SIGNATURE-----