Entropy (computing)

From Wikipedia, the free encyclopedia

In computing, entropy is the randomness collected by an operating system or application for use in cryptography or other uses that require random data. This randomness is often collected from hardware sources, either pre-existing ones such as mouse movements or specially provided randomness generators.

Contents

[edit] Entropy in the Linux kernel

The Linux kernel generates entropy from keyboard timings, mouse movements, and IDE timings and makes the random character data available to other operating system processes through the special files /dev/random and /dev/urandom. This capability was introduced in Linux version 1.3.30.[1]

There are some Linux kernel patches allowing one to use more entropy sources.[2] the audio-entropyd project, which is included in some operating systems such as Fedora Linux, allows audio data to be used as an entropy source.[3] In some systems, network interrupts can be used as an entropy source as well.[4]

On systems using the Linux kernel, programs needing significant amounts of random data from /dev/urandom cannot co-exist with programs reading little data from /dev/random, as /dev/urandom depletes /dev/random whenever it is being read.[5]

In the 1.3.30 Linux kernel, there are some timing issues; if the entropy pool is empty and a process reads /dev/random after an ioctl() call but before the actual write() call, the read may succeed but no random data will be provided to the process as the read was done before the write() call.[6]

[edit] Entropy in the Hurd kernel

A driver ported from the Linux kernel has been made available for the Hurd kernel.[7]

[edit] Entropy in Solaris

/dev/random and /dev/urandom have been available as Sun packages or patches for Solaris since Solaris 2.6,[8] and have been a standard feature since Solaris 9.[9] As of Solaris 10, administrators can remove existing entropy sources or define new ones via the kernel-level cryptographic framework.

A 3rd-party kernel module implementing /dev/random is also available for releases dating back to Solaris 2.4.[8]

[edit] Entropy in OS/2

There is a software package for OS/2 that allows software processes to retrieve random data.[10]

[edit] Entropy in Windows

Microsoft Windows releases newer than 95A feature the CryptoAPI (CAPI) API that gathers entropy in a similar fashion to Linux kernel's /dev/random.[11]

Windows's CryptoAPI uses the binary registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\RNG\Seed to store a seeded value from all of its entropy sources.[12]

Because CryptoAPI is closed-source, some free software and open-source applications running on the Windows platform use other measures to get randomness. For example, GnuPG, as of version 1.06, uses a variety of sources such as the number of free bytes in memory that combined with a random seed generate the desired randomness it needs.[13]

Programmers using CAPI can get entropy by calling CAPI's CryptGenRandom(), after properly initialising it.[14]

[edit] Entropy in other systems

There are some software packages that allow one to use a userspace process to gather random characters, exactly what /dev/random does, such as EGD, the Entropy Gathering Daemon.[15]


[edit] Hardware-originated entropy

Modern CPUs and hardware often features integrated generators that can provide high-quality and high-speed entropy to operating systems. On systems based on the Linux kernel, one can read the entropy generated from such a device through /dev/hw random.[16] However, sometimes /dev/hw_random may be slow;[17] usually around 80K/s.[18]

There are some companies manufacturing entropy generation devices, and some of them are shipped with drivers for Linux.[19]

On Debian GNU/Linux, one can install the rng-tools package (apt-get install rng-tools) that supports the true random number generators (TRNGs) found in some Intel, AMD, or VIA chipsets, effectively increasing the entropy collected into /dev/random and potentially improving the cryptographic potential. This is especially useful on headless servers that have no other sources of entropy.

[edit] Practical implications of entropy

System administrators, especially those supervising Internet servers, have to ensure that the server processes will not halt because of entropy depletion. Entropy on servers utilising the Linux kernel, or any other kernel or userspace process that generates entropy from the console and the storage subsystem, is often less than ideal because of the lack of a mouse and keyboard, thus servers have to generate their entropy from a limited set of resources such as IDE timings.

Entropy in Linux is viewable through the file /proc/sys/kernel/random/entropy_avail and should generally be at least 2000.[20] Entropy changes frequently.

Administrators responsible for systems that have low or zero entropy should not attempt to use /dev/urandom as a substitute for /dev/random as this may cause SSL/TLS connections to have lower-grade encryption.[21]

Some software systems change their Diffie-Hellman keys often, and this may in some cases help a server to continue functioning normally even with an entropy bottleneck.[22]

On servers with low entropy, a process can appear hung when it is waiting for random characters to appear in /dev/random (on Linux-based systems). For example, there was a known problem in Debian GNU/Linux that caused exim4 to hang in some cases because of this.[23]

[edit] Security implications

Entropy sources can be used for keyboard timing attacks.[24]

Entropy can affect the cryptography (TLS/SSL) of a server: If it is too low then the regeneration of codes can take much time to complete.

In some cases a cracker (malicious attacker) can guess some bits of entropy from the output of a pseudorandom number generator (PRNG), and this happens when not enough entropy is shoved into the PRNG.[25]

[edit] Other potential sources for entropy

Commonly used entropy sources include the mouse, keyboard, and IDE timings, but there are other potential sources. For example, one could collect entropy from the computer's microphone, or by building a sensor to measure the air turbulence inside a disk drive.[26] However, microphones are usually not available in servers.

[edit] References