idnits 2.17.00 (12 Aug 2021) /tmp/idnits48100/draft-eastlake-randomness2-07.txt: -(1): Line appears to be too long, but this could be caused by non-ascii characters in UTF-8 encoding -(318): Line appears to be too long, but this could be caused by non-ascii characters in UTF-8 encoding -(740): Line appears to be too long, but this could be caused by non-ascii characters in UTF-8 encoding -(747): Line appears to be too long, but this could be caused by non-ascii characters in UTF-8 encoding -(753): Line appears to be too long, but this could be caused by non-ascii characters in UTF-8 encoding -(1699): Line appears to be too long, but this could be caused by non-ascii characters in UTF-8 encoding Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3667, Section 5.1 on line 1565. -- Found old boilerplate from RFC 3978, Section 5.5 on line 1601. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 1574. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 1581. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 1587. ** The document claims conformance with section 10 of RFC 2026, but uses some RFC 3978/3979 boilerplate. As RFC 3978/3979 replaces section 10 of RFC 2026, you should not claim conformance with it if you have changed to using RFC 3978/3979 boilerplate. ** The document seems to lack an RFC 3978 Section 5.1 IPR Disclosure Acknowledgement -- however, there's a paragraph with a matching beginning. Boilerplate error? ** This document has an original RFC 3978 Section 5.4 Copyright Line, instead of the newer IETF Trust Copyright according to RFC 4748. ** This document has an original RFC 3978 Section 5.5 Disclaimer, instead of the newer disclaimer which includes the IETF Trust according to RFC 4748. ** The document uses RFC 3667 boilerplate or RFC 3978-like boilerplate instead of verbatim RFC 3978 boilerplate. After 6 May 2005, submission of drafts without verbatim RFC 3978 boilerplate is not accepted. The following non-3978 patterns matched text found in the document. That text should be removed or replaced: 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. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** Missing document type: Expected "INTERNET-DRAFT" in the upper left hand corner of the first page ** The document seems to lack a 1id_guidelines paragraph about Internet-Drafts being working documents. == There are 7 instances of lines with non-ascii characters in the document. == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** There is 1 instance of too long lines in the document, the longest one being 1 character in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year == The "Author's Address" (or "Authors' Addresses") section title is misspelled. == Line 798 has weird spacing: '...ity, it provi...' -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (June 2004) is 6548 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'SHA1' is mentioned on line 1326, but not defined == Unused Reference: 'DNSSEC' is defined on line 1662, but no explicit reference was found in the text == Unused Reference: 'IPSEC' is defined on line 1686, but no explicit reference was found in the text == Unused Reference: 'MAIL PGP' is defined on line 1718, but no explicit reference was found in the text == Unused Reference: 'SBOX1' is defined on line 1765, but no explicit reference was found in the text == Unused Reference: 'SBOX2' is defined on line 1768, but no explicit reference was found in the text == Unused Reference: 'SHIFT1' is defined on line 1778, but no explicit reference was found in the text == Unused Reference: 'SHIFT2' is defined on line 1781, but no explicit reference was found in the text == Unused Reference: 'SHA-2' is defined on line 1789, but no explicit reference was found in the text == Unused Reference: 'SSH' is defined on line 1793, but no explicit reference was found in the text == Unused Reference: 'TLS' is defined on line 1798, but no explicit reference was found in the text -- Obsolete informational reference (is this intentional?): RFC 2535 (ref. 'DNSSEC') (Obsoleted by RFC 4033, RFC 4034, RFC 4035) -- Obsolete informational reference (is this intentional?): RFC 2401 (ref. 'IPSEC') (Obsoleted by RFC 4301) -- Obsolete informational reference (is this intentional?): RFC 1320 (ref. 'MD4') (Obsoleted by RFC 6150) -- No information found for draft-orman-public-key-lengths- - is the name correct? -- Obsolete informational reference (is this intentional?): RFC 1750 (Obsoleted by RFC 4086) -- No information found for draft-ietf-secsh- - is the name correct? -- Obsolete informational reference (is this intentional?): RFC 2246 (ref. 'TLS') (Obsoleted by RFC 4346) Summary: 10 errors (**), 0 flaws (~~), 16 warnings (==), 14 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 彥繬etwork Working Group Donald E. Eastlake, 3rd 2 OBSOLETES RFC 1750 Jeffrey I. Schiller 3 Steve Crocker 4 Expires December 2004 June 2004 6 Randomness Requirements for Security 7 ---------- ------------ --- -------- 8 10 Status of This Document 12 This dacument is intended to become a Best Current Practice. 13 Comments should be sent to the authors. Distribution is unlimited. 15 This document is an Internet-Draft and is in full conformance with 16 all provisions of Section 10 of RFC 2026. Internet-Drafts are 17 working documents of the Internet Engineering Task Force (IETF), its 18 areas, and its working groups. Note that other groups may also 19 distribute working documents as Internet-Drafts. 21 Internet-Drafts are draft documents valid for a maximum of six months 22 and may be updated, replaced, or obsoleted by other documents at any 23 time. It is inappropriate to use Internet-Drafts as reference 24 material or to cite them other than as "work in progress." The list 25 of current Internet-Drafts can be accessed at 26 http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft 27 Shadow Directories can be accessed at 28 http://www.ietf.org/shadow.html. 30 Abstract 32 Security systems are built on strong cryptographic algorithms that 33 foil pattern analysis attempts. However, the security of these 34 systems is dependent on generating secret quantities for passwords, 35 cryptographic keys, and similar quantities. The use of pseudo-random 36 processes to generate secret quantities can result in pseudo- 37 security. The sophisticated attacker of these security systems may 38 find it easier to reproduce the environment that produced the secret 39 quantities, searching the resulting small set of possibilities, than 40 to locate the quantities in the whole of the potential number space. 42 Choosing random quantities to foil a resourceful and motivated 43 adversary is surprisingly difficult. This document points out many 44 pitfalls in using traditional pseudo-random number generation 45 techniques for choosing such quantities. It recommends the use of 46 truly random hardware techniques and shows that the existing hardware 47 on many systems can be used for this purpose. It provides suggestions 48 to ameliorate the problem when a hardware solution is not available. 49 And it gives examples of how large such quantities need to be for 50 some applications. 52 Acknowledgements 54 Special thanks to Peter Gutmann, who has permitted the incorporation 55 of material from his paper "Software Generation of Practically Strong 56 Random Numbers", and to Paul Hoffman for his extensive comments. 58 The following other persons (in alphabetic order) have also 59 contributed substantially to this document: 61 Tony Hansen, Sandy Harris, Russ Housley 63 The following persons (in alphabetic order) contributed to RFC 1750, 64 the predecessor of this document: 66 David M. Balenson, Don T. Davis, Carl Ellison, Marc Horowitz, 67 Christian Huitema, Charlie Kaufman, Steve Kent, Hal Murray, Neil 68 Haller, Richard Pitkin, Tim Redmond, and Doug Tygar. 70 Table of Contents 72 Status of This Document....................................1 73 Abstract...................................................1 75 Acknowledgements...........................................2 77 Table of Contents..........................................3 79 1. Introduction............................................5 81 2. General Requirements....................................6 83 3. Traditional Pseudo-Random Sequences.....................8 85 4. Unpredictability.......................................10 86 4.1 Problems with Clocks and Serial Numbers...............10 87 4.2 Timing and Content of External Events.................11 88 4.3 The Fallacy of Complex Manipulation...................11 89 4.4 The Fallacy of Selection from a Large Database........12 91 5. Hardware for Randomness................................13 92 5.1 Volume Required.......................................13 93 5.2 Sensitivity to Skew...................................13 94 5.2.1 Using Stream Parity to De-Skew......................14 95 5.2.2 Using Transition Mappings to De-Skew................15 96 5.2.3 Using FFT to De-Skew................................16 97 5.2.4 Using Compression to De-Skew........................16 98 5.3 Existing Hardware Can Be Used For Randomness..........17 99 5.3.1 Using Existing Sound/Video Input....................17 100 5.3.2 Using Existing Disk Drives..........................17 101 5.4 Ring Oscillator Sources...............................18 103 6. Recommended Software Strategy..........................19 104 6.1 Mixing Functions......................................19 105 6.1.1 A Trivial Mixing Function...........................19 106 6.1.2 Stronger Mixing Functions...........................20 107 6.1.3 Diffie-Hellman as a Mixing Function.................22 108 6.1.4 Using a Mixing Function to Stretch Random Bits......22 109 6.1.5 Other Factors in Choosing a Mixing Function.........23 110 6.2 Non-Hardware Sources of Randomness....................23 111 6.3 Cryptographically Strong Sequences....................24 112 6.3.1 Traditional Strong Sequences........................25 113 6.3.2 The Blum Blum Shub Sequence Generator...............26 114 6.3.3 Entropy Pool Techniques.............................27 116 7. Key Generation Standards and Examples..................28 117 7.1 US DoD Recommendations for Password Generation........28 118 7.2 X9.17 Key Generation..................................28 119 7.3 DSS Pseudo-Random Number Generation...................29 120 7.4 X9.82 Pseudo-Random Number Generation.................30 121 7.5 The /dev/random Device................................30 123 8. Examples of Randomness Required........................32 124 8.1 Password Generation..................................32 125 8.2 A Very High Security Cryptographic Key................33 126 8.2.1 Effort per Key Trial................................33 127 8.2.2 Meet in the Middle Attacks..........................34 128 8.2.3 Other Considerations................................35 130 9. Conclusion.............................................36 132 10. Security Considerations...............................37 133 11. Intellectual Property Considerations..................37 134 12. Copyright and Disclaimer..............................37 136 13. Appendix A: Changes from RFC 1750.....................38 138 14. Informative References................................39 140 Authors Addresses.........................................43 141 File Name and Expiration..................................43 143 1. Introduction 145 Software cryptography is coming into wider use and is continuing to 146 spread, although there is a long way to go until it becomes 147 pervasive. 149 Systems like SSH, IPSEC, TLS, S/MIME, PGP, DNSSEC, Kerberos, etc. are 150 maturing and becoming a part of the network landscape [SSH, IPSEC, 151 MAIL*, TLS, DNSSEC]. By comparison, when the previous version of this 152 document [RFC 1750] was issued in 1994, about the only Internet 153 cryptographic security specification in the IETF was the Privacy 154 Enhanced Mail protocol [MAIL PEM]. 156 These systems provide substantial protection against snooping and 157 spoofing. However, there is a potential flaw. At the heart of all 158 cryptographic systems is the generation of secret, unguessable (i.e., 159 random) numbers. 161 The lack of generally available facilities for generating such 162 unpredictable numbers is an open wound in the design of cryptographic 163 software. For the software developer who wants to build a key or 164 password generation procedure that runs on a wide range of hardware, 165 the only safe strategy so far has been to force the local 166 installation to supply a suitable routine to generate random numbers. 167 This is an awkward, error-prone and unpalatable solution. 169 It is important to keep in mind that the requirement is for data that 170 an adversary has a very low probability of guessing or determining. 171 This can easily fail if pseudo-random data is used which only meets 172 traditional statistical tests for randomness or which is based on 173 limited range sources, such as clocks. Frequently such random 174 quantities are determinable by an adversary searching through an 175 embarrassingly small space of possibilities. 177 This Best Current Practice describes techniques for producing random 178 quantities that will be resistant to such attack. It recommends that 179 future systems include hardware random number generation or provide 180 access to existing hardware that can be used for this purpose. It 181 suggests methods for use if such hardware is not available. And it 182 gives some estimates of the number of random bits required for sample 183 applications. 185 2. General Requirements 187 A commonly encountered randomness requirement today is the user 188 password. This is usually a simple character string. Obviously, if a 189 password can be guessed, it does not provide security. (For re-usable 190 passwords, it is desirable that users be able to remember the 191 password. This may make it advisable to use pronounceable character 192 strings or phrases composed on ordinary words. But this only affects 193 the format of the password information, not the requirement that the 194 password be very hard to guess.) 196 Many other requirements come from the cryptographic arena. 197 Cryptographic techniques can be used to provide a variety of services 198 including confidentiality and authentication. Such services are based 199 on quantities, traditionally called "keys", that are unknown to and 200 unguessable by an adversary. 202 In some cases, such as the use of symmetric encryption with the one 203 time pads or the US Data Encryption Standard [DES] or Advanced 204 Encryption Standard [AES], the parties who wish to communicate 205 confidentially and/or with authentication must all know the same 206 secret key. In other cases, using what are called asymmetric or 207 "public key" cryptographic techniques, keys come in pairs. One key of 208 the pair is private and must be kept secret by one party, the other 209 is public and can be published to the world. It is computationally 210 infeasible to determine the private key from the public key and 211 knowledge of the public is of no help to an adversary [ASYMMETRIC]. 212 [SCHNEIER, FERGUSON, KAUFMAN] 214 The frequency and volume of the requirement for random quantities 215 differs greatly for different cryptographic systems. Using pure RSA, 216 random quantities are required only when a new key pair is generated; 217 thereafter any number of messages can be signed without a further 218 need for randomness. The public key Digital Signature Algorithm 219 devised by the US National Institute of Standards and Technology 220 (NIST) requires good random numbers for each signature [DSS]. And 221 encrypting with a one time pad, in principle the strongest possible 222 encryption technique, requires a volume of randomness equal to all 223 the messages to be processed. [SCHNEIER, FERGUSON, KAUFMAN] 225 In most of these cases, an adversary can try to determine the 226 "secret" key by trial and error. (This is possible as long as the key 227 is enough smaller than the message that the correct key can be 228 uniquely identified.) The probability of an adversary succeeding at 229 this must be made acceptably low, depending on the particular 230 application. The size of the space the adversary must search is 231 related to the amount of key "information" present in the information 232 theoretic sense [SHANNON]. This depends on the number of different 233 secret values possible and the probability of each value as follows: 235 ----- 236 \ 237 Bits-of-information = \ - p * log ( p ) 238 / i 2 i 239 / 240 ----- 242 where i counts from 1 to the number of possible secret values and p 243 sub i is the probability of the value numbered i. (Since p sub i is 244 less than one, the log will be negative so each term in the sum will 245 be non-negative.) 247 If there are 2^n different values of equal probability, then n bits 248 of information are present and an adversary would, on the average, 249 have to try half of the values, or 2^(n-1) , before guessing the 250 secret quantity. If the probability of different values is unequal, 251 then there is less information present and fewer guesses will, on 252 average, be required by an adversary. In particular, any values that 253 the adversary can know are impossible, or are of low probability, can 254 be initially ignored by an adversary, who will search through the 255 more probable values first. 257 For example, consider a cryptographic system that uses 128 bit keys. 258 If these 128 bit keys are derived by using a fixed pseudo-random 259 number generator that is seeded with an 8 bit seed, then an adversary 260 needs to search through only 256 keys (by running the pseudo-random 261 number generator with every possible seed), not the 2^128 keys that 262 may at first appear to be the case. Only 8 bits of "information" are 263 in these 128 bit keys. 265 3. Traditional Pseudo-Random Sequences 267 Most traditional sources of random numbers use deterministic sources 268 of "pseudo-random" numbers. These typically start with a "seed" 269 quantity and use numeric or logical operations to produce a sequence 270 of values. 272 [KNUTH] has a classic exposition on pseudo-random numbers. 273 Applications he mentions are simulation of natural phenomena, 274 sampling, numerical analysis, testing computer programs, decision 275 making, and games. None of these have the same characteristics as the 276 sort of security uses we are talking about. Only in the last two 277 could there be an adversary trying to find the random quantity. 278 However, in these cases, the adversary normally has only a single 279 chance to use a guessed value. In guessing passwords or attempting to 280 break an encryption scheme, the adversary normally has many, perhaps 281 unlimited, chances at guessing the correct value. They can store the 282 message they are trying to break and repeatedly attack it. They are 283 also be assumed to be aided by a computer. 285 For testing the "randomness" of numbers, Knuth suggests a variety of 286 measures including statistical and spectral. These tests check things 287 like autocorrelation between different parts of a "random" sequence 288 or distribution of its values. But they could be met by a constant 289 stored random sequence, such as the "random" sequence printed in the 290 CRC Standard Mathematical Tables [CRC]. Despite meeting all the tests 291 suggested by Knuth, that sequence is unsuitable for cryptographic use 292 as adversaries must be assumed to have copies of all common published 293 "random" sequences and will able to spot the source and predict 294 future values. 296 A typical pseudo-random number generation technique, known as a 297 linear congruence pseudo-random number generator, is modular 298 arithmetic where the value numbered N+1 is calculated from the value 299 numbered N by 301 V = ( V * a + b )(Mod c) 302 N+1 N 304 The above technique has a strong relationship to linear shift 305 register pseudo-random number generators, which are well understood 306 cryptographically [SHIFT*]. In such generators bits are introduced at 307 one end of a shift register as the Exclusive Or (binary sum without 308 carry) of bits from selected fixed taps into the register. For 309 example: 311 +----+ +----+ +----+ +----+ 312 | B | <-- | B | <-- | B | <-- . . . . . . <-- | B | <-+ 313 | 0 | | 1 | | 2 | | n | | 314 +----+ +----+ +----+ +----+ | 315 | | | | 316 | | V +-----+ 317 | V +----------------> | | 318 V 们们们眉贸贸贸贸贸贸贸贸贸贸贸贸贸贸贸贸裙 +-----------------------------> | XOR | 319 +---------------------------------------------------> | | 320 +-----+ 322 V = ( ( V * 2 ) + B .xor. B ... )(Mod 2^n) 323 N+1 N 0 2 325 The goodness of traditional pseudo-random number generator algorithms 326 is measured by statistical tests on such sequences. Carefully chosen 327 values a, b, c, and initial V or the placement of shift register tap 328 in the above simple processes can produce excellent statistics. 330 These sequences may be adequate in simulations (Monte Carlo 331 experiments) as long as the sequence is orthogonal to the structure 332 of the space being explored. Even there, subtle patterns may cause 333 problems. However, such sequences are clearly bad for use in security 334 applications. They are fully predictable if the initial state is 335 known. Depending on the form of the pseudo-random number generator, 336 the sequence may be determinable from observation of a short portion 337 of the sequence [SCHNEIER, STERN]. For example, with the generators 338 above, one can determine V(n+1) given knowledge of V(n). In fact, it 339 has been shown that with these techniques, even if only one bit of 340 the pseudo-random values are released, the seed can be determined 341 from short sequences. 343 Not only have linear congruent generators been broken, but techniques 344 are now known for breaking all polynomial congruent generators. 345 [KRAWCZYK] 347 4. Unpredictability 349 Statistically tested randomness in the traditional sense described in 350 section 3 is NOT the same as the unpredictability required for 351 security use. 353 For example, use of a widely available constant sequence, such as 354 that from the CRC tables, is very weak against an adversary. Once 355 they learn of or guess it, they can easily break all security, future 356 and past, based on the sequence. [CRC] Yet the statistical properties 357 of these tables are good. 359 The following sections describe the limitations of some randomness 360 generation techniques and sources. 362 4.1 Problems with Clocks and Serial Numbers 364 Computer clocks, or similar operating system or hardware values, 365 provide significantly fewer real bits of unpredictability than might 366 appear from their specifications. 368 Tests have been done on clocks on numerous systems and it was found 369 that their behavior can vary widely and in unexpected ways. One 370 version of an operating system running on one set of hardware may 371 actually provide, say, microsecond resolution in a clock while a 372 different configuration of the "same" system may always provide the 373 same lower bits and only count in the upper bits at much lower 374 resolution. This means that successive reads on the clock may produce 375 identical values even if enough time has passed that the value 376 "should" change based on the nominal clock resolution. There are also 377 cases where frequently reading a clock can produce artificial 378 sequential values because of extra code that checks for the clock 379 being unchanged between two reads and increases it by one! Designing 380 portable application code to generate unpredictable numbers based on 381 such system clocks is particularly challenging because the system 382 designer does not always know the properties of the system clocks 383 that the code will execute on. 385 Use of hardware serial numbers such as an Ethernet addresses may also 386 provide fewer bits of uniqueness than one would guess. Such 387 quantities are usually heavily structured and subfields may have only 388 a limited range of possible values or values easily guessable based 389 on approximate date of manufacture or other data. For example, it is 390 likely that a company that manufactures both computers and Ethernet 391 adapters will, at least internally, use its own adapters, which 392 significantly limits the range of built-in addresses. 394 Problems such as those described above related to clocks and serial 395 numbers make code to produce unpredictable quantities difficult if 396 the code is to be ported across a variety of computer platforms and 397 systems. 399 4.2 Timing and Content of External Events 401 It is possible to measure the timing and content of mouse movement, 402 key strokes, and similar user events. This is a reasonable source of 403 unguessable data with some qualifications. On some machines, inputs 404 such as key strokes are buffered. Even though the user's inter- 405 keystroke timing may have sufficient variation and unpredictability, 406 there might not be an easy way to access that variation. Another 407 problem is that no standard method exists to sample timing details. 408 This makes it hard to build standard software intended for 409 distribution to a large range of machines based on this technique. 411 The amount of mouse movement or the keys actually hit are usually 412 easier to access than timings but may yield less unpredictability as 413 the user may provide highly repetitive input. 415 Other external events, such as network packet arrival times, can also 416 be used, with care. In particular, the possibility of manipulation of 417 such times by an adversary and the lack of history at system start up 418 must be considered. 420 4.3 The Fallacy of Complex Manipulation 422 One strategy which may give a misleading appearance of 423 unpredictability is to take a very complex algorithm (or an excellent 424 traditional pseudo-random number generator with good statistical 425 properties) and calculate a cryptographic key by starting with 426 limited data such as the computer system clock value as the seed. An 427 adversary who knew roughly when the generator was started would have 428 a relatively small number of seed values to test as they would know 429 likely values of the system clock. Large numbers of pseudo-random 430 bits could be generated but the search space an adversary would need 431 to check could be quite small. 433 Thus very strong and/or complex manipulation of data will not help if 434 the adversary can learn what the manipulation is and there is not 435 enough unpredictability in the starting seed value. They can usually 436 use the limited number of results stemming from a limited number of 437 seed values to defeat security. 439 Another serious strategy error is to assume that a very complex 440 pseudo-random number generation algorithm will produce strong random 441 numbers when there has been no theory behind or analysis of the 442 algorithm. There is a excellent example of this fallacy right near 443 the beginning of Chapter 3 in [KNUTH] where the author describes a 444 complex algorithm. It was intended that the machine language program 445 corresponding to the algorithm would be so complicated that a person 446 trying to read the code without comments wouldn't know what the 447 program was doing. Unfortunately, actual use of this algorithm showed 448 that it almost immediately converged to a single repeated value in 449 one case and a small cycle of values in another case. 451 Not only does complex manipulation not help you if you have a limited 452 range of seeds but blindly chosen complex manipulation can destroy 453 the randomness in a good seed! 455 4.4 The Fallacy of Selection from a Large Database 457 Another strategy that can give a misleading appearance of 458 unpredictability is selection of a quantity randomly from a database 459 and assume that its strength is related to the total number of bits 460 in the database. For example, typical USENET servers process many 461 megabytes of information per day [USENET]. Assume a random quantity 462 was selected by fetching 32 bytes of data from a random starting 463 point in this data. This does not yield 32*8 = 256 bits worth of 464 unguessability. Even after allowing that much of the data is human 465 language and probably has no more than 2 or 3 bits of information per 466 byte, it doesn't yield 32*2 = 64 bits of unguessability. For an 467 adversary with access to the same usenet database the unguessability 468 rests only on the starting point of the selection. That is perhaps a 469 little over a couple of dozen bits of unguessability. 471 The same argument applies to selecting sequences from the data on a 472 publicly available CD/DVD recording or any other large public 473 database. If the adversary has access to the same database, this 474 "selection from a large volume of data" step buys little. However, 475 if a selection can be made from data to which the adversary has no 476 access, such as system buffers on an active multi-user system, it may 477 be of help. 479 5. Hardware for Randomness 481 Is there any hope for true strong portable randomness in the future? 482 There might be. All that's needed is a physical source of 483 unpredictable numbers. 485 A thermal noise (sometimes called Johnson noise in integrated 486 circuits) or radioactive decay source and a fast, free-running 487 oscillator would do the trick directly [GIFFORD]. This is a trivial 488 amount of hardware, and could easily be included as a standard part 489 of a computer system's architecture. Furthermore, any system with a 490 spinning disk or ring oscillator and a stable (crystal) time source 491 or the like has an adequate source of randomness ([DAVIS] and Section 492 5.4). All that's needed is the common perception among computer 493 vendors that this small additional hardware and the software to 494 access it is necessary and useful. 496 5.1 Volume Required 498 How much unpredictability is needed? Is it possible to quantify the 499 requirement in, say, number of random bits per second? 501 The answer is not very much is needed. For AES, the key can be 128 502 bits and, as we show in an example in Section 8, even the highest 503 security system is unlikely to require strong keying material of much 504 over 200 bits. If a series of keys are needed, they can be generated 505 from a strong random seed (starting value) using a cryptographically 506 strong sequence as explained in Section 6.3. A few hundred random 507 bits generated at start up or once a day would be enough using such 508 techniques. Even if the random bits are generated as slowly as one 509 per second and it is not possible to overlap the generation process, 510 it should be tolerable in most high security applications to wait 200 511 seconds occasionally. 513 These numbers are trivial to achieve. It could be done by a person 514 repeatedly tossing a coin. Almost any hardware based process is 515 likely to be much faster. 517 5.2 Sensitivity to Skew 519 Is there any specific requirement on the shape of the distribution of 520 the random numbers? The good news is the distribution need not be 521 uniform. All that is needed is a conservative estimate of how non- 522 uniform it is to bound performance. Simple techniques to de-skew the 523 bit stream are given below and stronger cryptographic techniques are 524 described in Section 6.1.2 below. 526 5.2.1 Using Stream Parity to De-Skew 528 Consider taking a sufficiently long string of bits and map the string 529 to "zero" or "one". The mapping will not yield a perfectly uniform 530 distribution, but it can be as close as desired. One mapping that 531 serves the purpose is to take the parity of the string. This has the 532 advantages that it is robust across all degrees of skew up to the 533 estimated maximum skew and is absolutely trivial to implement in 534 hardware. 536 The following analysis gives the number of bits that must be sampled: 538 Suppose the ratio of ones to zeros is ( 0.5 + e ) to ( 0.5 - e ), 539 where e is between 0 and 0.5 and is a measure of the "eccentricity" 540 of the distribution. Consider the distribution of the parity function 541 of N bit samples. The probabilities that the parity will be one or 542 zero will be the sum of the odd or even terms in the binomial 543 expansion of (p + q)^N, where p = 0.5 + e, the probability of a one, 544 and q = 0.5 - e, the probability of a zero. 546 These sums can be computed easily as 548 N N 549 1/2 * ( ( p + q ) + ( p - q ) ) 550 and 551 N N 552 1/2 * ( ( p + q ) - ( p - q ) ). 554 (Which one corresponds to the probability the parity will be 1 555 depends on whether N is odd or even.) 557 Since p + q = 1 and p - q = 2e, these expressions reduce to 559 N 560 1/2 * [1 + (2e) ] 561 and 562 N 563 1/2 * [1 - (2e) ]. 565 Neither of these will ever be exactly 0.5 unless e is zero, but we 566 can bring them arbitrarily close to 0.5. If we want the probabilities 567 to be within some delta d of 0.5, i.e. then 569 N 570 ( 0.5 + ( 0.5 * (2e) ) ) < 0.5 + d. 572 Solving for N yields N > log(2d)/log(2e). (Note that 2e is less than 573 1, so its log is negative. Division by a negative number reverses the 574 sense of an inequality.) 575 The following table gives the length of the string which must be 576 sampled for various degrees of skew in order to come within 0.001 of 577 a 50/50 distribution. 579 +---------+--------+-------+ 580 | Prob(1) | e | N | 581 +---------+--------+-------+ 582 | 0.5 | 0.00 | 1 | 583 | 0.6 | 0.10 | 4 | 584 | 0.7 | 0.20 | 7 | 585 | 0.8 | 0.30 | 13 | 586 | 0.9 | 0.40 | 28 | 587 | 0.95 | 0.45 | 59 | 588 | 0.99 | 0.49 | 308 | 589 +---------+--------+-------+ 591 The last entry shows that even if the distribution is skewed 99% in 592 favor of ones, the parity of a string of 308 samples will be within 593 0.001 of a 50/50 distribution. 595 5.2.2 Using Transition Mappings to De-Skew 597 Another technique, originally due to von Neumann [VON NEUMANN], is to 598 examine a bit stream as a sequence of non-overlapping pairs. You 599 could then discard any 00 or 11 pairs found, interpret 01 as a 0 and 600 10 as a 1. Assume the probability of a 1 is 0.5+e and the probability 601 of a 0 is 0.5-e where e is the eccentricity of the source and 602 described in the previous section. Then the probability of each pair 603 is as follows: 605 +------+-----------------------------------------+ 606 | pair | probability | 607 +------+-----------------------------------------+ 608 | 00 | (0.5 - e)^2 = 0.25 - e + e^2 | 609 | 01 | (0.5 - e)*(0.5 + e) = 0.25 - e^2 | 610 | 10 | (0.5 + e)*(0.5 - e) = 0.25 - e^2 | 611 | 11 | (0.5 + e)^2 = 0.25 + e + e^2 | 612 +------+-----------------------------------------+ 614 This technique will completely eliminate any bias but at the expense 615 of taking an indeterminate number of input bits for any particular 616 desired number of output bits. The probability of any particular pair 617 being discarded is 0.5 + 2e^2 so the expected number of input bits to 618 produce X output bits is X/(0.25 - e^2). 620 This technique assumes that the bits are from a stream where each bit 621 has the same probability of being a 0 or 1 as any other bit in the 622 stream and that bits are not correlated, i.e., that the bits are 623 identical independent distributions. If alternate bits were from two 624 correlated sources, for example, the above analysis breaks down. 626 The above technique also provides another illustration of how a 627 simple statistical analysis can mislead if one is not always on the 628 lookout for patterns that could be exploited by an adversary. If the 629 algorithm were mis-read slightly so that overlapping successive bits 630 pairs were used instead of non-overlapping pairs, the statistical 631 analysis given is the same; however, instead of providing an unbiased 632 uncorrelated series of random 1's and 0's, it instead produces a 633 totally predictable sequence of exactly alternating 1's and 0's. 635 5.2.3 Using FFT to De-Skew 637 When real world data consists of strongly biased or correlated bits, 638 it may still contain useful amounts of randomness. This randomness 639 can be extracted through use of the discrete Fourier transform or its 640 optimized variant, the FFT. 642 Using the Fourier transform of the data, strong correlations can be 643 discarded. If adequate data is processed and remaining correlations 644 decay, spectral lines approaching statistical independence and 645 normally distributed randomness can be produced [BRILLINGER]. 647 5.2.4 Using Compression to De-Skew 649 Reversible compression techniques also provide a crude method of de- 650 skewing a skewed bit stream. This follows directly from the 651 definition of reversible compression and the formula in Section 2 652 above for the amount of information in a sequence. Since the 653 compression is reversible, the same amount of information must be 654 present in the shorter output than was present in the longer input. 655 By the Shannon information equation, this is only possible if, on 656 average, the probabilities of the different shorter sequences are 657 more uniformly distributed than were the probabilities of the longer 658 sequences. Therefore the shorter sequences must be de-skewed relative 659 to the input. 661 However, many compression techniques add a somewhat predictable 662 preface to their output stream and may insert such a sequence again 663 periodically in their output or otherwise introduce subtle patterns 664 of their own. They should be considered only a rough technique 665 compared with those described above or in Section 6.1.2. At a 666 minimum, the beginning of the compressed sequence should be skipped 667 and only later bits used for applications requiring random bits. 669 5.3 Existing Hardware Can Be Used For Randomness 671 As described below, many computers come with hardware that can, with 672 care, be used to generate truly random quantities. 674 5.3.1 Using Existing Sound/Video Input 676 Many computers are built with inputs that digitize some real world 677 analog source, such as sound from a microphone or video input from a 678 camera. Under appropriate circumstances, such input can provide 679 reasonably high quality random bits. The "input" from a sound 680 digitizer with no source plugged in or a camera with the lens cap on, 681 if the system has enough gain to detect anything, is essentially 682 thermal noise. 684 For example, on some UNIX based systems, one can read from the 685 /dev/audio device with nothing plugged into the microphone jack or 686 the microphone receiving only low level background noise. Such data 687 is essentially random noise although it should not be trusted without 688 some checking in case of hardware failure. It will, in any case, need 689 to be de-skewed as described elsewhere. 691 Combining this with compression to de-skew one can, in UNIXese, 692 generate a huge amount of medium quality random data by doing 694 cat /dev/audio | compress - >random-bits-file 696 5.3.2 Using Existing Disk Drives 698 Disk drives have small random fluctuations in their rotational speed 699 due to chaotic air turbulence [DAVIS]. By adding low level disk seek 700 time instrumentation to a system, a series of measurements can be 701 obtained that include this randomness. Such data is usually highly 702 correlated so that significant processing is needed, such as FFT (see 703 section 5.2.3). Nevertheless experimentation has shown that, with 704 such processing, most disk drives easily produce 100 bits a minute or 705 more of excellent random data. 707 Partly offsetting this need for processing is the fact that disk 708 drive failure will normally be rapidly noticed. Thus, problems with 709 this method of random number generation due to hardware failure are 710 unlikely. 712 5.4 Ring Oscillator Sources 714 If an integrated circuit is being designed or field programmed, an 715 odd number of gates can be connected in series to produce a free- 716 running ring oscillator. By sampling a point in the ring at a fixed 717 frequency, say one determined by a stable crystal oscillator, some 718 amount of entropy can be extracted due to variations in the free- 719 running oscillator timing. It is possible to increase the rate of 720 entropy by xor'ing sampled values from a few ring oscillators with 721 relatively prime lengths. It is sometimes recommended that an odd 722 number of rings be used so that, even if the rings somehow become 723 synchronously locked to each other, there will still be sampled bit 724 transitions. Another possibility source to sample is the output of a 725 noisy diode. 727 Sampled bits from such sources will have to be heavily de-skewed, as 728 disk rotation timings must be (Section 5.3.2). An engineering study 729 would be needed to determine the amount of entropy being produced 730 depending on the particular design. In any case, these can be good 731 sources whose cost is a trivial amount of hardware by modern 732 standards. 734 As an example, IEEE 802.11i suggests that the circuit below be 735 considered, with due attention in the design to isolation of the 736 rings from each other and from clocked circuits to avoid undesired 737 synchronization, etc., and extensive post processing. [IEEE 802.11i] 739 |\ |\ |\ 740 +-->| >0-->| >0-- 19 total --| >0--+----,命葮p4(们们们们们们眉贸贸葼葪们葼--+ 741 | |/ |/ |/ | | 742 | | | 743 +----------------------------------+ V 744 +-----+ 745 |\ |\ |\ | | output 746 +-->| >0-->| >0-- 23 total --| >0--+--->| XOR |------> 747 裙惹贸贸葼葪们裙惹贸贸们汝阮命孺没孺绵脳们贸么葪们裙惹贸贸眉贸贸贸葼葪命a=H命葪贸贸贸贸贸贸裙 | |/ |/ |/ | | | 748 | | +-----+ 749 +----------------------------------+ ^ ^ 750 | | 751 |\ |\ |\ | | 752 +-->| >0-->| >0-- 29 total --| >0--+------+ | 753 | |/ |/ 们汝锐命孺没孺绵脳们贸么葪们裙 |/ | | 754 | | | 755 +----------------------------------+ | 756 | 757 other randomness if available--------------+ 759 6. Recommended Software Strategy 761 What is the best overall strategy for meeting the requirement for 762 unguessable random numbers in the absence of a reliable hardware 763 source? It is to obtain random input from a number of uncorrelated 764 sources and to mix them with a strong mixing function. Such a 765 function will preserve the randomness present in any of the sources 766 even if other quantities being combined happen to be fixed or easily 767 guessable. This may be advisable even with a good hardware source, as 768 hardware can also fail, though this should be weighed against any 769 increase in the chance of overall failure due to added software 770 complexity. 772 6.1 Mixing Functions 774 A strong mixing function is one which combines two or more inputs and 775 produces an output where each output bit is a different complex non- 776 linear function of all the input bits. On average, changing any input 777 bit will change about half the output bits. But because the 778 relationship is complex and non-linear, no particular output bit is 779 guaranteed to change when any particular input bit is changed. 781 Consider the problem of converting a stream of bits that is skewed 782 towards 0 or 1 or which has a somewhat predictable pattern to a 783 shorter stream which is more random, as discussed in Section 5.2 784 above. This is simply another case where a strong mixing function is 785 desired, mixing the input bits to produce a smaller number of output 786 bits. The technique given in Section 5.2.1 of using the parity of a 787 number of bits is simply the result of successively Exclusive Or'ing 788 them which is examined as a trivial mixing function immediately 789 below. Use of stronger mixing functions to extract more of the 790 randomness in a stream of skewed bits is examined in Section 6.1.2. 792 6.1.1 A Trivial Mixing Function 794 A trivial example for single bit inputs is the Exclusive Or function, 795 which is equivalent to addition without carry, as show in the table 796 below. This is a degenerate case in which the one output bit always 797 changes for a change in either input bit. But, despite its 798 simplicity, it provides a useful illustration. 800 +-----------+-----------+----------+ 801 | input 1 | input 2 | output | 802 +-----------+-----------+----------+ 803 | 0 | 0 | 0 | 804 | 0 | 1 | 1 | 805 | 1 | 0 | 1 | 806 | 1 | 1 | 0 | 807 +-----------+-----------+----------+ 809 If inputs 1 and 2 are uncorrelated and combined in this fashion then 810 the output will be an even better (less skewed) random bit than the 811 inputs. If we assume an "eccentricity" e as defined in Section 5.2 812 above, then the output eccentricity relates to the input eccentricity 813 as follows: 815 e = 2 * e * e 816 output input 1 input 2 818 Since e is never greater than 1/2, the eccentricity is always 819 improved except in the case where at least one input is a totally 820 skewed constant. This is illustrated in the following table where the 821 top and left side values are the two input eccentricities and the 822 entries are the output eccentricity: 824 +--------+--------+--------+--------+--------+--------+--------+ 825 | e | 0.00 | 0.10 | 0.20 | 0.30 | 0.40 | 0.50 | 826 +--------+--------+--------+--------+--------+--------+--------+ 827 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 828 | 0.10 | 0.00 | 0.02 | 0.04 | 0.06 | 0.08 | 0.10 | 829 | 0.20 | 0.00 | 0.04 | 0.08 | 0.12 | 0.16 | 0.20 | 830 | 0.30 | 0.00 | 0.06 | 0.12 | 0.18 | 0.24 | 0.30 | 831 | 0.40 | 0.00 | 0.08 | 0.16 | 0.24 | 0.32 | 0.40 | 832 | 0.50 | 0.00 | 0.10 | 0.20 | 0.30 | 0.40 | 0.50 | 833 +--------+--------+--------+--------+--------+--------+--------+ 835 However, keep in mind that the above calculations assume that the 836 inputs are not correlated. If the inputs were, say, the parity of the 837 number of minutes from midnight on two clocks accurate to a few 838 seconds, then each might appear random if sampled at random intervals 839 much longer than a minute. Yet if they were both sampled and combined 840 with xor, the result would be zero most of the time. 842 6.1.2 Stronger Mixing Functions 844 The US Government Advanced Encryption Standard [AES] is an example of 845 a strong mixing function for multiple bit quantities. It takes up to 846 384 bits of input (128 bits of "data" and 256 bits of "key") and 847 produces 128 bits of output each of which is dependent on a complex 848 non-linear function of all input bits. Other encryption functions 849 with this characteristic, such as [DES], can also be used by 850 considering them to mix all of their key and data input bits. 852 Another good family of mixing functions are the "message digest" or 853 hashing functions such as The US Government Secure Hash Standards 854 [SHA*] and the MD4, MD5 [MD4, MD5] series. These functions all take a 855 practically unlimited amount of input and produce a relatively short 856 fixed length output mixing all the input bits. The MD* series produce 857 128 bits of output, SHA-1 produces 160 bits, and other SHA functions 858 produce up to 512 bits. 860 Although the message digest functions are designed for variable 861 amounts of input, AES and other encryption functions can also be used 862 to combine any number of inputs. If 128 bits of output is adequate, 863 the inputs can be packed into a 128-bit data quantity and successive 864 AES keys, padding with zeros if needed, which are then used to 865 successively encrypt using AES in Electronic Codebook Mode. Or the 866 input could be packed into one 128-bit key and multiple data blocks 867 and a CBC-MAC calculated [MODES]. 869 If more than 128 bits of output are needed, use more complex mixing. 870 But keep in mind that it is absolutely impossible to get more bits of 871 "randomness" out than are put in. For example, if inputs are packed 872 into three quantities, A, B, and C, use AES to encrypt A with B as a 873 key and then with C as a key to produce the 1st part of the output, 874 then encrypt B with C and then A for more output and, if necessary, 875 encrypt C with A and then B for yet more output. Still more output 876 can be produced by reversing the order of the keys given above to 877 stretch things. The same can be done with the hash functions by 878 hashing various subsets of the input data or different copies of the 879 input data with different prefixes and/or suffixes to produce 880 multiple outputs. 882 Many modern block encryption functions, including DES and AES, 883 incorporate modules known as S-Boxes (substitution boxes). These 884 produce a smaller number of outputs from a larger number of inputs 885 through a complex non-linear mixing function which would have the 886 effect of concentrating limited entropy in the inputs into the 887 output. 889 S-Boxes sometimes incorporate bent boolean functions (functions of an 890 even number of bits producing one output bit with maximum non- 891 linearity). Looking at the output for all input pairs differing in 892 any particular bit position, exactly half the outputs are different. 893 An S-Box in which each output bit is produced by a bent function such 894 that any linear combination of these functions is also a bent 895 function is called a "perfect S-Box". 897 S-boxes and various repeated application or cascades of such boxes 898 can be used for mixing. [SBOX*] 900 An example of using a strong mixing function would be to reconsider 901 the case of a string of 308 bits each of which is biased 99% towards 902 zero. The parity technique given in Section 5.2.1 above reduced this 903 to one bit with only a 1/1000 deviance from being equally likely a 904 zero or one. But, applying the equation for information given in 905 Section 2, this 308 bit skewed sequence has over 5 bits of 906 information in it. Thus hashing it with SHA-1 and taking the bottom 5 907 bits of the result would yield 5 unbiased random bits as opposed to 908 the single bit given by calculating the parity of the string. 910 6.1.3 Diffie-Hellman as a Mixing Function 912 Diffie-Hellman exponential key exchange is a technique that yields a 913 shared secret between two parties that can be made computationally 914 infeasible for a third party to determine even if they can observe 915 all the messages between the two communicating parties. This shared 916 secret is a mixture of initial quantities generated by each of them 917 [D-H]. If these initial quantities are random, then the shared secret 918 contains the combined randomness of them both, assuming they are 919 uncorrelated. 921 6.1.4 Using a Mixing Function to Stretch Random Bits 923 While it is not necessary for a mixing function to produce the same 924 or fewer bits than its inputs, mixing bits cannot "stretch" the 925 amount of random unpredictability present in the inputs. Thus four 926 inputs of 32 bits each where there is 12 bits worth of 927 unpredictability (such as 4,096 equally probable values) in each 928 input cannot produce more than 48 bits worth of unpredictable output. 929 The output can be expanded to hundreds or thousands of bits by, for 930 example, mixing with successive integers, but the clever adversary's 931 search space is still 2^48 possibilities. Furthermore, mixing to 932 fewer bits than are input will tend to strengthen the randomness of 933 the output the way using Exclusive Or to produce one bit from two did 934 above. 936 The last table in Section 6.1.1 shows that mixing a random bit with a 937 constant bit with Exclusive Or will produce a random bit. While this 938 is true, it does not provide a way to "stretch" one random bit into 939 more than one. If, for example, a random bit is mixed with a 0 and 940 then with a 1, this produces a two bit sequence but it will always be 941 either 01 or 10. Since there are only two possible values, there is 942 still only the one bit of original randomness. 944 6.1.5 Other Factors in Choosing a Mixing Function 946 For local use, AES has the advantages that it has been widely tested 947 for flaws, is reasonably efficient in software, and is widely 948 documented and implemented with hardware and software implementations 949 available all over the world including open source code. The SHA* 950 family have had a little less study and tend to require more CPU 951 cycles than AES but there is no reason to believe they are flawed. 952 Both SHA* and MD5 were derived from the earlier MD4 algorithm. They 953 all have source code available [SHA*, MD*]. Some signs of weakness 954 have been found in MD4 and MD5. In particular, MD4 has only three 955 rounds and there are several independent breaks of the first two or 956 last two rounds. And some collisions have been found in MD5 output. 958 AES was selected by a robust, public, and international process. It 959 and SHA* have been vouched for by the US National Security Agency 960 (NSA) on the basis of criteria that mostly remain secret, as was DES. 961 While this has been the cause of much speculation and doubt, 962 investigation of DES over the years has indicated that NSA 963 involvement in modifications to its design, which originated with 964 IBM, was primarily to strengthen it. No concealed or special weakness 965 has been found in DES. It is likely that the NSA modifications to MD4 966 to produce the SHA algorithms similarly strengthened these 967 algorithms, possibly against threats not yet known in the public 968 cryptographic community. 970 Where input lengths are unpredictable, hash algorithms are a little 971 more convenient to use than block encryption algorithms since they 972 are generally designed to accept variable length inputs. Block 973 encryption algorithms generally require an additional padding 974 algorithm to accomodate inputs that are not an even multiple of the 975 block size. 977 As of the time of this document, the authors know of no patent claims 978 to the basic AES, DES, SHA*, MD4, and MD5 algorithms other than 979 patents for which an irrevocable royalty free license has been 980 granted to the world. There may, of course, be basic patents of which 981 the authors are unaware or patents on implementations or uses or 982 other relevant patents issued or to be issued. 984 6.2 Non-Hardware Sources of Randomness 986 The best source of input for mixing would be a hardware randomness 987 such as ring oscillators, disk drive timing, thermal noise, or 988 radioactive decay. However, if that is not available there are other 989 possibilities. These include system clocks, system or input/output 990 buffers, user/system/hardware/network serial numbers and/or addresses 991 and timing, and user input. Unfortunately, each of these sources can 992 produce very limited or predictable values under some circumstances. 994 Some of the sources listed above would be quite strong on multi-user 995 systems where, in essence, each user of the system is a source of 996 randomness. However, on a small single user or embedded system, 997 especially at start up, it might be possible for an adversary to 998 assemble a similar configuration. This could give the adversary 999 inputs to the mixing process that were sufficiently correlated to 1000 those used originally as to make exhaustive search practical. 1002 The use of multiple random inputs with a strong mixing function is 1003 recommended and can overcome weakness in any particular input. The 1004 timing and content of requested "random" user keystrokes can yield 1005 hundreds of random bits but conservative assumptions need to be made. 1006 For example, assuming at most a few bits of randomness if the inter- 1007 keystroke interval is unique in the sequence up to that point and a 1008 similar assumption if the key hit is unique but assuming that no bits 1009 of randomness are present in the initial key value or if the timing 1010 or key value duplicate previous values. The results of mixing these 1011 timings and characters typed could be further combined with clock 1012 values and other inputs. 1014 This strategy may make practical portable code to produce good random 1015 numbers for security even if some of the inputs are very weak on some 1016 of the target systems. However, it may still fail against a high 1017 grade attack on small, single user or embedded systems, especially if 1018 the adversary has ever been able to observe the generation process in 1019 the past. A hardware based random source is still preferable. 1021 6.3 Cryptographically Strong Sequences 1023 In cases where a series of random quantities must be generated, an 1024 adversary may learn some values in the sequence. In general, they 1025 should not be able to predict other values from the ones that they 1026 know. 1028 The correct technique is to start with a strong random seed, take 1029 cryptographically strong steps from that seed [FERGUSON, SCHNEIER], 1030 and do not reveal the complete state of the generator in the sequence 1031 elements. If each value in the sequence can be calculated in a fixed 1032 way from the previous value, then when any value is compromised, all 1033 future values can be determined. This would be the case, for example, 1034 if each value were a constant function of the previously used values, 1035 even if the function were a very strong, non-invertible message 1036 digest function. 1038 (It should be noted that if your technique for generating a sequence 1039 of key values is fast enough, it can trivially be used as the basis 1040 for a confidentiality system. If two parties use the same sequence 1041 generating technique and start with the same seed material, they will 1042 generate identical sequences. These could, for example, be xor'ed at 1043 one end with data being send, encrypting it, and xor'ed with this 1044 data as received, decrypting it due to the reversible properties of 1045 the xor operation. This is commonly referred to as a simple stream 1046 cipher.) 1048 6.3.1 Traditional Strong Sequences 1050 A traditional way to achieve a strong sequence has been to have the 1051 values be produced by hashing the quantities produced by 1052 concatenating the seed with successive integers or the like and then 1053 mask the values obtained so as to limit the amount of generator state 1054 available to the adversary. 1056 It may also be possible to use an "encryption" algorithm with a 1057 random key and seed value to encrypt and feedback some or all of the 1058 output encrypted value into the value to be encrypted for the next 1059 iteration. Appropriate feedback techniques will usually be 1060 recommended with the encryption algorithm. An example is shown below 1061 where shifting and masking are used to combine the cypher output 1062 feedback. This type of feedback is defined by the US Government in 1063 connection with AES and DES [MODES] as Output Feedback Mode (OFM) but 1064 should be avoided for reasons described below. 1066 +---------------+ 1067 | V | 1068 | | n |--+ 1069 +--+------------+ | 1070 | | +---------+ 1071 shift| +---> | | +-----+ 1072 +--+ | Encrypt | <--- | Key | 1073 | +-------- | | +-----+ 1074 | | +---------+ 1075 V V 1076 +------------+--+ 1077 | V | | 1078 | n+1 | 1079 +---------------+ 1081 Note that if a shift of one is used, this is the same as the shift 1082 register technique described in Section 3 above but with the all 1083 important difference that the feedback is determined by a complex 1084 non-linear function of all bits rather than a simple linear or 1085 polynomial combination of output from a few bit position taps. 1087 It has been shown by Donald W. Davies that this sort of shifted 1088 partial output feedback significantly weakens an algorithm compared 1089 with feeding all of the output bits back as input. In particular, for 1090 DES, repeated encrypting a full 64 bit quantity will give an expected 1091 repeat in about 2^63 iterations. Feeding back anything less than 64 1092 (and more than 0) bits will give an expected repeat in between 2^31 1093 and 2^32 iterations! 1095 To predict values of a sequence from others when the sequence was 1096 generated by these techniques is equivalent to breaking the 1097 cryptosystem or inverting the "non-invertible" hashing involved with 1098 only partial information available. The less information revealed 1099 each iteration, the harder it will be for an adversary to predict the 1100 sequence. Thus it is best to use only one bit from each value. It has 1101 been shown that in some cases this makes it impossible to break a 1102 system even when the cryptographic system is invertible and can be 1103 broken if all of each generated value was revealed. 1105 6.3.2 The Blum Blum Shub Sequence Generator 1107 Currently the generator which has the strongest public proof of 1108 strength is called the Blum Blum Shub generator after its inventors 1109 [BBS]. It is also very simple and is based on quadratic residues. 1110 It's only disadvantage is that it is computationally intensive 1111 compared with the traditional techniques give in 6.3.1 above. This is 1112 not a major draw back if it is used for moderately infrequent 1113 purposes, such as generating session keys. 1115 Simply choose two large prime numbers, say p and q, which both have 1116 the property that you get a remainder of 3 if you divide them by 4. 1117 Let n = p * q. Then you choose a random number x relatively prime to 1118 n. The initial seed for the generator and the method for calculating 1119 subsequent values are then 1121 2 1122 s = ( x )(Mod n) 1123 0 1125 2 1126 s = ( s )(Mod n) 1127 i+1 i 1129 You must be careful to use only a few bits from the bottom of each s. 1130 It is always safe to use only the lowest order bit. If you use no 1131 more than the 1132 log ( log ( s ) ) 1133 2 2 i 1134 low order bits, then predicting any additional bits from a sequence 1135 generated in this manner is provable as hard as factoring n. As long 1136 as the initial x is secret, you can even make n public if you want. 1138 An interesting characteristic of this generator is that you can 1139 directly calculate any of the s values. In particular 1141 i 1142 ( ( 2 )(Mod (( p - 1 ) * ( q - 1 )) ) ) 1143 s = ( s )(Mod n) 1144 i 0 1146 This means that in applications where many keys are generated in this 1147 fashion, it is not necessary to save them all. Each key can be 1148 effectively indexed and recovered from that small index and the 1149 initial s and n. 1151 6.3.3 Entropy Pool Techniques 1153 Many modern pseudo-random number sources utilize the technique of 1154 maintaining a "pool" of bits and providing operations for strongly 1155 mixing input with some randomness into the pool and extracting psuedo 1156 random bits from the pool. This is illustrated in the figure below. 1158 +--------+ +------+ +---------+ 1159 --->| Mix In |--->| POOL |--->| Extract |---> 1160 们们贸贸贸裙 | Bits | | | | Bits | 1161 +--------+ +------+ +---------+ 1162 ^ V 1163 | | 1164 +-----------+ 1166 Bits to be feed into the pool can be any of the various hardware, 1167 environmental, or user input sources discussed above. It is also 1168 common to save the state of the pool on system shut down and restore 1169 it on re-starting, if stable storage is available. 1171 Care must be taken that enough entropy has been added to the pool to 1172 support particular output uses desired. See Section 7.5 for more 1173 details on an example implementation and [RSA BULL1] for similar 1174 suggestions. 1176 7. Key Generation Standards and Examples 1178 Several public standards and widely deployed examples are now in 1179 place for the generation of keys without special hardware. Three 1180 standards are described below. The two older standards use DES, with 1181 its 64-bit block and key size limit, but any equally strong or 1182 stronger mixing function could be substituted. The third is a more 1183 modern and stronger standard based on SHA-1. Finally the widely 1184 deployed modern UNIX random number generators are described. 1186 7.1 US DoD Recommendations for Password Generation 1188 The United States Department of Defense has specific recommendations 1189 for password generation [DoD]. They suggest using the US Data 1190 Encryption Standard [DES] in Output Feedback Mode [MODES] as follows: 1192 use an initialization vector determined from 1193 the system clock, 1194 system ID, 1195 user ID, and 1196 date and time; 1197 use a key determined from 1198 system interrupt registers, 1199 system status registers, and 1200 system counters; and, 1201 as plain text, use an external randomly generated 64 bit 1202 quantity such as 8 characters typed in by a system 1203 administrator. 1205 The password can then be calculated from the 64 bit "cipher text" 1206 generated by DES in 64-bit Output Feedback Mode. As many bits as are 1207 needed can be taken from these 64 bits and expanded into a 1208 pronounceable word, phrase, or other format if a human being needs to 1209 remember the password. 1211 7.2 X9.17 Key Generation 1213 The American National Standards Institute has specified a method for 1214 generating a sequence of keys as follows [X9.17]: 1216 s is the initial 64 bit seed 1217 0 1219 g is the sequence of generated 64 bit key quantities 1220 n 1222 k is a random key reserved for generating this key sequence 1224 t is the time at which a key is generated to as fine a resolution 1225 as is available (up to 64 bits). 1227 DES ( K, Q ) is the DES encryption of quantity Q with key K 1229 g = DES ( k, DES ( k, t ) .xor. s ) 1230 n n 1232 s = DES ( k, DES ( k, t ) .xor. g ) 1233 n+1 n 1235 If g sub n is to be used as a DES key, then every eighth bit should 1236 be adjusted for parity for that use but the entire 64 bit unmodified 1237 g should be used in calculating the next s. 1239 7.3 DSS Pseudo-Random Number Generation 1241 Appendix 3 of the NIST Digital Signature Standard [DSS] provides an 1242 approved method of producing a sequence of pseudo-random 160 bit 1243 quantities for use as private keys or the like. A subset of that 1244 algorithm is as follows: 1246 t = 0x 67452301 EFCDAB89 98BADCFE 10325476 C3D2E1F0 1248 q = a 160-bit prime number 1250 XKEY = initial seed 1251 0 1253 For j = 0 to ... 1255 XVAL = ( XKEY + optional user input ) (Mod 2^512) 1256 j 1258 X = G( t, XVAL ) (Mod q) 1259 j 1261 XKEY = ( 1 + XKEY + X ) (Mod 2^512) 1262 j+1 j j 1264 The quantities X thus produced are the pseudo-random sequence of 1265 values in the rang 0 to q. Two functions can be used for "G" above. 1266 Each produces a 160-bit value and takes two arguments, the first a 1267 160-bit value and the second a 512 bit value. 1269 The first is based on SHA-1 and works by setting the 5 linking 1270 variables, denoted H with subscripts in the SHA-1 specification, to 1271 the first argument divided into fifths. Then steps (a) through (e) of 1272 section 7 of the NIST SHA-1 specification are run over the second 1273 argument as if it were a 512-bit data block. The values of the 1274 linking variable after those steps are then concatenated to produce 1275 the output of G. [SHA-1] 1277 As an alternative second methold, NIST also defined an alternate G 1278 function based on multiple applications of the DES encryption 1279 function [DSS]. 1281 7.4 X9.82 Pseudo-Random Number Generation 1283 The National Institute for Standards and Technology (NIST) and the 1284 American National Standards Institutes (ANSI) X9F1 committee are in 1285 the final stages of creating a standard for random number generation. 1286 This standard includes a number of random number generators for use 1287 with AES and other block ciphers. It also includes random number 1288 generators based on hash functions and the arithmetic of elliptic 1289 curves [X9.82]. 1291 7.5 The /dev/random Device 1293 Several versions of the UNIX operating system provides a kernel- 1294 resident random number generator. In some cases, these generators 1295 makes use of events captured by the Kernel during normal system 1296 operation. 1298 For example, on some versions of Linux, the generator consists of a 1299 random pool of 512 bytes represented as 128 words of 4-bytes each. 1300 When an event occurs, such as a disk drive interrupt, the time of the 1301 event is xor'ed into the pool and the pool is stirred via a primitive 1302 polynomial of degree 128. The pool itself is treated as a ring 1303 buffer, with new data being XORed (after stirring with the 1304 polynomial) across the entire pool. 1306 Each call that adds entropy to the pool estimates the amount of 1307 likely true entropy the input contains. The pool itself contains a 1308 accumulator that estimates the total over all entropy of the pool. 1310 Input events come from several sources as listed below. 1311 Unfortunately, for server machines without human operators, the first 1312 and third are not available and entropy may be added very slowly in 1313 that case. 1315 1. Keyboard interrupts. The time of the interrupt as well as the scan 1316 code are added to the pool. This in effect adds entropy from the 1317 human operator by measuring inter-keystroke arrival times. 1319 2. Disk completion and other interrupts. A system being used by a 1320 person will likely have a hard to predict pattern of disk 1321 accesses. (But not all disk drivers support capturing this timing 1322 information with sufficient accuracy to be useful.) 1324 3. Mouse motion. The timing as well as mouse position is added in. 1326 When random bytes are required, the pool is hashed with SHA-1 [SHA1] 1327 to yield the returned bytes of randomness. If more bytes are required 1328 than the output of SHA-1 (20 bytes), then the hashed output is 1329 stirred back into the pool and a new hash performed to obtain the 1330 next 20 bytes. As bytes are removed from the pool, the estimate of 1331 entropy is similarly decremented. 1333 To ensure a reasonable random pool upon system startup, the standard 1334 startup scripts (and shutdown scripts) save the pool to a disk file 1335 at shutdown and read this file at system startup. 1337 There are two user exported interfaces. /dev/random returns bytes 1338 from the pool, but blocks when the estimated entropy drops to zero. 1339 As entropy is added to the pool from events, more data becomes 1340 available via /dev/random. Random data obtained from such a 1341 /dev/random device is suitable for key generation for long term keys, 1342 if enough random bits are in the pool or are added in a reasonable 1343 amount of time. 1345 /dev/urandom works like /dev/random, however it provides data even 1346 when the entropy estimate for the random pool drops to zero. This may 1347 be adequate for session keys or for other key generation tasks where 1348 blocking while waiting for more random bits is not acceptable. The 1349 risk of continuing to take data even when the pool's entropy estimate 1350 is small in that past output may be computable from current output 1351 provided an attacker can reverse SHA-1. Given that SHA-1 is designed 1352 to be non-invertible, this is a reasonable risk. 1354 To obtain random numbers under Linux, Solaris, or other UNIX systems 1355 equiped with code as described above, all an application needs to do 1356 is open either /dev/random or /dev/urandom and read the desired 1357 number of bytes. 1359 (The Linux Random device was written by Theodore Ts'o. It was based 1360 loosely on the random number generator in PGP 2.X and PGP 3.0 (aka 1361 PGP 5.0).) 1363 8. Examples of Randomness Required 1365 Below are two examples showing rough calculations of needed 1366 randomness for security. The first is for moderate security passwords 1367 while the second assumes a need for a very high security 1368 cryptographic key. 1370 In addition [ORMAN] and [RSA BULL13] provide information on the 1371 public key lengths that should be used for exchanging symmetric keys. 1373 8.1 Password Generation 1375 Assume that user passwords change once a year and it is desired that 1376 the probability that an adversary could guess the password for a 1377 particular account be less than one in a thousand. Further assume 1378 that sending a password to the system is the only way to try a 1379 password. Then the crucial question is how often an adversary can try 1380 possibilities. Assume that delays have been introduced into a system 1381 so that, at most, an adversary can make one password try every six 1382 seconds. That's 600 per hour or about 15,000 per day or about 1383 5,000,000 tries in a year. Assuming any sort of monitoring, it is 1384 unlikely someone could actually try continuously for a year. In fact, 1385 even if log files are only checked monthly, 500,000 tries is more 1386 plausible before the attack is noticed and steps taken to change 1387 passwords and make it harder to try more passwords. 1389 To have a one in a thousand chance of guessing the password in 1390 500,000 tries implies a universe of at least 500,000,000 passwords or 1391 about 2^29. Thus 29 bits of randomness are needed. This can probably 1392 be achieved using the US DoD recommended inputs for password 1393 generation as it has 8 inputs which probably average over 5 bits of 1394 randomness each (see section 7.1). Using a list of 1000 words, the 1395 password could be expressed as a three word phrase (1,000,000,000 1396 possibilities) or, using case insensitive letters and digits, six 1397 would suffice ((26+10)^6 = 2,176,782,336 possibilities). 1399 For a higher security password, the number of bits required goes up. 1400 To decrease the probability by 1,000 requires increasing the universe 1401 of passwords by the same factor which adds about 10 bits. Thus to 1402 have only a one in a million chance of a password being guessed under 1403 the above scenario would require 39 bits of randomness and a password 1404 that was a four word phrase from a 1000 word list or eight 1405 letters/digits. To go to a one in 10^9 chance, 49 bits of randomness 1406 are needed implying a five word phrase or ten letter/digit password. 1408 In a real system, of course, there are also other factors. For 1409 example, the larger and harder to remember passwords are, the more 1410 likely users are to write them down resulting in an additional risk 1411 of compromise. 1413 8.2 A Very High Security Cryptographic Key 1415 Assume that a very high security key is needed for symmetric 1416 encryption / decryption between two parties. Assume an adversary can 1417 observe communications and knows the algorithm being used. Within the 1418 field of random possibilities, the adversary can try key values in 1419 hopes of finding the one in use. Assume further that brute force 1420 trial of keys is the best the adversary can do. 1422 8.2.1 Effort per Key Trial 1424 How much effort will it take to try each key? For very high security 1425 applications it is best to assume a low value of effort. Even if it 1426 would clearly take tens of thousands of computer cycles or more to 1427 try a single key, there may be some pattern that enables huge blocks 1428 of key values to be tested with much less effort per key. Thus it is 1429 probably best to assume no more than a couple hundred cycles per key. 1430 (There is no clear lower bound on this as computers operate in 1431 parallel on a number of bits and a poor encryption algorithm could 1432 allow many keys or even groups of keys to be tested in parallel. 1433 However, we need to assume some value and can hope that a reasonably 1434 strong algorithm has been chosen for our hypothetical high security 1435 task.) 1437 If the adversary can command a highly parallel processor or a large 1438 network of work stations, 10^11 cycles per second is probably a 1439 minimum assumption for availability today. Looking forward a few 1440 years, there should be at least an order of magnitude improvement. 1441 Thus assuming 10^10 keys could be checked per second or 3.6*10^12 per 1442 hour or 6*10^14 per week or 2.4*10^15 per month is reasonable. This 1443 implies a need for a minimum of 63 bits of randomness in keys to be 1444 sure they cannot be found in a month. Even then it is possible that, 1445 a few years from now, a highly determined and resourceful adversary 1446 could break the key in 2 weeks (on average they need try only half 1447 the keys). 1449 These questions are considered in detail in "Minimal Key Lengths for 1450 Symmetric Ciphers to Provide Adequate Commercial Security: A Report 1451 by an Ad Hoc Group of Cryptographers and Computer Scientists" 1452 [KeyStudy] which was sponsored by the Business Software Alliance. It 1453 concluded that a reasonable key length in 1995 for very high security 1454 is in the range of 75 to 90 bits and, since the cost of cryptography 1455 does not vary much with they key size, recommends 90 bits. To update 1456 these recommendations, just add 2/3 of a bit per year for Moore's law 1458 [MOORE]. Thus, in the year 2004, this translates to a determination 1459 that a reasonable key length is in the 81 to 96 bit range. In fact, 1460 today, it is increasingly common to use keys longer than 96 bits, 1461 such as 128-bit (or longer) keys with AES and keys with effective 1462 lengths of 112-bits using triple-DES. 1464 8.2.2 Meet in the Middle Attacks 1466 If chosen or known plain text and the resulting encrypted text are 1467 available, a "meet in the middle" attack is possible if the structure 1468 of the encryption algorithm allows it. (In a known plain text attack, 1469 the adversary knows all or part of the messages being encrypted, 1470 possibly some standard header or trailer fields. In a chosen plain 1471 text attack, the adversary can force some chosen plain text to be 1472 encrypted, possibly by "leaking" an exciting text that would then be 1473 sent by the adversary over an encrypted channel.) 1475 An oversimplified explanation of the meet in the middle attack is as 1476 follows: the adversary can half-encrypt the known or chosen plain 1477 text with all possible first half-keys, sort the output, then half- 1478 decrypt the encoded text with all the second half-keys. If a match is 1479 found, the full key can be assembled from the halves and used to 1480 decrypt other parts of the message or other messages. At its best, 1481 this type of attack can halve the exponent of the work required by 1482 the adversary while adding a very large but roughly constant factor 1483 of effort. Thus, if this attack can be mounted, a doubling of the 1484 amount of randomness in the very strong key to a minimum of 192 bits 1485 (96*2) is required for the year 2004 based on the [KeyStudy] 1486 analysis. 1488 This amount of randomness is well beyond the limit of that in the 1489 inputs recommended by the US DoD for password generation and could 1490 require user typing timing, hardware random number generation, or 1491 other sources. 1493 The meet in the middle attack assumes that the cryptographic 1494 algorithm can be decomposed in this way but we can not rule that out 1495 without a deep knowledge of the algorithm. Even if a basic algorithm 1496 is not subject to a meet in the middle attack, an attempt to produce 1497 a stronger algorithm by applying the basic algorithm twice (or two 1498 different algorithms sequentially) with different keys may gain less 1499 added security than would be expected. Such a composite algorithm 1500 would be subject to a meet in the middle attack. 1502 Enormous resources may be required to mount a meet in the middle 1503 attack but they are probably within the range of the national 1504 security services of a major nation. Essentially all nations spy on 1505 other nations traffic. 1507 8.2.3 Other Considerations 1509 [KeyStudy] also considers the possibilities of special purpose code 1510 breaking hardware and having an adequate safety margin. 1512 If the two parties agree on a key by Diffie-Hellman exchange [D-H], 1513 then in principle only half of this randomness would have to be 1514 supplied by each party. However, there is probably some correlation 1515 between their random inputs so it is probably best to assume you end 1516 up with more like one and a half times the bits of randomness each 1517 provides for very high security if Diffie-Hellman is used. 1519 It should be noted that key length calculations such at those above 1520 are controversial and depend on various assumptions about the 1521 cryptographic algorithms in use. In some cases, a professional with a 1522 deep knowledge of code breaking techniques and of the strength of the 1523 algorithm in use could be satisfied with less than half of the 192 1524 bit key size derived above. 1526 For further examples of conservative design principles see 1527 [FERGUSON]. 1529 9. Conclusion 1531 Generation of unguessable "random" secret quantities for security use 1532 is an essential but difficult task. 1534 Hardware techniques to produce such randomness would be relatively 1535 simple. In particular, the volume and quality would not need to be 1536 high and existing computer hardware, such as disk drives, can be 1537 used. 1539 Widely available computational techniques are available to process 1540 low quality random quantities from multiple sources or a larger 1541 quantity of such low quality input from one source and produce a 1542 smaller quantity of higher quality keying material. In the absence of 1543 hardware sources of randomness, a variety of user and software 1544 sources can frequently, with care, be used instead; however, most 1545 modern systems already have hardware, such as disk drives or audio 1546 input, that could be used to produce high quality randomness. 1548 Once a sufficient quantity of high quality seed key material (a 1549 couple of hundred bits) is available, computational techniques are 1550 available to produce cryptographically strong sequences of 1551 unpredictable quantities from this seed material. 1553 10. Security Considerations 1555 The entirety of this document concerns techniques and recommendations 1556 for generating unguessable "random" quantities for use as passwords, 1557 cryptographic keys, initialization vectors, sequence numbers, and 1558 similar security uses. 1560 11. Intellectual Property Considerations 1562 By submitting this Internet-Draft, I certify that any applicable 1563 patent or other IPR claims of which I am aware have been disclosed, 1564 and any of which I become aware will be disclosed, in accordance with 1565 RFC 3668. 1567 The IETF takes no position regarding the validity or scope 1568 of any Intellectual Property Rights or other rights that might be 1569 claimed to pertain to the implementation or use of the technology 1570 described in this document or the extent to which any license under 1571 such rights might or might not be available; nor does it represent 1572 that it has made any independent effort to identify any such rights. 1573 Information on the procedures with respect to rights in RFC documents 1574 can be found in BCP 78 and BCP 79. 1576 Copies of IPR disclosures made to the IETF Secretariat and any 1577 assurances of licenses to be made available, or the result of an 1578 attempt made to obtain a general license or permission for the use of 1579 such proprietary rights by implementers or users of this 1580 specification can be obtained from the IETF on-line IPR repository at 1581 http://www.ietf.org/ipr. 1583 The IETF invites any interested party to bring to its attention any 1584 copyrights, patents or patent applications, or other proprietary 1585 rights that may cover technology that may be required to implement 1586 this standard. Please address the information to the IETF at ietf- 1587 ipr@ietf.org. 1589 12. Copyright and Disclaimer 1591 Copyright (C) The Internet Society 2004. This document is subject 1592 to the rights, licenses and restrictions contained in BCP 78, and 1593 except as set forth therein, the authors retain all their rights. 1595 This document and the information contained herein are provided on an 1596 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 1597 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET 1598 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, 1599 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE 1600 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 1601 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 1603 13. Appendix A: Changes from RFC 1750 1605 1. Additional acknowledgements have been added. 1607 2. Insertion of section 5.2.4 on de-skewing with S-boxes. 1609 3. Addition of section 5.4 on Ring Oscillator randomness sources. 1611 4. AES and the members of the SHA series producing more than 160 1612 bits have been added. Use of AES has been emphasized and the use 1613 of DES de-emphasized. 1615 5. Addition of section 6.3.3 on entropy pool techniques. 1617 6. Addition of section 7.3 on the pseudo-random number generation 1618 techniques given in FIPS 186-2, 7.4 on those given in X9.82, and 1619 section 7.5 on the random number generation techniques of the 1620 /dev/random device in Linux and other UNIX systems. 1622 7. Addition of references to the "Minimal Key Lengths for Symmetric 1623 Ciphers to Provide Adequate Commercial Security" study published 1624 in January 1996 [KeyStudy]. 1626 8. Minor wording changes and reference updates. 1628 14. Informative References 1630 [AES] - "Specification of the Advanced Encryption Standard (AES)", 1631 United States of America, US National Institute of Standards and 1632 Technology, FIPS 197, November 2001. 1634 [ASYMMETRIC] - "Secure Communications and Asymmetric Cryptosystems", 1635 edited by Gustavus J. Simmons, AAAS Selected Symposium 69, Westview 1636 Press, Inc. 1638 [BBS] - "A Simple Unpredictable Pseudo-Random Number Generator", SIAM 1639 Journal on Computing, v. 15, n. 2, 1986, L. Blum, M. Blum, & M. Shub. 1641 [BRILLINGER] - "Time Series: Data Analysis and Theory", Holden-Day, 1642 1981, David Brillinger. 1644 [CRC] - "C.R.C. Standard Mathematical Tables", Chemical Rubber 1645 Publishing Company. 1647 [DAVIS] - "Cryptographic Randomness from Air Turbulence in Disk 1648 Drives", Advances in Cryptology - Crypto '94, Springer-Verlag Lecture 1649 Notes in Computer Science #839, 1984, Don Davis, Ross Ihaka, and 1650 Philip Fenstermacher. 1652 [DES] - "Data Encryption Standard", US National Institute of 1653 Standards and Technology, FIPS 46-3, October 1999. 1654 - "Data Encryption Algorithm", American National Standards 1655 Institute, ANSI X3.92-1981. 1656 (See also FIPS 112, Password Usage, which includes FORTRAN 1657 code for performing DES.) 1659 [D-H] - RFC 2631, "Diffie-Hellman Key Agreement Method", Eric 1660 Rescrola, June 1999. 1662 [DNSSEC] - RFC 2535, "Domain Name System Security Extensions", D. 1663 Eastlake, March 1999. 1665 [DoD] - "Password Management Guideline", United States of America, 1666 Department of Defense, Computer Security Center, CSC-STD-002-85. 1667 (See also FIPS 112, Password Usage, which incorporates CSC-STD-002-85 1668 as one of its appendices.) 1670 [DSS] - "Digital Signature Standard (DSS)", US National Institute of 1671 Standards and Technology, FIPS 186-2, January 2000. 1673 [FERGUSON] - "Practical Cryptography", Niels Ferguson and Bruce 1674 Schneier, Wiley Publishing Inc., ISBN 047122894X, April 2003. 1676 [GIFFORD] - "Natural Random Number", MIT/LCS/TM-371, David K. 1677 Gifford, September 1988. 1679 [IEEE 802.11i] - "Amendment to Standard for Telecommunications and 1680 Information Exchange Between Systems - LAN/MAN Specific Requirements 1681 - Part 11: Wireless Medium Access Control (MAC) and physical layer 1682 (PHY) specifications: Medium Access Control (MAC) Security 1683 Enhancements", The Institute for Electrical and Electronics 1684 Engineers, January 2004. 1686 [IPSEC] - RFC 2401, "Security Architecture for the Internet 1687 Protocol", S. Kent, R. Atkinson, November 1998. 1689 [KAUFMAN] - "Network Security: Private Communication in a Public 1690 World", Charlie Kaufman, Radia Perlman, and Mike Speciner, Prentis 1691 Hall PTR, ISBN 0-13-046019-2, 2nd Edition 2002. 1693 [KeyStudy] - "Minimal Key Lengths for Symmetric Ciphers to Provide 1694 Adequate Commercial Security: A Report by an Ad Hoc Group of 1695 Cryptographers and Computer Scientists", M. Blaze, W. Diffie, R. 1696 Rivest, B. Schneier, T. Shimomura, E. Thompson, and M. Weiner, 1697 January 1996, . 1699 [KNUTH] - "The Art of Compute谩抿妊脴抿脿氓孺冕脿庙孺么脳葼r Programming", Volume 2: Seminumerical 1700 Algorithms, Chapter 3: Random Numbers. Addison Wesley Publishing 1701 Company, 3rd Edition November 1997, Donald E. Knuth. 1703 [KRAWCZYK] - "How to Predict Congruential Generators", Journal of 1704 Algorithms, V. 13, N. 4, December 1992, H. Krawczyk 1706 [MAIL PEM] - RFCs 1421 through 1424: 1707 - RFC 1421, Privacy Enhancement for Internet Electronic Mail: 1708 Part I: Message Encryption and Authentication Procedures, 02/10/1993, 1709 J. Linn 1710 - RFC 1422, Privacy Enhancement for Internet Electronic Mail: 1711 Part II: Certificate-Based Key Management, 02/10/1993, S. Kent 1712 - RFC 1423, Privacy Enhancement for Internet Electronic Mail: 1713 Part III: Algorithms, Modes, and Identifiers, 02/10/1993, D. Balenson 1714 - RFC 1424, Privacy Enhancement for Internet Electronic Mail: 1715 Part IV: Key Certification and Related Services, 02/10/1993, B. 1716 Kaliski 1718 [MAIL PGP] 1719 - RFC 2440, "OpenPGP Message Format", J. Callas, L. 1720 Donnerhacke, H. Finney, R. Thayer", November 1998. 1721 - RFC 3156, "MIME Security with OpenPGP" M. Elkins, D. Del 1722 Torto, R. Levien, T. Roessler, August 2001. 1724 [MAIL S/MIME] - RFCs 2632 through 2634: 1725 - RFC 2632, "S/MIME Version 3 Certificate Handling", B. 1726 Ramsdell, Ed., June 1999. 1727 - RFC 2633, "S/MIME Version 3 Message Specification", B. 1728 Ramsdell, Ed., June 1999. 1730 - RFC 2634, "Enhanced Security Services for S/MIME" P. 1731 Hoffman, Ed., June 1999. 1733 [MD4] - "The MD4 Message-Digest Algorithm", RFC1320, April 1992, R. 1734 Rivest 1736 [MD5] - "The MD5 Message-Digest Algorithm", RFC1321, April 1992, R. 1737 Rivest 1739 [MODES] - "DES Modes of Operation", US National Institute of 1740 Standards and Technology, FIPS 81, December 1980. 1741 - "Data Encryption Algorithm - Modes of Operation", American 1742 National Standards Institute, ANSI X3.106-1983. 1744 [MOORE] - Moore's Law: the exponential increase in the logic density 1745 of silicon circuits. Originally formulated by Gordon Moore in 1964 as 1746 a doubling every year starting in 1962, in the late 1970s the rate 1747 fell to a doubling every 18 months and has remained there through the 1748 date of this document. See "The New Hacker's Dictionary", Third 1749 Edition, MIT Press, ISBN 0-262-18178-9, Eric S. Raymond, 1996. 1751 [ORMAN] - "Determining Strengths For Public Keys Used For Exchanging 1752 Symmetric Keys", draft-orman-public-key-lengths-*.txt, Hilarie Orman, 1753 Paul Hoffman, work in progress. 1755 [RFC 1750] - "Randomness Requirements for Security", D. Eastlake, S. 1756 Crocker, J. Schiller, December 1994. 1758 [RSA BULL1] - "Suggestions for Random Number Generation in Software", 1759 RSA Laboratories Bulletin #1, January 1996. 1761 [RSA BULL13] - "A Cost-Based Security Analysis of Symmetric and 1762 Asymmetric Key Lengths", RSA Laboratories Bulletin #13, Robert 1763 Silverman, April 2000 (revised November 2001). 1765 [SBOX1] - "Practical s-box design", S. Mister, C. Adams, Selected 1766 Areas in Cryptography, 1996. 1768 [SBOX2] - "Perfect Non-linear S-boxes", K. Nyberg, Advances in 1769 Cryptography - Eurocrypt '91 Proceedings, Springer-Verland, 1991. 1771 [SCHNEIER] - "Applied Cryptography: Protocols, Algorithms, and Source 1772 Code in C", 2nd Edition, John Wiley & Sons, 1996, Bruce Schneier. 1774 [SHANNON] - "The Mathematical Theory of Communication", University of 1775 Illinois Press, 1963, Claude E. Shannon. (originally from: Bell 1776 System Technical Journal, July and October 1948) 1778 [SHIFT1] - "Shift Register Sequences", Aegean Park Press, Revised 1779 Edition 1982, Solomon W. Golomb. 1781 [SHIFT2] - "Cryptanalysis of Shift-Register Generated Stream Cypher 1782 Systems", Aegean Park Press, 1984, Wayne G. Barker. 1784 [SHA-1] - "Secure Hash Standard (SHA-1)", US National Institute of 1785 Science and Technology, FIPS 180-1, April 1993. 1786 - RFC 3174, "US Secure Hash Algorithm 1 (SHA1)", D. Eastlake, 1787 P. Jones, September 2001. 1789 [SHA-2] - "Secure Hash Standard", Draft (SHA-2156/384/512), US 1790 National Institute of Science and Technology, FIPS 180-2, not yet 1791 issued. 1793 [SSH] - draft-ietf-secsh-*, work in progress. 1795 [STERN] - "Secret Linear Congruential Generators are not 1796 Cryptographically Secure", Proceedings of IEEE STOC, 1987, J. Stern. 1798 [TLS] - RFC 2246, "The TLS Protocol Version 1.0", T. Dierks, C. 1799 Allen, January 1999. 1801 [USENET] - RFC 977, "Network News Transfer Protocol", B. Kantor, P. 1802 Lapsley, February 1986. 1803 - RFC 2980, "Common NNTP Extensions", S. Barber, October 1804 2000. 1806 [VON NEUMANN] - "Various techniques used in connection with random 1807 digits", von Neumann's Collected Works, Vol. 5, Pergamon Press, 1963, 1808 J. von Neumann. 1810 [X9.17] - "American National Standard for Financial Institution Key 1811 Management (Wholesale)", American Bankers Association, 1985. 1813 [X9.82] - "Random Number Generation", ANSI X9F1, work in progress. 1815 Authors Addresses 1817 Donald E. Eastlake 3rd 1818 Motorola Laboratories 1819 155 Beaver Street 1820 Milford, MA 01757 USA 1822 Telephone: +1 508-786-7554 (w) 1823 +1 508-634-2066 (h) 1824 EMail: Donald.Eastlake@motorola.com 1826 Jeffrey I. Schiller 1827 MIT, Room E40-311 1828 77 Massachusetts Avenue 1829 Cambridge, MA 02139-4307 USA 1831 Telephone: +1 617-253-0161 1832 E-mail: jis@mit.edu 1834 Steve Crocker 1836 EMail: steve@stevecrocker.com 1838 File Name and Expiration 1840 This is file draft-eastlake-randomness2-07.txt. 1842 It expires December 2004.