Annotation of www/crypto.html, Revision 1.66
1.10 deraadt 1: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Strict Level 2//EN//2.0">
1.1 deraadt 2: <html>
3: <head>
1.10 deraadt 4: <title>Cryptography in OpenBSD</title>
1.1 deraadt 5: <link rev=made href=mailto:www@openbsd.org>
6: <meta name="resource-type" content="document">
1.10 deraadt 7: <meta name="description" content="OpenBSD cryptography">
1.48 beck 8: <meta name="keywords" content="openbsd,cryptography,openssh,openssl,kerberos">
9: <meta name="keywords" content="ipsec,photuris,isakmp,ike,blowfish,des,rsa,dsa">
1.1 deraadt 10: <meta name="distribution" content="global">
11: <meta name="copyright" content="This document copyright 1997 by OpenBSD.">
12: </head>
13:
14: <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#23238E">
1.45 deraadt 15: <img align=left alt="[OpenBSD]" height=166 width=197 SRC="images/blowfish-notext.jpg">
16: <br>
17: <br>
18: <br>
1.61 deraadt 19: "The mantra of any good security engineer is: "Security is not a
1.45 deraadt 20: product, but a process." It's more than designing strong cryptography
21: into a system; it's designing the entire system such that all security
22: measures, including cryptography, work together."<br>
23: <br>
24: -- Bruce Schneier, author of "Applied Cryptography".
25: <br clear=all>
1.37 deraadt 26: <h2><font color=#e00000>Cryptography</font><hr></h2>
1.32 deraadt 27:
28: <strong>Index</strong><br>
1.41 louis 29: <a href=#why>Why do we ship cryptography?</a>.<br>
1.47 provos 30: <a href=#ssh>OpenSSH</a>.<br>
1.32 deraadt 31: <a href=#prng>Pseudo Random Number Generators</a> (PRNG): ARC4, ...<br>
32: <a href=#hash>Cryptographic Hash Functions</a>: MD5, SHA1, ...<br>
33: <a href=#trans>Cryptographic Transforms</a>: DES, Blowfish, ...<br>
1.51 deraadt 34: <a href=#hardware>Cryptographic Hardware support</a><br>
1.32 deraadt 35: <a href=#people>International Cryptographers wanted</a><br>
1.33 deraadt 36: <a href=#papers>Further Reading</a><br>
1.1 deraadt 37: <p>
1.32 deraadt 38: <hr>
39:
40: <a name=why></a>
1.42 deraadt 41: <h3><font color=#e00000>Why do we ship cryptography?</font></h3><p>
1.32 deraadt 42:
43: In three words: <strong>because we can</strong>.<p>
44:
1.1 deraadt 45: The OpenBSD project is based in Canada.<p>
46:
1.23 deraadt 47: The <a href=ECL.html>Export Control List of Canada</a>
48: places no significant restriction on the export of
1.5 deraadt 49: cryptographic software, and is even more explicit about the free
50: export of freely-available cryptographic software. Marc Plumb has
51: done
1.2 deraadt 52: <a href=http://insight.mcmaster.ca/org/efc/pages/doc/crypto-export.html>
1.31 aaron 53: some research to test the cryptographic laws</a>.
1.2 deraadt 54: <p>
1.1 deraadt 55:
1.3 deraadt 56: Hence the OpenBSD project has embedded cryptography into numerous places
57: in the operating system. We require that the cryptographic software we
58: use be <a href=policy.html>freely available and with good licenses</a>.
1.32 deraadt 59: We do not directly use cryptography with nasty patents.
1.13 deraadt 60: We also require that such software is from countries with useful export
1.16 deraadt 61: licenses because we do not wish to break the laws of any country.
62: The cryptographic software components which we use currently were
63: written in Argentina, Australia, Canada, Germany, Greece, Norway, and
64: Sweden.
65: <p>
1.7 deraadt 66:
1.15 deraadt 67: When we create OpenBSD releases or snapshots we build our release
68: binaries in free countries to assure that the sources and binaries we
69: provide to users are free of tainting. In the past our release binary
70: builds have been done in Canada, Sweden, and Germany.<p>
71:
1.16 deraadt 72: OpenBSD ships with Kerberos IV included. The codebase we use is the
1.17 deraadt 73: exportable KTH-based release from Sweden. Our X11 source has been
74: extended to make use of Kerberos IV as well. Kerberos V support will
1.54 deraadt 75: appear sometime in 2000, but at present time a freely exportable
1.16 deraadt 76: Kerberos V release does not exist.<p>
77:
1.66 ! deraadt 78: <img align=right src="images/vpnc-test-partner.gif">
! 79: OpenBSD was the first operating system to ship with an IPSEC stack.
! 80: We've been including IPSEC since early OpenBSD 2.1 release in 1997.
! 81: Our fully conformant in-kernel IPSEC stack, with hardware acceleration
! 82: based on a number of cards, and our own free ISAKMP daemon, is used as
! 83: one of the machines in the IPSEC conformance testbed run by VPNC.
! 84: <br clear=all>
! 85: <p>
! 86:
1.15 deraadt 87: Today cryptography is an important means for enhancing the <a
88: href=security.html>security</a> of an operating system. The
1.42 deraadt 89: cryptography utilized in OpenBSD can be classified into various
90: aspects, described as follows.<p>
1.10 deraadt 91:
1.39 louis 92: <a name=ssh></a>
1.47 provos 93: <h3><font color=#e00000>OpenSSH</font></h3><p>
1.39 louis 94:
1.40 deraadt 95: What is the first thing most people do after installing OpenBSD?
1.55 deraadt 96: They install Secure Shell
97: (<a href=http://www.openbsd.org/cgi-bin/man.cgi?query=ssh>ssh</a>)
1.46 deraadt 98: from the ports tree or the packages on the FTP sites. Until now, that is.<p>
1.39 louis 99:
1.55 deraadt 100: As of the 2.6 release, OpenBSD contains
1.50 provos 101: <a href="http://www.openssh.com/">OpenSSH</a>, an absolutely free and
102: patent unencumbered version of ssh.
1.55 deraadt 103: As of the OpenBSD 2.6 release date,
104: <a href="http://www.openssh.com/">OpenSSH</a> interoperated with ssh
105: version 1 and had many added features,
1.47 provos 106: <ul>
107: <li>
108: all components of a restrictive nature (ie. patents, see
109: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=ssl>ssl</a>))
1.55 deraadt 110: had been directly removed from the source code; any licensed or
111: patented components used external libraries.
1.47 provos 112: </li>
113: <li>
1.55 deraadt 114: had been updated to support ssh protocol 1.5.
1.47 provos 115: </li>
116: <li>
1.55 deraadt 117: contained added support for
1.47 provos 118: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=kerberos>kerberos</a>
119: authentication and ticket passing.
120: </li>
121: <li>
1.55 deraadt 122: supported one-time password authentication with
1.47 provos 123: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=skey>skey</a>.
124: </li>
125: </ul>
126: <p>
127:
1.55 deraadt 128: Roughly, we took a free license release of ssh and OpenBSD-ifyed it.
129: We get around the USA-based RSA patent by providing an easy way to
1.47 provos 130: automatically download and install a RSA-enabled package containing
131: shared library versions of libcrypto and libssl. These packages are
132: based on OpenSSL. People living outside the USA can freely use the
1.40 deraadt 133: RSA patented code, while people inside the USA can freely use it for
1.47 provos 134: non-commercial purposes. It appears as if companies inside the USA
135: can use the RSA libraries too, as long as RSA is not used in a profit
136: generating role.<p>
1.39 louis 137:
1.55 deraadt 138: But this way almost everyone will get ssh built into their OS.<p>
139:
140: <strong>NEW! OpenSSH supports protocol 2.0!</strong><p>
141:
142: Recently, we have extended OpenSSH so that it also does SSH 2 protocol.
143: Having a ssh daemon which can do all 3 major SSH protocols
144: (1.3, 1.5, 2.0) permits us much flexibility. Protocol 2.0 does not
145: use RSA for it's public key cryptography, relying instead on the DH
146: and DSA algorithms. In OpenBSD 2.7 -- which will ship with the new
147: OpenSSH -- you get protocol 2.0 support right out of the box! If
148: you wish to also support protocol 1.3 and 1.5, you simply add the
149: RSA package (as described our
150: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=ssl>ssl</a>
151: manual page), and restart the daemon.
1.39 louis 152:
1.18 deraadt 153: <a name=prng></a>
1.42 deraadt 154: <h3><font color=#e00000>Pseudo Random Number Generators</font></h3><p>
1.32 deraadt 155:
1.10 deraadt 156: A Pseudo Random Number Generator (PRNG) provides applications with a stream of
157: numbers which have certain important properties for system security:<p>
158:
159: <ul>
1.11 deraadt 160: <li>It should be impossible for an outsider to predict the output of the
161: random number generator even with knowledge of previous output.
162: <li>The generated numbers should not have repeating patterns which means
163: the PRNG should have a very long cycle length.
1.10 deraadt 164: </ul>
1.32 deraadt 165: <p>
1.10 deraadt 166:
1.13 deraadt 167: A PRNG is normally just an algorithm where the same initial starting
168: values will yield the same sequence of outputs. On a multiuser
169: operating system there are many sources which allow seeding the PRNG
170: with random data. The OpenBSD kernel uses the mouse interrupt timing,
171: network data interrupt latency, inter-keypress timing and disk IO
172: information to fill an entropy pool. Random numbers are available for
173: kernel routines and are exported via devices to userland programs.
1.36 deraadt 174: So far random numbers are used in the following places:<p>
1.13 deraadt 175:
1.10 deraadt 176: <ul>
1.14 deraadt 177: <li>Dynamic sin_port allocation in bind(2).
178: <li>PIDs of processes.
1.26 aaron 179: <li>IP datagram IDs.
1.14 deraadt 180: <li>RPC transaction IDs (XID).
181: <li>NFS RPC transaction IDs (XID).
182: <li>DNS Query-IDs.
183: <li>Inode generation numbers, see getfh(2) and fsirand(8).
1.31 aaron 184: <li>Timing perturbance in traceroute(8).
1.14 deraadt 185: <li>Stronger temporary names for mktemp(3) and mkstemp(3)
186: <li>Randomness added to the TCP ISS value for protection against
187: spoofing attacks.
1.29 deraadt 188: <li>random padding in IPSEC esp_old packets.
1.14 deraadt 189: <li>To generate salts for the various password algorithms.
190: <li>For generating fake S/Key challenges.
1.44 provos 191: <li>In <a href=http://www.physnet.uni-hamburg.de/provos/photuris/>photurisd</a>
1.28 angelos 192: and <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=isakmpd>isakmpd</a>
193: to provide liveness proof of key exchanges.
1.10 deraadt 194: </ul>
1.1 deraadt 195:
1.10 deraadt 196: <p>
1.18 deraadt 197: <a name=hash></a>
1.42 deraadt 198: <h3><font color=#e00000>Cryptographic Hash Functions</font></h3><p>
1.32 deraadt 199:
1.10 deraadt 200: A Hash Function compresses its input data to a string of
1.36 deraadt 201: constant size. For a Cryptographic Hash Function it is infeasible to find:
202:
1.1 deraadt 203: <ul>
1.11 deraadt 204: <li>two inputs which have the same output (collision resistant),
205: <li>a different input for a given input with the same output
206: (2nd preimage resistant).
1.1 deraadt 207: </ul>
1.32 deraadt 208: <p>
1.10 deraadt 209:
1.12 millert 210: In OpenBSD MD5, SHA1, and RIPEMD-160 are used as Cryptographic Hash Functions,
1.36 deraadt 211: e.g:<p>
1.10 deraadt 212: <ul>
1.27 deraadt 213: <li>In <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=skey>S/Key</a>
214: to provide one time passwords.
215: <li>In <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=ipsec>IPsec</a>,
1.44 provos 216: <a href=http://www.physnet.uni-hamburg.de/provos/photuris/>photurisd</a>
1.27 deraadt 217: and
218: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=isakmpd>isakmpd(8)</a>
219: to authenticate the data origin of packets and to ensure packet integrity.
220: <li>For FreeBSD-style MD5 passwords (not enabled by default), see
221: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=passwd.conf&sektion=5>
222: passwd.conf(5)</a>
223: <li>For TCP SYN cookie support (not enabled by default), see
224: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=options&sektion=4>
225: options(4)</a>
1.24 niklas 226: <li>In libssl for digital signing of messages.
1.10 deraadt 227: </ul>
1.32 deraadt 228: <p>
1.10 deraadt 229:
1.6 deraadt 230: <p>
1.18 deraadt 231: <a name=trans></a>
1.42 deraadt 232: <h3><font color=#e00000>Cryptographic Transforms</font></h3><p>
1.32 deraadt 233:
1.11 deraadt 234: Cryptographic Transforms are used to encrypt and decrypt data. These
235: are normally used with an encryption key for data encryption and with
236: a decryption key for data decryption. The security of a Cryptographic
237: Transform should rely only on the keying material.<p>
1.6 deraadt 238:
1.24 niklas 239: OpenBSD provides transforms like DES, 3DES, Blowfish and Cast for the
1.36 deraadt 240: kernel and userland programs, which are used in many places like:<p>
1.10 deraadt 241: <ul>
1.27 deraadt 242: <li>In libc for creating
243: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=blf_key>Blowfish</a>
1.33 deraadt 244: passwords. See also the <a href=papers/bcrypt-paper.ps>USENIX paper</a>
245: on this topic.
1.27 deraadt 246: <li>In
247: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=ipsec>IPsec</a>
248: to provide confidentiality for the network layer.
249: <li>In Kerberos and a handful of kerberized applications, like
250: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=telnet>telnet</a>,
251: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=cvs>cvs</a>,
252: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=rsh>rsh</a>,
253: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=rcp>rcp</a>,
254: and
255: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=rlogin>rlogin</a>.
1.44 provos 256: <li>In <a href=http://www.physnet.uni-hamburg.de/provos/photuris/>
1.27 deraadt 257: photurisd</a> and
258: <a href=http://www.openbsd.org/cgi-bin/man.cgi?query=isakmpd>isakmpd</a>
259: to protect the exchanges where IPsec key material is negotiated.
1.24 niklas 260: <li>In AFS to protect the messages passing over the network, providing
1.27 deraadt 261: confidentiality of remote filesystem access.
1.24 niklas 262: <li>In libssl to let applications communicate over the de-facto standard
263: cryptographically secure SSL protocol.
1.10 deraadt 264: </ul>
1.1 deraadt 265:
1.10 deraadt 266: <p>
1.51 deraadt 267: <a name=hardware></a>
268: <h3><font color=#e00000>Cryptographic Hardware Support</font></h3><p>
269:
1.58 louis 270: OpenBSD, starting with 2.7, has begun supporting some cryptography hardware
271: such as accelerators and random number generators.
1.51 deraadt 272: <ul>
273: <li><b>IPSEC crypto dequeue</b><br>
274: Our IPSEC stack has been modified so that cryptographic functions get
275: done out-of-line. Most simple software IPSEC stacks need to do
276: cryptography when processing each packet. This results in syncronous
277: performance. To use hardware properly and speedily one needs to seperate
278: these two components, as we have done. Actually, doing this gains some
279: performance even for the software case.
280: <p>
281: <li><b>HiFn 7751</b><br>
1.56 deraadt 282: Cards using the <a href="http://www.hifn.com/products/7751.html">HiFn 7751</a>
1.53 deraadt 283: can be used as a cryptographic accelerator (ie.
1.51 deraadt 284: <a href="http://www.powercrypt.com">PowerCrypt</a>).
285: Current performance using a single Hifn 7751 on each end of a tunnel
286: is 63Mbit/sec for 3DES/SHA1 ESP, nearly a 600% improvement over
287: using a P3/550 cpu. Further improvements are under way to resolve a
288: few more issues, but as of April 13, 2000 the code is considered
1.53 deraadt 289: stable. We wrote our own driver for supporting this chip, rather
290: than using the (USA-written)
291: <a href="http://www.powercrypt.com">powercrypt</a> driver, as well
1.60 deraadt 292: our driver links in properly to the IPSEC stack.
1.53 deraadt 293: The 7751 is now considered slow by industry standards and many vendors
294: have faster chips (even HiFn now has a faster but more expensive
1.60 deraadt 295: chip). Peak performance with 3DES SHA1 ESP is around 63MBit/sec.
296: <p>
297: (As an aside, HiFn was a difficult company to deal with; they even
298: threatened to sue us over our non-USA reverse engineering of their
299: crypto unlock algorithm).
1.53 deraadt 300: <p>
1.59 deraadt 301: <li><b>Broadcom BCM5805 (or beta chip Bluesteelnet 5501)</b><br>
1.65 deraadt 302: Just after the OpenBSD 2.7 release, we succeeded at adding preliminary
303: support for these early release parts provided to us by the vendor,
304: specifically starting with the test chip
1.59 deraadt 305: <a href="http://www.bluesteelnet.com/product.html">5501</a>.
306: Bluesteelnet was bought by Broadcom and started making real parts.
1.65 deraadt 307: Their new BCM5805 is similar, except that they also add an asymetric
308: engine for running DSA, RSA, and other such algorithms. With approximate
309: performance starting at more than four times as fast as the HiFn,
310: hopefully this chip will become more common soon.
1.60 deraadt 311: <p>
312: The Broadcom/Bluesteelnet people have been great to deal with. They gave
313: us complete documentation for their chips and a sufficient number of cards
314: to test with.
315: <p>
316:
317: <li><b>Pijnenburg PCC-ISES</b><br>
318: The <a href="http://www.pcc.pijnenburg.nl/pcc-ises.htm">PCC-ISES</a> is a
319: new chipset from the Netherlands. We have received sample hardware and
320: documentation, and work to support this should start fairly soon.
321: <p>
322:
323: <li><b>IRE 2141</b><br>
324: We have received documentation and sample hardware for the
325: <a href="http://www.ire.com/OEM/OEMTechnologyDefault.htm">IRE</a> crypto
326: cards based on the SafeNet chipset. We would like to get started on
327: supporting these soon.
1.57 deraadt 328: <p>
329:
330: <li><b>Other cards</b><br>
331: We are moving towards supporting other chips such as:
1.53 deraadt 332: <ul>
1.60 deraadt 333:
334: <li><a href="http://www.3com.com/promotions/3c990promo/index.html">3com 3c990</a>
1.53 deraadt 335: <li>and others
336: </ul>
337: <p>
1.52 deraadt 338: Intel (and 3com to a lesser degree) don't yet fully understand how
339: they could benefit from giving us documentation for their cryptography
340: cards, so feel free to contact them independently and encourage them.
1.60 deraadt 341: We have given up talking to them, since it appears to be a waste of time.
1.52 deraadt 342: <p>
1.60 deraadt 343: <b>If people wish to help with writing drivers,
344: <a href=#people>come and help us</a>.</b>
1.51 deraadt 345: <p>
346: <li><b>Intel 82802AB/82802AC Firmware Hub RNG</b><br>
347: The 82802 FWH chip (found on i810, i820, and i840 motherboards) contains
348: a random number generator (RNG). High-performance IPSEC requires more
349: random number entropy. As of April 10, 2000, we support the RNG. We
350: will add support for other RNG's found on crypto chips.
1.52 deraadt 351: <p>
352: <li><b>OpenSSL</b><br>
353: We have grand schemes for supporting crypto cards that can do RSA or DSA,
354: and exporting the functions of all crypto cards to OpenSSL so that
355: userland programs (ie. <a href="http://www.openssh.com">ssh</a>,
356: <a href="http://www.modssl.org/">apache https</a>, etc)
357: can benefit.
1.51 deraadt 358: </ul>
359:
360: <p>
1.32 deraadt 361: <a name=people></a>
1.42 deraadt 362: <h3><font color=#e00000>International Cryptographers Wanted</font></h3><p>
1.32 deraadt 363:
364: Of course, our project needs people to work on these systems. If any
365: non-American cryptographer who meets the constraints listed earlier is
366: interested in helping out with embedded cryptography in OpenBSD,
367: please contact us.<p>
368:
1.33 deraadt 369: <p>
370: <a name=papers></a>
1.42 deraadt 371: <h3><font color=#e00000>Further Reading</font></h3><p>
1.33 deraadt 372:
373: A number of papers have been written by OpenBSD team members, about
374: cryptographic changes they have done in OpenBSD. The postscript
1.34 deraadt 375: versions of these documents are available as follows.<p>
1.33 deraadt 376:
377: <ul>
1.43 deraadt 378: <li>A Future-Adaptable Password Scheme.<br>
1.49 deraadt 379: <a href=events.html#usenix99>Usenix 1999</a>,
1.43 deraadt 380: by <a href=mailto:provos@openbsd.org>Niels Provos<a/>,
381: <a href=mailto:dm@openbsd.org>David Mazieres</a>.<br>
1.33 deraadt 382: <a href=papers/bcrypt-paper.ps>paper</a> and
383: <a href=papers/bcrypt-slides.ps>slides</a>.
1.43 deraadt 384: <p>
385: <li>Cryptography in OpenBSD: An Overview.<br>
1.49 deraadt 386: <a href=events.html#usenix99>Usenix 1999</a>,
1.43 deraadt 387: by <a href=mailto:deraadt@openbsd.org>Theo de Raadt</a>,
388: <a href=mailto:niklas@openbsd.org>Niklas Hallqvist</a>,
389: <a href=mailto:art@openbsd.org>Artur Grabowski</a>,
390: <a href=mailto:angelos@openbsd.org>Angelos D. Keromytis</a>,
391: <a href=mailto:provos@openbsd.org>Niels Provos</a>.<br>
1.33 deraadt 392: <a href=papers/crypt-paper.ps>paper</a> and
393: <a href=papers/crypt-slides.ps>slides</a>.
1.62 niklas 394: <p>
395: <li>Implementing Internet Key Exchange (IKE).<br>
396: <a href=events.html#usenix2000>Usenix 2000</a>,
397: by <a href=mailto:niklas@openbsd.org>Niklas Hallqvist</a> and
398: <a href=mailto:angelos@openbsd.org>Angelos D. Keromytis</a>.<br>
399: <a href=papers/ikepaper.ps>paper</a> and
400: <a href=papers/ikeslides.ps>slides</a>.
1.63 deraadt 401: <p>
402: <li>Encrypting Virtual Memory</a><br>
403: <a href=events.html#sec2000>Usenix Security 2000</a>,
404: <a href=mailto:provos@openbsd.org>Niels Provos</a>.<br>
1.64 provos 405: <a href=papers/swapencrypt.ps>paper</a> and
406: <a href=papers/swapencrypt-slides.ps>slides</a>.
1.33 deraadt 407: </ul>
408:
1.32 deraadt 409: <p>
1.1 deraadt 410: <hr>
1.19 pauls 411: <a href=/index.html><img height=24 width=24 src=back.gif border=0 alt=OpenBSD></a>
1.10 deraadt 412: <a href=mailto:www@openbsd.org>www@openbsd.org</a>
413: <br>
1.66 ! deraadt 414: <small>$OpenBSD: crypto.html,v 1.65 2000/08/25 17:50:40 deraadt Exp $</small>
1.1 deraadt 415:
1.10 deraadt 416: </body>
417: </html>