Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

I'm implementing an entropy gathering program.

For that I collect 2 bits from two gpio-pins connected to a random source. I whiten this stream of bits using the von Neumann decorrelation algorithm. Now 2 out of 4 cases I can't use the bits because of that whitening algorithm (e.g. when both bits are 0 or both are 1). The timestamp when I have to discard bits is random.

My question now is: I use the value of the two bits, can I now also use that bit-discard-timestamp as an entropy source? Or are these (the values and the timestamps) correlated? I think they are not neccessarily correlated but I'm not entirely sure.

share|improve this question
2  
If in doubt => don't use it. What is your system design? What do you do with those bits, specifically? If you use them to reseed a PRNG periodically, it should not be an issue to have your hardware RNG being slow, it is much more important for it to be secure. –  Dmitry Yanushkevich Jul 16 at 7:56
    
The system is a simple random number generator that should be fairly secure. The current version does 1k bit per second and passes the "dieharder" rng test. I'm looking for ways to speed it up by finding other sources of random bits in the system. –  Folkert van Heusden Jul 16 at 8:12
1  
Hmm. You might want to read this as it explains the design of Linux RNG pretty well. It is exactly about how to speed things up with less "true randomness". –  Dmitry Yanushkevich Jul 16 at 8:27
    
Yes, I'm familiar with what is written there. –  Folkert van Heusden Jul 16 at 8:37
1  
@Folkert Simply because if your code is to be used in production, it would make much more sense to use techniques tested and proven in other applications. It makes life easier for someone who will support this after you, and chances to get it wrong are less. If it is for your leisure activities, then naturally, feel free to use anything. :-) –  Dmitry Yanushkevich Jul 16 at 9:54

2 Answers 2

up vote 3 down vote accepted

The values of these timestamps appear to be determined by two components:

  1. when your code decides to sample the GPIO inputs; and
  2. whether a bit is to be discarded or not.

The first component is not proven to be random (and if you assume it is, you would not need to add complexity to this RNG; just create a second RNG based on CPU execution jitter).

The second component is the same information that you have already used in the whitener. In other words, if an attacker can make some (partial) predictions about the raw GPIO inputs, then the timestamps are predictable, too.


Please note that the Wikipedia page you linked is not a complete description of the von Neumann algorithm; if you click through to Von Neumann extractor, you see that this algorithm requires that the source is a Bernoulli sequence. Almost all physical noise sources fail this because their output values are correlated.

share|improve this answer
    
Yes, the attacker problem is something I choose to ignore: if someone gets physical access to the setup all is lost anyway. You made a very interesting note regarding that additional notes on the V.M. algorithm, did not know about it! Regarding point 1: I would think there is jitter in the cpu-clock as there is in all (well most) clocks as well. I'll do an experiment with an oxco to see how much it is. Thanks! –  Folkert van Heusden Jul 16 at 12:38
1  
A prediction can be something like "a bit has a 70% chance of being equal to the last bit", which does not need physical access. –  CL. Jul 16 at 12:50

Assuming the random source is a Bernoulli process such that the von Neumann corrector can make it perfectly random, the bits are, by definition, uncorrelated with anything else, including your timestamps.

In the real world that assumption may not hold, but in that case your existing von Neumann corrected random stream is also faulty.

That said, the timestamps may still not be a good entropy source, even if they are uncorrelated with your random source. There is a widely held belief in the Linux kernel circles, for example, that clock jitter is just a black box PRNG that someone might analyze and break.

share|improve this answer
    
I'm not sure if it is the clock jitter in general that is suspect. If you know your hardware and know which clocks have seperate clock-sources (like the watchdog and the main clock in the arduino), then that is definately a good source. I think that the page you point to complains about measuring jitter in execution of a couple of instructions which is different. I think haveged is doing this. –  Folkert van Heusden Jul 17 at 13:29
    
@FolkertvanHeusden, maybe so, but the problem of estimating how much entropy there is in the signal remains. –  otus Jul 17 at 15:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.