4 ms·
This is a really good writeup and design, but it misses one crucial point: it doesn't matter what the actual quality of your noise source is. What matters is t
by lisper 10y ago
This is a really good writeup and design, but it misses one crucial point: it doesn't matter what the actual quality of your noise source is. What matters is that you have an accurate estimate of the quality of your noise source. [EDIT: actually, you don't even need that. All you really need is a reliable lower bound.] No noise source is perfect, so you have to use a whitener regardless. When you use a whitener you have to choose how many output bits to extract for a give number of input bits. If you extract more than the quality of your source allows, you lose. That's really all there is to it.
So the best approach to generating secure random numbers is simply to use a large safety margin in your estimate of the quality of your noise source, whatever it may be. You don't really need any fancy hardware unless you have very high bandwidth requirements (and if you think you have high bandwidth requirements you are almost certainly wrong). For nearly all practical applications (unless you are a telco) you can safely generate a crypto key by, for example, grabbing a few frames from a webcam pointed at a fan, or reading a few seconds of audio from a microphone while you say "Shhh", and running that through a whitener. That will give you several orders of magnitude of safety margin, which is enough to thwart any external attack.
- nickpsecurity 10y agoWell, it's easier to do that estimate on something following basic physics with decades of confirmation. At least I think it is. :) Far as the camera trick, it was used in LavaRand: http://www.lavarnd.org/what/index.html http://www.lavarnd.org/what/index.html That was a really, cool project back when a lava lamp was involved. You could get your company to buy one for "business purposes."
- lisper 10y ago> it's easier to do that estimate on something following basic physics Cameras and microphones follow the exact same basic physics as the op-amps in in the OP's circuit.
- nickpsecurity 10y agoDon't many use some kind of pre-processing or analog tricks in their products? It's what A/V people often told me.
- lisper 10y agoSure, but so what? That's my whole point: none of that is necessary, or even helpful. All you need is a good lower bound on your noise quality estimate, multiply by 10 or 100 or 1000 depending on how you want to trade off speed for paranoia, and you're done. Anything else is a distraction.
- nickpsecurity 10y ago"Sure, but so what? " Point being that a person with a baseline of electronics training knows exactly what one or two basic components are doing right next to each other. Products like A/V that use extra tricks can make the analysis more difficult or just take more knowledge. I lean toward the simple ones. A mic or camera sensor with nothing messing with its input might be fine, too. "All you need is a good lower bound on your noise quality estimate, multiply by 10 or 100 or 1000 depending on how you want to trade off speed for paranoia, and you're done." That part sounds right.
- ScottBurson 10y ago> When you use a whitener you have to choose how many output bits to extract for a give number of input bits. If you extract more than the quality of your source allows, you lose. Crypto is not my area of expertise, but this seems to contradict other things I've read. For example, in the debate about whether /dev/random should block, I seem to recall tptacek saying something like this: the idea that we have ciphers we can't break, but we have randomness sources that "run out" of entropy, doesn't pass the cryptographer's laugh test. I think someone else put it this way: seed AES with, say, 512 random bits, and then you can encrypt as many zero bits as you want to generate your random numbers; as long as AES itself is secure, you're not in any danger. That doesn't mean it's not a good idea to keep mixing in external entropy, of course, as long as that's easy to do and doesn't itself give an attacker a way to influence the results (I seem to recall seeing a paper about this somewhere). But it doesn't seem to be essential, if you believe those arguments. What do you think about this?
- lisper 10y agoThat is an excellent question! There are two separate issues here: 1. How many bits of real entropy can you count on getting out of a TRNG in a given amount of time? 2. How many bits can you safely extract from a PRNG that has been seeded with N bits of entropy? This discussion is about issue #1. The /dev/random vs /dev/urandom arguments are about issue #2. Just for the record, the answer to #2 is: once your PRNG has been seeded with "enough" entropy, you can safely extract an essentially infinite amount of pseudo-randomness out of it (where "essentially" means that there might be a theoretical limit, but you won't encounter it before the heat death of the universe). (How much entropy is "enough"? Again, it depends on how paranoid you want to be. 128 bits is barely enough. 256 is plenty. 512 is overkill.)
- HelloNurse 10y agoRunning out of TRNG entropy is a problem when the random number is used as a secret key or the equivalent, because for an adversary such a low-entropy value is easier to guess than it should. The effective number of possible keys is reduced. Use of the defective sample as a PRNG seed or something else is irrelevant.