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

"Kevin J. McCarthy" <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <aewmmEtkA2xeAgjA@qinghai>
On Fri, Apr 24, 2026 at 03:53:19PM +0200, Alejandro Colomar via Mutt-dev wrote:
>On 2026-04-24T13:15:52+0800, Kevin J. McCarthy wrote:
>> --- a/mutt_random.c
>> +++ b/mutt_random.c
>> @@ -25,25 +25,38 @@
>>
>>  #include <fcntl.h>
>>  #include <string.h>
>> -#include <sys/time.h>
>> -#include <sys/types.h>
>> -#include <unistd.h>
>> +#ifdef HAVE_SYS_TIME_H
>> +  #include <sys/time.h>
>> +#endif

[...]

>I think we can assume the header exists in every Unix-like system.
>
>And checking gnulib documentation, it seems that the only platform that
>lacks this header file was MSVC 14.  Is mutt being built there?
>If not, we could maybe remove that check in master everywhere.

I don't believe we target that platform.  I'll add a todo to remove the 
checks in master.  Thanks!

>Should we prefer arc4random_buf(3) over getrandom(2) if it's available?
>It's certainly simpler, and thus less prone to subtle bugs.

I thought about that, but I'm not sure if the Linux implementation also 
ported over to a more secure algorithm than RC4.

I think we'd want to leave the getrandom in any case, so for now I'll 
put it first.

>Anyway:
>
>	Reviewed-by: Alejandro Colomar <[email protected]>

Thanks!

-- 
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-----

iQIzBAEBCgAdFiEEiXWpszqjeRA4XFMIre92hIAxa9oFAmnsJpcACgkQre92hIAx
a9qlWRAAisaFrxQi95gzO1jE8y80rkfzr1tvA7EkVLG4CkPbgzbM4SU3LhRjD8KK
J7EN8dx6p28BeMGGgqh7oYAOP56YYoPM968A+eYm738gJj5mFTXC26MedU+8izVJ
Gi6RM7UxZczXAqgd/2U4wN1MsfuIUvfjI76pxstF5JKfHHN/a4tWvt6/2sA0ltRi
TfOY5Tpz4DtvZP3iFDSj8t77RM2ueyJ3nJdykXZWY57bh1l0sgtWZ/tXufw2EkH8
K7vGSw6Hzhyq/nxNT3839sFAUlaCwQ097o8Mnxwizop4JTXuW2COQrygpVPtZiSl
UvNWjCQTjRq7IICQFokclBOH0i5Wj/0u/9i6lXbzDlic5IGzSGEuVWDMQs01Fx/6
zaGSmt4wnXYrae2G+siae7+WiY4fy3cecCdTEGCZfSqJBOj3Z50TKFtc2w5uSMND
VBhS1tlz4+qLB+jvqzo7RYS1o+xbwmfa/kuN+HxcRY+4iKl5cqt/JaEZMAmVZR9m
KjmgFJaOJ8P2CeTPvSnDE6WBOz2CFBLoWS1g7kQO2MgY9vDL8ZgQuhQFJWJswMbI
Bl/XZM8i7a6nrtwODbP6dFljoUKeMq1vo8YUQc2ixdS7AFrJZ77Z2rD+hCOkIE+Q
POrIAoMuLs+Tv2D+/E4siVbeLQOmnrJH+hqX8lLZ82wGxf1XkE4=
=eMEb
-----END PGP SIGNATURE-----
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.