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