[FFmpeg-devel] [PATCH] lavu/random_seed: use getrandom() when available

Anton Khirnov anton at khirnov.net
Sun Jul 9 12:57:31 EEST 2023


Quoting Marton Balint (2023-07-07 22:02:26)
> 
> 
> On Fri, 7 Jul 2023, Anton Khirnov wrote:
> 
> > It is a better interface for /dev/u?random on Linux, which avoids the
> > issues associated with opening files.
> 
> 
> getrandom() actually have the same problem as read(). It can read less 
> than requested. So you should use it in a loop in that case or if it 
> returns EINTR.

I'm not convinced it's actually a problem.

This API is intended for small secrets like keys and such, somebody
trying to generate vast quantities of random data is likely misusing it
and could just as well use LFG or something.
Failing in that case seems like a good thing to me.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list