idnits 2.17.00 (12 Aug 2021) /tmp/idnits44252/draft-eastlake-randomness2-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Looks like you're using RFC 2026 boilerplate. This must be updated to follow RFC 3978/3979, as updated by RFC 4748. 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. ** The document seems to lack a 1id_guidelines paragraph about 6 months document validity -- however, there's a paragraph with a matching beginning. Boilerplate error? == 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.) ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. ** There are 4 instances of too long lines in the document, the longest one being 3 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The "Author's Address" (or "Authors' Addresses") section title is misspelled. -- 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 (November 2000) is 7856 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: 'SHS' is mentioned on line 884, but not defined == Missing Reference: 'Appendix' is mentioned on line 1930, but not defined == Unused Reference: 'ASYMMETRIC' is defined on line 1936, but no explicit reference was found in the text == Unused Reference: 'CRYPTO1' is defined on line 1949, but no explicit reference was found in the text == Unused Reference: 'DNSSEC' is defined on line 1982, but no explicit reference was found in the text == Unused Reference: 'IPSEC' is defined on line 1993, but no explicit reference was found in the text == Unused Reference: 'MAIL PGP' is defined on line 2013, but no explicit reference was found in the text == Unused Reference: 'SHIFT1' is defined on line 2033, but no explicit reference was found in the text == Unused Reference: 'SHIFT2' is defined on line 2036, but no explicit reference was found in the text == Unused Reference: 'STERN' is defined on line 2043, but no explicit reference was found in the text == Unused Reference: 'TLS' is defined on line 2046, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'ASYMMETRIC' -- Possible downref: Non-RFC (?) normative reference: ref. 'BBS' -- Possible downref: Non-RFC (?) normative reference: ref. 'BRILLINGER' -- Possible downref: Non-RFC (?) normative reference: ref. 'CRC' -- Possible downref: Non-RFC (?) normative reference: ref. 'CRYPTO1' -- Possible downref: Non-RFC (?) normative reference: ref. 'CRYPTO2' -- Possible downref: Non-RFC (?) normative reference: ref. 'CRYPTO3' -- Possible downref: Non-RFC (?) normative reference: ref. 'DAVIS' -- Possible downref: Non-RFC (?) normative reference: ref. 'DES' -- Possible downref: Non-RFC (?) normative reference: ref. 'DES MODES' -- Possible downref: Non-RFC (?) normative reference: ref. 'D-H' ** Obsolete normative reference: RFC 2535 (ref. 'DNSSEC') (Obsoleted by RFC 4033, RFC 4034, RFC 4035) -- Possible downref: Non-RFC (?) normative reference: ref. 'DoD' -- Possible downref: Non-RFC (?) normative reference: ref. 'GIFFORD' ** Obsolete normative reference: RFC 2401 (ref. 'IPSEC') (Obsoleted by RFC 4301) -- Possible downref: Non-RFC (?) normative reference: ref. 'KNUTH' -- Possible downref: Non-RFC (?) normative reference: ref. 'KRAWCZYK' ** Downref: Normative reference to an Historic RFC: RFC 1421 (ref. 'MAIL PEM') ** Obsolete normative reference: RFC 2440 (ref. 'MAIL PGP') (Obsoleted by RFC 4880) ** Obsolete normative reference: RFC 1320 (ref. 'MD4') (Obsoleted by RFC 6150) ** Downref: Normative reference to an Informational RFC: RFC 1321 (ref. 'MD5') -- Possible downref: Non-RFC (?) normative reference: ref. 'MOORE' ** Obsolete normative reference: RFC 1750 (Obsoleted by RFC 4086) -- Possible downref: Non-RFC (?) normative reference: ref. 'SHANNON' -- Possible downref: Non-RFC (?) normative reference: ref. 'SHIFT1' -- Possible downref: Non-RFC (?) normative reference: ref. 'SHIFT2' -- Possible downref: Non-RFC (?) normative reference: ref. 'SHA1' -- Possible downref: Non-RFC (?) normative reference: ref. 'STERN' ** Obsolete normative reference: RFC 2246 (ref. 'TLS') (Obsoleted by RFC 4346) -- Possible downref: Non-RFC (?) normative reference: ref. 'VON NEUMANN' Summary: 15 errors (**), 0 flaws (~~), 13 warnings (==), 24 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Network Working Group Donald E. Eastlake, 3rd 2 OBSOLETES RFC 1750 Jeffrey I. Schiller 3 Steve Crocker 4 Expires May 2001 November 2000 6 Randomness Requirements for Security 7 ---------- ------------ --- -------- 8 10 Status of This Document 12 This document 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 RFC2026. Internet-Drafts are working 17 documents of the Internet Engineering Task Force (IETF), its areas, 18 and its working groups. Note that other groups may also distribute 19 working documents as Internet-Drafts. 21 Internet-Drafts are draft documents valid for a maximum of six 22 months. Internet-Drafts may be updated, replaced, or obsoleted by 23 other documents at any time. It is not appropriate to use Internet- 24 Drafts as reference material or to cite them other than as a 25 ``working draft'' or ``work in progress.'' 27 The list of current Internet-Drafts can be accessed at 28 http://www.ietf.org/ietf/1id-abstracts.txt 30 The list of Internet-Draft Shadow Directories can be accessed at 31 http://www.ietf.org/shadow.html. 33 Abstract 35 Security systems today are built on increasingly strong cryptographic 36 algorithms that foil pattern analysis attempts. However, the security 37 of these systems is dependent on generating secret quantities for 38 passwords, cryptographic keys, and similar quantities. The use of 39 pseudo-random processes to generate secret quantities can result in 40 pseudo-security. The sophisticated attacker of these security 41 systems may find it easier to reproduce the environment that produced 42 the secret quantities, searching the resulting small set of 43 possibilities, than to locate the quantities in the whole of the 44 number space. 46 Choosing random quantities to foil a resourceful and motivated 47 adversary is surprisingly difficult. This document points out many 48 pitfalls in using traditional pseudo-random number generation 49 techniques for choosing such quantities. It recommends the use of 50 truly random hardware techniques and shows that the existing hardware 51 on many systems can be used for this purpose. It provides 52 suggestions to ameliorate the problem when a hardware solution is not 53 available. And it gives examples of how large such quantities need 54 to be for some particular applications. 56 Acknowledgements 58 Special thanks to 59 (1) The authors of "Minimal Key Lengths for Symmetric Ciphers to 60 Provide Adequate Commercial Security" which is incorporated as 61 Appendix A. 63 (2) Peter Gutmann who has permitted the incorporation into this 64 replacement for RFC 1750 of materila from is paper "Software 65 Generation of Practially Strong Random Numbers". 67 The following other persons (in alphabetic order) contributed to this 68 document: 70 (tbd) 72 The following persons (in alpahbetic order) contributed to RFC 1750, 73 the predeceasor of this document: 75 David M. Balenson, Don T. Davis, Carl Ellison, Marc Horowitz, 76 Christian Huitema, Charlie Kaufman, Steve Kent, Hal Murray, Neil 77 Haller, Richard Pitkin, Tim Redmond, Doug Tygar. 79 Status of This Document....................................1 81 Abstract...................................................2 82 Acknowledgements...........................................2 84 Table of Contents..........................................3 86 1. Introduction............................................5 88 2. Requirements............................................6 90 3. Traditional Pseudo-Random Sequences.....................8 92 4. Unpredictability.......................................10 93 4.1 Problems with Clocks and Serial Numbers...............10 94 4.2 Timing and Content of External Events.................11 95 4.3 The Fallacy of Complex Manipulation...................11 96 4.4 The Fallacy of Selection from a Large Database........12 98 5. Hardware for Randomness................................13 99 5.1 Volume Required.......................................13 100 5.2 Sensitivity to Skew...................................13 101 5.2.1 Using Stream Parity to De-Skew......................14 102 5.2.2 Using Transition Mappings to De-Skew................15 103 5.2.3 Using FFT to De-Skew................................16 104 5.2.4 Using Compression to De-Skew........................16 105 5.3 Existing Hardware Can Be Used For Randomness..........17 106 5.3.1 Using Existing Sound/Video Input....................17 107 5.3.2 Using Existing Disk Drives..........................17 109 6. Recommended Non-Hardware Strategy......................18 110 6.1 Mixing Functions......................................18 111 6.1.1 A Trivial Mixing Function...........................18 112 6.1.2 Stronger Mixing Functions...........................19 113 6.1.3 Diff-Hellman as a Mixing Function...................20 114 6.1.4 Using a Mixing Function to Stretch Random Bits......21 115 6.1.5 Other Factors in Choosing a Mixing Function.........21 116 6.2 Non-Hardware Sources of Randomness....................22 117 6.3 Cryptographically Strong Sequences....................23 118 6.3.1 Traditional Strong Sequences........................23 119 6.3.2 The Blum Blum Shub Sequence Generator...............24 121 7. Key Generation Standards and Examples..................26 122 7.1 US DoD Recommendations for Password Generation........26 123 7.2 X9.17 Key Generation..................................26 124 7.3 The /dev/random Device under Linux....................27 125 7.4 additional example....................................28 126 8. Examples of Randomness Required........................29 127 8.1 Password Generation..................................29 128 8.2 A Very High Security Cryptographic Key................30 129 8.2.1 Effort per Key Trial................................30 130 8.2.2 Meet in the Middle Attacks..........................30 132 9. Conclusion.............................................32 133 10. Security Considerations...............................32 135 Appendix: Minimal Secure Key Lengths Study................33 136 A.0 Abstract..............................................33 137 A.1. Encryption Plays an Essential Role in Protecting.....34 138 A.1.1 There is a need for information security............34 139 A.1.2 Encryption to protect confidentiality...............35 140 A.1.3 There are a variety of attackers....................36 141 A.1.4 Strong encryption is not expensive..................37 142 A.2. Brute-Forece is becoming easier......................37 143 A.3. 40-Bit Key Lengths Offer Virtually No Protection.....39 144 A.4. Even DES with 56-Bit Keys Is Increasingly Inadequate.40 145 A.4.1 DES is no panacea today.............................40 146 A.4.2 There are smarter avenues of attack than brute force41 147 A.4.3 Other algorithms are similar........................41 148 A.5. Appropriate Key Lengths for the Future --- A Proposal42 149 A.6 About the Authors.....................................44 150 A.7 Acknowledgement.......................................45 152 References................................................46 154 Authors Addresses.........................................49 155 File Name and Expiration..................................49 157 1. Introduction 159 Software cryptography has come into wider use and in continuing 160 spread, although there is a long way to go until it becomes 161 pervasive. Systems like IPSEC, TLS, S/MIME, PGP, DNSSEC, Kerberos, 162 etc. are maturing and becoming a part of the network landscape 163 [DNSSEC, IPSEC, MAIL*, TLS]. By comparison, when the previous 164 version of this document [RFC 1750] was issued in 1994, about the 165 only cryptographic security specification in the IETF was the Privacy 166 Enhanced Mail protocol [MAIL PEM]. 168 These systems provide substantial protection against snooping and 169 spoofing. However, there is a potential flaw. At the heart of all 170 cryptographic systems is the generation of secret, unguessable (i.e., 171 random) numbers. 173 For the present, the lack of generally available facilities for 174 generating such unpredictable numbers is an open wound in the design 175 of cryptographic software. For the software developer who wants to 176 build a key or password generation procedure that runs on a wide 177 range of hardware, the only safe strategy so far has been to force 178 the local installation to supply a suitable routine to generate 179 random numbers. To say the least, this is an awkward, error-prone 180 and unpalatable solution. 182 It is important to keep in mind that the requirement is for data that 183 an adversary has a very low probability of guessing or determining. 184 This will fail if pseudo-random data is used which only meets 185 traditional statistical tests for randomness or which is based on 186 limited range sources, such as clocks. Frequently such random 187 quantities are determinable by an adversary searching through an 188 embarrassingly small space of possibilities. 190 This informational document suggests techniques for producing random 191 quantities that will be resistant to such attack. It recommends that 192 future systems include hardware random number generation or provide 193 access to existing hardware that can be used for this purpose. It 194 suggests methods for use if such hardware is not available. And it 195 gives some estimates of the number of random bits required for sample 196 applications. 198 2. Requirements 200 Probably the most commonly encountered randomness requirement today 201 is the user password. This is usually a simple character string. 202 Obviously, if a password can be guessed, it does not provide 203 security. (For re-usable passwords, it is desirable that users be 204 able to remember the password. This may make it advisable to use 205 pronounceable character strings or phrases composed on ordinary 206 words. But this only affects the format of the password information, 207 not the requirement that the password be very hard to guess.) 209 Many other requirements come from the cryptographic arena. 210 Cryptographic techniques can be used to provide a variety of services 211 including confidentiality and authentication. Such services are 212 based on quantities, traditionally called "keys", that are unknown to 213 and unguessable by an adversary. 215 In some cases, such as the use of symmetric encryption with the one 216 time pads [CRYPTO*] or the US Data Encryption Standard [DES], the 217 parties who wish to communicate confidentially and/or with 218 authentication must all know the same secret key. In other cases, 219 using what are called asymmetric or "public key" cryptographic 220 techniques, keys come in pairs. One key of the pair is private and 221 must be kept secret by one party, the other is public and can be 222 published to the world. It is computationally infeasible to 223 determine the private key from the public key. [ASYMMETRIC, CRYPTO*] 225 The frequency and volume of the requirement for random quantities 226 differs greatly for different cryptographic systems. Using pure RSA 227 [CRYPTO*], random quantities are required when the key pair is 228 generated, but thereafter any number of messages can be signed 229 without any further need for randomness. The public key Digital 230 Signature Algorithm devused by the US National Institute of Standards 231 and Technology (NIST) requires good random numbers for each 232 signature. And encrypting with a one time pad, in principle the 233 strongest possible encryption technique, requires a volume of 234 randomness equal to all the messages to be processed. 236 In most of these cases, an adversary can try to determine the 237 "secret" key by trial and error. (This is possible as long as the 238 key is enough smaller than the message that the correct key can be 239 uniquely identified.) The probability of an adversary succeeding at 240 this must be made acceptably low, depending on the particular 241 application. The size of the space the adversary must search is 242 related to the amount of key "information" present in the information 243 theoretic sense [SHANNON]. This depends on the number of different 244 secret values possible and the probability of each value as follows: 246 ----- 247 \ 248 Bits-of-info = \ - p * log ( p ) 249 / i 2 i 250 / 251 ----- 253 where i varies from 1 to the number of possible secret values and p 254 sub i is the probability of the value numbered i. (Since p sub i is 255 less than one, the log will be negative so each term in the sum will 256 be non-negative.) 258 If there are 2^n different values of equal probability, then n bits 259 of information are present and an adversary would, on the average, 260 have to try half of the values, or 2^(n-1) , before guessing the 261 secret quantity. If the probability of different values is unequal, 262 then there is less information present and fewer guesses will, on 263 average, be required by an adversary. In particular, any values that 264 the adversary can know are impossible, or are of low probability, can 265 be initially ignored by an adversary, who will search through the 266 more probable values first. 268 For example, consider a cryptographic system that uses 56 bit keys. 269 If these 56 bit keys are derived by using a fixed pseudo-random 270 number generator that is seeded with an 8 bit seed, then an adversary 271 needs to search through only 256 keys (by running the pseudo-random 272 number generator with every possible seed), not the 2^56 keys that 273 may at first appear to be the case. Only 8 bits of "information" are 274 in these 56 bit keys. 276 3. Traditional Pseudo-Random Sequences 278 Most traditional sources of random numbers use deterministic sources 279 of "pseudo-random" numbers. These typically start with a "seed" 280 quantity and use numeric or logical operations to produce a sequence 281 of values. 283 [KNUTH] has a classic exposition on pseudo-random numbers. 284 Applications he mentions are simulation of natural phenomena, 285 sampling, numerical analysis, testing computer programs, decision 286 making, and games. None of these have the same characteristics as 287 the sort of security uses we are talking about. Only in the last two 288 could there be an adversary trying to find the random quantity. 289 However, in these cases, the adversary normally has only a single 290 chance to use a guessed value. In guessing passwords or attempting 291 to break an encryption scheme, the adversary normally has many, 292 perhaps unlimited, chances at guessing the correct value and should 293 be assumed to be aided by a computer. 295 For testing the "randomness" of numbers, Knuth suggests a variety of 296 measures including statistical and spectral. These tests check 297 things like autocorrelation between different parts of a "random" 298 sequence or distribution of its values. They could be met by a 299 constant stored random sequence, such as the "random" sequence 300 printed in the CRC Standard Mathematical Tables [CRC]. 302 A typical pseudo-random number generation technique, known as a 303 linear congruence pseudo-random number generator, is modular 304 arithmetic where the N+1th value is calculated from the Nth value by 306 V = ( V * a + b )(Mod c) 307 N+1 N 309 The above technique has a strong relationship to linear shift 310 register pseudo-random number generators, which are well understood 311 cryptographically [SHIFT*]. In such generators bits are introduced 312 at one end of a shift register as the Exclusive Or (binary sum 313 without carry) of bits from selected fixed taps into the register. 314 For example: 316 +----+ +----+ +----+ +----+ 317 | B | <-- | B | <-- | B | <-- . . . . . . <-- | B | <-+ 318 | 0 | | 1 | | 2 | | n | | 319 +----+ +----+ +----+ +----+ | 320 | | | | 321 | | V +-----+ 322 | V +----------------> | | 323 V +-----------------------------> | XOR | 324 +---------------------------------------------------> | | 325 +-----+ 327 V = ( ( V * 2 ) + B .xor. B ... )(Mod 2^n) 328 N+1 N 0 2 330 The goodness of traditional pseudo-random number generator algorithms 331 is measured by statistical tests on such sequences. Carefully chosen 332 values of the initial V and a, b, and c or the placement of shift 333 register tap in the above simple processes can produce excellent 334 statistics. 336 These sequences may be adequate in simulations (Monte Carlo 337 experiments) as long as the sequence is orthogonal to the structure 338 of the space being explored. Even there, subtle patterns may cause 339 problems. However, such sequences are clearly bad for use in 340 security applications. They are fully predictable if the initial 341 state is known. Depending on the form of the pseudo-random number 342 generator, the sequence may be determinable from observation of a 343 short portion of the sequence [CRYPTO*, STERN]. For example, with 344 the generators above, one can determine V(n+1) given knowledge of 345 V(n). In fact, it has been shown that with these techniques, even if 346 only one bit of the pseudo-random values are released, the seed can 347 be determined from short sequences. 349 Not only have linear congruent generators been broken, but techniques 350 are now known for breaking all polynomial congruent generators. 351 [KRAWCZYK] 353 4. Unpredictability 355 Randomness in the traditional sense described in section 3 is NOT the 356 same as the unpredictability required for security use. 358 For example, use of a widely available constant sequence, such as 359 that from the CRC tables, is very weak against an adversary. Once 360 they learn of or guess it, they can easily break all security, future 361 and past, based on the sequence. [CRC] Yet the statistical properties 362 of these tables are good. 364 The following sections describe the limitations of some randomness 365 generation techniques and sources. 367 4.1 Problems with Clocks and Serial Numbers 369 Computer clocks, or similar operating system or hardware values, 370 provide significantly fewer real bits of unpredictability than might 371 appear from their specifications. 373 Tests have been done on clocks on numerous systems and it was found 374 that their behavior can vary widely and in unexpected ways. One 375 version of an operating system running on one set of hardware may 376 actually provide, say, microsecond resolution in a clock while a 377 different configuration of the "same" system may always provide the 378 same lower bits and only count in the upper bits at much lower 379 resolution. This means that successive reads on the clock may 380 produce identical values even if enough time has passed that the 381 value "should" change based on the nominal clock resolution. There 382 are also cases where frequently reading a clock can produce 383 artificial sequential values because of extra code that checks for 384 the clock being unchanged between two reads and increases it by one! 385 Designing portable application code to generate unpredictable numbers 386 based on such system clocks is particularly challenging because the 387 system designer does not always know the properties of the system 388 clocks that the code will execute on. 390 Use of a hardware serial number such as an Ethernet address may also 391 provide fewer bits of uniqueness than one would guess. Such 392 quantities are usually heavily structured and subfields may have only 393 a limited range of possible values or values easily guessable based 394 on approximate date of manufacture or other data. For example, it is 395 likely that a company that manfactures both computers and Ethernet 396 adapters will, at least internally, use its own adapters, which 397 significantly limits the range of built in addresses. 399 Problems such as those described above related to clocks and serial 400 numbers make code to produce unpredictable quantities difficult if 401 the code is to be ported across a variety of computer platforms and 402 systems. 404 4.2 Timing and Content of External Events 406 It is possible to measure the timing and content of mouse movement, 407 key strokes, and similar user events. This is a reasonable source of 408 unguessable data with some qualifications. On some machines, inputs 409 such as key strokes are buffered. Even though the user's inter- 410 keystroke timing may have sufficient variation and unpredictability, 411 there might not be an easy way to access that variation. Another 412 problem is that no standard method exists to sample timing details. 413 This makes it hard to build standard software intended for 414 distribution to a large range of machines based on this technique. 416 The amount of mouse movement or the keys actually hit are usually 417 easier to access than timings but may yield less unpredictability as 418 the user may provide highly repetitive input. 420 Other external events, such as network packet arrival times, can also 421 be used with care. In particular, the possibility of manipulation of 422 such times by an adversary and the lack of history on system start up 423 must be considered. 425 4.3 The Fallacy of Complex Manipulation 427 One strategy which may give a misleading appearance of 428 unpredictability is to take a very complex algorithm (or an excellent 429 traditional pseudo-random number generator with good statistical 430 properties) and calculate a cryptographic key by starting with the 431 current value of a computer system clock as the seed. An adversary 432 who knew roughly when the generator was started would have a 433 relatively small number of seed values to test as they would know 434 likely values of the system clock. Large numbers of pseudo-random 435 bits could be generated but the search space an adversary would need 436 to check could be quite small. 438 Thus very strong and/or complex manipulation of data will not help if 439 the adversary can learn what the manipulation is and there is not 440 enough unpredictability in the starting seed value. Even if they can 441 not learn what the manipulation is, they may be able to use the 442 limited number of results stemming from a limited number of seed 443 values to defeat security. 445 Another serious strategy error is to assume that a very complex 446 pseudo-random number generation algorithm will produce strong random 447 numbers when there has been no theory behind or analysis of the 448 algorithm. There is a excellent example of this fallacy right near 449 the beginning of chapter 3 in [KNUTH] where the author describes a 450 complex algorithm. It was intended that the machine language program 451 corresponding to the algorithm would be so complicated that a person 452 trying to read the code without comments wouldn't know what the 453 program was doing. Unfortunately, actual use of this algorithm 454 showed that it almost immediately converged to a single repeated 455 value in one case and a small cycle of values in another case. 457 Not only does complex manipulation not help you if you have a limited 458 range of seeds but blindly chosen complex manipulation can destroy 459 the randomness in a good seed! 461 4.4 The Fallacy of Selection from a Large Database 463 Another strategy that can give a misleading appearance of 464 unpredictability is selection of a quantity randomly from a database 465 and assume that its strength is related to the total number of bits 466 in the database. For example, typical USENET servers process many 467 megabytes of information per day. Assume a random quantity was 468 selected by fetching 32 bytes of data from a random starting point in 469 this data. This does not yield 32*8 = 256 bits worth of 470 unguessability. Even after allowing that much of the data is human 471 language and probably has more like 2 or 3 bits of information per 472 byte, it doesn't yield 32*2.5 = 80 bits of unguessability. For an 473 adversary with access to the same usenet database the unguessability 474 rests only on the starting point of the selection. That is perhaps a 475 little over a couple of dozen bits of unguessability. 477 The same argument applies to selecting sequences from the data on a 478 CD/DVD recording or any other large public database. If the 479 adversary has access to the same database, this "selection from a 480 large volume of data" step buys very little. However, if a selection 481 can be made from data to which the adversary has no access, such as 482 system buffers on an active multi-user system, it may be of help. 484 5. Hardware for Randomness 486 Is there any hope for strong portable randomness in the future? 487 There might be. All that's needed is a physical source of 488 unpredictable numbers. 490 A thermal noise or radioactive decay source and a fast, free-running 491 oscillator would do the trick directly [GIFFORD]. This is a trivial 492 amount of hardware, and could easily be included as a standard part 493 of a computer system's architecture. Furthermore, any system with a 494 spinning disk or the like has an adequate source of randomness 495 [DAVIS]. All that's needed is the common perception among computer 496 vendors that this small additional hardware and the software to 497 access it is necessary and useful. 499 5.1 Volume Required 501 How much unpredictability is needed? Is it possible to quantify the 502 requirement in, say, number of random bits per second? 504 The answer is not very much is needed. For DES, the key is 56 bits 505 and, as we show in an example in Section 8, even the highest security 506 system is unlikely to require a keying material of over 200 bits. If 507 a series of keys are needed, they can be generated from a strong 508 random seed using a cryptographically strong sequence as explained in 509 Section 6.3. A few hundred random bits generated once a day would be 510 enough using such techniques. Even if the random bits are generated 511 as slowly as one per second and it is not possible to overlap the 512 generation process, it should be tolerable in high security 513 applications to wait 200 seconds occasionally. 515 These numbers are trivial to achieve. It could be done by a person 516 repeatedly tossing a coin. Almost any hardware process is likely to 517 be much faster. 519 5.2 Sensitivity to Skew 521 Is there any specific requirement on the shape of the distribution of 522 the random numbers? The good news is the distribution need not be 523 uniform. All that is needed is a conservative estimate of how non- 524 uniform it is to bound performance. Two simple techniques to de-skew 525 the bit stream are given below and stronger techniques are mentioned 526 in Section 6.1.2 below. 528 5.2.1 Using Stream Parity to De-Skew 530 Consider taking a sufficiently long string of bits and map the string 531 to "zero" or "one". The mapping will not yield a perfectly uniform 532 distribution, but it can be as close as desired. One mapping that 533 serves the purpose is to take the parity of the string. This has the 534 advantages that it is robust across all degrees of skew up to the 535 estimated maximum skew and is absolutely trivial to implement in 536 hardware. 538 The following analysis gives the number of bits that must be sampled: 540 Suppose the ratio of ones to zeros is 0.5 + e : 0.5 - e, where e is 541 between 0 and 0.5 and is a measure of the "eccentricity" of the 542 distribution. Consider the distribution of the parity function of N 543 bit samples. The probabilities that the parity will be one or zero 544 will be the sum of the odd or even terms in the binomial expansion of 545 (p + q)^N, where p = 0.5 + e, the probability of a one, and q = 0.5 - 546 e, the probability of a zero. 548 These sums can be computed easily as 550 N N 551 1/2 * ( ( p + q ) + ( p - q ) ) 552 and 553 N N 554 1/2 * ( ( p + q ) - ( p - q ) ). 556 (Which one corresponds to the probability the parity will be 1 557 depends on whether N is odd or even.) 559 Since p + q = 1 and p - q = 2e, these expressions reduce to 561 N 562 1/2 * [1 + (2e) ] 563 and 564 N 565 1/2 * [1 - (2e) ]. 567 Neither of these will ever be exactly 0.5 unless e is zero, but we 568 can bring them arbitrarily close to 0.5. If we want the 569 probabilities to be within some delta d of 0.5, i.e. then 571 N 572 ( 0.5 + ( 0.5 * (2e) ) ) < 0.5 + d. 574 Solving for N yields N > log(2d)/log(2e). (Note that 2e is less than 575 1, so its log is negative. Division by a negative number reverses 576 the sense of an inequality.) 577 The following table gives the length of the string which must be 578 sampled for various degrees of skew in order to come within 0.001 of 579 a 50/50 distribution. 581 +---------+--------+-------+ 582 | Prob(1) | e | N | 583 +---------+--------+-------+ 584 | 0.5 | 0.00 | 1 | 585 | 0.6 | 0.10 | 4 | 586 | 0.7 | 0.20 | 7 | 587 | 0.8 | 0.30 | 13 | 588 | 0.9 | 0.40 | 28 | 589 | 0.95 | 0.45 | 59 | 590 | 0.99 | 0.49 | 308 | 591 +---------+--------+-------+ 593 The last entry shows that even if the distribution is skewed 99% in 594 favor of ones, the parity of a string of 308 samples will be within 595 0.001 of a 50/50 distribution. 597 5.2.2 Using Transition Mappings to De-Skew 599 Another technique, originally due to von Neumann [VON NEUMANN], is to 600 examine a bit stream as a sequence of non-overlapping pairs. You 601 could then discard any 00 or 11 pairs found, interpret 01 as a 0 and 602 10 as a 1. Assume the probability of a 1 is 0.5+e and the 603 probability of a 0 is 0.5-e where e is the eccentricity of the source 604 and described in the previous section. Then the probability of each 605 pair is as follows: 607 +------+-----------------------------------------+ 608 | pair | probability | 609 +------+-----------------------------------------+ 610 | 00 | (0.5 - e)^2 = 0.25 - e + e^2 | 611 | 01 | (0.5 - e)*(0.5 + e) = 0.25 - e^2 | 612 | 10 | (0.5 + e)*(0.5 - e) = 0.25 - e^2 | 613 | 11 | (0.5 + e)^2 = 0.25 + e + e^2 | 614 +------+-----------------------------------------+ 616 This technique will completely eliminate any bias but at the expense 617 of taking an indeterminate number of input bits for any particular 618 desired number of output bits. The probability of any particular 619 pair being discarded is 0.5 + 2e^2 so the expected number of input 620 bits to produce X output bits is X/(0.25 - e^2). 622 This technique assumes that the bits are from a stream where each bit 623 has the same probability of being a 0 or 1 as any other bit in the 624 stream and that bits are not correlated, i.e., that the bits are 625 identical independent distributions. If alternate bits were from two 626 correlated sources, for example, the above analysis breaks down. 628 The above technique also provides another illustration of how a 629 simple statistical analysis can mislead if one is not always on the 630 lookout for patterns that could be exploited by an adversary. If the 631 algorithm were mis-read slightly so that overlapping successive bits 632 pairs were used instead of non-overlapping pairs, the statistical 633 analysis given is the same; however, instead of providing an unbiased 634 uncorrelated series of random 1's and 0's, it instead produces a 635 totally predictable sequence of exactly alternating 1's and 0's. 637 5.2.3 Using FFT to De-Skew 639 When real world data consists of strongly biased or correlated bits, 640 it may still contain useful amounts of randomness. This randomness 641 can be extracted through use of the discrete Fourier transform or its 642 optimized variant, the FFT. 644 Using the Fourier transform of the data, strong correlations can be 645 discarded. If adequate data is processed and remaining correlations 646 decay, spectral lines approaching statistical independence and 647 normally distributed randomness can be produced [BRILLINGER]. 649 5.2.4 Using Compression to De-Skew 651 Reversible compression techniques also provide a crude method of de- 652 skewing a skewed bit stream. This follows directly from the 653 definition of reversible compression and the formula in Section 2 654 above for the amount of information in a sequence. Since the 655 compression is reversible, the same amount of information must be 656 present in the shorter output than was present in the longer input. 657 By the Shannon information equation, this is only possible if, on 658 average, the probabilities of the different shorter sequences are 659 more uniformly distributed than were the probabilities of the longer 660 sequences. Thus the shorter sequences are de-skewed relative to the 661 input. 663 However, many compression techniques add a somewhat predictable 664 preface to their output stream and may insert such a sequence again 665 periodically in their output or otherwise introduce subtle patterns 666 of their own. They should be considered only a rough technique 667 compared with those described above or in Section 6.1.2. At a 668 minimum, the beginning of the compressed sequence should be skipped 669 and only later bits used for applications requiring random bits. 671 5.3 Existing Hardware Can Be Used For Randomness 673 As described below, many computers come with hardware that can, with 674 care, be used to generate truly random quantities. 676 5.3.1 Using Existing Sound/Video Input 678 Increasingly computers are being built with inputs that digitize some 679 real world analog source, such as sound from a microphone or video 680 input from a camera. Under appropriate circumstances, such input can 681 provide reasonably high quality random bits. The "input" from a 682 sound digitizer with no source plugged in or a camera with the lens 683 cap on, if the system has enough gain to detect anything, is 684 essentially thermal noise. 686 For example, on a SPARCstation, one can read from the /dev/audio 687 device with nothing plugged into the microphone jack. Such data is 688 essentially random noise although it should not be trusted without 689 some checking in case of hardware failure. It will, in any case, 690 need to be de-skewed as described elsewhere. 692 Combining this with compression to de-skew one can, in UNIXese, 693 generate a huge amount of medium quality random data by doing 695 cat /dev/audio | compress - >random-bits-file 697 5.3.2 Using Existing Disk Drives 699 Disk drives have small random fluctuations in their rotational speed 700 due to chaotic air turbulence [DAVIS]. By adding low level disk seek 701 time instrumentation to a system, a series of measurements can be 702 obtained that include this randomness. Such data is usually highly 703 correlated so that significant processing is needed, including FFT 704 (see section 5.2.3). Nevertheless experimentation has shown that, 705 with such processing, disk drives easily produce 100 bits a minute or 706 more of excellent random data. 708 Partly offsetting this need for processing is the fact that disk 709 drive failure will normally be rapidly noticed. Thus, problems with 710 this method of random number generation due to hardware failure are 711 very unlikely. 713 6. Recommended Non-Hardware Strategy 715 What is the best overall strategy for meeting the requirement for 716 unguessable random numbers in the absence of a reliable hardware 717 source? It is to obtain random input from a number of uncorrelated 718 sources and to mix them with a strong mixing function. Such a 719 function will preserve the randomness present in any of the sources 720 even if other quantities being combined are fixed or easily 721 guessable. This may be advisable even with a good hardware source as 722 hardware can also fail, though this should be weighed against any 723 increase in the chance of overall failure due to added software 724 complexity. 726 6.1 Mixing Functions 728 A strong mixing function is one which combines two or more inputs and 729 produces an output where each output bit is a different complex non- 730 linear function of all the input bits. On average, changing any 731 input bit will change about half the output bits. But because the 732 relationship is complex and non-linear, no particular output bit is 733 guaranteed to change when any particular input bit is changed. 735 Consider the problem of converting a stream of bits that is skewed 736 towards 0 or 1 to a shorter stream which is more random, as discussed 737 in Section 5.2 above. This is simply another case where a strong 738 mixing function is desired, mixing the input bits to produce a 739 smaller number of output bits. The technique given in Section 5.2.1 740 of using the parity of a number of bits is simply the result of 741 successively Exclusive Or'ing them which is examined as a trivial 742 mixing function immediately below. Use of stronger mixing functions 743 to extract more of the randomness in a stream of skewed bits is 744 examined in Section 6.1.2. 746 6.1.1 A Trivial Mixing Function 748 A trivial example for single bit inputs is the Exclusive Or function, 749 which is equivalent to addition without carry, as show in the table 750 below. This is a degenerate case in which the one output bit always 751 changes for a change in either input bit. But, despite its 752 simplicity, it will still provide a useful illustration. 754 +-----------+-----------+----------+ 755 | input 1 | input 2 | output | 756 +-----------+-----------+----------+ 757 | 0 | 0 | 0 | 758 | 0 | 1 | 1 | 759 | 1 | 0 | 1 | 760 | 1 | 1 | 0 | 761 +-----------+-----------+----------+ 763 If inputs 1 and 2 are uncorrelated and combined in this fashion then 764 the output will be an even better (less skewed) random bit than the 765 inputs. If we assume an "eccentricity" e as defined in Section 5.2 766 above, then the output eccentricity relates to the input eccentricity 767 as follows: 769 e = 2 * e * e 770 output input 1 input 2 772 Since e is never greater than 1/2, the eccentricity is always 773 improved except in the case where at least one input is a totally 774 skewed constant. This is illustrated in the following table where 775 the top and left side values are the two input eccentricities and the 776 entries are the output eccentricity: 778 +--------+--------+--------+--------+--------+--------+--------+ 779 | e | 0.00 | 0.10 | 0.20 | 0.30 | 0.40 | 0.50 | 780 +--------+--------+--------+--------+--------+--------+--------+ 781 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 782 | 0.10 | 0.00 | 0.02 | 0.04 | 0.06 | 0.08 | 0.10 | 783 | 0.20 | 0.00 | 0.04 | 0.08 | 0.12 | 0.16 | 0.20 | 784 | 0.30 | 0.00 | 0.06 | 0.12 | 0.18 | 0.24 | 0.30 | 785 | 0.40 | 0.00 | 0.08 | 0.16 | 0.24 | 0.32 | 0.40 | 786 | 0.50 | 0.00 | 0.10 | 0.20 | 0.30 | 0.40 | 0.50 | 787 +--------+--------+--------+--------+--------+--------+--------+ 789 However, keep in mind that the above calculations assume that the 790 inputs are not correlated. If the inputs were, say, the parity of 791 the number of minutes from midnight on two clocks accurate to a few 792 seconds, then each might appear random if sampled at random intervals 793 much longer than a minute. Yet if they were both sampled and 794 combined with xor, the result would be zero most of the time. 796 6.1.2 Stronger Mixing Functions 798 The US Government Data Encryption Standard [DES] is an example of a 799 strong mixing function for multiple bit quantities. It takes up to 800 120 bits of input (64 bits of "data" and 56 bits of "key") and 801 produces 64 bits of output each of which is dependent on a complex 802 non-linear function of all input bits. Other strong encryption 803 functions with this characteristic can also be used by considering 804 them to mix all of their key and data input bits. 806 Another good family of mixing functions are the "message digest" or 807 hashing functions such as The US Government Secure Hash Standard 808 [SHA1] and the MD4, MD5 [MD4, MD5] series. These functions all take 809 an arbitrary amount of input and produce an output mixing all the 810 input bits. The MD* series produce 128 bits of output and SHA1 811 produces 160 bits. 813 Although the message digest functions are designed for variable 814 amounts of input, DES and other encryption functions can also be used 815 to combine any number of inputs. If 64 bits of output is adequate, 816 the inputs can be packed into a 64 bit data quantity and successive 817 56 bit keys, padding with zeros if needed, which are then used to 818 successively encrypt using DES in Electronic Codebook Mode [DES 819 MODES]. If more than 64 bits of output are needed, use more complex 820 mixing. For example, if inputs are packed into three quantities, A, 821 B, and C, use DES to encrypt A with B as a key and then with C as a 822 key to produce the 1st part of the output, then encrypt B with C and 823 then A for more output and, if necessary, encrypt C with A and then B 824 for yet more output. Still more output can be produced by reversing 825 the order of the keys given above to stretch things. The same can be 826 done with the hash functions by hashing various subsets of the input 827 data to produce multiple outputs. But keep in mind that it is 828 impossible to get more bits of "randomness" out than are put in. 830 An example of using a strong mixing function would be to reconsider 831 the case of a string of 308 bits each of which is biased 99% towards 832 zero. The parity technique given in Section 5.2.1 above reduced this 833 to one bit with only a 1/1000 deviance from being equally likely a 834 zero or one. But, applying the equation for information given in 835 Section 2, this 308 bit skewed sequence has over 5 bits of 836 information in it. Thus hashing it with SHA1 or MD5 and taking the 837 bottom 5 bits of the result would yield 5 unbiased random bits as 838 opposed to the single bit given by calculating the parity of the 839 string. 841 6.1.3 Diff-Hellman as a Mixing Function 843 Diffie-Hellman exponential key exchange is a technique that yields a 844 shared secret between two parties that can be made computationally 845 infeasible for a third party to determine even if they can observe 846 all the messages between the two communicating parties. This shared 847 secret is a mixture of initial quantities generated by each of them 848 [D-H]. If these initial quantities are random, then the shared 849 secret contains the combined randomness of them both, assuming they 850 are uncorrelated. 852 6.1.4 Using a Mixing Function to Stretch Random Bits 854 While it is not necessary for a mixing function to produce the same 855 or fewer bits than its inputs, mixing bits cannot "stretch" the 856 amount of random unpredictability present in the inputs. Thus four 857 inputs of 32 bits each where there is 12 bits worth of 858 unpredicatability (such as 4,096 equally probable values) in each 859 input cannot produce more than 48 bits worth of unpredictable output. 860 The output can be expanded to hundreds or thousands of bits by, for 861 example, mixing with successive integers, but the clever adversary's 862 search space is still 2^48 possibilities. Furthermore, mixing to 863 fewer bits than are input will tend to strengthen the randomness of 864 the output the way using Exclusive Or to produce one bit from two did 865 above. 867 The last table in Section 6.1.1 shows that mixing a random bit with a 868 constant bit with Exclusive Or will produce a random bit. While this 869 is true, it does not provide a way to "stretch" one random bit into 870 more than one. If, for example, a random bit is mixed with a 0 and 871 then with a 1, this produces a two bit sequence but it will always be 872 either 01 or 10. Since there are only two possible values, there is 873 still only the one bit of original randomness. 875 6.1.5 Other Factors in Choosing a Mixing Function 877 For local use, DES has the advantages that it has been widely tested 878 for flaws, is widely documented, and is widely implemented with 879 hardware and software implementations available all over the world 880 including source code available on the Internet. The SHA1 and MD* 881 family are younger algorithms which have been less tested but there 882 is no particular reason to believe they are flawed. Both MD5 and SHS 883 were derived from the earlier MD4 algorithm. They all have source 884 code available [SHS, MD4, MD5]. 886 DES and SHA1 have been vouched for the the US National Security 887 Agency (NSA) on the basis of criteria that primarily remain secret. 888 While this is the cause of much speculation and doubt, investigation 889 of DES over the years has indicated that NSA involvement in 890 modifications to its design, which originated with IBM, was primarily 891 to strengthen it. No concealed or special weakness has been found in 892 DES. It is almost certain that the NSA modification to MD4 to 893 produce the SHA1 similarly strengthened the algorithm, possibly 894 against threats not yet known in the public cryptographic community. 896 DES, SHA1, MD4, and MD5 are royalty free for all purposes. Continued 897 advances in crypography and computing power have cast some doubts on 898 MD4 and MD5 so their use is not recommended. 900 Another advantage of the MD* or similar hashing algorithms over 901 encryption algorithms is that they are not subject to the same 902 regulations imposed by the US Government prohibiting the unlicensed 903 export or import of encryption/decryption software and hardware. The 904 same should be true of DES rigged to produce an irreversible hash 905 code but most DES packages are oriented to reversible encryption. 907 6.2 Non-Hardware Sources of Randomness 909 The best source of input for mixing would be a hardware randomness 910 such as disk drive timing effected by air turbulence, audio input 911 with thermal noise, or radioactive decay. However, if that is not 912 available there are other possibilities. These include system 913 clocks, system or input/output buffers, user/system/hardware/network 914 serial numbers and/or addresses and timing, and user input. 915 Unfortunately, any of these sources can produce limited or 916 predicatable values under some circumstances. 918 Some of the sources listed above would be quite strong on multi-user 919 systems where, in essence, each user of the system is a source of 920 randomness. However, on a small single user system, it might be 921 possible for an adversary to assemble a similar configuration. This 922 could give the adversary inputs to the mixing process that were 923 sufficiently correlated to those used originally as to make 924 exhaustive search practical. 926 The use of multiple random inputs with a strong mixing function is 927 recommended and can overcome weakness in any particular input. For 928 example, the timing and content of requested "random" user keystrokes 929 can yield hundreds of random bits but conservative assumptions need 930 to be made. For example, assuming a few bits of randomness if the 931 inter-keystroke interval is unique in the sequence up to that point 932 and a similar assumption if the key hit is unique but assuming that 933 no bits of randomness are present in the initial key value or if the 934 timing or key value duplicate previous values. The results of mixing 935 these timings and characters typed could be further combined with 936 clock values and other inputs. 938 This strategy may make practical portable code to produce good random 939 numbers for security even if some of the inputs are very weak on some 940 of the target systems. However, it may still fail against a high 941 grade attack on small single user systems, especially if the 942 adversary has ever been able to observe the generation process in the 943 past. A hardware based random source is still preferable. 945 6.3 Cryptographically Strong Sequences 947 In cases where a series of random quantities must be generated, an 948 adversary may learn some values in the sequence. In general, they 949 should not be able to predict other values from the ones that they 950 know. 952 The correct technique is to start with a strong random seed, take 953 cryptographically strong steps from that seed [CRYPTO2, CRYPTO3], and 954 do not reveal the complete state of the generator in the sequence 955 elements. If each value in the sequence can be calculated in a fixed 956 way from the previous value, then when any value is compromised, all 957 future values can be determined. This would be the case, for 958 example, if each value were a constant function of the previously 959 used values, even if the function were a very strong, non-invertible 960 message digest function. 962 It should be noted that if your technique for generating a sequence 963 of key values is fast enough, it can trivially be used as the basis 964 for a confidentiality system. If two parties use the same sequence 965 generating technique and start with the same seed material, they will 966 generate identical sequences. These could, for example, be xor'ed at 967 one end with data being send, encrypting it, and xor'ed with this 968 data as received, decrypting it due to the reversible properties of 969 the xor operation. 971 6.3.1 Traditional Strong Sequences 973 A traditional way to achieve a strong sequence has been to have the 974 values be produced by hashing the quantities produced by 975 concatenating the seed with successive integers or the like and then 976 mask the values obtained so as to limit the amount of generator state 977 available to the adversary. 979 It may also be possible to use an "encryption" algorithm with a 980 random key and seed value to encrypt and feedback some or all of the 981 output encrypted value into the value to be encrypted for the next 982 iteration. Appropriate feedback techniques will usually be 983 recommended with the encryption algorithm. An example is shown below 984 where shifting and masking are used to combine the cypher output 985 feedback. This type of feedback is recommended by the US Government 986 in connection with DES [DES MODES]. 988 +---------------+ 989 | V | 990 | | n | 991 +--+------------+ 992 | | +---------+ 993 | +---------> | | +-----+ 994 +--+ | Encrypt | <--- | Key | 995 | +-------- | | +-----+ 996 | | +---------+ 997 V V 998 +------------+--+ 999 | V | | 1000 | n+1 | 1001 +---------------+ 1003 Note that if a shift of one is used, this is the same as the shift 1004 register technique described in Section 3 above but with the all 1005 important difference that the feedback is determined by a complex 1006 non-linear function of all bits rather than a simple linear or 1007 polynomial combination of output from a few bit position taps. 1009 It has been shown by Donald W. Davies that this sort of shifted 1010 partial output feedback significantly weakens an algorithm compared 1011 will feeding all of the output bits back as input. In particular, 1012 for DES, repeated encrypting a full 64 bit quantity will give an 1013 expected repeat in about 2^63 iterations. Feeding back anything less 1014 than 64 (and more than 0) bits will give an expected repeat in 1015 between 2**31 and 2**32 iterations! 1017 To predict values of a sequence from others when the sequence was 1018 generated by these techniques is equivalent to breaking the 1019 cryptosystem or inverting the "non-invertible" hashing involved with 1020 only partial information available. The less information revealed 1021 each iteration, the harder it will be for an adversary to predict the 1022 sequence. Thus it is best to use only one bit from each value. It 1023 has been shown that in some cases this makes it impossible to break a 1024 system even when the cryptographic system is invertible and can be 1025 broken if all of each generated value was revealed. 1027 6.3.2 The Blum Blum Shub Sequence Generator 1029 Currently the generator which has the strongest public proof of 1030 strength is called the Blum Blum Shub generator after its inventors 1031 [BBS]. It is also very simple and is based on quadratic residues. 1032 It's only disadvantage is that is is computationally intensive 1033 compared with the traditional techniques give in 6.3.1 above. This 1034 is not a serious draw back if it is used for moderately infrequent 1035 purposes, such as generating session keys. 1037 Simply choose two large prime numbers, say p and q, which both have 1038 the property that you get a remainder of 3 if you divide them by 4. 1039 Let n = p * q. Then you choose a random number x relatively prime to 1040 n. The initial seed for the generator and the method for calculating 1041 subsequent values are then 1043 2 1044 s = ( x )(Mod n) 1045 0 1047 2 1048 s = ( s )(Mod n) 1049 i+1 i 1051 You must be careful to use only a few bits from the bottom of each s. 1052 It is always safe to use only the lowest order bit. If you use no 1053 more than the 1054 log ( log ( s ) ) 1055 2 2 i 1056 low order bits, then predicting any additional bits from a sequence 1057 generated in this manner is provable as hard as factoring n. As long 1058 as the initial x is secret, you can even make n public if you want. 1060 An intersting characteristic of this generator is that you can 1061 directly calculate any of the s values. In particular 1063 i 1064 ( ( 2 )(Mod (( p - 1 ) * ( q - 1 )) ) ) 1065 s = ( s )(Mod n) 1066 i 0 1068 This means that in applications where many keys are generated in this 1069 fashion, it is not necessary to save them all. Each key can be 1070 effectively indexed and recovered from that small index and the 1071 initial s and n. 1073 7. Key Generation Standards and Examples 1075 Several public standards and widely deplyed examples are now in place 1076 for the generation of keys without special hardware. Two standards 1077 are described below. Both use DES but any equally strong or stronger 1078 mixing function could be substituted. Then a few widely deployed 1079 examples are described. 1081 7.1 US DoD Recommendations for Password Generation 1083 The United States Department of Defense has specific recommendations 1084 for password generation [DoD]. They suggest using the US Data 1085 Encryption Standard [DES] in Output Feedback Mode [DES MODES] as 1086 follows: 1088 use an initialization vector determined from 1089 the system clock, 1090 system ID, 1091 user ID, and 1092 date and time; 1093 use a key determined from 1094 system interrupt registers, 1095 system status registers, and 1096 system counters; and, 1097 as plain text, use an external randomly generated 64 bit 1098 quantity such as 8 characters typed in by a system 1099 administrator. 1101 The password can then be calculated from the 64 bit "cipher text" 1102 generated in 64-bit Output Feedback Mode. As many bits as are needed 1103 can be taken from these 64 bits and expanded into a pronounceable 1104 word, phrase, or other format if a human being needs to remember the 1105 password. 1107 7.2 X9.17 Key Generation 1109 The American National Standards Institute has specified a method for 1110 generating a sequence of keys as follows: 1112 s is the initial 64 bit seed 1113 0 1115 g is the sequence of generated 64 bit key quantities 1116 n 1118 k is a random key reserved for generating this key sequence 1119 t is the time at which a key is generated to as fine a resolution 1120 as is available (up to 64 bits). 1122 DES ( K, Q ) is the DES encryption of quantity Q with key K 1124 g = DES ( k, DES ( k, t ) .xor. s ) 1125 n n 1127 s = DES ( k, DES ( k, t ) .xor. g ) 1128 n+1 n 1130 If g sub n is to be used as a DES key, then every eighth bit should 1131 be adjusted for parity for that use but the entire 64 bit unmodified 1132 g should be used in calculating the next s. 1134 7.3 The /dev/random Device under Linux 1136 The Linux operating system provides a Kernel resident random number 1137 generator. This generator makes use of events captured by the Kernel 1138 during normal system operation. 1140 The generator consists of a random pool of bytes, by default 512 1141 bytes (represented as 128, 4 byte integers). When an event occurs, 1142 such as a disk drive interrupt, the time of the event is xored into 1143 the pool and the pool is stirred via a primitive polynomial of degree 1144 128. The pool itself is treated as a ring buffer, with new data 1145 being xored (after stirring with the polynomial) across the entire 1146 pool. 1148 Each call that adds entropy to the pool estimates the amount of 1149 likely true entropy the input contains. The pool itself contains a 1150 accumulator that estimates the total over all entropy of the pool. 1152 Input events come from several sources: 1154 1. Keyboard interrupts. The time of the interrupt as well as the scan 1155 code are added to the pool. This in effect adds entropy from the 1156 human operator by measuring inter-keystroke arrival times. 1158 2. Disk completion and other interrupts. A system being used by a 1159 person will likely have a hard to predict pattern of disk 1160 accesses. 1162 3. Mouse motion. The timing as well as mouse position is added in. 1164 When random bytes are required, the pool is hashed with SHA-1 [SHA1] 1165 to yield the returned bytes of randomness. If more bytes are required 1166 than the output of SHA-1 (20 bytes), then the hashed output is 1167 stirred back into the pool and a new hash performed to obtain the 1168 next 20 bytes. As bytes are removed from the pool, the estimate of 1169 entropy is similarly decremented. 1171 To ensure a reasonable random pool upon system startup, the standard 1172 Linux startup scripts (and shutdown scripts) save the pool to a disk 1173 file at shutdown and read this file at system startup. 1175 There are two user exported interfaces. /dev/random returns bytes 1176 from the pool, but blocks when the estimated entropy drops to zero. 1177 As entropy is added to the pool from events, more data becomes 1178 available via /dev/random. Random data obtained /dev/random is 1179 suitable for key generation for long term keys. 1181 /dev/urandom works like /dev/random, however it provides data even 1182 when the entropy estimate for the random pool drops to zero. This 1183 should be fine for session keys. The risk of continuing to take data 1184 even when the pools entropy estimate is small is that past output may 1185 be computable from current output provided an attacker can reverse 1186 SHA-1. Given that SHA-1 should not be invertible, this is a 1187 reasonable risk. 1189 To obtain random numbers under Linux, all an application needs to do 1190 is open either /dev/random or /dev/urandom and read the desired 1191 number of bytes. 1193 The Linux Random device was written by Theodore Ts'o. It is based 1194 loosely on the random number generator in PGP 2.X and PGP 3.0 (aka 1195 PGP 5.0). 1197 7.4 additional example 1199 (tba) 1201 8. Examples of Randomness Required 1203 Below are two examples showing rough calculations of needed 1204 randomness for security. The first is for moderate security 1205 passwords while the second assumes a need for a very high security 1206 cryptographic key. 1208 8.1 Password Generation 1210 Assume that user passwords change once a year and it is desired that 1211 the probability that an adversary could guess the password for a 1212 particular account be less than one in a thousand. Further assume 1213 that sending a password to the system is the only way to try a 1214 password. Then the crucial question is how often an adversary can 1215 try possibilities. Assume that delays have been introduced into a 1216 system so that, at most, an adversary can make one password try every 1217 six seconds. That's 600 per hour or about 15,000 per day or about 1218 5,000,000 tries in a year. Assuming any sort of monitoring, it is 1219 unlikely someone could actually try continuously for a year. In 1220 fact, even if log files are only checked monthly, 500,000 tries is 1221 more plausible before the attack is noticed and steps taken to change 1222 passwords and make it harder to try more passwords. 1224 To have a one in a thousand chance of guessing the password in 1225 500,000 tries implies a universe of at least 500,000,000 passwords or 1226 about 2^29. Thus 29 bits of randomness are needed. This can probably 1227 be achieved using the US DoD recommended inputs for password 1228 generation as it has 8 inputs which probably average over 5 bits of 1229 randomness each (see section 7.1). Using a list of 1000 words, the 1230 password could be expressed as a three word phrase (1,000,000,000 1231 possibilities) or, using case insensitive letters and digits, six 1232 would suffice ((26+10)^6 = 2,176,782,336 possibilities). 1234 For a higher security password, the number of bits required goes up. 1235 To decrease the probability by 1,000 requires increasing the universe 1236 of passwords by the same factor which adds about 10 bits. Thus to 1237 have only a one in a million chance of a password being guessed under 1238 the above scenario would require 39 bits of randomness and a password 1239 that was a four word phrase from a 1000 word list or eight 1240 letters/digits. To go to a one in 10^9 chance, 49 bits of randomness 1241 are needed implying a five word phrase or ten letter/digit password. 1243 In a real system, of course, there are also other factors. For 1244 example, the larger and harder to remember passwords are, the more 1245 likely users are to write them down resulting in an additional risk 1246 of compromise. 1248 8.2 A Very High Security Cryptographic Key 1250 Assume that a very high security key is needed for symmetric 1251 encryption / decryption between two parties. Assume an adversary can 1252 observe communications and knows the algorithm being used. Within 1253 the field of random possibilities, the adversary can try key values 1254 in hopes of finding the one in use. Assume further that brute force 1255 trial of keys is the best the adversary can do. 1257 8.2.1 Effort per Key Trial 1259 How much effort will it take to try each key? For very high security 1260 applications it is best to assume a low value of effort. This 1261 questions is considered in detail in Appendix A. It concludes that a 1262 reasonable key length in 1995 for very high security is in the range 1263 of 75 to 90 bits and, since the cost of cryptography does not very 1264 much with they key size, recommends 90 bits. To update these 1265 recommendations, just add 2/3 of a bit per year for Moore's law 1266 [MOORE]. Thus, in the year 2001, this translates to a determination 1267 that a reasonable key length is in 78 to 93 bit range. 1269 8.2.2 Meet in the Middle Attacks 1271 If chosen or known plain text and the resulting encrypted text are 1272 available, a "meet in the middle" attack is possible if the structure 1273 of the encryption algorithm allows it. (In a known plain text 1274 attack, the adversary knows all or part of the messages being 1275 encrypted, possibly some standard header or trailer fields. In a 1276 chosen plain text attack, the adversary can force some chosen plain 1277 text to be encrypted, possibly by "leaking" an exciting text that 1278 would then be sent by the adversary over an encrypted channel.) 1280 An oversimplified explanation of the meet in the middle attack is as 1281 follows: the adversary can half-encrypt the known or chosen plain 1282 text with all possible first half-keys, sort the output, then half- 1283 decrypt the encoded text with all the second half-keys. If a match 1284 is found, the full key can be assembled from the halves and used to 1285 decrypt other parts of the message or other messages. At its best, 1286 this type of attack can halve the exponent of the work required by 1287 the adversary while adding a large but roughly constant factor of 1288 effort. To be assured of safety against this, a doubling of the 1289 amount of randomness in a very strong key to a minimum of 176 bits is 1290 required for the year 2001 based on the Appendix A analysis. 1292 This amount of randomness is beyond the limit of that in the inputs 1293 recommended by the US DoD for password generation and could require 1294 user typing timing, hardware random number generation, or other 1295 sources. 1297 The meet in the middle attack assumes that the cryptographic 1298 algorithm can be decomposed in this way but we can not rule that out 1299 without a thorough knowledge of the algorithm. Even if a basic 1300 algorithm is not subject to a meet in the middle attack, an attempt 1301 to produce a stronger algorithm by applying the basic algorithm twice 1302 (or two different algorithms sequentially) with different keys may 1303 gain less added security than would be expected. Such a composite 1304 algorithm would be subject to a meet in the middle attack. 1306 Enormous resources may be required to mount a meet in the middle 1307 attack but they are probably within the range of the national 1308 security services of a major nation. Essentially all nations spy on 1309 other nations government traffic and several nations are believed to 1310 spy on commercial traffic for economic advantage. 1312 It should be noted that key length calculations such at those above 1313 are controversial and depend on various assumptions about the 1314 cryptographic algorithms in use. In some cases, a professional with 1315 a deep knowledge of code breaking techniques and of the strength of 1316 the algorithm in use could be satisfied with less than half of the 1317 176 bit key size derived above. 1319 9. Conclusion 1321 Generation of unguessable "random" secret quantities for security use 1322 is an essential but difficult task. 1324 We have shown that hardware techniques to produce such randomness 1325 would be relatively simple. In particular, the volume and quality 1326 would not need to be high and existing computer hardware, such as 1327 disk drives, can be used. 1329 Computational techniques are available to process low quality random 1330 quantities from multiple sources or a larger quantity of such low 1331 quality input from one source and produce a smaller quantity of 1332 higher quality, less predictable key material. In the absence of 1333 hardware sources of randomness, a variety of user and software 1334 sources can frequently be used instead with care; however, most 1335 modern systems already have hardware, such as disk drives or audio 1336 input, that could be used to produce high quality randomness. 1338 Once a sufficient quantity of high quality seed key material (a few 1339 hundred bits) is available, strong computational techniques are 1340 available to produce cryptographically strong sequences of 1341 unpredicatable quantities from this seed material. 1343 10. Security Considerations 1345 The entirety of this document concerns techniques and recommendations 1346 for generating unguessable "random" quantities for use as passwords, 1347 cryptographic keys, initialiazation vectors, sequence numbers, and 1348 similar security uses. 1350 Appendix: Minimal Secure Key Lengths Study 1352 Minimal Key Lengths for Symmetric Ciphers 1353 to Provide Adequate Commercial Security 1355 A Report by an Ad Hoc Group of 1356 Cryptographers and Computer Scientists 1358 Matt Blaze, AT&T Research, mab@research.att.com 1359 Whitfield Diffie, Sun Microsystems, diffie@eng.sun.com 1360 Ronald L. Rivest, MIT LCS, rivest@lcs.mit.edu 1361 Bruce Schneier, Counterpane Systems, schneier@counterpane.com 1362 Tsutomu Shimomura, San Diego Supercomputer Center, tsutomu@sdsc.edu 1363 Eric Thompson Access Data, Inc., eric@accessdata.com 1364 Michael Wiener, Bell Northern Research, wiener@bnr.ca 1366 January 1996 1368 A.0 Abstract 1370 Encryption plays an essential role in protecting the privacy of 1371 electronic information against threats from a variety of potential 1372 attackers. In so doing, modern cryptography employs a combination of 1373 _conventional_ or _symmetric_ cryptographic systems for encrypting 1374 data and _public key_ or _asymmetric_ systems for managing the _keys_ 1375 used by the symmetric systems. Assessing the strength required of 1376 the symmetric cryptographic systems is therefore an essential step in 1377 employing cryptography for computer and communication security. 1379 Technology readily available today (late 1995) makes _brute- 1380 force_ attacks against cryptographic systems considered adequate for 1381 the past several years both fast and cheap. General purpose 1382 computers can be used, but a much more efficient approach is to 1383 employ commercially available _Field Programmable Gate Array (FPGA)_ 1384 technology. For attackers prepared to make a higher initial 1385 investment, custom-made, special-purpose chips make such calculations 1386 much faster and significantly lower the amortized cost per solution. 1388 As a result, cryptosystems with 40-bit keys offer virtually no 1389 protection at this point against brute-force attacks. Even the U.S. 1390 Data Encryption Standard with 56-bit keys is increasingly inadequate. 1391 As cryptosystems often succumb to `smarter' attacks than brute-force 1392 key search, it is also important to remember that the keylengths 1393 discussed here are the minimum needed for security against the 1394 computational threats considered. 1396 Fortunately, the cost of very strong encryption is not 1398 significantly greater than that of weak encryption. Therefore, to 1399 provide adequate protection against the most serious threats --- 1400 well-funded commercial enterprises or government intelligence 1401 agencies --- keys used to protect data today should be at least 75 1402 bits long. To protect information adequately for the next 20 years 1403 in the face of expected advances in computing power, keys in newly- 1404 deployed systems should be at least 90 bits long. 1406 A.1. Encryption Plays an Essential Role in Protecting 1407 the Privacy of Electronic Information 1409 A.1.1 There is a need for information security 1411 As we write this paper in late 1995, the development of 1412 electronic commerce and the Global Information Infrastructure is at a 1413 critical juncture. The dirt paths of the middle ages only became 1414 highways of business and culture after the security of travelers and 1415 the merchandise they carried could be assured. So too the 1416 information superhighway will be an ill-traveled road unless 1417 information, the goods of the Information Age, can be moved, stored, 1418 bought, and sold securely. Neither corporations nor individuals will 1419 entrust their private business or personal data to computer networks 1420 unless they can assure their information's security. 1422 Today, most forms of information can be stored and processed 1423 electronically. This means a wide variety of information, with 1424 varying economic values and privacy aspects and with a wide variation 1425 in the time over which the information needs to be protected, will be 1426 found on computer networks. Consider the spectrum: 1428 o Electronic Funds Transfers of millions or even billions of 1429 dollars, whose short term security is essential but whose 1430 exposure is brief; 1432 o A company's strategic corporate plans, whose confidentiality 1433 must be preserved for a small number of years; 1435 o A proprietary product (Coke formula, new drug design) that 1436 needs to be protected over its useful life, often decades; 1437 and 1439 o Information private to an individual (medical condition, 1440 employment evaluation) that may need protection for the 1441 lifetime of the individual. 1443 A.1.2 Encryption to protect confidentiality 1445 Encryption Can Provide Strong Confidentiality Protection 1447 Encryption is accomplished by scrambling data using mathematical 1448 procedures that make it extremely difficult and time consuming for 1449 anyone other than authorized recipients --- those with the correct 1450 decryption _keys_ --- to recover the _plain text_. Proper encryption 1451 guarantees that the information will be safe even if it falls into 1452 hostile hands. 1454 Encryption --- and decryption --- can be performed by either 1455 computer software or hardware. Common approaches include writing the 1456 algorithm on a disk for execution by a computer central processor; 1457 placing it in ROM or PROM for execution by a microprocessor; and 1458 isolating storage and execution in a computer accessory device (smart 1459 card or PCMCIA card). 1461 The degree of protection obtained depends on several factors. 1462 These include: the quality of the cryptosystem; the way it is 1463 implemented in software or hardware (especially its reliability and 1464 the manner in which the keys are chosen); and the total number of 1465 possible keys that can be used to encrypt the information. A 1466 cryptographic algorithm is considered strong if: 1468 1. There is no shortcut that allows the opponent to recover the 1469 plain text without using brute force to test keys until the 1470 correct one is found; and 1472 2. The number of possible keys is sufficiently large to make 1473 such an attack infeasible. 1475 The principle here is similar to that of a combination lock on a 1476 safe. If the lock is well designed so that a burglar cannot hear or 1477 feel its inner workings, a person who does not know the combination 1478 can open it only by dialing one set of numbers after another until it 1479 yields. 1481 The sizes of encryption keys are measured in bits and the 1482 difficulty of trying all possible keys grows exponentially with the 1483 number of bits used. Adding one bit to the key doubles the number of 1484 possible keys; adding ten increases it by a factor of more than a 1485 thousand. 1487 There is no definitive way to look at a cipher and determine 1488 whether a shortcut exists. Nonetheless, several encryption 1489 algorithms --- most notably the U.S Data Encryption Standard (DES) 1490 --- have been extensively studied in the public literature and are 1491 widely believed to be of very high quality. An essential element in 1492 cryptographic algorithm design is thus the length of the key, whose 1493 size places an upper bound on the system's strength. 1495 Throughout this paper, we will assume that there are no shortcuts 1496 and treat the length of the key as representative of the 1497 cryptosystem's _workfactor_ --- the minimum amount of effort required 1498 to break the system. It is important to bear in mind, however, that 1499 cryptographers regard this as a rash assumption and many would 1500 recommend keys two or more times as long as needed to resist brute- 1501 force attacks. Prudent cryptographic designs not only employ longer 1502 keys than might appear to be needed, but devote more computation to 1503 encrypting and decrypting. A good example of this is the popular 1504 approach of using _triple-DES_: encrypting the output of DES twice 1505 more, using a total of three distinct keys. 1507 Encryption systems fall into two broad classes. Conventional or 1508 symmetric cryptosystems --- those in which an entity with the ability 1509 to encrypt also has the ability to decrypt and vice versa --- are the 1510 systems under consideration in this paper. The more recent public 1511 key or asymmetric cryptosystems have the property that the ability to 1512 encrypt does not imply the ability to decrypt. In contemporary 1513 cryptography, public-key systems are indispensable for managing the 1514 keys of conventional cryptosystems. All known public key 1515 cryptosystems, however, are subject to shortcut attacks and must 1516 therefore use keys ten or more times the lengths of those discussed 1517 here to achieve the an equivalent level of security. 1519 Although computers permit electronic information to be encrypted 1520 using very large keys, advances in computing power keep pushing up 1521 the size of keys that can be considered large and thus keep making it 1522 easier for individuals and organizations to attack encrypted 1523 information without the expenditure of unreasonable resources. 1525 A.1.3 There are a variety of attackers 1527 There Are Threats from a Variety of Potential Attackers. 1529 Threats to confidentiality of information come from a number of 1530 directions and their forms depend on the resources of the attackers. 1531 `Hackers,' who might be anything from high school students to 1532 commercial programmers, may have access to mainframe computers or 1533 networks of workstations. The same people can readily buy 1534 inexpensive, off-the-shelf, boards, containing _Field Programmable 1535 Gate Array (FPGA)_ chips that function as `programmable hardware' and 1536 vastly increase the effectiveness of a cryptanalytic effort. A 1537 startup company or even a well-heeled individual could afford large 1538 numbers of these chips. A major corporation or organized crime 1539 operation with `serious money' to spend could acquire custom computer 1540 chips specially designed for decryption. An intelligence agency, 1541 engaged in espionage for national economic advantage, could build a 1542 machine employing millions of such chips. 1544 A.1.4 Strong encryption is not expensive 1546 Current Technology Permits Very Strong Encryption for Effectively the 1547 Same Cost As Weaker Encryption. 1549 It is a property of computer encryption that modest increases in 1550 computational cost can produce vast increases in security. 1551 Encrypting information very securely (e.g., with 128-bit keys) 1552 typically requires little more computing than encrypting it weakly 1553 (e.g., with 40-bit keys). In many applications, the cryptography 1554 itself accounts for only a small fraction of the computing costs, 1555 compared to such processes as voice or image compression required to 1556 prepare material for encryption. 1558 One consequence of this uniformity of costs is that there is 1559 rarely any need to tailor the strength of cryptography to the 1560 sensitivity of the information being protected. Even if most of the 1561 information in a system has neither privacy implications nor monetary 1562 value, there is no practical or economic reason to design computer 1563 hardware or software to provide differing levels of encryption for 1564 different messages. It is simplest, most prudent, and thus 1565 fundamentally most economical, to employ a uniformly high level of 1566 encryption: the strongest encryption required for any information 1567 that might be stored or transmitted by a secure system. 1569 A.2. Brute-Forece is becoming easier 1571 Readily Available Technology Makes Brute-Force Decryption Attacks 1572 Faster and Cheaper. 1574 The kind of hardware used to mount a brute-force attack against 1575 an encryption algorithm depends on the scale of the cryptanalytic 1576 operation and the total funds available to the attacking enterprise. 1577 In the analysis that follows, we consider three general classes of 1578 technology that are likely to be employed by attackers with differing 1579 resources available to them. Not surprisingly, the cryptanalytic 1580 technologies that require larger up-front investments yield the 1581 lowest cost per recovered key, amortized over the life of the 1582 hardware. 1584 It is the nature of brute-force attacks that they can be 1585 parallelized indefinitely. It is possible to use as many machines as 1586 are available, assigning each to work on a separate part of the 1587 problem. Thus regardless of the technology employed, the search time 1588 can be reduced by adding more equipment; twice as much hardware can 1589 be expected to find the right key in half the time. The total 1590 investment will have doubled, but if the hardware is kept constantly 1591 busy finding keys, the cost per key recovered is unchanged. 1593 At the low end of the technology spectrum is the use of 1594 conventional personal computers or workstations programmed to test 1595 keys. Many people, by virtue of already owning or having access to 1596 the machines, are in a position use such resources at little or no 1597 cost. However, general purpose computers --- laden with such 1598 ancillary equipment as video controllers, keyboards, interfaces, 1599 memory, and disk storage --- make expensive search engines. They are 1600 therefore likely to be employed only by casual attackers who are 1601 unable or unwilling to invest in more specialized equipment. 1603 A more efficient technological approach is to take advantage of 1604 commercially available Field Programmable Gate Arrays. FPGAs 1605 function as programmable hardware and allow faster implementations of 1606 such tasks as encryption and decryption than conventional processors. 1607 FPGAs are a commonly used tool for simple computations that need to 1608 be done very quickly, particularly simulating integrated circuits 1609 during development. 1611 FPGA technology is fast and cheap. The cost of an AT&T ORCA chip 1612 that can test 30 million DES keys per second is $200. This is 1,000 1613 times faster than a PC at about one-tenth the cost! FPGAs are widely 1614 available and, mounted on cards, can be installed in standard PCs 1615 just like sound cards, modems, or extra memory. 1617 FPGA technology may be optimal when the same tool must be used 1618 for attacking a variety of different cryptosystems. Often, as with 1619 DES, a cryptosystem is sufficiently widely used to justify the 1620 construction of more specialized facilities. In these circumstances, 1621 the most cost-effective technology, but the one requiring the largest 1622 initial investment, is the use of _Application-Specific Integrated 1623 Circuits (ASICs)_. A $10 chip can test 200 million keys per second. 1624 This is seven times faster than an FPGA chip at one-twentieth the 1625 cost. 1627 Because ASICs require a far greater engineering investment than 1628 FPGAs and must be fabricated in quantity before they are economical, 1629 this approach is only available to serious, well-funded operations 1630 such as dedicated commercial (or criminal) enterprises and government 1631 intelligence agencies. 1633 A.3. 40-Bit Key Lengths Offer Virtually No Protection 1635 Current U.S. Government policy generally limits exportable mass 1636 market software that incorporates encryption for confidentiality to 1637 using the RC2 or RC4 algorithms with 40-bit keys. A 40-bit key 1638 length means that there are 2^40 possible keys. On average, half of 1639 these (2^39) must be tried to find the correct one. Export of other 1640 algorithms and key lengths must be approved on a case by case basis. 1641 For example, DES with a 56-bit key has been approved for certain 1642 applications such as financial transactions. 1644 The recent successful brute-force attack by two French graduate 1645 students on Netscape's 40-bit RC4 algorithm demonstrates the dangers 1646 of such short keys. These students at the Ecole Polytechnique in 1647 Paris used `idle time' on the school's computers, incurring no cost 1648 to themselves or their school. Even with these limited resources, 1649 they were able to recover the 40-bit key in a few days. 1651 There is no need to have the resources of an institution of 1652 higher education at hand, however. Anyone with a modicum of computer 1653 expertise and a few hundred dollars would be able to attack 40-bit 1654 encryption much faster. An FPGA chip --- costing approximately $400 1655 mounted on a card --- would on average recover a 40-bit key in five 1656 hours. Assuming the FPGA lasts three years and is used continuously 1657 to find keys, the average cost per key is eight cents. 1659 A more determined commercial predator, prepared to spend $10,000 1660 for a set-up with 25 ORCA chips, can find 40-bit keys in an average 1661 of 12 minutes, at the same average eight cent cost. Spending more 1662 money to buy more chips reduces the time accordingly: $300,000 1663 results in a solution in an average of 24 seconds; $10,000,000 1664 results in an average solution in 0.7 seconds. 1666 As already noted, a corporation with substantial resources can 1667 design and commission custom chips that are much faster. By doing 1668 this, a company spending $300,000 could find the right 40-bit key in 1669 an average of 0.18 seconds at 1/10th of a cent per solution; a larger 1670 company or government agency willing to spend $10,000,000 could find 1671 the right key on average in 0.005 seconds (again at 1/10th of a cent 1672 per solution). (Note that the cost per solution remains constant 1673 because we have conservatively assumed constant costs for chip 1674 acquisition --- in fact increasing the quantities purchased of a 1675 custom chip reduces the average chip cost as the initial design and 1676 set-up costs are spread over a greater number of chips.) 1678 These results are summarized in Table I (below). 1680 A.4. Even DES with 56-Bit Keys Is Increasingly Inadequate 1682 A.4.1 DES is no panacea today 1684 The Data Encryption Standard (DES) was developed in the 1970s by 1685 IBM and NSA and adopted by the U.S. Government as a Federal 1686 Information Processing Standard for data encryption. It was intended 1687 to provide strong encryption for the government's sensitive but 1688 unclassified information. It was recognized by many, even at the 1689 time DES was adopted, that technological developments would make 1690 DES's 56-bit key exceedingly vulnerable to attack before the end of 1691 the century. 1693 Today, DES may be the most widely employed encryption algorithm 1694 and continues to be a commonly cited benchmark. Yet DES-like 1695 encryption strength is no panacea. Calculations show that DES is 1696 inadequate against a corporate or government attacker committing 1697 serious resources. The bottom line is that DES is cheaper and easier 1698 to break than many believe. 1700 As explained above, 40-bit encryption provides inadequate 1701 protection against even the most casual of intruders, content to 1702 scavenge time on idle machines or to spend a few hundred dollars. 1703 Against such opponents, using DES with a 56-bit key will provide a 1704 substantial measure of security. At present, it would take a year 1705 and a half for someone using $10,000 worth of FPGA technology to 1706 search out a DES key. In ten years time an investment of this size 1707 would allow one to find a DES key in less than a week. 1709 The real threat to commercial transactions and to privacy on the 1710 Internet is from individuals and organizations willing to invest 1711 substantial time and money. As more and more business and personal 1712 information becomes electronic, the potential rewards to a dedicated 1713 commercial predator also increase significantly and may justify the 1714 commitment of adequate resources. 1716 A serious effort --- on the order of $300,000 --- by a legitimate 1717 or illegitimate business could find a DES key in an average of 19 1718 days using off-the-shelf technology and in only 3 hours using a 1719 custom developed chip. In the latter case, it would cost $38 to find 1720 each key (again assuming a 3 year life to the chip and continual 1721 use). A business or government willing to spend $10,000,000 on 1722 custom chips, could recover DES keys in an average of 6 minutes, for 1723 the same $38 per key. 1725 At the very high end, an organization --- presumably a government 1726 intelligence agency --- willing to spend $300,000,000 could recover 1727 DES keys in 12 seconds each! The investment required is large but 1728 not unheard of in the intelligence community. It is less than the 1729 cost of the Glomar Explorer, built to salvage a single Russian 1730 submarine, and far less than the cost of many spy satellites. Such 1731 an expense might be hard to justify in attacking a single target, but 1732 seems entirely appropriate against a cryptographic algorithm, like 1733 DES, enjoying extensive popularity around the world. 1735 There is ample evidence of the danger presented by government 1736 intelligence agencies seeking to obtain information not only for 1737 military purposes but for commercial advantage. Congressional 1738 hearings in 1993 highlighted instances in which the French and 1739 Japanese governments spied on behalf of their countries' own 1740 businesses. Thus, having to protect commercial information against 1741 such threats is not a hypothetical proposition. 1743 A.4.2 There are smarter avenues of attack than brute force 1745 It is easier to walk around a tree than climb up and down it. 1746 There is no need to break the window of a house to get in if the 1747 front door is unlocked. 1749 Calculations regarding the strength of encryption against brute- 1750 force attack are _worst case_ scenarios. They assume that the 1751 ciphers are in a sense perfect and that attempts to find shortcuts 1752 have failed. One important point is that the crudest approach --- 1753 searching through the keys --- is entirely feasible against many 1754 widely used systems. Another is that the keylengths we discuss are 1755 always minimal. As discussed earlier, prudent designs might use keys 1756 twice or three times as long to provide a margin of safety. 1758 A.4.3 Other algorithms are similar 1760 The Analysis for Other Algorithms Is Roughly Comparable. 1762 The above analysis has focused on the time and money required to 1763 find a key to decrypt information using the RC4 algorithm with a 40- 1764 bit key or the DES algorithm with its 56-bit key, but the results are 1765 not peculiar to these ciphers. Although each algorithm has its own 1766 particular characteristics, the effort required to find the keys of 1767 other ciphers is comparable. There may be some differences as the 1768 result of implementation procedures, but these do not materially 1769 affect the brute-force breakability of algorithms with roughly 1770 comparable key lengths. 1772 Specifically, it has been suggested at times that differences in 1773 set-up procedures, such as the long key-setup process in RC4, result 1774 in some algorithms having effectively longer keys than others. For 1775 the purpose of our analysis, such factors appear to vary the 1776 effective key length by no more than about eight bits. 1778 A.5. Appropriate Key Lengths for the Future --- A Proposal 1780 Table I summarizes the costs of carrying out brute-force attacks 1781 against symmetric cryptosystems with 40-bit and 56-bit keys using 1782 networks of general purpose computers, Field Programmable Gate 1783 Arrays, and special-purpose chips. 1785 It shows that 56 bits provides a level of protection --- about a 1786 year and a half --- that would be adequate for many commercial 1787 purposes against an opponent prepared to invest $10,000. Against an 1788 opponent prepared to invest $300,000, the period of protection has 1789 dropped to the barest minimum of 19 days. Above this, the protection 1790 quickly declines to negligible. A very large, but easily imaginable, 1791 investment by an intelligence agency would clearly allow it to 1792 recover keys in real time. 1794 What workfactor would be required for security today? For an 1795 opponent whose budget lay in the $10 to 300 million range, the time 1796 required to search out keys in a 75-bit keyspace would be between 6 1797 years and 70 days. Although the latter figure may seem comparable to 1798 the `barest minimum' 19 days mentioned earlier, it represents --- 1799 under our amortization assumptions --- a cost of $19 million and a 1800 recovery rate of only five keys a year. The victims of such an 1801 attack would have to be fat targets indeed. 1803 Because many kinds of information must be kept confidential for 1804 long periods of time, assessment cannot be limited to the protection 1805 required today. Equally important, cryptosystems --- especially if 1806 they are standards --- often remain in use for years or even decades. 1807 DES, for example, has been in use for more than 20 years and will 1808 probably continue to be employed for several more. In particular, 1809 the lifetime of a cryptosystem is likely to exceed the lifetime of 1810 any individual product embodying it. 1812 A rough estimate of the minimum strength required as a function 1813 of time can be obtained by applying an empirical rule, popularly 1814 called `Moore's Law,' which holds that the computing power available 1815 for a given cost doubles every 18 months. Taking into account both 1816 the lifetime of cryptographic equipment and the lifetime of the 1817 secrets it protects, we believe it is prudent to require that 1818 encrypted data should still be secure in 20 years. Moore's Law thus 1819 predicts that the keys should be approximately 14 bits longer than 1820 required to protect against an attack today. 1822 *Bearing in mind that the additional computational costs of 1823 stronger encryption are modest, we strongly recommend a minimum key- 1824 length of 90 bits for symmetric cryptosystems.* 1826 It is instructive to compare this recommendation with both 1827 Federal Information Processing Standard 46, The Data Encryption 1828 Standard (DES), and Federal Information Processing Standard 185, The 1829 Escrowed Encryption Standard (EES). DES was proposed 21 years ago 1830 and used a 56-bit key. Applying Moore's Law and adding 14 bits, we 1831 see that the strength of DES when it was proposed in 1975 was 1832 comparable to that of a 70-bit system today. Furthermore, it was 1833 estimated at the time that DES was not strong enough and that keys 1834 could be recovered at a rate of one per day for an investment of 1835 about twenty-million dollars. Our 75-bit estimate today corresponds 1836 to 61 bits in 1975, enough to have moved the cost of key recovery 1837 just out of reach. The Escrowed Encryption Standard, while 1838 unacceptable to many potential users for other reasons, embodies a 1839 notion of appropriate key length that is similar to our own. It uses 1840 80-bit keys, a number that lies between our figures of 75 and 90 1841 bits. 1843 Table I 1845 Time and cost Length Needed 1846 Type of Budget Tool per key recovered for protection 1847 Attacker 40bits 56bits in Late 1995 1849 Pedestrian Hacker 1851 tiny scavenged 1 week infeasible 45 1852 computer 1853 time 1855 $400 FPGA 5 hours 38 years 50 1856 ($0.08) ($5,000) 1858 Small Business 1860 $10,000 FPGA 12 minutes 556 days 55 1861 ($0.08) ($5,000) 1863 Corporate Department 1865 $300K FPGA 24 seconds 19 days 60 1866 or ($0.08) ($5,000) 1867 ASIC .18 seconds 3 hours 1868 ($0.001) ($38) 1870 Big Company 1871 $10M FPGA .7 seconds 13 hours 70 1872 or ($0.08) ($5,000) 1873 ASIC .005 seconds 6 minutes 1874 ($0.001) ($38) 1876 Intellegence Agency 1878 $300M ASIC .0002 seconds 12 seconds 75 1879 ($0.001) ($38) 1881 A.6 About the Authors 1883 *Matt Blaze* is a senior research scientist at AT&T Research in the 1884 area of computer security and cryptography. Recently Blaze 1885 demonstrated weaknesses in the U.S. government's `Clipper Chip' key 1886 escrow encryption system. His current interests include large-scale 1887 trust management and the applications of smartcards. 1889 *Whitfield Diffie* is a distinguished Engineer at Sun Microsystems 1890 specializing in security. In 1976 Diffie and Martin Hellman created 1891 public key cryptography, which solved the problem of sending coded 1892 information between individuals with no prior relationship and is the 1893 basis for widespread encryption in the digital information age. 1895 *Ronald L. Rivest* is a professor of computer science at the 1896 Massachusetts Institute of Technology, and is Associate Director of 1897 MIT's Laboratory for Computer Science. Rivest, together with Leonard 1898 Adleman and Adi Shamir, invented the RSA public-key cryptosystem that 1899 is used widely throughout industry. Ron Rivest is one of the 1900 founders of RSA Data Security Inc. and is the creator of variable key 1901 length symmetric key ciphers (e.g., RC4). 1903 *Bruce Schneier* is president of Counterpane Systems, a consulting 1904 firm specializing in cryptography and computer security. Schneier 1905 writes and speaks frequently on computer security and privacy and is 1906 the author of a leading cryptography textbook, Applied Cryptography, 1907 and is the creator of the symmetric key cipher Blowfish. 1909 *Tsutomu Shimomura* is a computational physicist employed by the San 1910 Diego Supercomputer Center who is an expert in designing software 1911 security tools. Last year, Shimomura was responsible for tracking 1912 down the computer outlaw Kevin Mitnick, who electronically stole and 1913 altered valuable electronic information around the country. 1915 *Eric Thompson* heads AccessData Corporation's cryptanalytic team and 1916 is a frequent lecturer on applied crytography. AccessData 1917 specializes in data recovery and decrypting information utilizing 1918 brute force as well as `smarter' attacks. Regular clients include 1919 the FBI and other law enforcement agencies as well as corporations. 1921 *Michael Wiener* is a cryptographic advisor at Bell-Northern Research 1922 where he focuses on cryptanalysis, security architectures, and 1923 public-key infrastructures. His influential 1993 paper, Efficient 1924 DES Key Search, describes in detail how to construct a machine to 1925 brute force crack DES coded information (and provides cost estimates 1926 as well). 1928 A.7 Acknowledgement 1930 The [Appendix] authors would like to thank the Business Software 1931 Alliance, which provided support for a one-day meeting, held in 1932 Chicago on 20 November 1995. 1934 References 1936 [ASYMMETRIC] - "Secure Communications and Asymmetric Cryptosystems", 1937 edited by Gustavus J. Simmons, AAAS Selected Symposium 69, Westview 1938 Press, Inc. 1940 [BBS] - "A Simple Unpredictable Pseudo-Random Number Generator", SIAM 1941 Journal on Computing, v. 15, n. 2, 1986, L. Blum, M. Blum, & M. Shub. 1943 [BRILLINGER] - "Time Series: Data Analysis and Theory", Holden-Day, 1944 1981, David Brillinger. 1946 [CRC] - "C.R.C. Standard Mathematical Tables", Chemical Rubber 1947 Publishing Company. 1949 [CRYPTO1] - "Cryptography: A Primer", A Wiley-Interscience 1950 Publication, John Wiley & Sons, 1981, Alan G. Konheim. 1952 [CRYPTO2] - "Cryptography: A New Dimension in Computer Data 1953 Security", A Wiley-Interscience Publication, John Wiley & Sons, 1982, 1954 Carl H. Meyer & Stephen M. Matyas. 1956 [CRYPTO3] - "Applied Cryptography: Protocols, Algorithsm, and Source 1957 Code in C", Second Edition, John Wiley & Sons, 1996, Bruce Schneier. 1959 [DAVIS] - "Cryptographic Randomness from Air Turbulence in Disk 1960 Drives", Advances in Cryptology - Crypto '94, Springer-Verlag Lecture 1961 Notes in Computer Science #839, 1984, Don Davis, Ross Ihaka, and 1962 Philip Fenstermacher. 1964 [DES] - "Data Encryption Standard", United States of America, 1965 Department of Commerce, National Institute of Standards and 1966 Technology, Federal Information Processing Standard (FIPS) 46-1. 1967 - "Data Encryption Algorithm", American National Standards Institute, 1968 ANSI X3.92-1981. 1969 (See also FIPS 112, Password Usage, which includes FORTRAN code for 1970 performing DES.) 1972 [DES MODES] - "DES Modes of Operation", United States of America, 1973 Department of Commerce, National Institute of Standards and 1974 Technology, Federal Information Processing Standard (FIPS) 81. 1975 - Data Encryption Algorithm - Modes of Operation, American National 1976 Standards Institute, ANSI X3.106-1983. 1978 [D-H] - "New Directions in Cryptography", IEEE Transactions on 1979 Information Technology, November, 1976, Whitfield Diffie and Martin 1980 E. Hellman. 1982 [DNSSEC] - RFC 2535, "Domain Name System Security Extensions", D. 1983 Eastlake, March 1999. 1985 [DoD] - "Password Management Guideline", United States of America, 1986 Department of Defense, Computer Security Center, CSC-STD-002-85. 1987 (See also FIPS 112, Password Usage, which incorporates CSC-STD-002-85 1988 as one of its appendices.) 1990 [GIFFORD] - "Natural Random Number", MIT/LCS/TM-371, September 1988, 1991 David K. Gifford 1993 [IPSEC] - RFC 2401, "Security Architecture for the Internet 1994 Protocol", S. Kent, R. Atkinson, November 1998 1996 [KNUTH] - "The Art of Computer Programming", Volume 2: Seminumerical 1997 Algorithms, Chapter 3: Random Numbers. Addison Wesley Publishing 1998 Company, Second Edition 1982, Donald E. Knuth. 2000 [KRAWCZYK] - "How to Predict Congruential Generators", Journal of 2001 Algorithms, V. 13, N. 4, December 1992, H. Krawczyk 2003 [MAIL PEM] - RFCs 1421 through 1424: 2004 - RFC 1424, Privacy Enhancement for Internet Electronic Mail: Part 2005 IV: Key Certification and Related Services, 02/10/1993, B. Kaliski 2006 - RFC 1423, Privacy Enhancement for Internet Electronic Mail: Part 2007 III: Algorithms, Modes, and Identifiers, 02/10/1993, D. Balenson 2008 - RFC 1422, Privacy Enhancement for Internet Electronic Mail: Part 2009 II: Certificate-Based Key Management, 02/10/1993, S. Kent 2010 - RFC 1421, Privacy Enhancement for Internet Electronic Mail: Part I: 2011 Message Encryption and Authentication Procedures, 02/10/1993, J. Linn 2013 [MAIL PGP] - RFC 2440, "OpenPGP Message Format", J. Callas, L. 2014 Donnerhacke, H. Finney, R. Thayer", November 1998 2016 [MAIL S/MIME] - RFC 2633, "S/MIME Version 3 Message Specification", 2017 B. Ramsdell, Ed., June 1999. 2019 [MD4] - The MD4 Message-Digest Algorithm, RFC1320, April 1992, R. 2020 Rivest 2021 [MD5] - The MD5 Message-Digest Algorithm, RFC1321, April 1992, R. 2022 Rivest 2024 [MOORE] - 2026 [RFC 1750] - "Randomness Requirements for Security", D. Eastlake, S. 2027 Crocker, J. Schiller, December 1994. 2029 [SHANNON] - "The Mathematical Theory of Communication", University of 2030 Illinois Press, 1963, Claude E. Shannon. (originally from: Bell 2031 System Technical Journal, July and October 1948) 2033 [SHIFT1] - "Shift Register Sequences", Aegean Park Press, Revised 2034 Edition 1982, Solomon W. Golomb. 2036 [SHIFT2] - "Cryptanalysis of Shift-Register Generated Stream Cypher 2037 Systems", Aegean Park Press, 1984, Wayne G. Barker. 2039 [SHA1] - Secure Hash Standard, United States of American, National 2040 Institute of Science and Technology, Federal Information Processing 2041 Standard (FIPS) 180-1, April 1993. 2043 [STERN] - "Secret Linear Congruential Generators are not 2044 Cryptograhically Secure", Proceedings of IEEE STOC, 1987, J. Stern. 2046 [TLS] - RFC 2246, "The TLS Protocol Version 1.0", T. Dierks, C. 2047 Allen, January 1999. 2049 [VON NEUMANN] - "Various techniques used in connection with random 2050 digits", von Neumann's Collected Works, Vol. 5, Pergamon Press, 1963, 2051 J. von Neumann. 2053 Authors Addresses 2055 Donald E. Eastlake 3rd 2056 Motorola 2057 155 Beaver Street 2058 Milford, MA 01757 USA 2060 Telephone: +1 508-261-5434 (w) 2061 +1 508-634-2066 (h) 2062 FAX: +1 508-261-4447 (w) 2063 EMail: Donald.Eastlake@motorola.com 2065 Jeffrey I. Schiller 2066 MIT Room E40-311 2067 77 Massachusetts Avenue 2068 Cambridge, MA 02139-4307 USA 2070 Telephone: +1 617-253-0161 2071 E-mail: jis@mit.edu 2073 Steve Crocker 2074 Longitude Systems, Inc. 2075 Suite 100 2076 1319 Shepard Drive 2077 Sterling, VA 20164 USA 2079 Telephone: +1 703-433-0808 x206 2080 FAX: +1 202-478-0458 2081 EMail: steve@stevecrocker.com 2083 File Name and Expiration 2085 This is file draft-eastlake-randomness2-01.txt. 2087 It expires May 2001.