While looking for solutions to entropy pool depletion on virtual machines, I came across an interesting project called `haveged`, which is based on the [HAVEGE](http://www.irisa.fr/caps/projects/hipsor/) algorithm (HArdware Volatile Entropy Gathering and Expansion). It makes a pretty fantastic claim.

> 
> HAVEGE is a random number generator that exploits the modifications of
>  the internal CPU hardware states (caches, branch predictors, TLBs) as
>  a source of uncertainty. During an initialization phase, the hardware
>  clock cycle counter of the processor is used to gather part of this
>  entropy: tens of thousands of unpredictable bits can be gathered per
>  operating system call in average.
> 
> 
> 

If this really produces nearly unlimited high-quality entropy on headless virtual machines, it should be included in every server distribution by default! And yet, some people have raised concerns.

> 
> "At its heart, [HAVEGE] uses timing information based on the
>  processor's high resolution timer (the RDTSC instruction). This
>  instruction can be virtualized, and some virtual machine hosts have
>  chosen to disable this instruction, returning 0s or predictable
>  results."  
> 
>  (Source: [PolarSSL Security Advisory 2011-02](https://polarssl.org/tech-updates/security-advisories/polarssl-security-advisory-2011-02) on polarssl.org).
> 
> 
> 

And furthermore, popular NIST and ENT tests will sometimes give `haveged` a PASS even when it's intentionally mis-configured, and not actually producing random numbers!

> 
> I replaced the “HARDTICKS” macro in HAVEGE with the constant 0 (zero)
>  rather than reading the time stamp counter of the processor. This
>  immediately failed the randomness test. However, when I used the
>  constant 1 (one) instead, the ent test passed. And even nist almost
>  passed with only a single missed test out of the 426 tests executed.
>  (Source: [Evaluating HAVEGE Randomness](http://jakob.engbloms.se/archives/1374) on engbloms.se).
> 
> 
> 

* So, which virtualization platforms/hypervisors are safe to use with `haveged` in a virtual machine?
* And is there a generally accepted best practice way to test whether a source of randomness is producing sufficiently high quality numbers?