Fixing getrandom()
Fixing getrandom()
Posted Sep 30, 2019 11:59 UTC (Mon) by excors (subscriber, #95769)In reply to: Fixing getrandom() by anton
Parent article: Fixing getrandom()
> you need a way to get the raw data (transformation into JPEG usually tries to get rid of the noise that we want for the RNG)
It's not just the JPEG compression - the Android camera API is happy to give you uncompressed YUV but that still wouldn't be raw enough. You'd want the (typically) 10-bit Bayer data directly from the sensor, before the ISP has tried to make it look pretty (doing noise reduction, adjusting levels in a way that might saturate the noise out of existence, smoothing the image, etc). And you probably want to manually configure the sensor to maximise noise (long exposure, high gain, disable binning, etc). Android provides enough control to let applications request that, but I don't know how many of the camera drivers implement it fully, so it's probably not a very portable approach.
Posted Sep 30, 2019 12:49 UTC (Mon)
by anton (subscriber, #25547)
[Link]
Thermal noise is relatively small compared to photon noise if the sensor receives significant photons, but may be enough for initializing the RNG. And of course you don't want to be have so much brightness and so much exposure that the sensor saturates, but you can recognize anything approaching saturation, and then use shorter exposure time, if too many pixels are saturated. Combining high gain with long exposure will give more thermal noise in darkness, but produce saturation if there is light.
Fixing getrandom()