< draft-eastlake-randomness2-07.txt   draft-eastlake-randomness2-08.txt >
娼タNetwork Working Group Donald E. Eastlake, 3rd Network Working Group Donald E. Eastlake, 3rd
OBSOLETES RFC 1750 Jeffrey I. Schiller OBSOLETES RFC 1750 Jeffrey I. Schiller
Steve Crocker Steve Crocker
Expires December 2004 June 2004 Expires February 2005 August 2004
Randomness Requirements for Security Randomness Requirements for Security
---------- ------------ --- -------- ---------- ------------ --- --------
<draft-eastlake-randomness2-07.txt> <draft-eastlake-randomness2-08.txt>
Status of This Document Status of This Document
This dacument is intended to become a Best Current Practice. By submitting this Internet-Draft, I certify that any applicable
patent or other IPR claims of which I am aware have been disclosed,
or will be disclosed, and any of which I become aware will be
disclosed, in accordance with RFC 3668.
This document is intended to become a Best Current Practice.
Comments should be sent to the authors. Distribution is unlimited. Comments should be sent to the authors. Distribution is unlimited.
This document is an Internet-Draft and is in full conformance with This document is an Internet-Draft and is in full conformance with
all provisions of Section 10 of RFC 2026. Internet-Drafts are all provisions of Section 10 of RFC 2026. Internet-Drafts are
working documents of the Internet Engineering Task Force (IETF), its working documents of the Internet Engineering Task Force (IETF), its
areas, and its working groups. Note that other groups may also areas, and its working groups. Note that other groups may also
distribute working documents as Internet-Drafts. distribute working documents as Internet-Drafts.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
skipping to change at page 3, line 10 skipping to change at page 4, line 10
David M. Balenson, Don T. Davis, Carl Ellison, Marc Horowitz, David M. Balenson, Don T. Davis, Carl Ellison, Marc Horowitz,
Christian Huitema, Charlie Kaufman, Steve Kent, Hal Murray, Neil Christian Huitema, Charlie Kaufman, Steve Kent, Hal Murray, Neil
Haller, Richard Pitkin, Tim Redmond, and Doug Tygar. Haller, Richard Pitkin, Tim Redmond, and Doug Tygar.
Table of Contents Table of Contents
Status of This Document....................................1 Status of This Document....................................1
Abstract...................................................1 Abstract...................................................1
Acknowledgements...........................................2 Acknowledgements...........................................3
Table of Contents..........................................3 Table of Contents..........................................4
1. Introduction............................................5 1. Introduction............................................6
2. General Requirements....................................6 2. General Requirements....................................7
3. Traditional Pseudo-Random Sequences.....................8 3. Traditional Pseudo-Random Sequences.....................9
4. Unpredictability.......................................10 4. Unpredictability.......................................11
4.1 Problems with Clocks and Serial Numbers...............10 4.1 Problems with Clocks and Serial Numbers...............11
4.2 Timing and Content of External Events.................11 4.2 Timing and Content of External Events.................12
4.3 The Fallacy of Complex Manipulation...................11 4.3 The Fallacy of Complex Manipulation...................12
4.4 The Fallacy of Selection from a Large Database........12 4.4 The Fallacy of Selection from a Large Database........13
5. Hardware for Randomness................................13 5. Hardware for Randomness................................14
5.1 Volume Required.......................................13 5.1 Volume Required.......................................14
5.2 Sensitivity to Skew...................................13 5.2 Sensitivity to Skew...................................14
5.2.1 Using Stream Parity to De-Skew......................14 5.2.1 Using Stream Parity to De-Skew......................15
5.2.2 Using Transition Mappings to De-Skew................15 5.2.2 Using Transition Mappings to De-Skew................16
5.2.3 Using FFT to De-Skew................................16 5.2.3 Using FFT to De-Skew................................17
5.2.4 Using Compression to De-Skew........................16 5.2.4 Using Compression to De-Skew........................17
5.3 Existing Hardware Can Be Used For Randomness..........17 5.3 Existing Hardware Can Be Used For Randomness..........18
5.3.1 Using Existing Sound/Video Input....................17 5.3.1 Using Existing Sound/Video Input....................18
5.3.2 Using Existing Disk Drives..........................17 5.3.2 Using Existing Disk Drives..........................18
5.4 Ring Oscillator Sources...............................18 5.4 Ring Oscillator Sources...............................19
6. Recommended Software Strategy..........................19 6. Recommended Software Strategy..........................21
6.1 Mixing Functions......................................19 6.1 Mixing Functions......................................21
6.1.1 A Trivial Mixing Function...........................19 6.1.1 A Trivial Mixing Function...........................21
6.1.2 Stronger Mixing Functions...........................20 6.1.2 Stronger Mixing Functions...........................22
6.1.3 Diffie-Hellman as a Mixing Function.................22 6.1.3 Using S-Boxes for Mixing............................24
6.1.4 Using a Mixing Function to Stretch Random Bits......22 6.1.4 Diffie-Hellman as a Mixing Function.................24
6.1.5 Other Factors in Choosing a Mixing Function.........23 6.1.5 Using a Mixing Function to Stretch Random Bits......24
6.2 Non-Hardware Sources of Randomness....................23 6.1.6 Other Factors in Choosing a Mixing Function.........25
6.3 Cryptographically Strong Sequences....................24 6.2 Non-Hardware Sources of Randomness....................26
6.3.1 Traditional Strong Sequences........................25 6.3 Cryptographically Strong Sequences....................27
6.3.2 The Blum Blum Shub Sequence Generator...............26 6.3.1 Traditional Strong Sequences........................27
6.3.3 Entropy Pool Techniques.............................27 6.3.2 The Blum Blum Shub Sequence Generator...............28
6.3.3 Entropy Pool Techniques.............................29
7. Key Generation Standards and Examples..................28 7. Key Generation Standards and Examples..................31
7.1 US DoD Recommendations for Password Generation........28 7.1 US DoD Recommendations for Password Generation........31
7.2 X9.17 Key Generation..................................28 7.2 X9.17 Key Generation..................................31
7.3 DSS Pseudo-Random Number Generation...................29 7.3 DSS Pseudo-Random Number Generation...................32
7.4 X9.82 Pseudo-Random Number Generation.................30 7.4 X9.82 Pseudo-Random Number Generation.................33
7.5 The /dev/random Device................................30 7.5 The /dev/random Device................................33
8. Examples of Randomness Required........................32 8. Examples of Randomness Required........................35
8.1 Password Generation..................................32 8.1 Password Generation..................................35
8.2 A Very High Security Cryptographic Key................33 8.2 A Very High Security Cryptographic Key................36
8.2.1 Effort per Key Trial................................33 8.2.1 Effort per Key Trial................................36
8.2.2 Meet in the Middle Attacks..........................34 8.2.2 Meet in the Middle Attacks..........................37
8.2.3 Other Considerations................................35 8.2.3 Other Considerations................................38
9. Conclusion.............................................36 9. Conclusion.............................................39
10. Security Considerations...............................37 10. Security Considerations...............................40
11. Intellectual Property Considerations..................37 11. Copyright and Disclaimer..............................40
12. Copyright and Disclaimer..............................37
13. Appendix A: Changes from RFC 1750.....................38 12. Appendix A: Changes from RFC 1750.....................41
14. Informative References................................39 14. Informative References................................42
Authors Addresses.........................................43 Authors Addresses.........................................46
File Name and Expiration..................................43 File Name and Expiration..................................46
1. Introduction 1. Introduction
Software cryptography is coming into wider use and is continuing to Software cryptography is coming into wider use and is continuing to
spread, although there is a long way to go until it becomes spread, although there is a long way to go until it becomes
pervasive. pervasive.
Systems like SSH, IPSEC, TLS, S/MIME, PGP, DNSSEC, Kerberos, etc. are Systems like SSH, IPSEC, TLS, S/MIME, PGP, DNSSEC, Kerberos, etc. are
maturing and becoming a part of the network landscape [SSH, IPSEC, maturing and becoming a part of the network landscape [SSH, IPSEC,
MAIL*, TLS, DNSSEC]. By comparison, when the previous version of this MAIL*, TLS, DNSSEC]. By comparison, when the previous version of this
skipping to change at page 6, line 23 skipping to change at page 7, line 23
the format of the password information, not the requirement that the the format of the password information, not the requirement that the
password be very hard to guess.) password be very hard to guess.)
Many other requirements come from the cryptographic arena. Many other requirements come from the cryptographic arena.
Cryptographic techniques can be used to provide a variety of services Cryptographic techniques can be used to provide a variety of services
including confidentiality and authentication. Such services are based including confidentiality and authentication. Such services are based
on quantities, traditionally called "keys", that are unknown to and on quantities, traditionally called "keys", that are unknown to and
unguessable by an adversary. unguessable by an adversary.
In some cases, such as the use of symmetric encryption with the one In some cases, such as the use of symmetric encryption with the one
time pads or the US Data Encryption Standard [DES] or Advanced time pads or an algorithm like the US Advanced Encryption Standard
Encryption Standard [AES], the parties who wish to communicate [AES], the parties who wish to communicate confidentially and/or with
confidentially and/or with authentication must all know the same authentication must all know the same secret key. In other cases,
secret key. In other cases, using what are called asymmetric or using what are called asymmetric or "public key" cryptographic
"public key" cryptographic techniques, keys come in pairs. One key of techniques, keys come in pairs. One key of the pair is private and
the pair is private and must be kept secret by one party, the other must be kept secret by one party, the other is public and can be
is public and can be published to the world. It is computationally published to the world. It is computationally infeasible to determine
infeasible to determine the private key from the public key and the private key from the public key and knowledge of the public is of
knowledge of the public is of no help to an adversary [ASYMMETRIC]. no help to an adversary [ASYMMETRIC]. [SCHNEIER, FERGUSON, KAUFMAN]
[SCHNEIER, FERGUSON, KAUFMAN]
The frequency and volume of the requirement for random quantities The frequency and volume of the requirement for random quantities
differs greatly for different cryptographic systems. Using pure RSA, differs greatly for different cryptographic systems. Using pure RSA,
random quantities are required only when a new key pair is generated; random quantities are required only when a new key pair is generated;
thereafter any number of messages can be signed without a further thereafter any number of messages can be signed without a further
need for randomness. The public key Digital Signature Algorithm need for randomness. The public key Digital Signature Algorithm
devised by the US National Institute of Standards and Technology devised by the US National Institute of Standards and Technology
(NIST) requires good random numbers for each signature [DSS]. And (NIST) requires good random numbers for each signature [DSS]. And
encrypting with a one time pad, in principle the strongest possible encrypting with a one time pad, in principle the strongest possible
encryption technique, requires a volume of randomness equal to all encryption technique, requires a volume of randomness equal to all
skipping to change at page 9, line 12 skipping to change at page 10, line 12
carry) of bits from selected fixed taps into the register. For carry) of bits from selected fixed taps into the register. For
example: example:
+----+ +----+ +----+ +----+ +----+ +----+ +----+ +----+
| B | <-- | B | <-- | B | <-- . . . . . . <-- | B | <-+ | B | <-- | B | <-- | B | <-- . . . . . . <-- | B | <-+
| 0 | | 1 | | 2 | | n | | | 0 | | 1 | | 2 | | n | |
+----+ +----+ +----+ +----+ | +----+ +----+ +----+ +----+ |
| | | | | | | |
| | V +-----+ | | V +-----+
| V +----------------> | | | V +----------------> | |
V テヌテヌテヌテシテウテウテウテウテウテウテウテウテウテウテウテウテウテウテウテウネケ +-----------------------------> | XOR | V +-----------------------------> | XOR |
+---------------------------------------------------> | | +---------------------------------------------------> | |
+-----+ +-----+
V = ( ( V * 2 ) + B .xor. B ... )(Mod 2^n) V = ( ( V * 2 ) + B .xor. B ... )(Mod 2^n)
N+1 N 0 2 N+1 N 0 2
The goodness of traditional pseudo-random number generator algorithms The goodness of traditional pseudo-random number generator algorithms
is measured by statistical tests on such sequences. Carefully chosen is measured by statistical tests on such sequences. Carefully chosen
values a, b, c, and initial V or the placement of shift register tap values a, b, c, and initial V or the placement of shift register tap
in the above simple processes can produce excellent statistics. in the above simple processes can produce excellent statistics.
skipping to change at page 11, line 13 skipping to change at page 12, line 13
Problems such as those described above related to clocks and serial Problems such as those described above related to clocks and serial
numbers make code to produce unpredictable quantities difficult if numbers make code to produce unpredictable quantities difficult if
the code is to be ported across a variety of computer platforms and the code is to be ported across a variety of computer platforms and
systems. systems.
4.2 Timing and Content of External Events 4.2 Timing and Content of External Events
It is possible to measure the timing and content of mouse movement, It is possible to measure the timing and content of mouse movement,
key strokes, and similar user events. This is a reasonable source of key strokes, and similar user events. This is a reasonable source of
unguessable data with some qualifications. On some machines, inputs unguessable data with some qualifications. On some machines, inputs
such as key strokes are buffered. Even though the user's inter- such as key strokes are buffered. Even though the userどヨs inter-
keystroke timing may have sufficient variation and unpredictability, keystroke timing may have sufficient variation and unpredictability,
there might not be an easy way to access that variation. Another there might not be an easy way to access that variation. Another
problem is that no standard method exists to sample timing details. problem is that no standard method exists to sample timing details.
This makes it hard to build standard software intended for This makes it hard to build standard software intended for
distribution to a large range of machines based on this technique. distribution to a large range of machines based on this technique.
The amount of mouse movement or the keys actually hit are usually The amount of mouse movement or the keys actually hit are usually
easier to access than timings but may yield less unpredictability as easier to access than timings but may yield less unpredictability as
the user may provide highly repetitive input. the user may provide highly repetitive input.
skipping to change at page 12, line 9 skipping to change at page 13, line 9
use the limited number of results stemming from a limited number of use the limited number of results stemming from a limited number of
seed values to defeat security. seed values to defeat security.
Another serious strategy error is to assume that a very complex Another serious strategy error is to assume that a very complex
pseudo-random number generation algorithm will produce strong random pseudo-random number generation algorithm will produce strong random
numbers when there has been no theory behind or analysis of the numbers when there has been no theory behind or analysis of the
algorithm. There is a excellent example of this fallacy right near algorithm. There is a excellent example of this fallacy right near
the beginning of Chapter 3 in [KNUTH] where the author describes a the beginning of Chapter 3 in [KNUTH] where the author describes a
complex algorithm. It was intended that the machine language program complex algorithm. It was intended that the machine language program
corresponding to the algorithm would be so complicated that a person corresponding to the algorithm would be so complicated that a person
trying to read the code without comments wouldn't know what the trying to read the code without comments wouldnどヨt know what the
program was doing. Unfortunately, actual use of this algorithm showed program was doing. Unfortunately, actual use of this algorithm showed
that it almost immediately converged to a single repeated value in that it almost immediately converged to a single repeated value in
one case and a small cycle of values in another case. one case and a small cycle of values in another case.
Not only does complex manipulation not help you if you have a limited Not only does complex manipulation not help you if you have a limited
range of seeds but blindly chosen complex manipulation can destroy range of seeds but blindly chosen complex manipulation can destroy
the randomness in a good seed! the randomness in a good seed!
4.4 The Fallacy of Selection from a Large Database 4.4 The Fallacy of Selection from a Large Database
Another strategy that can give a misleading appearance of Another strategy that can give a misleading appearance of
unpredictability is selection of a quantity randomly from a database unpredictability is selection of a quantity randomly from a database
and assume that its strength is related to the total number of bits and assume that its strength is related to the total number of bits
in the database. For example, typical USENET servers process many in the database. For example, typical USENET servers process many
megabytes of information per day [USENET]. Assume a random quantity megabytes of information per day [USENET]. Assume a random quantity
was selected by fetching 32 bytes of data from a random starting was selected by fetching 32 bytes of data from a random starting
point in this data. This does not yield 32*8 = 256 bits worth of point in this data. This does not yield 32*8 = 256 bits worth of
unguessability. Even after allowing that much of the data is human unguessability. Even after allowing that much of the data is human
language and probably has no more than 2 or 3 bits of information per language and probably has no more than 2 or 3 bits of information per
byte, it doesn't yield 32*2 = 64 bits of unguessability. For an byte, it doesnどヨt yield 32*2 = 64 bits of unguessability. For an
adversary with access to the same usenet database the unguessability adversary with access to the same usenet database the unguessability
rests only on the starting point of the selection. That is perhaps a rests only on the starting point of the selection. That is perhaps a
little over a couple of dozen bits of unguessability. little over a couple of dozen bits of unguessability.
The same argument applies to selecting sequences from the data on a The same argument applies to selecting sequences from the data on a
publicly available CD/DVD recording or any other large public publicly available CD/DVD recording or any other large public
database. If the adversary has access to the same database, this database. If the adversary has access to the same database, this
"selection from a large volume of data" step buys little. However, "selection from a large volume of data" step buys little. However,
if a selection can be made from data to which the adversary has no if a selection can be made from data to which the adversary has no
access, such as system buffers on an active multi-user system, it may access, such as system buffers on an active multi-user system, it may
be of help. be of help.
5. Hardware for Randomness 5. Hardware for Randomness
Is there any hope for true strong portable randomness in the future? Is there any hope for true strong portable randomness in the future?
There might be. All that's needed is a physical source of There might be. All thatどヨs needed is a physical source of
unpredictable numbers. unpredictable numbers.
A thermal noise (sometimes called Johnson noise in integrated A thermal noise (sometimes called Johnson noise in integrated
circuits) or radioactive decay source and a fast, free-running circuits) or radioactive decay source and a fast, free-running
oscillator would do the trick directly [GIFFORD]. This is a trivial oscillator would do the trick directly [GIFFORD]. This is a trivial
amount of hardware, and could easily be included as a standard part amount of hardware, and could easily be included as a standard part
of a computer system's architecture. Furthermore, any system with a of a computer systemどヨs architecture. Most audio (or video) input
devices are useable [TURBID]. Furthermore, any system with a
spinning disk or ring oscillator and a stable (crystal) time source spinning disk or ring oscillator and a stable (crystal) time source
or the like has an adequate source of randomness ([DAVIS] and Section or the like has an adequate source of randomness ([DAVIS] and Section
5.4). All that's needed is the common perception among computer 5.4). All thatどヨs needed is the common perception among computer
vendors that this small additional hardware and the software to vendors that this small additional hardware and the software to
access it is necessary and useful. access it is necessary and useful.
5.1 Volume Required 5.1 Volume Required
How much unpredictability is needed? Is it possible to quantify the How much unpredictability is needed? Is it possible to quantify the
requirement in, say, number of random bits per second? requirement in, say, number of random bits per second?
The answer is not very much is needed. For AES, the key can be 128 The answer is not very much is needed. For AES, the key can be 128
bits and, as we show in an example in Section 8, even the highest bits and, as we show in an example in Section 8, even the highest
skipping to change at page 16, line 13 skipping to change at page 17, line 17
stream and that bits are not correlated, i.e., that the bits are stream and that bits are not correlated, i.e., that the bits are
identical independent distributions. If alternate bits were from two identical independent distributions. If alternate bits were from two
correlated sources, for example, the above analysis breaks down. correlated sources, for example, the above analysis breaks down.
The above technique also provides another illustration of how a The above technique also provides another illustration of how a
simple statistical analysis can mislead if one is not always on the simple statistical analysis can mislead if one is not always on the
lookout for patterns that could be exploited by an adversary. If the lookout for patterns that could be exploited by an adversary. If the
algorithm were mis-read slightly so that overlapping successive bits algorithm were mis-read slightly so that overlapping successive bits
pairs were used instead of non-overlapping pairs, the statistical pairs were used instead of non-overlapping pairs, the statistical
analysis given is the same; however, instead of providing an unbiased analysis given is the same; however, instead of providing an unbiased
uncorrelated series of random 1's and 0's, it instead produces a uncorrelated series of random 1どヨs and 0どヨs, it instead produces a
totally predictable sequence of exactly alternating 1's and 0's. totally predictable sequence of exactly alternating 1どヨs and 0どヨs.
5.2.3 Using FFT to De-Skew 5.2.3 Using FFT to De-Skew
When real world data consists of strongly biased or correlated bits, When real world data consists of strongly biased or correlated bits,
it may still contain useful amounts of randomness. This randomness it may still contain useful amounts of randomness. This randomness
can be extracted through use of the discrete Fourier transform or its can be extracted through use of the discrete Fourier transform or its
optimized variant, the FFT. optimized variant, the FFT.
Using the Fourier transform of the data, strong correlations can be Using the Fourier transform of the data, strong correlations can be
discarded. If adequate data is processed and remaining correlations discarded. If adequate data is processed and remaining correlations
skipping to change at page 17, line 32 skipping to change at page 18, line 34
the microphone receiving only low level background noise. Such data the microphone receiving only low level background noise. Such data
is essentially random noise although it should not be trusted without is essentially random noise although it should not be trusted without
some checking in case of hardware failure. It will, in any case, need some checking in case of hardware failure. It will, in any case, need
to be de-skewed as described elsewhere. to be de-skewed as described elsewhere.
Combining this with compression to de-skew one can, in UNIXese, Combining this with compression to de-skew one can, in UNIXese,
generate a huge amount of medium quality random data by doing generate a huge amount of medium quality random data by doing
cat /dev/audio | compress - >random-bits-file cat /dev/audio | compress - >random-bits-file
A detailed examination of this type of randomness source appears in
[TURBID].
5.3.2 Using Existing Disk Drives 5.3.2 Using Existing Disk Drives
Disk drives have small random fluctuations in their rotational speed Disk drives have small random fluctuations in their rotational speed
due to chaotic air turbulence [DAVIS]. By adding low level disk seek due to chaotic air turbulence [DAVIS]. By adding low level disk seek
time instrumentation to a system, a series of measurements can be time instrumentation to a system, a series of measurements can be
obtained that include this randomness. Such data is usually highly obtained that include this randomness. Such data is usually highly
correlated so that significant processing is needed, such as FFT (see correlated so that significant processing is needed, such as FFT (see
section 5.2.3). Nevertheless experimentation has shown that, with section 5.2.3). Nevertheless experimentation has shown that, with
such processing, most disk drives easily produce 100 bits a minute or such processing, most disk drives easily produce 100 bits a minute or
more of excellent random data. more of excellent random data.
skipping to change at page 18, line 13 skipping to change at page 19, line 18
unlikely. unlikely.
5.4 Ring Oscillator Sources 5.4 Ring Oscillator Sources
If an integrated circuit is being designed or field programmed, an If an integrated circuit is being designed or field programmed, an
odd number of gates can be connected in series to produce a free- odd number of gates can be connected in series to produce a free-
running ring oscillator. By sampling a point in the ring at a fixed running ring oscillator. By sampling a point in the ring at a fixed
frequency, say one determined by a stable crystal oscillator, some frequency, say one determined by a stable crystal oscillator, some
amount of entropy can be extracted due to variations in the free- amount of entropy can be extracted due to variations in the free-
running oscillator timing. It is possible to increase the rate of running oscillator timing. It is possible to increase the rate of
entropy by xor'ing sampled values from a few ring oscillators with entropy by xorどヨing sampled values from a few ring oscillators with
relatively prime lengths. It is sometimes recommended that an odd relatively prime lengths. It is sometimes recommended that an odd
number of rings be used so that, even if the rings somehow become number of rings be used so that, even if the rings somehow become
synchronously locked to each other, there will still be sampled bit synchronously locked to each other, there will still be sampled bit
transitions. Another possibility source to sample is the output of a transitions. Another possibility source to sample is the output of a
noisy diode. noisy diode.
Sampled bits from such sources will have to be heavily de-skewed, as Sampled bits from such sources will have to be heavily de-skewed, as
disk rotation timings must be (Section 5.3.2). An engineering study disk rotation timings must be (Section 5.3.2). An engineering study
would be needed to determine the amount of entropy being produced would be needed to determine the amount of entropy being produced
depending on the particular design. In any case, these can be good depending on the particular design. In any case, these can be good
skipping to change at page 18, line 31 skipping to change at page 20, line 4
disk rotation timings must be (Section 5.3.2). An engineering study disk rotation timings must be (Section 5.3.2). An engineering study
would be needed to determine the amount of entropy being produced would be needed to determine the amount of entropy being produced
depending on the particular design. In any case, these can be good depending on the particular design. In any case, these can be good
sources whose cost is a trivial amount of hardware by modern sources whose cost is a trivial amount of hardware by modern
standards. standards.
As an example, IEEE 802.11i suggests that the circuit below be As an example, IEEE 802.11i suggests that the circuit below be
considered, with due attention in the design to isolation of the considered, with due attention in the design to isolation of the
rings from each other and from clocked circuits to avoid undesired rings from each other and from clocked circuits to avoid undesired
synchronization, etc., and extensive post processing. [IEEE 802.11i] synchronization, etc., and extensive post processing. [IEEE 802.11i]
|\ |\ |\ |\ |\ |\
+-->| >0-->| >0-- 19 total --| >0--+----,テネ湾4(テヌテヌテヌテヌテヌテヌテシテウテウネネ療ヌネ--+ +-->| >0-->| >0-- 19 total --| >0--+-------+
| |/ |/ |/ | | | |/ |/ |/ | |
| | | | | |
+----------------------------------+ V +----------------------------------+ V
+-----+ +-----+
|\ |\ |\ | | output |\ |\ |\ | | output
+-->| >0-->| >0-- 23 total --| >0--+--->| XOR |------> +-->| >0-->| >0-- 23 total --| >0--+--->| XOR |------>
ネケネヌテウテウネネ療ヌネケネヌテウテウテヌネネテネ貪サネ貪狹療ヌテウテエネ療ヌネケネヌテウテウテシテウテウテウネネ療a=Hテネ療ウテウテウテウテウテウネケ | |/ |/ |/ | | | | |/ |/ |/ | | |
| | +-----+ | | +-----+
+----------------------------------+ ^ ^ +----------------------------------+ ^ ^
| | | |
|\ |\ |\ | | |\ |\ |\ | |
+-->| >0-->| >0-- 29 total --| >0--+------+ | +-->| >0-->| >0-- 29 total --| >0--+------+ |
| |/ |/ テヌネネテネ貪サネ貪狹療ヌテウテエネ療ヌネケ |/ | | | |/ |/ |/ | |
| | | | | |
+----------------------------------+ | +----------------------------------+ |
| |
other randomness if available--------------+ other randomness if available--------------+
6. Recommended Software Strategy 6. Recommended Software Strategy
What is the best overall strategy for meeting the requirement for What is the best overall strategy for meeting the requirement for
unguessable random numbers in the absence of a reliable hardware unguessable random numbers in the absence of a reliable hardware
source? It is to obtain random input from a number of uncorrelated source? It is to obtain random input from a number of uncorrelated
skipping to change at page 19, line 33 skipping to change at page 21, line 33
bit will change about half the output bits. But because the bit will change about half the output bits. But because the
relationship is complex and non-linear, no particular output bit is relationship is complex and non-linear, no particular output bit is
guaranteed to change when any particular input bit is changed. guaranteed to change when any particular input bit is changed.
Consider the problem of converting a stream of bits that is skewed Consider the problem of converting a stream of bits that is skewed
towards 0 or 1 or which has a somewhat predictable pattern to a towards 0 or 1 or which has a somewhat predictable pattern to a
shorter stream which is more random, as discussed in Section 5.2 shorter stream which is more random, as discussed in Section 5.2
above. This is simply another case where a strong mixing function is above. This is simply another case where a strong mixing function is
desired, mixing the input bits to produce a smaller number of output desired, mixing the input bits to produce a smaller number of output
bits. The technique given in Section 5.2.1 of using the parity of a bits. The technique given in Section 5.2.1 of using the parity of a
number of bits is simply the result of successively Exclusive Or'ing number of bits is simply the result of successively Exclusive Orどヨing
them which is examined as a trivial mixing function immediately them which is examined as a trivial mixing function immediately
below. Use of stronger mixing functions to extract more of the below. Use of stronger mixing functions to extract more of the
randomness in a stream of skewed bits is examined in Section 6.1.2. randomness in a stream of skewed bits is examined in Section 6.1.2.
6.1.1 A Trivial Mixing Function 6.1.1 A Trivial Mixing Function
A trivial example for single bit inputs is the Exclusive Or function, A trivial example for single bit inputs is the Exclusive Or function,
which is equivalent to addition without carry, as show in the table which is equivalent to addition without carry, as show in the table
below. This is a degenerate case in which the one output bit always below. This is a degenerate case in which the one output bit always
changes for a change in either input bit. But, despite its changes for a change in either input bit. But, despite its
skipping to change at page 21, line 38 skipping to change at page 23, line 38
into three quantities, A, B, and C, use AES to encrypt A with B as a into three quantities, A, B, and C, use AES to encrypt A with B as a
key and then with C as a key to produce the 1st part of the output, key and then with C as a key to produce the 1st part of the output,
then encrypt B with C and then A for more output and, if necessary, then encrypt B with C and then A for more output and, if necessary,
encrypt C with A and then B for yet more output. Still more output encrypt C with A and then B for yet more output. Still more output
can be produced by reversing the order of the keys given above to can be produced by reversing the order of the keys given above to
stretch things. The same can be done with the hash functions by stretch things. The same can be done with the hash functions by
hashing various subsets of the input data or different copies of the hashing various subsets of the input data or different copies of the
input data with different prefixes and/or suffixes to produce input data with different prefixes and/or suffixes to produce
multiple outputs. multiple outputs.
An example of using a strong mixing function would be to reconsider
the case of a string of 308 bits each of which is biased 99% towards
zero. The parity technique given in Section 5.2.1 above reduced this
to one bit with only a 1/1000 deviance from being equally likely a
zero or one. But, applying the equation for information given in
Section 2, this 308 bit skewed sequence has over 5 bits of
information in it. Thus hashing it with SHA-1 and taking the bottom 5
bits of the result would yield 5 unbiased random bits as opposed to
the single bit given by calculating the parity of the string.
Alternatively, for some applications, you could use the entire hash
output to retain almost all of the entropy.
6.1.3 Using S-Boxes for Mixing
Many modern block encryption functions, including DES and AES, Many modern block encryption functions, including DES and AES,
incorporate modules known as S-Boxes (substitution boxes). These incorporate modules known as S-Boxes (substitution boxes). These
produce a smaller number of outputs from a larger number of inputs produce a smaller number of outputs from a larger number of inputs
through a complex non-linear mixing function which would have the through a complex non-linear mixing function which would have the
effect of concentrating limited entropy in the inputs into the effect of concentrating limited entropy in the inputs into the
output. output.
S-Boxes sometimes incorporate bent boolean functions (functions of an S-Boxes sometimes incorporate bent boolean functions (functions of an
even number of bits producing one output bit with maximum non- even number of bits producing one output bit with maximum non-
linearity). Looking at the output for all input pairs differing in linearity). Looking at the output for all input pairs differing in
any particular bit position, exactly half the outputs are different. any particular bit position, exactly half the outputs are different.
An S-Box in which each output bit is produced by a bent function such An S-Box in which each output bit is produced by a bent function such
that any linear combination of these functions is also a bent that any linear combination of these functions is also a bent
function is called a "perfect S-Box". function is called a "perfect S-Box".
S-boxes and various repeated application or cascades of such boxes S-boxes and various repeated application or cascades of such boxes
can be used for mixing. [SBOX*] can be used for mixing. [SBOX*]
An example of using a strong mixing function would be to reconsider 6.1.4 Diffie-Hellman as a Mixing Function
the case of a string of 308 bits each of which is biased 99% towards
zero. The parity technique given in Section 5.2.1 above reduced this
to one bit with only a 1/1000 deviance from being equally likely a
zero or one. But, applying the equation for information given in
Section 2, this 308 bit skewed sequence has over 5 bits of
information in it. Thus hashing it with SHA-1 and taking the bottom 5
bits of the result would yield 5 unbiased random bits as opposed to
the single bit given by calculating the parity of the string.
6.1.3 Diffie-Hellman as a Mixing Function
Diffie-Hellman exponential key exchange is a technique that yields a Diffie-Hellman exponential key exchange is a technique that yields a
shared secret between two parties that can be made computationally shared secret between two parties that can be made computationally
infeasible for a third party to determine even if they can observe infeasible for a third party to determine even if they can observe
all the messages between the two communicating parties. This shared all the messages between the two communicating parties. This shared
secret is a mixture of initial quantities generated by each of them secret is a mixture of initial quantities generated by each of the
[D-H]. If these initial quantities are random, then the shared secret parties [D-H].
contains the combined randomness of them both, assuming they are
uncorrelated.
6.1.4 Using a Mixing Function to Stretch Random Bits If these initial quantities are random and uncorrelated, then the
shared secret combines that randomness, but, of course, can not
produce more randomness than the size of the shared secret generated.
While this is true if the Diffie-Hellman computation is performed
privately, if an adversary can observe either of the public keys and
knows the modulus being used, they need only search through the space
of the other secret key in order to be able to calculate the shared
secret [D-H]. So, conservatively, it would be best to consider public
Diffie-Hellman to produce a quantity whose guessability corresponds
to the worst of the two inputs.
6.1.5 Using a Mixing Function to Stretch Random Bits
While it is not necessary for a mixing function to produce the same While it is not necessary for a mixing function to produce the same
or fewer bits than its inputs, mixing bits cannot "stretch" the or fewer bits than its inputs, mixing bits cannot "stretch" the
amount of random unpredictability present in the inputs. Thus four amount of random unpredictability present in the inputs. Thus four
inputs of 32 bits each where there is 12 bits worth of inputs of 32 bits each where there is 12 bits worth of
unpredictability (such as 4,096 equally probable values) in each unpredictability (such as 4,096 equally probable values) in each
input cannot produce more than 48 bits worth of unpredictable output. input cannot produce more than 48 bits worth of unpredictable output.
The output can be expanded to hundreds or thousands of bits by, for The output can be expanded to hundreds or thousands of bits by, for
example, mixing with successive integers, but the clever adversary's example, mixing with successive integers, but the clever adversaryどヨs
search space is still 2^48 possibilities. Furthermore, mixing to search space is still 2^48 possibilities. Furthermore, mixing to
fewer bits than are input will tend to strengthen the randomness of fewer bits than are input will tend to strengthen the randomness of
the output the way using Exclusive Or to produce one bit from two did the output the way using Exclusive Or to produce one bit from two did
above. above.
The last table in Section 6.1.1 shows that mixing a random bit with a The last table in Section 6.1.1 shows that mixing a random bit with a
constant bit with Exclusive Or will produce a random bit. While this constant bit with Exclusive Or will produce a random bit. While this
is true, it does not provide a way to "stretch" one random bit into is true, it does not provide a way to "stretch" one random bit into
more than one. If, for example, a random bit is mixed with a 0 and more than one. If, for example, a random bit is mixed with a 0 and
then with a 1, this produces a two bit sequence but it will always be then with a 1, this produces a two bit sequence but it will always be
either 01 or 10. Since there are only two possible values, there is either 01 or 10. Since there are only two possible values, there is
still only the one bit of original randomness. still only the one bit of original randomness.
6.1.5 Other Factors in Choosing a Mixing Function 6.1.6 Other Factors in Choosing a Mixing Function
For local use, AES has the advantages that it has been widely tested For local use, AES has the advantages that it has been widely tested
for flaws, is reasonably efficient in software, and is widely for flaws, is reasonably efficient in software, and is widely
documented and implemented with hardware and software implementations documented and implemented with hardware and software implementations
available all over the world including open source code. The SHA* available all over the world including open source code. The SHA*
family have had a little less study and tend to require more CPU family have had a little less study and tend to require more CPU
cycles than AES but there is no reason to believe they are flawed. cycles than AES but there is no reason to believe they are flawed.
Both SHA* and MD5 were derived from the earlier MD4 algorithm. They Both SHA* and MD5 were derived from the earlier MD4 algorithm. They
all have source code available [SHA*, MD*]. Some signs of weakness all have source code available [SHA*, MD*]. Some signs of weakness
have been found in MD4 and MD5. In particular, MD4 has only three have been found in MD4 and MD5. In particular, MD4 has only three
skipping to change at page 23, line 35 skipping to change at page 26, line 4
IBM, was primarily to strengthen it. No concealed or special weakness IBM, was primarily to strengthen it. No concealed or special weakness
has been found in DES. It is likely that the NSA modifications to MD4 has been found in DES. It is likely that the NSA modifications to MD4
to produce the SHA algorithms similarly strengthened these to produce the SHA algorithms similarly strengthened these
algorithms, possibly against threats not yet known in the public algorithms, possibly against threats not yet known in the public
cryptographic community. cryptographic community.
Where input lengths are unpredictable, hash algorithms are a little Where input lengths are unpredictable, hash algorithms are a little
more convenient to use than block encryption algorithms since they more convenient to use than block encryption algorithms since they
are generally designed to accept variable length inputs. Block are generally designed to accept variable length inputs. Block
encryption algorithms generally require an additional padding encryption algorithms generally require an additional padding
algorithm to accomodate inputs that are not an even multiple of the algorithm to accommodate inputs that are not an even multiple of the
block size. block size.
As of the time of this document, the authors know of no patent claims As of the time of this document, the authors know of no patent claims
to the basic AES, DES, SHA*, MD4, and MD5 algorithms other than to the basic AES, DES, SHA*, MD4, and MD5 algorithms other than
patents for which an irrevocable royalty free license has been patents for which an irrevocable royalty free license has been
granted to the world. There may, of course, be basic patents of which granted to the world. There may, of course, be basic patents of which
the authors are unaware or patents on implementations or uses or the authors are unaware or patents on implementations or uses or
other relevant patents issued or to be issued. other relevant patents issued or to be issued.
6.2 Non-Hardware Sources of Randomness 6.2 Non-Hardware Sources of Randomness
The best source of input for mixing would be a hardware randomness The best source of input for mixing would be a hardware randomness
such as ring oscillators, disk drive timing, thermal noise, or such as ring oscillators, disk drive timing, thermal noise, or
radioactive decay. However, if that is not available there are other radioactive decay. However, if that is not available, there are other
possibilities. These include system clocks, system or input/output possibilities. These include system clocks, system or input/output
buffers, user/system/hardware/network serial numbers and/or addresses buffers, user/system/hardware/network serial numbers and/or addresses
and timing, and user input. Unfortunately, each of these sources can and timing, and user input. Unfortunately, each of these sources can
produce very limited or predictable values under some circumstances. produce very limited or predictable values under some circumstances.
Some of the sources listed above would be quite strong on multi-user Some of the sources listed above would be quite strong on multi-user
systems where, in essence, each user of the system is a source of systems where, in essence, each user of the system is a source of
randomness. However, on a small single user or embedded system, randomness. However, on a small single user or embedded system,
especially at start up, it might be possible for an adversary to especially at start up, it might be possible for an adversary to
assemble a similar configuration. This could give the adversary assemble a similar configuration. This could give the adversary
skipping to change at page 25, line 6 skipping to change at page 27, line 26
way from the previous value, then when any value is compromised, all way from the previous value, then when any value is compromised, all
future values can be determined. This would be the case, for example, future values can be determined. This would be the case, for example,
if each value were a constant function of the previously used values, if each value were a constant function of the previously used values,
even if the function were a very strong, non-invertible message even if the function were a very strong, non-invertible message
digest function. digest function.
(It should be noted that if your technique for generating a sequence (It should be noted that if your technique for generating a sequence
of key values is fast enough, it can trivially be used as the basis of key values is fast enough, it can trivially be used as the basis
for a confidentiality system. If two parties use the same sequence for a confidentiality system. If two parties use the same sequence
generating technique and start with the same seed material, they will generating technique and start with the same seed material, they will
generate identical sequences. These could, for example, be xor'ed at generate identical sequences. These could, for example, be xorどヨed at
one end with data being send, encrypting it, and xor'ed with this one end with data being send, encrypting it, and xorどヨed with this
data as received, decrypting it due to the reversible properties of data as received, decrypting it due to the reversible properties of
the xor operation. This is commonly referred to as a simple stream the xor operation. This is commonly referred to as a simple stream
cipher.) cipher.)
6.3.1 Traditional Strong Sequences 6.3.1 Traditional Strong Sequences
A traditional way to achieve a strong sequence has been to have the A traditional way to achieve a strong sequence has been to have the
values be produced by hashing the quantities produced by values be produced by hashing the quantities produced by
concatenating the seed with successive integers or the like and then concatenating the seed with successive integers or the like and then
mask the values obtained so as to limit the amount of generator state mask the values obtained so as to limit the amount of generator state
skipping to change at page 26, line 26 skipping to change at page 28, line 49
sequence. Thus it is best to use only one bit from each value. It has sequence. Thus it is best to use only one bit from each value. It has
been shown that in some cases this makes it impossible to break a been shown that in some cases this makes it impossible to break a
system even when the cryptographic system is invertible and can be system even when the cryptographic system is invertible and can be
broken if all of each generated value was revealed. broken if all of each generated value was revealed.
6.3.2 The Blum Blum Shub Sequence Generator 6.3.2 The Blum Blum Shub Sequence Generator
Currently the generator which has the strongest public proof of Currently the generator which has the strongest public proof of
strength is called the Blum Blum Shub generator after its inventors strength is called the Blum Blum Shub generator after its inventors
[BBS]. It is also very simple and is based on quadratic residues. [BBS]. It is also very simple and is based on quadratic residues.
It's only disadvantage is that it is computationally intensive Itどヨs only disadvantage is that it is computationally intensive
compared with the traditional techniques give in 6.3.1 above. This is compared with the traditional techniques give in 6.3.1 above. This is
not a major draw back if it is used for moderately infrequent not a major draw back if it is used for moderately infrequent
purposes, such as generating session keys. purposes, such as generating session keys.
Simply choose two large prime numbers, say p and q, which both have Simply choose two large prime numbers, say p and q, which both have
the property that you get a remainder of 3 if you divide them by 4. the property that you get a remainder of 3 if you divide them by 4.
Let n = p * q. Then you choose a random number x relatively prime to Let n = p * q. Then you choose a random number x relatively prime to
n. The initial seed for the generator and the method for calculating n. The initial seed for the generator and the method for calculating
subsequent values are then subsequent values are then
skipping to change at page 27, line 28 skipping to change at page 30, line 7
6.3.3 Entropy Pool Techniques 6.3.3 Entropy Pool Techniques
Many modern pseudo-random number sources utilize the technique of Many modern pseudo-random number sources utilize the technique of
maintaining a "pool" of bits and providing operations for strongly maintaining a "pool" of bits and providing operations for strongly
mixing input with some randomness into the pool and extracting psuedo mixing input with some randomness into the pool and extracting psuedo
random bits from the pool. This is illustrated in the figure below. random bits from the pool. This is illustrated in the figure below.
+--------+ +------+ +---------+ +--------+ +------+ +---------+
--->| Mix In |--->| POOL |--->| Extract |---> --->| Mix In |--->| POOL |--->| Extract |--->
テヌテヌテウテウテウネケ | Bits | | | | Bits | | Bits | | | | Bits |
+--------+ +------+ +---------+ +--------+ +------+ +---------+
^ V ^ V
| | | |
+-----------+ +-----------+
Bits to be feed into the pool can be any of the various hardware, Bits to be feed into the pool can be any of the various hardware,
environmental, or user input sources discussed above. It is also environmental, or user input sources discussed above. It is also
common to save the state of the pool on system shut down and restore common to save the state of the pool on system shut down and restore
it on re-starting, if stable storage is available. it on re-starting, if stable storage is available.
skipping to change at page 28, line 12 skipping to change at page 31, line 12
details on an example implementation and [RSA BULL1] for similar details on an example implementation and [RSA BULL1] for similar
suggestions. suggestions.
7. Key Generation Standards and Examples 7. Key Generation Standards and Examples
Several public standards and widely deployed examples are now in Several public standards and widely deployed examples are now in
place for the generation of keys without special hardware. Three place for the generation of keys without special hardware. Three
standards are described below. The two older standards use DES, with standards are described below. The two older standards use DES, with
its 64-bit block and key size limit, but any equally strong or its 64-bit block and key size limit, but any equally strong or
stronger mixing function could be substituted. The third is a more stronger mixing function could be substituted. The third is a more
modern and stronger standard based on SHA-1. Finally the widely modern and stronger standard based on SHA-1. Lastly the widely
deployed modern UNIX random number generators are described. deployed modern UNIX random number generators are described.
7.1 US DoD Recommendations for Password Generation 7.1 US DoD Recommendations for Password Generation
The United States Department of Defense has specific recommendations The United States Department of Defense has specific recommendations
for password generation [DoD]. They suggest using the US Data for password generation [DoD]. They suggest using the US Data
Encryption Standard [DES] in Output Feedback Mode [MODES] as follows: Encryption Standard [DES] in Output Feedback Mode [MODES] as follows:
use an initialization vector determined from use an initialization vector determined from
the system clock, the system clock,
skipping to change at page 30, line 13 skipping to change at page 33, line 13
160-bit value and the second a 512 bit value. 160-bit value and the second a 512 bit value.
The first is based on SHA-1 and works by setting the 5 linking The first is based on SHA-1 and works by setting the 5 linking
variables, denoted H with subscripts in the SHA-1 specification, to variables, denoted H with subscripts in the SHA-1 specification, to
the first argument divided into fifths. Then steps (a) through (e) of the first argument divided into fifths. Then steps (a) through (e) of
section 7 of the NIST SHA-1 specification are run over the second section 7 of the NIST SHA-1 specification are run over the second
argument as if it were a 512-bit data block. The values of the argument as if it were a 512-bit data block. The values of the
linking variable after those steps are then concatenated to produce linking variable after those steps are then concatenated to produce
the output of G. [SHA-1] the output of G. [SHA-1]
As an alternative second methold, NIST also defined an alternate G As an alternative second method, NIST also defined an alternate G
function based on multiple applications of the DES encryption function based on multiple applications of the DES encryption
function [DSS]. function [DSS].
7.4 X9.82 Pseudo-Random Number Generation 7.4 X9.82 Pseudo-Random Number Generation
The National Institute for Standards and Technology (NIST) and the The National Institute for Standards and Technology (NIST) and the
American National Standards Institutes (ANSI) X9F1 committee are in American National Standards Institutes (ANSI) X9F1 committee are in
the final stages of creating a standard for random number generation. the final stages of creating a standard for random number generation.
This standard includes a number of random number generators for use This standard includes a number of random number generators for use
with AES and other block ciphers. It also includes random number with AES and other block ciphers. It also includes random number
skipping to change at page 30, line 37 skipping to change at page 33, line 37
7.5 The /dev/random Device 7.5 The /dev/random Device
Several versions of the UNIX operating system provides a kernel- Several versions of the UNIX operating system provides a kernel-
resident random number generator. In some cases, these generators resident random number generator. In some cases, these generators
makes use of events captured by the Kernel during normal system makes use of events captured by the Kernel during normal system
operation. operation.
For example, on some versions of Linux, the generator consists of a For example, on some versions of Linux, the generator consists of a
random pool of 512 bytes represented as 128 words of 4-bytes each. random pool of 512 bytes represented as 128 words of 4-bytes each.
When an event occurs, such as a disk drive interrupt, the time of the When an event occurs, such as a disk drive interrupt, the time of the
event is xor'ed into the pool and the pool is stirred via a primitive event is xorどヨed into the pool and the pool is stirred via a primitive
polynomial of degree 128. The pool itself is treated as a ring polynomial of degree 128. The pool itself is treated as a ring
buffer, with new data being XORed (after stirring with the buffer, with new data being XORed (after stirring with the
polynomial) across the entire pool. polynomial) across the entire pool.
Each call that adds entropy to the pool estimates the amount of Each call that adds entropy to the pool estimates the amount of
likely true entropy the input contains. The pool itself contains a likely true entropy the input contains. The pool itself contains a
accumulator that estimates the total over all entropy of the pool. accumulator that estimates the total over all entropy of the pool.
Input events come from several sources as listed below. Input events come from several sources as listed below.
Unfortunately, for server machines without human operators, the first Unfortunately, for server machines without human operators, the first
skipping to change at page 31, line 39 skipping to change at page 34, line 39
As entropy is added to the pool from events, more data becomes As entropy is added to the pool from events, more data becomes
available via /dev/random. Random data obtained from such a available via /dev/random. Random data obtained from such a
/dev/random device is suitable for key generation for long term keys, /dev/random device is suitable for key generation for long term keys,
if enough random bits are in the pool or are added in a reasonable if enough random bits are in the pool or are added in a reasonable
amount of time. amount of time.
/dev/urandom works like /dev/random, however it provides data even /dev/urandom works like /dev/random, however it provides data even
when the entropy estimate for the random pool drops to zero. This may when the entropy estimate for the random pool drops to zero. This may
be adequate for session keys or for other key generation tasks where be adequate for session keys or for other key generation tasks where
blocking while waiting for more random bits is not acceptable. The blocking while waiting for more random bits is not acceptable. The
risk of continuing to take data even when the pool's entropy estimate risk of continuing to take data even when the poolどヨs entropy estimate
is small in that past output may be computable from current output is small in that past output may be computable from current output
provided an attacker can reverse SHA-1. Given that SHA-1 is designed provided an attacker can reverse SHA-1. Given that SHA-1 is designed
to be non-invertible, this is a reasonable risk. to be non-invertible, this is a reasonable risk.
To obtain random numbers under Linux, Solaris, or other UNIX systems To obtain random numbers under Linux, Solaris, or other UNIX systems
equiped with code as described above, all an application needs to do equipped with code as described above, all an application needs to do
is open either /dev/random or /dev/urandom and read the desired is open either /dev/random or /dev/urandom and read the desired
number of bytes. number of bytes.
(The Linux Random device was written by Theodore Ts'o. It was based (The Linux Random device was written by Theodore Tsどヨo. It was based
loosely on the random number generator in PGP 2.X and PGP 3.0 (aka loosely on the random number generator in PGP 2.X and PGP 3.0 (aka
PGP 5.0).) PGP 5.0).)
8. Examples of Randomness Required 8. Examples of Randomness Required
Below are two examples showing rough calculations of needed Below are two examples showing rough calculations of needed
randomness for security. The first is for moderate security passwords randomness for security. The first is for moderate security passwords
while the second assumes a need for a very high security while the second assumes a need for a very high security
cryptographic key. cryptographic key.
skipping to change at page 32, line 24 skipping to change at page 35, line 24
8.1 Password Generation 8.1 Password Generation
Assume that user passwords change once a year and it is desired that Assume that user passwords change once a year and it is desired that
the probability that an adversary could guess the password for a the probability that an adversary could guess the password for a
particular account be less than one in a thousand. Further assume particular account be less than one in a thousand. Further assume
that sending a password to the system is the only way to try a that sending a password to the system is the only way to try a
password. Then the crucial question is how often an adversary can try password. Then the crucial question is how often an adversary can try
possibilities. Assume that delays have been introduced into a system possibilities. Assume that delays have been introduced into a system
so that, at most, an adversary can make one password try every six so that, at most, an adversary can make one password try every six
seconds. That's 600 per hour or about 15,000 per day or about seconds. Thatどヨs 600 per hour or about 15,000 per day or about
5,000,000 tries in a year. Assuming any sort of monitoring, it is 5,000,000 tries in a year. Assuming any sort of monitoring, it is
unlikely someone could actually try continuously for a year. In fact, unlikely someone could actually try continuously for a year. In fact,
even if log files are only checked monthly, 500,000 tries is more even if log files are only checked monthly, 500,000 tries is more
plausible before the attack is noticed and steps taken to change plausible before the attack is noticed and steps taken to change
passwords and make it harder to try more passwords. passwords and make it harder to try more passwords.
To have a one in a thousand chance of guessing the password in To have a one in a thousand chance of guessing the password in
500,000 tries implies a universe of at least 500,000,000 passwords or 500,000 tries implies a universe of at least 500,000,000 passwords or
about 2^29. Thus 29 bits of randomness are needed. This can probably about 2^29. Thus 29 bits of randomness are needed. This can probably
be achieved using the US DoD recommended inputs for password be achieved using the US DoD recommended inputs for password
skipping to change at page 33, line 49 skipping to change at page 36, line 49
could break the key in 2 weeks (on average they need try only half could break the key in 2 weeks (on average they need try only half
the keys). the keys).
These questions are considered in detail in "Minimal Key Lengths for These questions are considered in detail in "Minimal Key Lengths for
Symmetric Ciphers to Provide Adequate Commercial Security: A Report Symmetric Ciphers to Provide Adequate Commercial Security: A Report
by an Ad Hoc Group of Cryptographers and Computer Scientists" by an Ad Hoc Group of Cryptographers and Computer Scientists"
[KeyStudy] which was sponsored by the Business Software Alliance. It [KeyStudy] which was sponsored by the Business Software Alliance. It
concluded that a reasonable key length in 1995 for very high security concluded that a reasonable key length in 1995 for very high security
is in the range of 75 to 90 bits and, since the cost of cryptography is in the range of 75 to 90 bits and, since the cost of cryptography
does not vary much with they key size, recommends 90 bits. To update does not vary much with they key size, recommends 90 bits. To update
these recommendations, just add 2/3 of a bit per year for Moore's law these recommendations, just add 2/3 of a bit per year for Mooreどヨs law
[MOORE]. Thus, in the year 2004, this translates to a determination [MOORE]. Thus, in the year 2004, this translates to a determination
that a reasonable key length is in the 81 to 96 bit range. In fact, that a reasonable key length is in the 81 to 96 bit range. In fact,
today, it is increasingly common to use keys longer than 96 bits, today, it is increasingly common to use keys longer than 96 bits,
such as 128-bit (or longer) keys with AES and keys with effective such as 128-bit (or longer) keys with AES and keys with effective
lengths of 112-bits using triple-DES. lengths of 112-bits using triple-DES.
8.2.2 Meet in the Middle Attacks 8.2.2 Meet in the Middle Attacks
If chosen or known plain text and the resulting encrypted text are If chosen or known plain text and the resulting encrypted text are
skipping to change at page 35, line 10 skipping to change at page 38, line 10
Enormous resources may be required to mount a meet in the middle Enormous resources may be required to mount a meet in the middle
attack but they are probably within the range of the national attack but they are probably within the range of the national
security services of a major nation. Essentially all nations spy on security services of a major nation. Essentially all nations spy on
other nations traffic. other nations traffic.
8.2.3 Other Considerations 8.2.3 Other Considerations
[KeyStudy] also considers the possibilities of special purpose code [KeyStudy] also considers the possibilities of special purpose code
breaking hardware and having an adequate safety margin. breaking hardware and having an adequate safety margin.
If the two parties agree on a key by Diffie-Hellman exchange [D-H],
then in principle only half of this randomness would have to be
supplied by each party. However, there is probably some correlation
between their random inputs so it is probably best to assume you end
up with more like one and a half times the bits of randomness each
provides for very high security if Diffie-Hellman is used.
It should be noted that key length calculations such at those above It should be noted that key length calculations such at those above
are controversial and depend on various assumptions about the are controversial and depend on various assumptions about the
cryptographic algorithms in use. In some cases, a professional with a cryptographic algorithms in use. In some cases, a professional with a
deep knowledge of code breaking techniques and of the strength of the deep knowledge of code breaking techniques and of the strength of the
algorithm in use could be satisfied with less than half of the 192 algorithm in use could be satisfied with less than half of the 192
bit key size derived above. bit key size derived above.
For further examples of conservative design principles see For further examples of conservative design principles see
[FERGUSON]. [FERGUSON].
9. Conclusion 9. Conclusion
Generation of unguessable "random" secret quantities for security use Generation of unguessable "random" secret quantities for security use
is an essential but difficult task. is an essential but difficult task.
Hardware techniques to produce such randomness would be relatively Hardware techniques to produce such randomness would be relatively
simple. In particular, the volume and quality would not need to be simple. In particular, the volume and quality would not need to be
high and existing computer hardware, such as disk drives, can be high and existing computer hardware, such as audio input or disk
used. drives, can be used.
Widely available computational techniques are available to process Widely available computational techniques are available to process
low quality random quantities from multiple sources or a larger low quality random quantities from multiple sources or a larger
quantity of such low quality input from one source and produce a quantity of such low quality input from one source and produce a
smaller quantity of higher quality keying material. In the absence of smaller quantity of higher quality keying material. In the absence of
hardware sources of randomness, a variety of user and software hardware sources of randomness, a variety of user and software
sources can frequently, with care, be used instead; however, most sources can frequently, with care, be used instead; however, most
modern systems already have hardware, such as disk drives or audio modern systems already have hardware, such as disk drives or audio
input, that could be used to produce high quality randomness. input, that could be used to produce high quality randomness.
Once a sufficient quantity of high quality seed key material (a Once a sufficient quantity of high quality seed key material (a
couple of hundred bits) is available, computational techniques are couple of hundred bits) is available, computational techniques are
available to produce cryptographically strong sequences of available to produce cryptographically strong sequences of
unpredictable quantities from this seed material. computationally unpredictable quantities from this seed material.
10. Security Considerations 10. Security Considerations
The entirety of this document concerns techniques and recommendations The entirety of this document concerns techniques and recommendations
for generating unguessable "random" quantities for use as passwords, for generating unguessable "random" quantities for use as passwords,
cryptographic keys, initialization vectors, sequence numbers, and cryptographic keys, initialization vectors, sequence numbers, and
similar security uses. similar security uses.
11. Intellectual Property Considerations 11. Copyright and Disclaimer
By submitting this Internet-Draft, I certify that any applicable
patent or other IPR claims of which I am aware have been disclosed,
and any of which I become aware will be disclosed, in accordance with
RFC 3668.
The IETF takes no position regarding the validity or scope
of any Intellectual Property Rights or other rights that might be
claimed to pertain to the implementation or use of the technology
described in this document or the extent to which any license under
such rights might or might not be available; nor does it represent
that it has made any independent effort to identify any such rights.
Information on the procedures with respect to rights in RFC documents
can be found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at ietf-
ipr@ietf.org.
12. Copyright and Disclaimer
Copyright (C) The Internet Society 2004. This document is subject Copyright (C) The Internet Society 2004. This document is subject to
to the rights, licenses and restrictions contained in BCP 78, and the rights, licenses and restrictions contained in BCP 78 and except
except as set forth therein, the authors retain all their rights. as set forth therein, the authors retain all their rights.
This document and the information contained herein are provided on an This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
13. Appendix A: Changes from RFC 1750 12. Appendix A: Changes from RFC 1750
1. Additional acknowledgements have been added. 1. Additional acknowledgements have been added.
2. Insertion of section 5.2.4 on de-skewing with S-boxes. 2. Insertion of section 5.2.4 on de-skewing with S-boxes.
3. Addition of section 5.4 on Ring Oscillator randomness sources. 3. Addition of section 5.4 on Ring Oscillator randomness sources.
4. AES and the members of the SHA series producing more than 160 4. AES and the members of the SHA series producing more than 160
bits have been added. Use of AES has been emphasized and the use bits have been added. Use of AES has been emphasized and the use
of DES de-emphasized. of DES de-emphasized.
skipping to change at page 38, line 28 skipping to change at page 41, line 28
6. Addition of section 7.3 on the pseudo-random number generation 6. Addition of section 7.3 on the pseudo-random number generation
techniques given in FIPS 186-2, 7.4 on those given in X9.82, and techniques given in FIPS 186-2, 7.4 on those given in X9.82, and
section 7.5 on the random number generation techniques of the section 7.5 on the random number generation techniques of the
/dev/random device in Linux and other UNIX systems. /dev/random device in Linux and other UNIX systems.
7. Addition of references to the "Minimal Key Lengths for Symmetric 7. Addition of references to the "Minimal Key Lengths for Symmetric
Ciphers to Provide Adequate Commercial Security" study published Ciphers to Provide Adequate Commercial Security" study published
in January 1996 [KeyStudy]. in January 1996 [KeyStudy].
8. Minor wording changes and reference updates. 8. Added caveats to using Diffie-Hellman as a mixing function.
9. Addition of references to the [TURBID] paper and system.
10. Minor wording changes and reference updates.
14. Informative References 14. Informative References
[AES] - "Specification of the Advanced Encryption Standard (AES)", [AES] - "Specification of the Advanced Encryption Standard (AES)",
United States of America, US National Institute of Standards and United States of America, US National Institute of Standards and
Technology, FIPS 197, November 2001. Technology, FIPS 197, November 2001.
[ASYMMETRIC] - "Secure Communications and Asymmetric Cryptosystems", [ASYMMETRIC] - "Secure Communications and Asymmetric Cryptosystems",
edited by Gustavus J. Simmons, AAAS Selected Symposium 69, Westview edited by Gustavus J. Simmons, AAAS Selected Symposium 69, Westview
Press, Inc. Press, Inc.
skipping to change at page 39, line 25 skipping to change at page 42, line 25
[BBS] - "A Simple Unpredictable Pseudo-Random Number Generator", SIAM [BBS] - "A Simple Unpredictable Pseudo-Random Number Generator", SIAM
Journal on Computing, v. 15, n. 2, 1986, L. Blum, M. Blum, & M. Shub. Journal on Computing, v. 15, n. 2, 1986, L. Blum, M. Blum, & M. Shub.
[BRILLINGER] - "Time Series: Data Analysis and Theory", Holden-Day, [BRILLINGER] - "Time Series: Data Analysis and Theory", Holden-Day,
1981, David Brillinger. 1981, David Brillinger.
[CRC] - "C.R.C. Standard Mathematical Tables", Chemical Rubber [CRC] - "C.R.C. Standard Mathematical Tables", Chemical Rubber
Publishing Company. Publishing Company.
[DAVIS] - "Cryptographic Randomness from Air Turbulence in Disk [DAVIS] - "Cryptographic Randomness from Air Turbulence in Disk
Drives", Advances in Cryptology - Crypto '94, Springer-Verlag Lecture Drives", Advances in Cryptology - Crypto どヨ94, Springer-Verlag Lecture
Notes in Computer Science #839, 1984, Don Davis, Ross Ihaka, and Notes in Computer Science #839, 1984, Don Davis, Ross Ihaka, and
Philip Fenstermacher. Philip Fenstermacher.
[DES] - "Data Encryption Standard", US National Institute of [DES] - "Data Encryption Standard", US National Institute of
Standards and Technology, FIPS 46-3, October 1999. Standards and Technology, FIPS 46-3, October 1999.
- "Data Encryption Algorithm", American National Standards - "Data Encryption Algorithm", American National Standards
Institute, ANSI X3.92-1981. Institute, ANSI X3.92-1981.
(See also FIPS 112, Password Usage, which includes FORTRAN (See also FIPS 112, Password Usage, which includes FORTRAN
code for performing DES.) code for performing DES.)
skipping to change at page 40, line 25 skipping to change at page 43, line 25
[KAUFMAN] - "Network Security: Private Communication in a Public [KAUFMAN] - "Network Security: Private Communication in a Public
World", Charlie Kaufman, Radia Perlman, and Mike Speciner, Prentis World", Charlie Kaufman, Radia Perlman, and Mike Speciner, Prentis
Hall PTR, ISBN 0-13-046019-2, 2nd Edition 2002. Hall PTR, ISBN 0-13-046019-2, 2nd Edition 2002.
[KeyStudy] - "Minimal Key Lengths for Symmetric Ciphers to Provide [KeyStudy] - "Minimal Key Lengths for Symmetric Ciphers to Provide
Adequate Commercial Security: A Report by an Ad Hoc Group of Adequate Commercial Security: A Report by an Ad Hoc Group of
Cryptographers and Computer Scientists", M. Blaze, W. Diffie, R. Cryptographers and Computer Scientists", M. Blaze, W. Diffie, R.
Rivest, B. Schneier, T. Shimomura, E. Thompson, and M. Weiner, Rivest, B. Schneier, T. Shimomura, E. Thompson, and M. Weiner,
January 1996, <www.counterpane.com/keylength.html>. January 1996, <www.counterpane.com/keylength.html>.
[KNUTH] - "The Art of Computeテ。テネムテ佚テテ・ネ貪眦テネ貪エテ諒r Programming", Volume 2: Seminumerical [KNUTH] - "The Art of Computer Programming", Volume 2: Seminumerical
Algorithms, Chapter 3: Random Numbers. Addison Wesley Publishing Algorithms, Chapter 3: Random Numbers. Addison Wesley Publishing
Company, 3rd Edition November 1997, Donald E. Knuth. Company, 3rd Edition November 1997, Donald E. Knuth.
[KRAWCZYK] - "How to Predict Congruential Generators", Journal of [KRAWCZYK] - "How to Predict Congruential Generators", Journal of
Algorithms, V. 13, N. 4, December 1992, H. Krawczyk Algorithms, V. 13, N. 4, December 1992, H. Krawczyk
[MAIL PEM] - RFCs 1421 through 1424: [MAIL PEM] - RFCs 1421 through 1424:
- RFC 1421, Privacy Enhancement for Internet Electronic Mail: - RFC 1421, Privacy Enhancement for Internet Electronic Mail:
Part I: Message Encryption and Authentication Procedures, 02/10/1993, Part I: Message Encryption and Authentication Procedures, 02/10/1993,
J. Linn J. Linn
skipping to change at page 41, line 19 skipping to change at page 44, line 19
Rivest Rivest
[MD5] - "The MD5 Message-Digest Algorithm", RFC1321, April 1992, R. [MD5] - "The MD5 Message-Digest Algorithm", RFC1321, April 1992, R.
Rivest Rivest
[MODES] - "DES Modes of Operation", US National Institute of [MODES] - "DES Modes of Operation", US National Institute of
Standards and Technology, FIPS 81, December 1980. Standards and Technology, FIPS 81, December 1980.
- "Data Encryption Algorithm - Modes of Operation", American - "Data Encryption Algorithm - Modes of Operation", American
National Standards Institute, ANSI X3.106-1983. National Standards Institute, ANSI X3.106-1983.
[MOORE] - Moore's Law: the exponential increase in the logic density [MOORE] - Mooreどヨs Law: the exponential increase in the logic density
of silicon circuits. Originally formulated by Gordon Moore in 1964 as of silicon circuits. Originally formulated by Gordon Moore in 1964 as
a doubling every year starting in 1962, in the late 1970s the rate a doubling every year starting in 1962, in the late 1970s the rate
fell to a doubling every 18 months and has remained there through the fell to a doubling every 18 months and has remained there through the
date of this document. See "The New Hacker's Dictionary", Third date of this document. See "The New Hackerどヨs Dictionary", Third
Edition, MIT Press, ISBN 0-262-18178-9, Eric S. Raymond, 1996. Edition, MIT Press, ISBN 0-262-18178-9, Eric S. Raymond, 1996.
[ORMAN] - "Determining Strengths For Public Keys Used For Exchanging [ORMAN] - "Determining Strengths For Public Keys Used For Exchanging
Symmetric Keys", draft-orman-public-key-lengths-*.txt, Hilarie Orman, Symmetric Keys", draft-orman-public-key-lengths-*.txt, Hilarie Orman,
Paul Hoffman, work in progress. Paul Hoffman, work in progress.
[RFC 1750] - "Randomness Requirements for Security", D. Eastlake, S. [RFC 1750] - "Randomness Requirements for Security", D. Eastlake, S.
Crocker, J. Schiller, December 1994. Crocker, J. Schiller, December 1994.
[RSA BULL1] - "Suggestions for Random Number Generation in Software", [RSA BULL1] - "Suggestions for Random Number Generation in Software",
RSA Laboratories Bulletin #1, January 1996. RSA Laboratories Bulletin #1, January 1996.
[RSA BULL13] - "A Cost-Based Security Analysis of Symmetric and [RSA BULL13] - "A Cost-Based Security Analysis of Symmetric and
Asymmetric Key Lengths", RSA Laboratories Bulletin #13, Robert Asymmetric Key Lengths", RSA Laboratories Bulletin #13, Robert
Silverman, April 2000 (revised November 2001). Silverman, April 2000 (revised November 2001).
[SBOX1] - "Practical s-box design", S. Mister, C. Adams, Selected [SBOX1] - "Practical s-box design", S. Mister, C. Adams, Selected
Areas in Cryptography, 1996. Areas in Cryptography, 1996.
[SBOX2] - "Perfect Non-linear S-boxes", K. Nyberg, Advances in [SBOX2] - "Perfect Non-linear S-boxes", K. Nyberg, Advances in
Cryptography - Eurocrypt '91 Proceedings, Springer-Verland, 1991. Cryptography - Eurocrypt どヨ91 Proceedings, Springer-Verland, 1991.
[SCHNEIER] - "Applied Cryptography: Protocols, Algorithms, and Source [SCHNEIER] - "Applied Cryptography: Protocols, Algorithms, and Source
Code in C", 2nd Edition, John Wiley & Sons, 1996, Bruce Schneier. Code in C", 2nd Edition, John Wiley & Sons, 1996, Bruce Schneier.
[SHANNON] - "The Mathematical Theory of Communication", University of [SHANNON] - "The Mathematical Theory of Communication", University of
Illinois Press, 1963, Claude E. Shannon. (originally from: Bell Illinois Press, 1963, Claude E. Shannon. (originally from: Bell
System Technical Journal, July and October 1948) System Technical Journal, July and October 1948)
[SHIFT1] - "Shift Register Sequences", Aegean Park Press, Revised [SHIFT1] - "Shift Register Sequences", Aegean Park Press, Revised
Edition 1982, Solomon W. Golomb. Edition 1982, Solomon W. Golomb.
skipping to change at page 42, line 25 skipping to change at page 45, line 25
issued. issued.
[SSH] - draft-ietf-secsh-*, work in progress. [SSH] - draft-ietf-secsh-*, work in progress.
[STERN] - "Secret Linear Congruential Generators are not [STERN] - "Secret Linear Congruential Generators are not
Cryptographically Secure", Proceedings of IEEE STOC, 1987, J. Stern. Cryptographically Secure", Proceedings of IEEE STOC, 1987, J. Stern.
[TLS] - RFC 2246, "The TLS Protocol Version 1.0", T. Dierks, C. [TLS] - RFC 2246, "The TLS Protocol Version 1.0", T. Dierks, C.
Allen, January 1999. Allen, January 1999.
[TURBID] - "High Entropy Symbol Generator", John S. Denker,
<http://www.av8n.com/turbid/paper/turbid.htm>, 2003.
[USENET] - RFC 977, "Network News Transfer Protocol", B. Kantor, P. [USENET] - RFC 977, "Network News Transfer Protocol", B. Kantor, P.
Lapsley, February 1986. Lapsley, February 1986.
- RFC 2980, "Common NNTP Extensions", S. Barber, October - RFC 2980, "Common NNTP Extensions", S. Barber, October
2000. 2000.
[VON NEUMANN] - "Various techniques used in connection with random [VON NEUMANN] - "Various techniques used in connection with random
digits", von Neumann's Collected Works, Vol. 5, Pergamon Press, 1963, digits", von Neumannどヨs Collected Works, Vol. 5, Pergamon Press, 1963,
J. von Neumann. J. von Neumann.
[X9.17] - "American National Standard for Financial Institution Key [X9.17] - "American National Standard for Financial Institution Key
Management (Wholesale)", American Bankers Association, 1985. Management (Wholesale)", American Bankers Association, 1985.
[X9.82] - "Random Number Generation", ANSI X9F1, work in progress. [X9.82] - "Random Number Generation", ANSI X9F1, work in progress.
Authors Addresses Authors Addresses
Donald E. Eastlake 3rd Donald E. Eastlake 3rd
skipping to change at page 43, line 30 skipping to change at page 46, line 30
Telephone: +1 617-253-0161 Telephone: +1 617-253-0161
E-mail: jis@mit.edu E-mail: jis@mit.edu
Steve Crocker Steve Crocker
EMail: steve@stevecrocker.com EMail: steve@stevecrocker.com
File Name and Expiration File Name and Expiration
This is file draft-eastlake-randomness2-07.txt. This is file draft-eastlake-randomness2-08.txt.
It expires December 2004. It expires February 2005.
 End of changes. 70 change blocks. 
166 lines changed or deleted 158 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/