Home > Articles > Security > Network Security

  • Print
  • + Share This
Like this article? We recommend

Entropy Sources

Entropy is the measurement of available randomness. A source of randomness is needed to generate cryptographic keys. The keys cannot be predictable because an attacker would be able to guess the key and break the encryption. The problem is that computers are deterministic machines, so they are very unsuited to the task of random number generation. Computers can only produce pseudo random numbers that are, at best, very close to random. True random numbers can only be generated with hardware measuring stochastic natural phenomena, such as radioactive decay.

Hardware-based random number generators are often expensive and have slow bit rates of entropy production. Instead, software-based pseudo random number generators are used. Randomness is approximated by measuring a series of partially random events such as the timing between key strokes, mouse positioning, or arrival of network packets. All of the entropy is collected into a pool and stirred (a mathematical process to improve randomness).

The standard interface for entropy requests is to provide two sources: random and urandom. The random source provides processed entropy from the pool. If the pool is empty or not enough entropy is present to fulfill a request, random source will block (wait until completion) until enough entropy becomes available. The urandom source provides processed entropy from the pool if available. If not enough entropy is available, a cryptographic hash of the available entropy is returned instead. The urandom source will never block.

The random source always provides the highest quality of entropy with the performance penalty of requests being nondeterministic. The urandom source avoids the penalty by providing lower-quality entropy when the pool is low. The interface can be implemented either by two character pseudo devices, FIFOs, or by UNIX domain sockets.

The criteria for choosing an entropy source for OpenSSH are:

  • That the source supports the intended Solaris OS release (2.6, 7, 8, or 9)

  • That the source supports either thirty-two bit or sixty-four bit kernel mode

  • That the source supports the SPARC and IA-32 platforms

  • That the source is self-contained

The choices for entropy sources are:

  • OpenSSH's internal entropy collection

  • Kernel-level random number generator

  • Entropy gathering daemon

  • ANDIrand

  • SUNWski

  • Pseudo random number generator daemon

OpenSSH Internal Entropy Collection

The internal entropy collection is the default when no other option is provided when OpenSSH is configured. At the invocation of OpenSSH, entropy is gathered by running user-level commands, such as ps(1). OpenSSH will block until enough entropy is gathered. This gives the appearance that OpenSSH has hung, particularly on lightly-loaded systems. Internal entropy gathering is not recommended due to its performance.

Kernel-Level Random Number Generators

Kernel-level random number generators implement the standard entropy interface as two character pseudo devices: /dev/random and /dev/urandom. A kernel implementation has access to all internal state information such as process context and device driver intrinsics. This provides a larger quantity of and a finer grained source of entropy than user-level sources. The Solaris 9 OE and the Linux operating system provide a kernel-level random number generator. With the Solaris 8 OE, it is provided in a patch (patch ID 112438 for SPARC and 112439 for Intel). Kernel-level random number generators are the recommended entropy source.

ANDIrand

ANDIrand is a kernel-level random number generator kernel module developed by Andreas Maier. It provides the /dev/random and /dev/urandom character pseudo devices. This module is not supported by Sun, so it is not recommended for systems requiring Sun support services.

SUNWski

SUNWski is a user-level daemon for the Solaris 2.6 OE. It provides the random entropy source interface as a FIFO special file. It is not available for other Solaris OS releases, so it is not recommended.

Entropy Gathering Daemon (EGD)

The entropy gathering daemon (EGD) is a user-level daemon written in Perl by Brian Warner for GNU Privacy Guard. It provides only the random entropy source interface through a UNIX domain socket. This source will block, causing performance problems, so it is not recommended. EGD also requires the installation of perl(1), which is not recommended for minimized systems.

Pseudo Random Number Generator Daemon

The pseudo random number generator daemon (PRNGD) is a user-level daemon written in C by Lutz Jaenicke. It provides both the random and urandom entropy sources through a UNIX domain socket. It conforms to the EGD protocol for entropy requests. PRNGD is recommended for systems without a kernel-level random number generator.

Recommendations

Whenever possible use a kernel-level random number generator. It provides the highest quality of pseudo random numbers, has access to the private state information in the kernel, and is difficult for an attacker to determine the inner state. If you cannot use a kernel-level random number generator, use the PRNGD daemon. The following table contains entrophy recommendations based on the operating environment.

TABLE 2 Entropy Source Recommendations

Solaris OS Release

Source

Solaris 9 OE

/dev/random

Solaris 8 OE

/dev/random (patch 112438 or 112439)

Solaris 2.6 or 7 OE

PRNGD


Building PRNGD Software

PRNGD must be configured manually because there is no configure script. Configuration and building occur at the same time. PRNGD does not need to be installed on the build machine because it is packaged later for deployment.

To Build PRNGD Using the Forte C Compiler

  • For the Solaris 7, 8, or 9 OEs

  1. Change the directory to the prngd-x.x.x directory.

  2. Use the make(1S) command to build the software package.

  3. $ make CC=cc CFLAGS="-xO5 -DSOLARIS" SYSLIBS="-lsocket -lnsl"

  • For the Solaris 2.6 OE

  1. Change the directory to the prngd-x.x.x directory.

  2. Use the make(1S) command to build the software package.

  3. $ make CC=cc CFLAGS="-xO5 -KPIC -DSOLARIS26 -D__EXTENSIONS__" \
    SYSLIBS="-lsocket -lnsl"

To Build PRNGD Using the GNU C Compiler

  • For the Solaris 7, 8, or 9 OEs

  1. Change directories to the prngd-x.x.x directory.

  2. Use the make(1S) command to build the software package.

  3. $ make CC=gcc CFLAGS="-O3 -DSOLARIS" SYSLIBS="-lsocket -lnsl"

  • For the Solaris 2.6 OE

  1. Change directories to the prngd-x.x.x directory.

  2. Use the make(1S) command to build the software package.

  3. $ make CC=gcc CFLAGS="-O3 -DSOLARIS26 -D__EXTENSIONS__" \
    SYSLIBS="-lsocket -lnsl"

  • + Share This
  • 🔖 Save To Your Account