]>
Commit | Line | Data |
---|---|---|
79e259e3 | 1 | |
d5957691 MC |
2 | OPENSSL INSTALLATION |
3 | -------------------- | |
79e259e3 | 4 | |
07930a75 RL |
5 | [This document describes installation on all supported operating |
6 | systems (currently mainly the Linux/Unix family, OpenVMS and | |
7 | Windows)] | |
4109b97c RE |
8 | |
9 | To install OpenSSL, you will need: | |
79e259e3 | 10 | |
07930a75 RL |
11 | * A make implementation |
12 | * Perl 5 with core modules (please read NOTES.PERL) | |
13 | * The perl module Text::Template (please read NOTES.PERL) | |
73bfb9ad | 14 | * an ANSI C compiler |
d5957691 | 15 | * a development environment in the form of development libraries and C |
d57d85ff | 16 | header files |
2acd8ec7 RL |
17 | * a supported operating system |
18 | ||
84f4f0bd RL |
19 | For additional platform specific requirements and other details, |
20 | please read one of these: | |
2acd8ec7 | 21 | |
b32b8961 | 22 | * NOTES.VMS (OpenVMS) |
20ab55f4 | 23 | * NOTES.WIN (any supported Windows) |
07930a75 | 24 | * NOTES.DJGPP (DOS platform with DJGPP) |
79e259e3 | 25 | |
4109b97c RE |
26 | Quick Start |
27 | ----------- | |
79e259e3 | 28 | |
4109b97c | 29 | If you want to just get on with it, do: |
79e259e3 | 30 | |
2acd8ec7 RL |
31 | on Unix: |
32 | ||
33 | $ ./config | |
34 | $ make | |
35 | $ make test | |
36 | $ make install | |
37 | ||
38 | on OpenVMS: | |
39 | ||
40 | $ @config | |
41 | $ mms | |
42 | $ mms test | |
43 | $ mms install | |
79e259e3 | 44 | |
b32b8961 RL |
45 | on Windows (only pick one of the targets for configuration): |
46 | ||
47 | $ perl Configure { VC-WIN32 | VC-WIN64A | VC-WIN64I | VC-CE } | |
48 | $ nmake | |
49 | $ nmake test | |
8c16829e | 50 | $ nmake install |
b32b8961 | 51 | |
d872c55c | 52 | [If any of these steps fails, see section Installation in Detail below.] |
b1fe6b43 | 53 | |
2acd8ec7 RL |
54 | This will build and install OpenSSL in the default location, which is: |
55 | ||
56 | Unix: normal installation directories under /usr/local | |
57 | OpenVMS: SYS$COMMON:[OPENSSL-'version'...], where 'version' is the | |
667c6bfe RL |
58 | OpenSSL version number with underscores instead of periods. |
59 | Windows: C:\Program Files\OpenSSL or C:\Program Files (x86)\OpenSSL | |
2acd8ec7 RL |
60 | |
61 | If you want to install it anywhere else, run config like this: | |
79e259e3 | 62 | |
2acd8ec7 RL |
63 | On Unix: |
64 | ||
65 | $ ./config --prefix=/opt/openssl --openssldir=/usr/local/ssl | |
66 | ||
67 | On OpenVMS: | |
68 | ||
69 | $ @config --prefix=PROGRAM:[INSTALLS] --openssldir=SYS$MANAGER:[OPENSSL] | |
79e259e3 | 70 | |
b1fe6b43 UM |
71 | |
72 | Configuration Options | |
73 | --------------------- | |
74 | ||
2d99cee7 | 75 | There are several options to ./config (or ./Configure) to customize |
8c16829e RL |
76 | the build (note that for Windows, the defaults for --prefix and |
77 | --openssldir depend in what configuration is used and what Windows | |
78 | implementation OpenSSL is built on. More notes on this in NOTES.WIN): | |
2613c1fa | 79 | |
fa28bfd6 MC |
80 | --api=x.y.z |
81 | Don't build with support for deprecated APIs below the | |
82 | specified version number. For example "--api=1.1.0" will | |
83 | remove support for all APIS that were deprecated in OpenSSL | |
84 | version 1.1.0 or below. | |
462ba4f6 | 85 | |
fa28bfd6 MC |
86 | --cross-compile-prefix=PREFIX |
87 | The PREFIX to include in front of commands for your | |
85afea67 AP |
88 | toolchain. It's likely to have to end with dash, e.g. |
89 | a-b-c- would invoke GNU compiler as a-b-c-gcc, etc. | |
90 | Unfortunately cross-compiling is too case-specific to | |
91 | put together one-size-fits-all instructions. You might | |
92 | have to pass more flags or set up environment variables | |
93 | to actually make it work. Android and iOS cases are | |
94 | discussed in corresponding Configurations/10-main.cf | |
95 | sections. But there are cases when this option alone is | |
96 | sufficient. For example to build the mingw64 target on | |
97 | Linux "--cross-compile-prefix=x86_64-w64-mingw32-" | |
98 | works. Naturally provided that mingw packages are | |
99 | installed. Today Debian and Ubuntu users have option to | |
100 | install a number of prepackaged cross-compilers along | |
101 | with corresponding run-time and development packages for | |
102 | "alien" hardware. To give another example | |
103 | "--cross-compile-prefix=mipsel-linux-gnu-" suffices | |
104 | in such case. Needless to mention that you have to | |
105 | invoke ./Configure, not ./config, and pass your target | |
106 | name explicitly. | |
fa28bfd6 MC |
107 | |
108 | --debug | |
109 | Build OpenSSL with debugging symbols. | |
110 | ||
111 | --libdir=DIR | |
112 | The name of the directory under the top of the installation | |
113 | directory tree (see the --prefix option) where libraries will | |
114 | be installed. By default this is "lib". Note that on Windows | |
115 | only ".lib" files will be stored in this location. dll files | |
116 | will always be installed to the "bin" directory. | |
2acd8ec7 | 117 | |
ecabf05e MC |
118 | --openssldir=DIR |
119 | Directory for OpenSSL configuration files, and also the | |
d5957691 MC |
120 | default certificate and key store. Defaults are: |
121 | ||
667c6bfe | 122 | Unix: /usr/local/ssl |
8c16829e RL |
123 | Windows: C:\Program Files\Common Files\SSL |
124 | or C:\Program Files (x86)\Common Files\SSL | |
667c6bfe | 125 | OpenVMS: SYS$COMMON:[OPENSSL-COMMON] |
d5957691 | 126 | |
fa28bfd6 MC |
127 | --prefix=DIR |
128 | The top of the installation directory tree. Defaults are: | |
129 | ||
130 | Unix: /usr/local | |
131 | Windows: C:\Program Files\OpenSSL | |
132 | or C:\Program Files (x86)\OpenSSL | |
133 | OpenVMS: SYS$COMMON:[OPENSSL-'version'] | |
134 | ||
135 | --release | |
136 | Build OpenSSL without debugging symbols. This is the default. | |
137 | ||
138 | --strict-warnings | |
139 | This is a developer flag that switches on various compiler | |
140 | options recommended for OpenSSL development. It only works | |
141 | when using gcc or clang as the compiler. If you are | |
142 | developing a patch for OpenSSL then it is recommended that | |
143 | you use this option where possible. | |
144 | ||
145 | --with-zlib-include=DIR | |
146 | The directory for the location of the zlib include file. This | |
147 | option is only necessary if enable-zlib (see below) is used | |
148 | and the include file is not already on the system include | |
149 | path. | |
150 | ||
151 | --with-zlib-lib=LIB | |
152 | On Unix: this is the directory containing the zlib library. | |
153 | If not provided the system library path will be used. | |
154 | On Windows: this is the filename of the zlib library (with or | |
155 | without a path). This flag must be provided if the | |
156 | zlib-dynamic option is not also used. If zlib-dynamic is used | |
157 | then this flag is optional and a default value ("ZLIB1") is | |
158 | used if not provided. | |
159 | On VMS: this is the filename of the zlib library (with or | |
160 | without a path). This flag is optional and if not provided | |
161 | then "GNV$LIBZSHR", "GNV$LIBZSHR32" or "GNV$LIBZSHR64" is | |
162 | used by default depending on the pointer size chosen. | |
d5957691 | 163 | |
ecabf05e MC |
164 | no-afalgeng |
165 | Don't build the AFALG engine. This option will be forced if | |
166 | on a platform that does not support AFALG. | |
167 | ||
fa28bfd6 | 168 | enable-asan |
f430ba31 | 169 | Build with the Address sanitiser. This is a developer option |
fa28bfd6 MC |
170 | only. It may not work on all platforms and should never be |
171 | used in production environments. It will only work when used | |
172 | with gcc or clang and should be used in conjunction with the | |
173 | no-shared option. | |
174 | ||
ecabf05e | 175 | no-asm |
05328815 MC |
176 | Do not use assembler code. On some platforms a small amount |
177 | of assembler code may still be used. | |
ecabf05e MC |
178 | |
179 | no-async | |
180 | Do not build support for async operations. | |
d5957691 | 181 | |
ecabf05e MC |
182 | no-autoalginit |
183 | Don't automatically load all supported ciphers and digests. | |
d5957691 MC |
184 | Typically OpenSSL will make available all of its supported |
185 | ciphers and digests. For a statically linked application this | |
186 | may be undesirable if small executable size is an objective. | |
187 | This only affects libcrypto. Ciphers and digests will have to | |
188 | be loaded manually using EVP_add_cipher() and | |
ecabf05e MC |
189 | EVP_add_digest() if this option is used. This option will |
190 | force a non-shared build. | |
d5957691 | 191 | |
ecabf05e MC |
192 | no-autoerrinit |
193 | Don't automatically load all libcrypto/libssl error strings. | |
d5957691 MC |
194 | Typically OpenSSL will automatically load human readable |
195 | error strings. For a statically linked application this may | |
196 | be undesirable if small executable size is an objective. | |
197 | ||
d5957691 | 198 | |
ecabf05e MC |
199 | no-capieng |
200 | Don't build the CAPI engine. This option will be forced if | |
201 | on a platform that does not support CAPI. | |
d5957691 | 202 | |
ecabf05e MC |
203 | no-cms |
204 | Don't build support for CMS features | |
d5957691 | 205 | |
ecabf05e MC |
206 | no-comp |
207 | Don't build support for SSL/TLS compression. If this option | |
208 | is left enabled (the default), then compression will only | |
209 | work if the zlib or zlib-dynamic options are also chosen. | |
d5957691 | 210 | |
ecabf05e MC |
211 | enable-crypto-mdebug |
212 | Build support for debugging memory allocated via | |
213 | OPENSSL_malloc() or OPENSSL_zalloc(). | |
214 | ||
215 | enable-crypto-mdebug-backtrace | |
216 | As for crypto-mdebug, but additionally provide backtrace | |
217 | information for allocated memory. | |
8d054a55 RL |
218 | TO BE USED WITH CARE: this uses GNU C functionality, and |
219 | is therefore not usable for non-GNU config targets. If | |
220 | your build complains about the use of '-rdynamic' or the | |
221 | lack of header file execinfo.h, this option is not for you. | |
222 | ALSO NOTE that even though execinfo.h is available on your | |
223 | system (through Gnulib), the functions might just be stubs | |
224 | that do nothing. | |
ecabf05e MC |
225 | |
226 | no-ct | |
227 | Don't build support for Certificate Transparency. | |
228 | ||
229 | no-deprecated | |
230 | Don't build with support for any deprecated APIs. This is the | |
231 | same as using "--api" and supplying the latest version | |
232 | number. | |
233 | ||
234 | no-dgram | |
235 | Don't build support for datagram based BIOs. Selecting this | |
236 | option will also force the disabling of DTLS. | |
237 | ||
238 | no-dso | |
239 | Don't build support for loading Dynamic Shared Objects. | |
240 | ||
241 | no-dynamic-engine | |
242 | Don't build the dynamically loaded engines. This only has an | |
243 | effect in a "shared" build | |
244 | ||
245 | no-ec | |
246 | Don't build support for Elliptic Curves. | |
247 | ||
248 | no-ec2m | |
249 | Don't build support for binary Elliptic Curves | |
250 | ||
251 | enable-ec_nistp_64_gcc_128 | |
252 | Enable support for optimised implementations of some commonly | |
253 | used NIST elliptic curves. This is only supported on some | |
254 | platforms. | |
255 | ||
256 | enable-egd | |
257 | Build support for gathering entropy from EGD (Entropy | |
258 | Gathering Daemon). | |
259 | ||
260 | no-engine | |
261 | Don't build support for loading engines. | |
262 | ||
263 | no-err | |
264 | Don't compile in any error strings. | |
265 | ||
266 | no-filenames | |
267 | Don't compile in filename and line number information (e.g. | |
268 | for errors and memory allocation). | |
269 | ||
fa28bfd6 MC |
270 | enable-fuzz |
271 | Build with support for fuzzing. This is a developer option | |
272 | only. It may not work on all platforms and should never be | |
273 | used in production environments. See the file fuzz/README.md | |
274 | for further details. | |
275 | ||
ecabf05e MC |
276 | no-gost |
277 | Don't build support for GOST based ciphersuites. Note that | |
278 | if this feature is enabled then GOST ciphersuites are only | |
279 | available if the GOST algorithms are also available through | |
280 | loading an externally supplied engine. | |
281 | ||
282 | enable-heartbeats | |
283 | Build support for DTLS heartbeats. | |
284 | ||
285 | no-hw-padlock | |
286 | Don't build the padlock engine. | |
287 | ||
288 | no-makedepend | |
05328815 | 289 | Don't generate dependencies. |
ecabf05e MC |
290 | |
291 | no-multiblock | |
292 | Don't build support for writing multiple records in one | |
293 | go in libssl (Note: this is a different capability to the | |
294 | pipelining functionality). | |
295 | ||
296 | no-nextprotoneg | |
297 | Don't build support for the NPN TLS extension. | |
298 | ||
299 | no-ocsp | |
300 | Don't build support for OCSP. | |
d5957691 | 301 | |
ecabf05e MC |
302 | no-pic |
303 | Don't build with support for Position Independent Code. | |
d5957691 | 304 | |
ecabf05e MC |
305 | no-posix-io |
306 | Don't use POSIX IO capabilities. | |
307 | ||
308 | no-psk | |
309 | Don't build support for Pre-Shared Key based ciphersuites. | |
310 | ||
311 | no-rdrand | |
312 | Don't use hardware RDRAND capabilities. | |
313 | ||
314 | no-rfc3779 | |
315 | Don't build support for RFC3779 ("X.509 Extensions for IP | |
316 | Addresses and AS Identifiers") | |
317 | ||
ecabf05e MC |
318 | sctp |
319 | Build support for SCTP | |
320 | ||
ce942199 MC |
321 | no-shared |
322 | Do not create shared libraries, only static ones. See "Note | |
323 | on shared libraries" below. | |
d5957691 | 324 | |
ecabf05e MC |
325 | no-sock |
326 | Don't build support for socket BIOs | |
d5957691 | 327 | |
ecabf05e MC |
328 | no-srp |
329 | Don't build support for SRP or SRP based ciphersuites. | |
330 | ||
331 | no-srtp | |
332 | Don't build SRTP support | |
d5957691 | 333 | |
ecabf05e MC |
334 | no-sse2 |
335 | Exclude SSE2 code paths. Normally SSE2 extension is | |
d5957691 MC |
336 | detected at run-time, but the decision whether or not the |
337 | machine code will be executed is taken solely on CPU | |
338 | capability vector. This means that if you happen to run OS | |
339 | kernel which does not support SSE2 extension on Intel P4 | |
340 | processor, then your application might be exposed to | |
341 | "illegal instruction" exception. There might be a way | |
342 | to enable support in kernel, e.g. FreeBSD kernel can be | |
343 | compiled with CPU_ENABLE_SSE, and there is a way to | |
f430ba31 | 344 | disengage SSE2 code paths upon application start-up, |
d5957691 | 345 | but if you aim for wider "audience" running such kernel, |
05328815 | 346 | consider no-sse2. Both the 386 and no-asm options imply |
d5957691 MC |
347 | no-sse2. |
348 | ||
ecabf05e MC |
349 | enable-ssl-trace |
350 | Build with the SSL Trace capabilities (adds the "-trace" | |
351 | option to s_client and s_server). | |
352 | ||
353 | no-static-engine | |
354 | Don't build the statically linked engines. This only | |
355 | has an impact when not built "shared". | |
356 | ||
357 | no-stdio | |
358 | Don't use any C "stdio" features. Only libcrypto and libssl | |
359 | can be built in this way. Using this option will suppress | |
360 | building the command line applications. Additionally since | |
361 | the OpenSSL tests also use the command line applications the | |
362 | tests will also be skipped. | |
363 | ||
364 | no-threads | |
365 | Don't try to build with support for multi-threaded | |
366 | applications. | |
367 | ||
368 | threads | |
369 | Build with support for multi-threaded applications. Most | |
370 | platforms will enable this by default. However if on a | |
371 | platform where this is not the case then this will usually | |
372 | require additional system-dependent options! See "Note on | |
373 | multi-threading" below. | |
374 | ||
375 | no-ts | |
376 | Don't build Time Stamping Authority support. | |
377 | ||
fa28bfd6 | 378 | enable-ubsan |
f430ba31 | 379 | Build with the Undefined Behaviour sanitiser. This is a |
fa28bfd6 MC |
380 | developer option only. It may not work on all platforms and |
381 | should never be used in production environments. It will only | |
382 | work when used with gcc or clang and should be used in | |
383 | conjunction with the "-DPEDANTIC" option (or the | |
384 | --strict-warnings option). | |
385 | ||
ecabf05e MC |
386 | no-ui |
387 | Don't build with the "UI" capability (i.e. the set of | |
388 | features enabling text based prompts). | |
389 | ||
390 | enable-unit-test | |
391 | Enable additional unit test APIs. This should not typically | |
392 | be used in production deployments. | |
393 | ||
394 | enable-weak-ssl-ciphers | |
395 | Build support for SSL/TLS ciphers that are considered "weak" | |
396 | (e.g. RC4 based ciphersuites). | |
397 | ||
398 | zlib | |
399 | Build with support for zlib compression/decompression. | |
400 | ||
401 | zlib-dynamic | |
402 | Like "zlib", but has OpenSSL load the zlib library | |
403 | dynamically when needed. This is only supported on systems | |
404 | where loading of shared libraries is supported. | |
405 | ||
406 | 386 | |
407 | On Intel hardware, use the 80386 instruction set only | |
408 | (the default x86 code is more efficient, but requires at | |
409 | least a 486). Note: Use compiler flags for any other CPU | |
410 | specific configuration, e.g. "-m32" to build x86 code on | |
411 | an x64 system. | |
d5957691 | 412 | |
ecabf05e MC |
413 | no-<prot> |
414 | Don't build support for negotiating the specified SSL/TLS | |
415 | protocol (one of ssl, ssl3, tls, tls1, tls1_1, tls1_2, dtls, | |
416 | dtls1 or dtls1_2). If "no-tls" is selected then all of tls1, | |
417 | tls1_1 and tls1_2 are disabled. Similarly "no-dtls" will | |
418 | disable dtls1 and dtls1_2. The "no-ssl" option is synonymous | |
419 | with "no-ssl3". Note this only affects version negotiation. | |
420 | OpenSSL will still provide the methods for applications to | |
421 | explicitly select the individual protocol versions. | |
422 | ||
423 | no-<prot>-method | |
424 | As for no-<prot> but in addition do not build the methods for | |
425 | applications to explicitly select individual protocol | |
426 | versions. | |
427 | ||
428 | enable-<alg> | |
429 | Build with support for the specified algorithm, where <alg> | |
430 | is one of: md2 or rc5. | |
431 | ||
432 | no-<alg> | |
433 | Build without support for the specified algorithm, where | |
434 | <alg> is one of: bf, blake2, camellia, cast, chacha, cmac, | |
435 | des, dh, dsa, ecdh, ecdsa, idea, md4, md5, mdc2, ocb, | |
436 | ploy1305, rc2, rc4, rmd160, scrypt, seed or whirlpool. The | |
437 | "ripemd" algorithm is deprecated and if used is synonymous | |
438 | with rmd160. | |
439 | ||
440 | -Dxxx, -lxxx, -Lxxx, -fxxx, -mXXX, -Kxxx | |
441 | These system specific options will be passed through to the | |
442 | compiler to allow you to define preprocessor symbols, specify | |
443 | additional libraries, library directories or other compiler | |
d5957691 | 444 | options. |
b1fe6b43 | 445 | |
79e259e3 | 446 | |
4109b97c RE |
447 | Installation in Detail |
448 | ---------------------- | |
c9f06e7f | 449 | |
4109b97c | 450 | 1a. Configure OpenSSL for your operation system automatically: |
c9f06e7f | 451 | |
b32b8961 RL |
452 | NOTE: This is not available on Windows. |
453 | ||
2acd8ec7 RL |
454 | $ ./config [options] # Unix |
455 | ||
456 | or | |
457 | ||
458 | $ @config [options] ! OpenVMS | |
459 | ||
460 | For the remainder of this text, the Unix form will be used in all | |
461 | examples, please use the appropriate form for your platform. | |
c9f06e7f | 462 | |
4109b97c | 463 | This guesses at your operating system (and compiler, if necessary) and |
b1fe6b43 | 464 | configures OpenSSL based on this guess. Run ./config -t to see |
db209ec2 UM |
465 | if it guessed correctly. If you want to use a different compiler, you |
466 | are cross-compiling for another platform, or the ./config guess was | |
467 | wrong for other reasons, go to step 1b. Otherwise go to step 2. | |
c9f06e7f | 468 | |
b1fe6b43 UM |
469 | On some systems, you can include debugging information as follows: |
470 | ||
471 | $ ./config -d [options] | |
472 | ||
c9f06e7f | 473 | 1b. Configure OpenSSL for your operating system manually |
79e259e3 | 474 | |
4109b97c RE |
475 | OpenSSL knows about a range of different operating system, hardware and |
476 | compiler combinations. To see the ones it knows about, run | |
79e259e3 | 477 | |
2acd8ec7 RL |
478 | $ ./Configure # Unix |
479 | ||
480 | or | |
481 | ||
482 | $ perl Configure # All other platforms | |
483 | ||
484 | For the remainder of this text, the Unix form will be used in all | |
485 | examples, please use the appropriate form for your platform. | |
79e259e3 | 486 | |
4109b97c RE |
487 | Pick a suitable name from the list that matches your system. For most |
488 | operating systems there is a choice between using "cc" or "gcc". When | |
489 | you have identified your system (and if necessary compiler) use this name | |
2acd8ec7 | 490 | as the argument to Configure. For example, a "linux-elf" user would |
4109b97c | 491 | run: |
79e259e3 | 492 | |
b1fe6b43 | 493 | $ ./Configure linux-elf [options] |
79e259e3 | 494 | |
5bb9e2b4 RL |
495 | If your system isn't listed, you will have to create a configuration |
496 | file named Configurations/{something}.conf and add the correct | |
497 | configuration for your system. See the available configs as examples | |
498 | and read Configurations/README and Configurations/README.design for | |
499 | more information. | |
79e259e3 | 500 | |
5bb9e2b4 RL |
501 | The generic configurations "cc" or "gcc" should usually work on 32 bit |
502 | Unix-like systems. | |
503 | ||
fa28bfd6 MC |
504 | Configure creates a build file ("Makefile" on Unix, "makefile" on Windows |
505 | and "descrip.mms" on OpenVMS) from a suitable template in Configurations, | |
506 | and defines various macros in include/openssl/opensslconf.h (generated from | |
507 | include/openssl/opensslconf.h.in). | |
79e259e3 | 508 | |
2acd8ec7 RL |
509 | 1c. Configure OpenSSL for building outside of the source tree. |
510 | ||
511 | OpenSSL can be configured to build in a build directory separate from | |
512 | the directory with the source code. It's done by placing yourself in | |
513 | some other directory and invoking the configuration commands from | |
514 | there. | |
515 | ||
516 | Unix example: | |
517 | ||
518 | $ mkdir /var/tmp/openssl-build | |
519 | $ cd /var/tmp/openssl-build | |
520 | $ /PATH/TO/OPENSSL/SOURCE/config [options] | |
521 | ||
522 | or | |
523 | ||
524 | $ /PATH/TO/OPENSSL/SOURCE/Configure [target] [options] | |
525 | ||
526 | OpenVMS example: | |
527 | ||
528 | $ set default sys$login: | |
529 | $ create/dir [.tmp.openssl-build] | |
530 | $ set default [.tmp.openssl-build] | |
531 | $ @[PATH.TO.OPENSSL.SOURCE]config {options} | |
532 | ||
533 | or | |
534 | ||
535 | $ @[PATH.TO.OPENSSL.SOURCE]Configure {target} {options} | |
536 | ||
b32b8961 RL |
537 | Windows example: |
538 | ||
539 | $ C: | |
540 | $ mkdir \temp-openssl | |
541 | $ cd \temp-openssl | |
542 | $ perl d:\PATH\TO\OPENSSL\SOURCE\Configure {target} {options} | |
543 | ||
2acd8ec7 RL |
544 | Paths can be relative just as well as absolute. Configure will |
545 | do its best to translate them to relative paths whenever possible. | |
546 | ||
462ba4f6 | 547 | 2. Build OpenSSL by running: |
79e259e3 | 548 | |
2acd8ec7 RL |
549 | $ make # Unix |
550 | $ mms ! (or mmk) OpenVMS | |
b32b8961 | 551 | $ nmake # Windows |
79e259e3 | 552 | |
2acd8ec7 RL |
553 | This will build the OpenSSL libraries (libcrypto.a and libssl.a on |
554 | Unix, corresponding on other platforms) and the OpenSSL binary | |
555 | ("openssl"). The libraries will be built in the top-level directory, | |
556 | and the binary will be in the "apps" subdirectory. | |
79e259e3 | 557 | |
2acd8ec7 | 558 | If the build fails, look at the output. There may be reasons for |
9020b862 | 559 | the failure that aren't problems in OpenSSL itself (like missing |
fa28bfd6 MC |
560 | standard headers). If you are having problems you can get help by |
561 | sending an email to the openssl-users email list (see | |
562 | https://www.openssl.org/community/mailinglists.html for details). If it | |
563 | is a bug with OpenSSL itself, please report the problem to | |
564 | <rt@openssl.org> (note that your message will be recorded in the request | |
565 | tracker publicly readable at | |
2acd8ec7 | 566 | https://www.openssl.org/community/index.html#bugs and will be |
d5957691 MC |
567 | forwarded to a public mailing list). Please check out the request |
568 | tracker. Maybe the bug was already reported or has already been | |
569 | fixed. | |
b1fe6b43 | 570 | |
436a376b | 571 | [If you encounter assembler error messages, try the "no-asm" |
b82ccbb7 | 572 | configuration option as an immediate fix.] |
436a376b | 573 | |
91174a91 UM |
574 | Compiling parts of OpenSSL with gcc and others with the system |
575 | compiler will result in unresolved symbols on some systems. | |
576 | ||
462ba4f6 | 577 | 3. After a successful build, the libraries should be tested. Run: |
79e259e3 | 578 | |
2acd8ec7 RL |
579 | $ make test # Unix |
580 | $ mms test ! OpenVMS | |
b32b8961 | 581 | $ nmake test # Windows |
79e259e3 | 582 | |
6616429d | 583 | NOTE: you MUST run the tests from an unprivileged account (or |
f430ba31 | 584 | disable your privileges temporarily if your platform allows it). |
6616429d | 585 | |
2e996acf RL |
586 | If some tests fail, look at the output. There may be reasons for |
587 | the failure that isn't a problem in OpenSSL itself (like a | |
588 | malfunction with Perl). You may want increased verbosity, that | |
589 | can be accomplished like this: | |
590 | ||
be6bdab6 | 591 | $ make VERBOSE=1 test # Unix |
2acd8ec7 | 592 | |
e8173157 | 593 | $ mms /macro=(VERBOSE=1) test ! OpenVMS |
2e996acf | 594 | |
be6bdab6 | 595 | $ nmake VERBOSE=1 test # Windows |
b32b8961 | 596 | |
2e996acf RL |
597 | If you want to run just one or a few specific tests, you can use |
598 | the make variable TESTS to specify them, like this: | |
599 | ||
2acd8ec7 RL |
600 | $ make TESTS='test_rsa test_dsa' test # Unix |
601 | $ mms/macro="TESTS=test_rsa test_dsa" test ! OpenVMS | |
b32b8961 | 602 | $ nmake TESTS='test_rsa test_dsa' test # Windows |
2e996acf | 603 | |
2acd8ec7 | 604 | And of course, you can combine (Unix example shown): |
2e996acf | 605 | |
be6bdab6 | 606 | $ make VERBOSE=1 TESTS='test_rsa test_dsa' test |
2e996acf RL |
607 | |
608 | You can find the list of available tests like this: | |
609 | ||
2acd8ec7 | 610 | $ make list-tests # Unix |
5bb9e2b4 | 611 | $ mms list-tests ! OpenVMS |
b32b8961 | 612 | $ nmake list-tests # Windows |
2e996acf | 613 | |
d40b0622 RL |
614 | Have a look at the manual for the perl module Test::Harness to |
615 | see what other HARNESS_* variables there are. | |
616 | ||
2e996acf | 617 | If you find a problem with OpenSSL itself, try removing any |
2acd8ec7 RL |
618 | compiler optimization flags from the CFLAGS line in Makefile and |
619 | run "make clean; make" or corresponding. | |
2e996acf | 620 | |
fa28bfd6 | 621 | Please send bug reports to <rt@openssl.org>. |
b1fe6b43 | 622 | |
462ba4f6 | 623 | 4. If everything tests ok, install OpenSSL with |
79e259e3 | 624 | |
2acd8ec7 RL |
625 | $ make install # Unix |
626 | $ mms install ! OpenVMS | |
fa28bfd6 | 627 | $ nmake install # Windows |
2acd8ec7 RL |
628 | |
629 | This will install all the software components in this directory | |
630 | tree under PREFIX (the directory given with --prefix or its | |
631 | default): | |
632 | ||
633 | Unix: | |
634 | ||
635 | bin/ Contains the openssl binary and a few other | |
636 | utility scripts. | |
637 | include/openssl | |
638 | Contains the header files needed if you want | |
639 | to build your own programs that use libcrypto | |
640 | or libssl. | |
641 | lib Contains the OpenSSL library files. | |
642 | lib/engines Contains the OpenSSL dynamically loadable engines. | |
643 | share/man/{man1,man3,man5,man7} | |
644 | Contains the OpenSSL man-pages. | |
d5957691 | 645 | share/doc/openssl/html/{man1,man3,man5,man7} |
2acd8ec7 RL |
646 | Contains the HTML rendition of the man-pages. |
647 | ||
648 | OpenVMS ('arch' is replaced with the architecture name, "Alpha" | |
649 | or "ia64"): | |
650 | ||
651 | [.EXE.'arch'] Contains the openssl binary and a few other | |
652 | utility scripts. | |
653 | [.include.openssl] | |
654 | Contains the header files needed if you want | |
655 | to build your own programs that use libcrypto | |
656 | or libssl. | |
657 | [.LIB.'arch'] Contains the OpenSSL library files. | |
658 | [.ENGINES.'arch'] | |
659 | Contains the OpenSSL dynamically loadable engines. | |
660 | [.SYS$STARTUP] Contains startup, login and shutdown scripts. | |
661 | These define appropriate logical names and | |
662 | command symbols. | |
663 | ||
664 | ||
665 | Additionally, install will add the following directories under | |
666 | OPENSSLDIR (the directory given with --openssldir or its default) | |
667 | for you convenience: | |
668 | ||
669 | certs Initially empty, this is the default location | |
670 | for certificate files. | |
671 | private Initially empty, this is the default location | |
672 | for private key files. | |
673 | misc Various scripts. | |
60cdb821 | 674 | |
e5f3045f BM |
675 | Package builders who want to configure the library for standard |
676 | locations, but have the package installed somewhere else so that | |
677 | it can easily be packaged, can use | |
678 | ||
2acd8ec7 RL |
679 | $ make DESTDIR=/tmp/package-root install # Unix |
680 | $ mms/macro="DESTDIR=TMP:[PACKAGE-ROOT]" install ! OpenVMS | |
e5f3045f | 681 | |
3c65577f | 682 | The specified destination directory will be prepended to all |
2acd8ec7 | 683 | installation target paths. |
4fd53220 | 684 | |
2acd8ec7 | 685 | Compatibility issues with previous OpenSSL versions: |
4fd53220 BM |
686 | |
687 | * COMPILING existing applications | |
688 | ||
fa28bfd6 | 689 | OpenSSL 1.1.0 hides a number of structures that were previously |
2acd8ec7 RL |
690 | open. This includes all internal libssl structures and a number |
691 | of EVP types. Accessor functions have been added to allow | |
692 | controlled access to the structures' data. | |
4fd53220 | 693 | |
2acd8ec7 RL |
694 | This means that some software needs to be rewritten to adapt to |
695 | the new ways of doing things. This often amounts to allocating | |
696 | an instance of a structure explicitly where you could previously | |
697 | allocate them on the stack as automatic variables, and using the | |
698 | provided accessor functions where you would previously access a | |
699 | structure's field directly. | |
4fd53220 | 700 | |
2acd8ec7 RL |
701 | Some APIs have changed as well. However, older APIs have been |
702 | preserved when possible. | |
4fd53220 | 703 | |
fa28bfd6 MC |
704 | Environment Variables |
705 | --------------------- | |
706 | ||
707 | A number of environment variables can be used to provide additional control | |
708 | over the build process. Typically these should be defined prior to running | |
709 | config or Configure. Not all environment variables are relevant to all | |
710 | platforms. | |
711 | ||
712 | AR | |
713 | The name of the ar executable to use. | |
714 | ||
715 | CC | |
716 | The compiler to use. Configure will attempt to pick a default | |
717 | compiler for your platform but this choice can be overridden | |
718 | using this variable. Set it to the compiler executable you wish | |
719 | to use, e.g. "gcc" or "clang". | |
720 | ||
721 | CROSS_COMPILE | |
722 | This environment variable has the same meaning as for the | |
723 | "--cross-compile-prefix" Configure flag described above. If both | |
724 | are set then the Configure flag takes precedence. | |
725 | ||
726 | NM | |
727 | The name of the nm executable to use. | |
728 | ||
729 | OPENSSL_LOCAL_CONFIG_DIR | |
730 | OpenSSL comes with a database of information about how it | |
731 | should be built on different platforms. This information is | |
732 | held in ".conf" files in the Configurations directory. See the | |
733 | file Configurations/README for further information about the | |
734 | format of ".conf" files. As well as the standard ".conf" files | |
735 | it is possible to create your own ".conf" files and store them | |
736 | locally, outside the OpenSSL source tree. This environment | |
737 | variable can be set to the directory where these files are held. | |
738 | ||
739 | PERL | |
d513369b RL |
740 | The name of the Perl executable to use when building OpenSSL. |
741 | ||
742 | HASHBANGPERL | |
743 | The command string for the Perl executable to insert in the | |
744 | #! line of perl scripts that will be publically installed. | |
745 | Default: /usr/bin/env perl | |
746 | Note: the value of this variable is added to the same scripts | |
747 | on all platforms, but it's only relevant on Unix-like platforms. | |
fa28bfd6 MC |
748 | |
749 | RC | |
750 | The name of the rc executable to use. The default will be as | |
751 | defined for the target platform in the ".conf" file. If not | |
752 | defined then "windres" will be used. The WINDRES environment | |
753 | variable is synonymous to this. If both are defined then RC | |
754 | takes precedence. | |
755 | ||
756 | RANLIB | |
757 | The name of the ranlib executable to use. | |
758 | ||
759 | WINDRES | |
760 | See RC. | |
761 | ||
762 | Makefile targets | |
763 | ---------------- | |
764 | ||
765 | The Configure script generates a Makefile in a format relevant to the specific | |
766 | platform. The Makefiles provide a number of targets that can be used. Not all | |
767 | targets may be available on all platforms. Only the most common targets are | |
768 | described here. Examine the Makefiles themselves for the full list. | |
769 | ||
770 | all | |
771 | The default target to build all the software components. | |
772 | ||
773 | clean | |
774 | Remove all build artefacts and return the directory to a "clean" | |
775 | state. | |
776 | ||
777 | depend | |
778 | Rebuild the dependencies in the Makefiles. This is a legacy | |
779 | option that no longer needs to be used in OpenSSL 1.1.0. | |
780 | ||
781 | install | |
782 | Install all OpenSSL components. | |
783 | ||
784 | install_sw | |
785 | Only install the OpenSSL software components. | |
786 | ||
787 | install_docs | |
788 | Only install the OpenSSL documentation components. | |
789 | ||
790 | install_man_docs | |
791 | Only install the OpenSSL man pages (Unix only). | |
792 | ||
793 | install_html_docs | |
794 | Only install the OpenSSL html documentation. | |
795 | ||
796 | list-tests | |
797 | Prints a list of all the self test names. | |
798 | ||
799 | test | |
800 | Build and run the OpenSSL self tests. | |
801 | ||
802 | uninstall | |
803 | Uninstall all OpenSSL components. | |
804 | ||
805 | update | |
806 | This is a developer option. If you are developing a patch for | |
807 | OpenSSL you may need to use this if you want to update | |
808 | automatically generated files; add new error codes or add new | |
809 | (or change the visibility of) public API functions. (Unix only). | |
4fd53220 | 810 | |
5f8d5c96 BM |
811 | Note on multi-threading |
812 | ----------------------- | |
813 | ||
814 | For some systems, the OpenSSL Configure script knows what compiler options | |
815 | are needed to generate a library that is suitable for multi-threaded | |
816 | applications. On these systems, support for multi-threading is enabled | |
817 | by default; use the "no-threads" option to disable (this should never be | |
818 | necessary). | |
819 | ||
820 | On other systems, to enable support for multi-threading, you will have | |
33d50ef6 | 821 | to specify at least two options: "threads", and a system-dependent option. |
5f8d5c96 BM |
822 | (The latter is "-D_REENTRANT" on various systems.) The default in this |
823 | case, obviously, is not to include support for multi-threading (but | |
824 | you can still use "no-threads" to suppress an annoying warning message | |
825 | from the Configure script.) | |
826 | ||
35d8fa56 | 827 | OpenSSL provides built-in support for two threading models: pthreads (found on |
8b75603c MC |
828 | most UNIX/Linux systems), and Windows threads. No other threading models are |
829 | supported. If your platform does not provide pthreads or Windows threads then | |
830 | you should Configure with the "no-threads" option. | |
fcc6a1c4 RL |
831 | |
832 | Note on shared libraries | |
833 | ------------------------ | |
834 | ||
ce942199 MC |
835 | For most systems the OpenSSL Configure script knows what is needed to |
836 | build shared libraries for libcrypto and libssl. On these systems | |
837 | the shared libraries will be created by default. This can be suppressed and | |
838 | only static libraries created by using the "no-shared" option. On systems | |
839 | where OpenSSL does not know how to build shared libraries the "no-shared" | |
840 | option will be forced and only static libraries will be created. | |
96c930dd LJ |
841 | |
842 | Note on random number generation | |
843 | -------------------------------- | |
844 | ||
845 | Availability of cryptographically secure random numbers is required for | |
846 | secret key generation. OpenSSL provides several options to seed the | |
847 | internal PRNG. If not properly seeded, the internal PRNG will refuse | |
848 | to deliver random bytes and a "PRNG not seeded error" will occur. | |
849 | On systems without /dev/urandom (or similar) device, it may be necessary | |
fa28bfd6 | 850 | to install additional support software to obtain a random seed. |
96c930dd LJ |
851 | Please check out the manual pages for RAND_add(), RAND_bytes(), RAND_egd(), |
852 | and the FAQ for more information. | |
4a9476dd | 853 |