xref: /freebsd/crypto/openssl/INSTALL.md (revision e7be843b4a162e68651d3911f0357ed464915629)
1Build and Install
2=================
3
4This document describes installation on all supported operating
5systems: the Unix/Linux family (including macOS), OpenVMS,
6and Windows.
7
8Table of Contents
9=================
10
11 - [Prerequisites](#prerequisites)
12 - [Notational Conventions](#notational-conventions)
13 - [Quick Installation Guide](#quick-installation-guide)
14   - [Building OpenSSL](#building-openssl)
15   - [Installing OpenSSL](#installing-openssl)
16 - [Configuration Options](#configuration-options)
17   - [API Level](#api-level)
18   - [Cross Compile Prefix](#cross-compile-prefix)
19   - [Build Type](#build-type)
20   - [Directories](#directories)
21   - [Compiler Warnings](#compiler-warnings)
22   - [Compression Algorithm Flags](#compression-algorithm-flags)
23   - [Seeding the Random Generator](#seeding-the-random-generator)
24   - [Setting the FIPS HMAC key](#setting-the-FIPS-HMAC-key)
25   - [Enable and Disable Features](#enable-and-disable-features)
26   - [Displaying configuration data](#displaying-configuration-data)
27 - [Installation Steps in Detail](#installation-steps-in-detail)
28   - [Configure](#configure-openssl)
29   - [Build](#build-openssl)
30   - [Test](#test-openssl)
31   - [Install](#install-openssl)
32 - [Advanced Build Options](#advanced-build-options)
33   - [Environment Variables](#environment-variables)
34   - [Makefile Targets](#makefile-targets)
35   - [Running Selected Tests](#running-selected-tests)
36 - [Troubleshooting](#troubleshooting)
37   - [Configuration Problems](#configuration-problems)
38   - [Build Failures](#build-failures)
39   - [Test Failures](#test-failures)
40 - [Notes](#notes)
41   - [Notes on multi-threading](#notes-on-multi-threading)
42   - [Notes on shared libraries](#notes-on-shared-libraries)
43   - [Notes on random number generation](#notes-on-random-number-generation)
44   - [Notes on assembler modules compilation](#notes-on-assembler-modules-compilation)
45
46Prerequisites
47=============
48
49To install OpenSSL, you will need:
50
51 * A "make" implementation
52 * Perl 5 with core modules (please read [NOTES-PERL.md](NOTES-PERL.md))
53 * The Perl module `Text::Template` (please read [NOTES-PERL.md](NOTES-PERL.md))
54 * an ANSI C compiler
55 * POSIX C library (at least POSIX.1-2008), or compatible types and
56   functionality.
57 * a development environment in the form of development libraries and C
58   header files
59 * a supported operating system
60
61For additional platform specific requirements, solutions to specific
62issues and other details, please read one of these:
63
64 * [Notes for UNIX-like platforms](NOTES-UNIX.md)
65 * [Notes for Android platforms](NOTES-ANDROID.md)
66 * [Notes for Windows platforms](NOTES-WINDOWS.md)
67 * [Notes for the DOS platform with DJGPP](NOTES-DJGPP.md)
68 * [Notes for the OpenVMS platform](NOTES-VMS.md)
69 * [Notes for the HPE NonStop platform](NOTES-NONSTOP.md)
70 * [Notes on POSIX](NOTES-POSIX.md)
71 * [Notes on Perl](NOTES-PERL.md)
72 * [Notes on Valgrind](NOTES-VALGRIND.md)
73
74Notational conventions
75======================
76
77Throughout this document, we use the following conventions.
78
79Commands
80--------
81
82Any line starting with a dollar sign is a command line.
83
84    $ command
85
86The dollar sign indicates the shell prompt and is not to be entered as
87part of the command.
88
89Choices
90-------
91
92Several words in curly braces separated by pipe characters indicate a
93**mandatory choice**, to be replaced with one of the given words.
94For example, the line
95
96    $ echo { WORD1 | WORD2 | WORD3 }
97
98represents one of the following three commands
99
100    $ echo WORD1
101    - or -
102    $ echo WORD2
103    - or -
104    $ echo WORD3
105
106One or several words in square brackets separated by pipe characters
107denote an **optional choice**.  It is similar to the mandatory choice,
108but it can also be omitted entirely.
109
110So the line
111
112    $ echo [ WORD1 | WORD2 | WORD3 ]
113
114represents one of the four commands
115
116    $ echo WORD1
117    - or -
118    $ echo WORD2
119    - or -
120    $ echo WORD3
121    - or -
122    $ echo
123
124Arguments
125---------
126
127**Optional Arguments** are enclosed in square brackets.
128
129    [option...]
130
131A trailing ellipsis means that more than one could be specified.
132
133Quick Installation Guide
134========================
135
136If you just want to get OpenSSL installed without bothering too much
137about the details, here is the short version of how to build and install
138OpenSSL.  If any of the following steps fails, please consult the
139[Installation in Detail](#installation-steps-in-detail) section below.
140
141Building OpenSSL
142----------------
143
144Use the following commands to configure, build and test OpenSSL.
145The testing is optional, but recommended if you intend to install
146OpenSSL for production use.
147
148### Unix / Linux / macOS / NonStop
149
150    $ ./Configure
151    $ make
152    $ make test
153
154### OpenVMS
155
156Use the following commands to build OpenSSL:
157
158    $ perl Configure
159    $ mms
160    $ mms test
161
162### Windows
163
164If you are using Visual Studio, open a Developer Command Prompt and
165issue the following commands to build OpenSSL.
166
167    $ perl Configure
168    $ nmake
169    $ nmake test
170
171As mentioned in the [Choices](#choices) section, you need to pick one
172of the four Configure targets in the first command.
173
174Most likely you will be using the `VC-WIN64A`/`VC-WIN64A-HYBRIDCRT` target for
17564bit Windows binaries (AMD64) or `VC-WIN32`/`VC-WIN32-HYBRIDCRT` for 32bit
176Windows binaries (X86).
177The other two options are `VC-WIN64I` (Intel IA64, Itanium) and
178`VC-CE` (Windows CE) are rather uncommon nowadays.
179
180Installing OpenSSL
181------------------
182
183The following commands will install OpenSSL to a default system location.
184
185**Danger Zone:** even if you are impatient, please read the following two
186paragraphs carefully before you install OpenSSL.
187
188For security reasons the default system location is by default not writable
189for unprivileged users.  So for the final installation step administrative
190privileges are required.  The default system location and the procedure to
191obtain administrative privileges depends on the operating system.
192It is recommended to compile and test OpenSSL with normal user privileges
193and use administrative privileges only for the final installation step.
194
195On some platforms OpenSSL is preinstalled as part of the Operating System.
196In this case it is highly recommended not to overwrite the system versions,
197because other applications or libraries might depend on it.
198To avoid breaking other applications, install your copy of OpenSSL to a
199[different location](#installing-to-a-different-location) which is not in
200the global search path for system libraries.
201
202Finally, if you plan on using the FIPS module, you need to read the
203[Post-installation Notes](#post-installation-notes) further down.
204
205### Unix / Linux / macOS / NonStop
206
207Depending on your distribution, you need to run the following command as
208root user or prepend `sudo` to the command:
209
210    $ make install
211
212By default, OpenSSL will be installed to
213
214    /usr/local
215
216More precisely, the files will be installed into the  subdirectories
217
218    /usr/local/bin
219    /usr/local/lib
220    /usr/local/include
221    ...
222
223depending on the file type, as it is custom on Unix-like operating systems.
224
225### OpenVMS
226
227Use the following command to install OpenSSL.
228
229    $ mms install
230
231By default, OpenSSL will be installed to
232
233    SYS$COMMON:[OPENSSL]
234
235### Windows
236
237If you are using Visual Studio, open the Developer Command Prompt _elevated_
238and issue the following command.
239
240    $ nmake install
241
242The easiest way to elevate the Command Prompt is to press and hold down both
243the `<CTRL>` and `<SHIFT>` keys while clicking the menu item in the task menu.
244
245The default installation location is
246
247    C:\Program Files\OpenSSL
248
249for native binaries, or
250
251    C:\Program Files (x86)\OpenSSL
252
253for 32bit binaries on 64bit Windows (WOW64).
254
255#### Installing to a different location
256
257To install OpenSSL to a different location (for example into your home
258directory for testing purposes) run `Configure` as shown in the following
259examples.
260
261The options `--prefix` and `--openssldir` are explained in further detail in
262[Directories](#directories) below, and the values used here are mere examples.
263
264On Unix:
265
266    $ ./Configure --prefix=/opt/openssl --openssldir=/usr/local/ssl
267
268On OpenVMS:
269
270    $ perl Configure --prefix=PROGRAM:[INSTALLS] --openssldir=SYS$MANAGER:[OPENSSL]
271
272Note: if you do add options to the configuration command, please make sure
273you've read more than just this Quick Start, such as relevant `NOTES-*` files,
274the options outline below, as configuration options may change the outcome
275in otherwise unexpected ways.
276
277Configuration Options
278=====================
279
280There are several options to `./Configure` to customize the build (note that
281for Windows, the defaults for `--prefix` and `--openssldir` depend on what
282configuration is used and what Windows implementation OpenSSL is built on.
283For more information, see the [Notes for Windows platforms](NOTES-WINDOWS.md).
284
285API Level
286---------
287
288    --api=x.y[.z]
289
290Build the OpenSSL libraries to support the API for the specified version.
291If [no-deprecated](#no-deprecated) is also given, don't build with support
292for deprecated APIs in or below the specified version number.  For example,
293adding
294
295    --api=1.1.0 no-deprecated
296
297will remove support for all APIs that were deprecated in OpenSSL version
2981.1.0 or below.  This is a rather specialized option for developers.
299If you just intend to remove all deprecated APIs up to the current version
300entirely, just specify [no-deprecated](#no-deprecated).
301If `--api` isn't given, it defaults to the current (minor) OpenSSL version.
302
303Cross Compile Prefix
304--------------------
305
306    --cross-compile-prefix=<PREFIX>
307
308The `<PREFIX>` to include in front of commands for your toolchain.
309
310It is likely to have to end with dash, e.g. `a-b-c-` would invoke GNU compiler
311as `a-b-c-gcc`, etc.  Unfortunately cross-compiling is too case-specific to put
312together one-size-fits-all instructions.  You might have to pass more flags or
313set up environment variables to actually make it work.  Android and iOS cases
314are discussed in corresponding `Configurations/15-*.conf` files.  But there are
315cases when this option alone is sufficient.  For example to build the mingw64
316target on Linux `--cross-compile-prefix=x86_64-w64-mingw32-` works.  Naturally
317provided that mingw packages are installed.  Today Debian and Ubuntu users
318have option to install a number of prepackaged cross-compilers along with
319corresponding run-time and development packages for "alien" hardware.  To give
320another example `--cross-compile-prefix=mipsel-linux-gnu-` suffices in such
321case.
322
323For cross compilation, you must [configure manually](#manual-configuration).
324Also, note that `--openssldir` refers to target's file system, not one you are
325building on.
326
327Build Type
328----------
329
330    --debug
331
332Build OpenSSL with debugging symbols and zero optimization level.
333
334    --release
335
336Build OpenSSL without debugging symbols.  This is the default.
337
338Directories
339-----------
340
341### libdir
342
343    --libdir=DIR
344
345The name of the directory under the top of the installation directory tree
346(see the `--prefix` option) where libraries will be installed.  By default
347this is `lib`. Note that on Windows only static libraries (`*.lib`) will
348be stored in this location. Shared libraries (`*.dll`) will always be
349installed to the `bin` directory.
350
351Some build targets have a multilib postfix set in the build configuration.
352For these targets the default libdir is `lib<multilib-postfix>`. Please use
353`--libdir=lib` to override the libdir if adding the postfix is undesirable.
354
355### openssldir
356
357    --openssldir=DIR
358
359Directory for OpenSSL configuration files, and also the default certificate
360and key store.  Defaults are:
361
362    Unix:           /usr/local/ssl
363    Windows:        C:\Program Files\Common Files\SSL
364    OpenVMS:        SYS$COMMON:[OPENSSL-COMMON]
365
366For 32bit Windows applications on Windows 64bit (WOW64), always replace
367`C:\Program Files` by `C:\Program Files (x86)`.
368
369### prefix
370
371    --prefix=DIR
372
373The top of the installation directory tree.  Defaults are:
374
375    Unix:           /usr/local
376    Windows:        C:\Program Files\OpenSSL
377    OpenVMS:        SYS$COMMON:[OPENSSL]
378
379Compiler Warnings
380-----------------
381
382    --strict-warnings
383
384This is a developer flag that switches on various compiler options recommended
385for OpenSSL development.  It only works when using gcc or clang as the compiler.
386If you are developing a patch for OpenSSL then it is recommended that you use
387this option where possible.
388
389Compression Algorithm Flags
390---------------------------
391
392### with-brotli-include
393
394    --with-brotli-include=DIR
395
396The directory for the location of the brotli include files (i.e. the location
397of the **brotli** include directory).  This option is only necessary if
398[enable-brotli](#enable-brotli) is used and the include files are not already
399on the system include path.
400
401### with-brotli-lib
402
403    --with-brotli-lib=LIB
404
405**On Unix**: this is the directory containing the brotli libraries.
406If not provided, the system library path will be used.
407
408The names of the libraries are:
409
410* libbrotlicommon.a or libbrotlicommon.so
411* libbrotlidec.a or libbrotlidec.so
412* libbrotlienc.a or libbrotlienc.so
413
414**On Windows:** this is the directory containing the brotli libraries.
415If not provided, the system library path will be used.
416
417The names of the libraries are:
418
419* brotlicommon.lib
420* brotlidec.lib
421* brotlienc.lib
422
423### with-zlib-include
424
425    --with-zlib-include=DIR
426
427The directory for the location of the zlib include file.  This option is only
428necessary if [zlib](#zlib) is used and the include file is not
429already on the system include path.
430
431### with-zlib-lib
432
433    --with-zlib-lib=LIB
434
435**On Unix**: this is the directory containing the zlib library.
436If not provided the system library path will be used.
437
438**On Windows:** this is the filename of the zlib library (with or
439without a path).  This flag must be provided if the
440[zlib-dynamic](#zlib-dynamic) option is not also used. If `zlib-dynamic` is used
441then this flag is optional and defaults to `ZLIB1` if not provided.
442
443**On VMS:** this is the filename of the zlib library (with or without a path).
444This flag is optional and if not provided then `GNV$LIBZSHR`, `GNV$LIBZSHR32`
445or `GNV$LIBZSHR64` is used by default depending on the pointer size chosen.
446
447### with-zstd-include
448
449    --with-zstd-include=DIR
450
451The directory for the location of the Zstd include file. This option is only
452necessary if [enable-std](#enable-zstd) is used and the include file is not
453already on the system include path.
454
455OpenSSL requires Zstd 1.4 or greater. The Linux kernel source contains a
456*zstd.h* file that is not compatible with the 1.4.x Zstd distribution, the
457compilation will generate an error if the Linux *zstd.h* is included before
458(or instead of) the Zstd distribution header.
459
460### with-zstd-lib
461
462    --with-zstd-lib=LIB
463
464**On Unix**: this is the directory containing the Zstd library.
465If not provided the system library path will be used.
466
467**On Windows:** this is the filename of the Zstd library (with or
468without a path).  This flag must be provided if the
469[enable-zstd-dynamic](#enable-zstd-dynamic) option is not also used.
470If `zstd-dynamic` is used then this flag is optional and defaults
471to `LIBZSTD` if not provided.
472
473Seeding the Random Generator
474----------------------------
475
476    --with-rand-seed=seed1[,seed2,...]
477
478A comma separated list of seeding methods which will be tried by OpenSSL
479in order to obtain random input (a.k.a "entropy") for seeding its
480cryptographically secure random number generator (CSPRNG).
481The current seeding methods are:
482
483### os
484
485Use a trusted operating system entropy source.
486This is the default method if such an entropy source exists.
487
488### getrandom
489
490Use the [getrandom(2)][man-getrandom] or equivalent system call.
491
492[man-getrandom]: http://man7.org/linux/man-pages/man2/getrandom.2.html
493
494### devrandom
495
496Use the first device from the `DEVRANDOM` list which can be opened to read
497random bytes.  The `DEVRANDOM` preprocessor constant expands to
498
499    "/dev/urandom","/dev/random","/dev/srandom"
500
501on most unix-ish operating systems.
502
503### egd
504
505Check for an entropy generating daemon.
506This source is ignored by the FIPS provider.
507
508### rdcpu
509
510Use the `RDSEED` or `RDRAND` command on x86 or `RNDRRS` command on aarch64
511if provided by the CPU.
512
513### none
514
515Disable automatic seeding.  This is the default on some operating systems where
516no suitable entropy source exists, or no support for it is implemented yet.
517This option is ignored by the FIPS provider.
518
519For more information, see the section [Notes on random number generation][rng]
520at the end of this document.
521
522[rng]: #notes-on-random-number-generation
523
524### jitter
525
526When configured with `enable-jitter`, a "JITTER" RNG is compiled that
527can provide an alternative software seed source. It can be configured
528by setting `seed` option in `openssl.cnf`. A minimal `openssl.cnf` is
529shown below:
530
531    openssl_conf = openssl_init
532
533    [openssl_init]
534    random = random
535
536    [random]
537    seed=JITTER
538
539It uses a statically linked [jitterentropy-library] as the seed source.
540
541Additional configuration flags available:
542
543    --with-jitter-include=DIR
544
545The directory for the location of the jitterentropy.h include file, if
546it is outside the system include path.
547
548    --with-jitter-lib=DIR
549
550This is the directory containing the static libjitterentropy.a
551library, if it is outside the system library path.
552
553Setting the FIPS HMAC key
554-------------------------
555
556    --fips-key=value
557
558As part of its self-test validation, the FIPS module must verify itself
559by performing a SHA-256 HMAC computation on itself. The default key is
560the SHA256 value of "holy hand grenade of antioch" and is sufficient
561for meeting the FIPS requirements.
562
563To change the key to a different value, use this flag. The value should
564be a hex string no more than 64 characters.
565
566Enable and Disable Features
567---------------------------
568
569Feature options always come in pairs, an option to enable feature
570`xxxx`, and an option to disable it:
571
572    [ enable-xxxx | no-xxxx ]
573
574Whether a feature is enabled or disabled by default, depends on the feature.
575In the following list, always the non-default variant is documented: if
576feature `xxxx` is disabled by default then `enable-xxxx` is documented and
577if feature `xxxx` is enabled by default then `no-xxxx` is documented.
578
579### no-afalgeng
580
581Don't build the AFALG engine.
582
583This option will be forced on a platform that does not support AFALG.
584
585### enable-ktls
586
587Build with Kernel TLS support.
588
589This option will enable the use of the Kernel TLS data-path, which can improve
590performance and allow for the use of sendfile and splice system calls on
591TLS sockets.  The Kernel may use TLS accelerators if any are available on the
592system.  This option will be forced off on systems that do not support the
593Kernel TLS data-path.
594
595### enable-asan
596
597Build with the Address sanitiser.
598
599This is a developer option only.  It may not work on all platforms and should
600never be used in production environments.  It will only work when used with
601gcc or clang and should be used in conjunction with the [no-shared](#no-shared)
602option.
603
604### enable-acvp-tests
605
606Build support for Automated Cryptographic Validation Protocol (ACVP)
607tests.
608
609This is required for FIPS validation purposes. Certain ACVP tests require
610access to algorithm internals that are not normally accessible.
611Additional information related to ACVP can be found at
612<https://github.com/usnistgov/ACVP>.
613
614### no-apps
615
616Do not build apps, e.g. the openssl program. This is handy for minimization.
617This option also disables tests.
618
619### no-asm
620
621Do not use assembler code.
622
623This should be viewed as debugging/troubleshooting option rather than for
624production use.  On some platforms a small amount of assembler code may still
625be used even with this option.
626
627### no-async
628
629Do not build support for async operations.
630
631### no-atexit
632
633Do not use `atexit()` in libcrypto builds.
634
635`atexit()` has varied semantics between platforms and can cause SIGSEGV in some
636circumstances. This option disables the atexit registration of OPENSSL_cleanup.
637By default, NonStop configurations use `no-atexit`.
638
639### no-autoalginit
640
641Don't automatically load all supported ciphers and digests.
642
643Typically OpenSSL will make available all of its supported ciphers and digests.
644For a statically linked application this may be undesirable if small executable
645size is an objective.  This only affects libcrypto.  Ciphers and digests will
646have to be loaded manually using `EVP_add_cipher()` and `EVP_add_digest()`
647if this option is used.  This option will force a non-shared build.
648
649### no-autoerrinit
650
651Don't automatically load all libcrypto/libssl error strings.
652
653Typically OpenSSL will automatically load human readable error strings.  For a
654statically linked application this may be undesirable if small executable size
655is an objective.
656
657### enable-brotli
658
659Build with support for brotli compression/decompression.
660
661### enable-brotli-dynamic
662
663Like the enable-brotli option, but has OpenSSL load the brotli library dynamically
664when needed.
665
666This is only supported on systems where loading of shared libraries is supported.
667
668### no-autoload-config
669
670Don't automatically load the default `openssl.cnf` file.
671
672Typically OpenSSL will automatically load a system config file which configures
673default SSL options.
674
675### enable-buildtest-c++
676
677While testing, generate C++ buildtest files that simply check that the public
678OpenSSL header files are usable standalone with C++.
679
680Enabling this option demands extra care.  For any compiler flag given directly
681as configuration option, you must ensure that it's valid for both the C and
682the C++ compiler.  If not, the C++ build test will most likely break.  As an
683alternative, you can use the language specific variables, `CFLAGS` and `CXXFLAGS`.
684
685### --banner=text
686
687Use the specified text instead of the default banner at the end of
688configuration.
689
690### --w
691
692On platforms where the choice of 32-bit or 64-bit architecture
693is not explicitly specified, `Configure` will print a warning
694message and wait for a few seconds to let you interrupt the
695configuration. Using this flag skips the wait.
696
697### no-bulk
698
699Build only some minimal set of features.
700This is a developer option used internally for CI build tests of the project.
701
702### no-cached-fetch
703
704Never cache algorithms when they are fetched from a provider.  Normally, a
705provider indicates if the algorithms it supplies can be cached or not.  Using
706this option will reduce run-time memory usage but it also introduces a
707significant performance penalty.  This option is primarily designed to help
708with detecting incorrect reference counting.
709
710### no-capieng
711
712Don't build the CAPI engine.
713
714This option will be forced if on a platform that does not support CAPI.
715
716### no-cmp
717
718Don't build support for Certificate Management Protocol (CMP)
719and Certificate Request Message Format (CRMF).
720
721### no-cms
722
723Don't build support for Cryptographic Message Syntax (CMS).
724
725### no-comp
726
727Don't build support for SSL/TLS compression.
728
729If this option is enabled (the default), then compression will only work if
730the zlib or `zlib-dynamic` options are also chosen.
731
732### enable-crypto-mdebug
733
734This now only enables the `failed-malloc` feature.
735
736### enable-crypto-mdebug-backtrace
737
738This is a no-op; the project uses the compiler's address/leak sanitizer instead.
739
740### no-ct
741
742Don't build support for Certificate Transparency (CT).
743
744### no-deprecated
745
746Don't build with support for deprecated APIs up until and including the version
747given with `--api` (or the current version, if `--api` wasn't specified).
748
749### no-dgram
750
751Don't build support for datagram based BIOs.
752
753Selecting this option will also force the disabling of DTLS.
754
755### no-docs
756
757Don't build and install documentation, i.e. manual pages in various forms.
758
759### no-dso
760
761Don't build support for loading Dynamic Shared Objects (DSO)
762
763### enable-devcryptoeng
764
765Build the `/dev/crypto` engine.
766
767This option is automatically selected on the BSD platform, in which case it can
768be disabled with `no-devcryptoeng`.
769
770### no-dynamic-engine
771
772Don't build the dynamically loaded engines.
773
774This only has an effect in a shared build.
775
776### no-ec
777
778Don't build support for Elliptic Curves.
779
780### no-ec2m
781
782Don't build support for binary Elliptic Curves
783
784### no-tls-deprecated-ec
785
786Disable legacy TLS EC groups that were deprecated in RFC8422.  These are the
787Koblitz curves, B<secp160r1>, B<secp160r2>, B<secp192r1>, B<secp224r1>, and the
788binary Elliptic curves that would also be disabled by C<no-ec2m>.
789
790### enable-ec_nistp_64_gcc_128
791
792Enable support for optimised implementations of some commonly used NIST
793elliptic curves.
794
795This option is only supported on platforms:
796
797 - with little-endian storage of non-byte types
798 - that tolerate misaligned memory references
799 - where the compiler:
800   - supports the non-standard type `__uint128_t`
801   - defines the built-in macro `__SIZEOF_INT128__`
802
803### enable-egd
804
805Build support for gathering entropy from the Entropy Gathering Daemon (EGD).
806
807### no-engine
808
809Don't build support for loading engines.
810
811### no-err
812
813Don't compile in any error strings.
814
815### enable-external-tests
816
817Enable building of integration with external test suites.
818
819This is a developer option and may not work on all platforms.  The following
820external test suites are currently supported:
821
822 - GOST engine test suite
823 - Python PYCA/Cryptography test suite
824 - krb5 test suite
825
826See the file [test/README-external.md](test/README-external.md)
827for further details.
828
829### no-filenames
830
831Don't compile in filename and line number information (e.g.  for errors and
832memory allocation).
833
834### enable-fips
835
836Build (and install) the FIPS provider
837
838### no-fips-securitychecks
839
840Don't perform FIPS module run-time checks related to enforcement of security
841parameters such as minimum security strength of keys.
842
843### no-fips-post
844
845Don't perform FIPS module Power On Self Tests.
846
847This option MUST be used for debugging only as it makes the FIPS provider
848non-compliant. It is useful when setting breakpoints in FIPS algorithms.
849
850### enable-fips-jitter
851
852Use the CPU Jitter library as a FIPS validated entropy source.
853
854This option will only produce a compliant FIPS provider if you have:
855
8561. independently performed the required [SP 800-90B] entropy assessments;
8572. meet the minimum required entropy as specified by [jitterentropy-library];
8583. obtain an [ESV] certificate for the [jitterentropy-library] and
8594. have had the resulting FIPS provider certified by the [CMVP].
860
861Failure to do all of these will produce a non-compliant FIPS provider.
862
863### enable-fuzz-libfuzzer, enable-fuzz-afl
864
865Build with support for fuzzing using either libfuzzer or AFL.
866
867These are developer options only.  They may not work on all  platforms and
868should never be used in production environments.
869
870See the file [fuzz/README.md](fuzz/README.md) for further details.
871
872### no-gost
873
874Don't build support for GOST based ciphersuites.
875
876Note that if this feature is enabled then GOST ciphersuites are only available
877if the GOST algorithms are also available through loading an externally supplied
878engine.
879
880### no-http
881
882Disable HTTP support.
883
884### no-legacy
885
886Don't build the legacy provider.
887
888Disabling this also disables the legacy algorithms: MD2 (already disabled by default).
889
890### no-makedepend
891
892Don't generate dependencies.
893
894### no-ml-dsa
895
896Disable Module-Lattice-Based Digital Signature Standard (ML-DSA) support.
897ML-DSA is based on CRYSTALS-DILITHIUM. See [FIPS 204].
898
899### no-ml-kem
900
901Disable Module-Lattice-Based Key-Encapsulation Mechanism Standard (ML-KEM)
902support.  ML-KEM is based on CRYSTALS-KYBER. See [FIPS 203].
903
904### no-module
905
906Don't build any dynamically loadable engines.
907
908This also implies `no-dynamic-engine`.
909
910### no-multiblock
911
912Don't build support for writing multiple records in one go in libssl
913
914Note: this is a different capability to the pipelining functionality.
915
916### no-nextprotoneg
917
918Don't build support for the Next Protocol Negotiation (NPN) TLS extension.
919
920### no-ocsp
921
922Don't build support for Online Certificate Status Protocol (OCSP).
923
924### no-padlockeng
925
926Don't build the padlock engine.
927
928### no-hw-padlock
929
930As synonym for `no-padlockeng`.  Deprecated and should not be used.
931
932### no-pic
933
934Don't build with support for Position Independent Code.
935
936### enable-pie
937
938Build with support for Position Independent Execution.
939
940### no-pinshared
941
942Don't pin the shared libraries.
943
944By default OpenSSL will attempt to stay in memory until the process exits.
945This is so that libcrypto and libssl can be properly cleaned up automatically
946via an `atexit()` handler.  The handler is registered by libcrypto and cleans
947up both libraries.  On some platforms the `atexit()` handler will run on unload of
948libcrypto (if it has been dynamically loaded) rather than at process exit.
949
950This option can be used to stop OpenSSL from attempting to stay in memory until the
951process exits.  This could lead to crashes if either libcrypto or libssl have
952already been unloaded at the point that the atexit handler is invoked, e.g.  on a
953platform which calls `atexit()` on unload of the library, and libssl is unloaded
954before libcrypto then a crash is likely to happen.
955
956Note that shared library pinning is not automatically disabled for static builds,
957i.e., `no-shared` does not imply `no-pinshared`. This may come as a surprise when
958linking libcrypto statically into a shared third-party library, because in this
959case the shared library will be pinned. To prevent this behaviour, you need to
960configure the static build using `no-shared` and `no-pinshared` together.
961
962Applications can suppress running of the `atexit()` handler at run time by
963using the `OPENSSL_INIT_NO_ATEXIT` option to `OPENSSL_init_crypto()`.
964See the man page for it for further details.
965
966### no-posix-io
967
968Don't use POSIX IO capabilities.
969
970### no-psk
971
972Don't build support for Pre-Shared Key based ciphersuites.
973
974### no-rdrand
975
976Don't use hardware RDRAND capabilities.
977
978### no-rfc3779
979
980Don't build support for RFC3779, "X.509 Extensions for IP Addresses and
981AS Identifiers".
982
983### sctp
984
985Build support for Stream Control Transmission Protocol (SCTP).
986
987### no-shared
988
989Do not create shared libraries, only static ones.
990
991See [Notes on shared libraries](#notes-on-shared-libraries) below.
992
993### no-slh-dsa
994
995Disable Stateless Hash Based Digital Signature Standard support.
996(SLH-DSA is based on SPHINCS+. See [FIPS 205])
997
998### no-sm2-precomp
999
1000Disable using the SM2 precomputed table on aarch64 to make the library smaller.
1001
1002### no-sock
1003
1004Don't build support for socket BIOs.
1005
1006### no-srp
1007
1008Don't build support for Secure Remote Password (SRP) protocol or
1009SRP based ciphersuites.
1010
1011### no-srtp
1012
1013Don't build Secure Real-Time Transport Protocol (SRTP) support.
1014
1015### no-sse2
1016
1017Exclude SSE2 code paths from 32-bit x86 assembly modules.
1018
1019Normally SSE2 extension is detected at run-time, but the decision whether or not
1020the machine code will be executed is taken solely on CPU capability vector.  This
1021means that if you happen to run OS kernel which does not support SSE2 extension
1022on Intel P4 processor, then your application might be exposed to "illegal
1023instruction" exception.  There might be a way to enable support in kernel, e.g.
1024FreeBSD kernel can be compiled with `CPU_ENABLE_SSE`, and there is a way to
1025disengage SSE2 code paths upon application start-up, but if you aim for wider
1026"audience" running such kernel, consider `no-sse2`.  Both the `386` and `no-asm`
1027options imply `no-sse2`.
1028
1029### no-ssl-trace
1030
1031Don't build with SSL Trace capabilities.
1032
1033This removes the `-trace` option from `s_client` and `s_server`, and omits the
1034`SSL_trace()` function from libssl.
1035
1036Disabling `ssl-trace` may provide a small reduction in libssl binary size.
1037
1038### no-static-engine
1039
1040Don't build the statically linked engines.
1041
1042This only has an impact when not built "shared".
1043
1044### no-stdio
1045
1046Don't use anything from the C header file `stdio.h` that makes use of the `FILE`
1047type.  Only libcrypto and libssl can be built in this way.  Using this option will
1048suppress building the command line applications.  Additionally, since the OpenSSL
1049tests also use the command line applications, the tests will also be skipped.
1050
1051### no-tests
1052
1053Don't build test programs or run any tests.
1054
1055### enable-tfo
1056
1057Build with support for TCP Fast Open (RFC7413). Supported on Linux, macOS and FreeBSD.
1058
1059### no-quic
1060
1061Don't build with QUIC support.
1062
1063### no-threads
1064
1065Don't build with support for multi-threaded applications.
1066
1067### threads
1068
1069Build with support for multi-threaded applications.  Most platforms will enable
1070this by default.  However, if on a platform where this is not the case then this
1071will usually require additional system-dependent options!
1072
1073See [Notes on multi-threading](#notes-on-multi-threading) below.
1074
1075### no-thread-pool
1076
1077Don't build with support for thread pool functionality.
1078
1079### thread-pool
1080
1081Build with thread pool functionality. If enabled, OpenSSL algorithms may
1082use the thread pool to perform parallel computation. This option in itself
1083does not enable OpenSSL to spawn new threads. Currently the only supported
1084thread pool mechanism is the default thread pool.
1085
1086### no-default-thread-pool
1087
1088Don't build with support for default thread pool functionality.
1089
1090### default-thread-pool
1091
1092Build with default thread pool functionality. If enabled, OpenSSL may create
1093and manage threads up to a maximum number of threads authorized by the
1094application. Supported on POSIX compliant platforms and Windows.
1095
1096### enable-trace
1097
1098Build with support for the integrated tracing api.
1099
1100See manual pages OSSL_trace_set_channel(3) and OSSL_trace_enabled(3) for details.
1101
1102### enable-sslkeylog
1103
1104Build with support for the SSLKEYLOGFILE environment variable
1105
1106When enabled, setting SSLKEYLOGFILE to a file path records the keys exchanged
1107during a TLS handshake for use in analysis tools like wireshark.  Note that the
1108use of this mechanism allows for decryption of application payloads found in
1109captured packets using keys from the key log file and therefore has significant
1110security consequences.  See Section 3 of
1111[the draft standard for SSLKEYLOGFILE](https://datatracker.ietf.org/doc/draft-ietf-tls-keylogfile/)
1112
1113### no-ts
1114
1115Don't build Time Stamping (TS) Authority support.
1116
1117### enable-ubsan
1118
1119Build with the Undefined Behaviour sanitiser (UBSAN).
1120
1121This is a developer option only.  It may not work on all platforms and should
1122never be used in production environments.  It will only work when used with
1123gcc or clang and should be used in conjunction with the `-DPEDANTIC` option
1124(or the `--strict-warnings` option).
1125
1126### no-ui-console
1127
1128Don't build with the User Interface (UI) console method
1129
1130The User Interface console method enables text based console prompts.
1131
1132### enable-unit-test
1133
1134Enable additional unit test APIs.
1135
1136This should not typically be used in production deployments.
1137
1138### no-uplink
1139
1140Don't build support for UPLINK interface.
1141
1142### enable-weak-ssl-ciphers
1143
1144Build support for SSL/TLS ciphers that are considered "weak"
1145
1146Enabling this includes for example the RC4 based ciphersuites.
1147
1148### zlib
1149
1150Build with support for zlib compression/decompression.
1151
1152### zlib-dynamic
1153
1154Like the zlib option, but has OpenSSL load the zlib library dynamically
1155when needed.
1156
1157This is only supported on systems where loading of shared libraries is supported.
1158
1159### enable-zstd
1160
1161Build with support for Zstd compression/decompression.
1162
1163### enable-zstd-dynamic
1164
1165Like the enable-zstd option, but has OpenSSL load the Zstd library dynamically
1166when needed.
1167
1168This is only supported on systems where loading of shared libraries is supported.
1169
1170### enable-unstable-qlog
1171
1172Enables qlog output support for the QUIC protocol. This functionality is
1173unstable and implements a draft version of the qlog specification. The qlog
1174output from OpenSSL will change in incompatible ways in future, and is not
1175subject to any format stability or compatibility guarantees at this time. See
1176the manpage openssl-qlog(7) for details.
1177
1178### 386
1179
1180In 32-bit x86 builds, use the 80386 instruction set only in assembly modules
1181
1182The default x86 code is more efficient, but requires at least an 486 processor.
1183Note: This doesn't affect compiler generated code, so this option needs to be
1184accompanied by a corresponding compiler-specific option.
1185
1186### no-{protocol}
1187
1188    no-{ssl|ssl3|tls|tls1|tls1_1|tls1_2|tls1_3|dtls|dtls1|dtls1_2}
1189
1190Don't build support for negotiating the specified SSL/TLS protocol.
1191
1192If `no-tls` is selected then all of `tls1`, `tls1_1`, `tls1_2` and `tls1_3`
1193are disabled.
1194Similarly `no-dtls` will disable `dtls1` and `dtls1_2`.  The `no-ssl` option is
1195synonymous with `no-ssl3`.  Note this only affects version negotiation.
1196OpenSSL will still provide the methods for applications to explicitly select
1197the individual protocol versions.
1198
1199### no-integrity-only-ciphers
1200
1201Don't build support for integrity only ciphers in tls.
1202
1203### no-{protocol}-method
1204
1205    no-{ssl3|tls1|tls1_1|tls1_2|dtls1|dtls1_2}-method
1206
1207Analogous to `no-{protocol}` but in addition do not build the methods for
1208applications to explicitly select individual protocol versions.  Note that there
1209is no `no-tls1_3-method` option because there is no application method for
1210TLSv1.3.
1211
1212Using individual protocol methods directly is deprecated.  Applications should
1213use `TLS_method()` instead.
1214
1215### enable-{algorithm}
1216
1217    enable-{md2|rc5}
1218
1219Build with support for the specified algorithm.
1220
1221### no-{algorithm}
1222
1223    no-{aria|bf|blake2|camellia|cast|chacha|cmac|
1224        des|dh|dsa|ecdh|ecdsa|idea|md4|mdc2|ml-dsa|
1225        ml-kem|ocb|poly1305|rc2|rc4|rmd160|scrypt|
1226        seed|siphash|siv|sm2|sm3|sm4|whirlpool}
1227
1228Build without support for the specified algorithm.
1229
1230The `ripemd` algorithm is deprecated and if used is synonymous with `rmd160`.
1231
1232### Compiler-specific options
1233
1234    -Dxxx, -Ixxx, -Wp, -lxxx, -Lxxx, -Wl, -rpath, -R, -framework, -static
1235
1236These system specific options will be recognised and passed through to the
1237compiler to allow you to define preprocessor symbols, specify additional
1238libraries, library directories or other compiler options.  It might be worth
1239noting that some compilers generate code specifically for processor the
1240compiler currently executes on.  This is not necessarily what you might have
1241in mind, since it might be unsuitable for execution on other, typically older,
1242processor.  Consult your compiler documentation.
1243
1244Take note of the [Environment Variables](#environment-variables) documentation
1245below and how these flags interact with those variables.
1246
1247    -xxx, +xxx, /xxx
1248
1249Additional options that are not otherwise recognised are passed through as
1250they are to the compiler as well.  Unix-style options beginning with a
1251`-` or `+` and Windows-style options beginning with a `/` are recognised.
1252Again, consult your compiler documentation.
1253
1254If the option contains arguments separated by spaces, then the URL-style
1255notation `%20` can be used for the space character in order to avoid having
1256to quote the option.  For example, `-opt%20arg` gets expanded to `-opt arg`.
1257In fact, any ASCII character can be encoded as %xx using its hexadecimal
1258encoding.
1259
1260Take note of the [Environment Variables](#environment-variables) documentation
1261below and how these flags interact with those variables.
1262
1263### Environment Variables
1264
1265    VAR=value
1266
1267Assign the given value to the environment variable `VAR` for `Configure`.
1268
1269These work just like normal environment variable assignments, but are supported
1270on all platforms and are confined to the configuration scripts only.
1271These assignments override the corresponding value in the inherited environment,
1272if there is one.
1273
1274The following variables are used as "`make` variables" and can be used as an
1275alternative to giving preprocessor, compiler and linker options directly as
1276configuration.  The following variables are supported:
1277
1278    AR              The static library archiver.
1279    ARFLAGS         Flags for the static library archiver.
1280    AS              The assembler compiler.
1281    ASFLAGS         Flags for the assembler compiler.
1282    CC              The C compiler.
1283    CFLAGS          Flags for the C compiler.
1284    CXX             The C++ compiler.
1285    CXXFLAGS        Flags for the C++ compiler.
1286    CPP             The C/C++ preprocessor.
1287    CPPFLAGS        Flags for the C/C++ preprocessor.
1288    CPPDEFINES      List of CPP macro definitions, separated
1289                    by a platform specific character (':' or
1290                    space for Unix, ';' for Windows, ',' for
1291                    VMS).  This can be used instead of using
1292                    -D (or what corresponds to that on your
1293                    compiler) in CPPFLAGS.
1294    CPPINCLUDES     List of CPP inclusion directories, separated
1295                    the same way as for CPPDEFINES.  This can
1296                    be used instead of -I (or what corresponds
1297                    to that on your compiler) in CPPFLAGS.
1298    HASHBANGPERL    Perl invocation to be inserted after '#!'
1299                    in public perl scripts (only relevant on
1300                    Unix).
1301    LD              The program linker (not used on Unix, $(CC)
1302                    is used there).
1303    LDFLAGS         Flags for the shared library, DSO and
1304                    program linker.
1305    LDLIBS          Extra libraries to use when linking.
1306                    Takes the form of a space separated list
1307                    of library specifications on Unix and
1308                    Windows, and as a comma separated list of
1309                    libraries on VMS.
1310    RANLIB          The library archive indexer.
1311    RC              The Windows resource compiler.
1312    RCFLAGS         Flags for the Windows resource compiler.
1313    RM              The command to remove files and directories.
1314
1315These cannot be mixed with compiling/linking flags given on the command line.
1316In other words, something like this isn't permitted.
1317
1318    $ ./Configure -DFOO CPPFLAGS=-DBAR -DCOOKIE
1319
1320Backward compatibility note:
1321
1322To be compatible with older configuration scripts, the environment variables
1323are ignored if compiling/linking flags are given on the command line, except
1324for the following:
1325
1326    AR, CC, CXX, CROSS_COMPILE, HASHBANGPERL, PERL, RANLIB, RC, and WINDRES
1327
1328For example, the following command will not see `-DBAR`:
1329
1330    $ CPPFLAGS=-DBAR ./Configure -DCOOKIE
1331
1332However, the following will see both set variables:
1333
1334    $ CC=gcc CROSS_COMPILE=x86_64-w64-mingw32- ./Configure -DCOOKIE
1335
1336If `CC` is set, it is advisable to also set `CXX` to ensure both the C and C++
1337compiler are in the same "family".  This becomes relevant with
1338`enable-external-tests` and `enable-buildtest-c++`.
1339
1340### Reconfigure
1341
1342    reconf
1343    reconfigure
1344
1345Reconfigure from earlier data.
1346
1347This fetches the previous command line options and environment from data
1348saved in `configdata.pm` and runs the configuration process again, using
1349these options and environment.  Note: NO other option is permitted together
1350with `reconf`.  Note: The original configuration saves away values for ALL
1351environment variables that were used, and if they weren't defined, they are
1352still saved away with information that they weren't originally defined.
1353This information takes precedence over environment variables that are
1354defined when reconfiguring.
1355
1356Displaying configuration data
1357-----------------------------
1358
1359The configuration script itself will say very little, and finishes by
1360creating `configdata.pm`.  This perl module can be loaded by other scripts
1361to find all the configuration data, and it can also be used as a script to
1362display all sorts of configuration data in a human readable form.
1363
1364For more information, please do:
1365
1366    $ ./configdata.pm --help                         # Unix
1367
1368or
1369
1370    $ perl configdata.pm --help                      # Windows and VMS
1371
1372Installation Steps in Detail
1373============================
1374
1375Configure OpenSSL
1376-----------------
1377
1378### Automatic Configuration
1379
1380In previous version, the `config` script determined the platform type and
1381compiler and then called `Configure`. Starting with version 3.0, they are
1382the same.
1383
1384#### Unix / Linux / macOS
1385
1386    $ ./Configure [options...]
1387
1388#### OpenVMS
1389
1390    $ perl Configure [options...]
1391
1392#### Windows
1393
1394    $ perl Configure [options...]
1395
1396### Manual Configuration
1397
1398OpenSSL knows about a range of different operating system, hardware and
1399compiler combinations.  To see the ones it knows about, run
1400
1401    $ ./Configure LIST                               # Unix
1402
1403or
1404
1405    $ perl Configure LIST                            # All other platforms
1406
1407For the remainder of this text, the Unix form will be used in all examples.
1408Please use the appropriate form for your platform.
1409
1410Pick a suitable name from the list that matches your system.  For most
1411operating systems there is a choice between using cc or gcc.
1412When you have identified your system (and if necessary compiler) use this
1413name as the argument to `Configure`.  For example, a `linux-elf` user would
1414run:
1415
1416    $ ./Configure linux-elf [options...]
1417
1418### Creating your own Configuration
1419
1420If your system isn't listed, you will have to create a configuration
1421file named `Configurations/YOURFILENAME.conf` (replace `YOURFILENAME`
1422with a filename of your choosing) and add the correct
1423configuration for your system.  See the available configs as examples
1424and read [Configurations/README.md](Configurations/README.md) and
1425[Configurations/README-design.md](Configurations/README-design.md)
1426for more information.
1427
1428The generic configurations `cc` or `gcc` should usually work on 32 bit
1429Unix-like systems.
1430
1431`Configure` creates a build file (`Makefile` on Unix, `makefile` on Windows
1432and `descrip.mms` on OpenVMS) from a suitable template in `Configurations/`,
1433and defines various macros in `include/openssl/configuration.h` (generated
1434from `include/openssl/configuration.h.in`.
1435
1436If none of the generated build files suit your purpose, it's possible to
1437write your own build file template and give its name through the environment
1438variable `BUILDFILE`.  For example, Ninja build files could be supported by
1439writing `Configurations/build.ninja.tmpl` and then configure with `BUILDFILE`
1440set like this (Unix syntax shown, you'll have to adapt for other platforms):
1441
1442    $ BUILDFILE=build.ninja perl Configure [options...]
1443
1444### Out of Tree Builds
1445
1446OpenSSL can be configured to build in a build directory separate from the
1447source code directory.  It's done by placing yourself in some other
1448directory and invoking the configuration commands from there.
1449
1450#### Unix example
1451
1452    $ mkdir /var/tmp/openssl-build
1453    $ cd /var/tmp/openssl-build
1454    $ /PATH/TO/OPENSSL/SOURCE/Configure [options...]
1455
1456#### OpenVMS example
1457
1458    $ set default sys$login:
1459    $ create/dir [.tmp.openssl-build]
1460    $ set default [.tmp.openssl-build]
1461    $ perl D:[PATH.TO.OPENSSL.SOURCE]Configure [options...]
1462
1463#### Windows example
1464
1465    $ C:
1466    $ mkdir \temp-openssl
1467    $ cd \temp-openssl
1468    $ perl d:\PATH\TO\OPENSSL\SOURCE\Configure [options...]
1469
1470Paths can be relative just as well as absolute.  `Configure` will do its best
1471to translate them to relative paths whenever possible.
1472
1473Build OpenSSL
1474-------------
1475
1476Build OpenSSL by running:
1477
1478    $ make                                           # Unix
1479    $ mms                                            ! (or mmk) OpenVMS
1480    $ nmake                                          # Windows
1481
1482This will build the OpenSSL libraries (`libcrypto.a` and `libssl.a` on
1483Unix, corresponding on other platforms) and the OpenSSL binary
1484(`openssl`).  The libraries will be built in the top-level directory,
1485and the binary will be in the `apps/` subdirectory.
1486
1487If the build fails, take a look at the [Build Failures](#build-failures)
1488subsection of the [Troubleshooting](#troubleshooting) section.
1489
1490Test OpenSSL
1491------------
1492
1493After a successful build, and before installing, the libraries should
1494be tested.  Run:
1495
1496    $ make test                                      # Unix
1497    $ mms test                                       ! OpenVMS
1498    $ nmake test                                     # Windows
1499
1500**Warning:** you MUST run the tests from an unprivileged account (or disable
1501your privileges temporarily if your platform allows it).
1502
1503See [test/README.md](test/README.md) for further details how run tests.
1504
1505See [test/README-dev.md](test/README-dev.md) for guidelines on adding tests.
1506
1507Install OpenSSL
1508---------------
1509
1510If everything tests ok, install OpenSSL with
1511
1512    $ make install                                   # Unix
1513    $ mms install                                    ! OpenVMS
1514    $ nmake install                                  # Windows
1515
1516Note that in order to perform the install step above you need to have
1517appropriate permissions to write to the installation directory.
1518
1519The above commands will install all the software components in this
1520directory tree under `<PREFIX>` (the directory given with `--prefix` or
1521its default):
1522
1523### Unix / Linux / macOS
1524
1525    bin/           Contains the openssl binary and a few other
1526                   utility scripts.
1527    include/openssl
1528                   Contains the header files needed if you want
1529                   to build your own programs that use libcrypto
1530                   or libssl.
1531    lib            Contains the OpenSSL library files.
1532    lib/engines    Contains the OpenSSL dynamically loadable engines.
1533
1534    share/man/man1 Contains the OpenSSL command line man-pages.
1535    share/man/man3 Contains the OpenSSL library calls man-pages.
1536    share/man/man5 Contains the OpenSSL configuration format man-pages.
1537    share/man/man7 Contains the OpenSSL other misc man-pages.
1538
1539    share/doc/openssl/html/man1
1540    share/doc/openssl/html/man3
1541    share/doc/openssl/html/man5
1542    share/doc/openssl/html/man7
1543                   Contains the HTML rendition of the man-pages.
1544
1545### OpenVMS
1546
1547'arch' is replaced with the architecture name, `ALPHA` or `IA64`,
1548'sover' is replaced with the shared library version (`0101` for 1.1), and
1549'pz' is replaced with the pointer size OpenSSL was built with:
1550
1551    [.EXE.'arch']  Contains the openssl binary.
1552    [.EXE]         Contains a few utility scripts.
1553    [.include.openssl]
1554                   Contains the header files needed if you want
1555                   to build your own programs that use libcrypto
1556                   or libssl.
1557    [.LIB.'arch']  Contains the OpenSSL library files.
1558    [.ENGINES'sover''pz'.'arch']
1559                   Contains the OpenSSL dynamically loadable engines.
1560    [.SYS$STARTUP] Contains startup, login and shutdown scripts.
1561                   These define appropriate logical names and
1562                   command symbols.
1563    [.SYSTEST]     Contains the installation verification procedure.
1564    [.HTML]        Contains the HTML rendition of the manual pages.
1565
1566### Additional Directories
1567
1568Additionally, install will add the following directories under
1569OPENSSLDIR (the directory given with `--openssldir` or its default)
1570for you convenience:
1571
1572    certs          Initially empty, this is the default location
1573                   for certificate files.
1574    private        Initially empty, this is the default location
1575                   for private key files.
1576    misc           Various scripts.
1577
1578The installation directory should be appropriately protected to ensure
1579unprivileged users cannot make changes to OpenSSL binaries or files, or
1580install engines.  If you already have a pre-installed version of OpenSSL as
1581part of your Operating System it is recommended that you do not overwrite
1582the system version and instead install to somewhere else.
1583
1584Package builders who want to configure the library for standard locations,
1585but have the package installed somewhere else so that it can easily be
1586packaged, can use
1587
1588    $ make DESTDIR=/tmp/package-root install         # Unix
1589    $ mms/macro="DESTDIR=TMP:[PACKAGE-ROOT]" install ! OpenVMS
1590
1591The specified destination directory will be prepended to all installation
1592target paths.
1593
1594Compatibility issues with previous OpenSSL versions
1595---------------------------------------------------
1596
1597### COMPILING existing applications
1598
1599Starting with version 1.1.0, OpenSSL hides a number of structures that were
1600previously open.  This includes all internal libssl structures and a number
1601of EVP types.  Accessor functions have been added to allow controlled access
1602to the structures' data.
1603
1604This means that some software needs to be rewritten to adapt to the new ways
1605of doing things.  This often amounts to allocating an instance of a structure
1606explicitly where you could previously allocate them on the stack as automatic
1607variables, and using the provided accessor functions where you would previously
1608access a structure's field directly.
1609
1610Some APIs have changed as well.  However, older APIs have been preserved when
1611possible.
1612
1613Post-installation Notes
1614-----------------------
1615
1616With the default OpenSSL installation comes a FIPS provider module, which
1617needs some post-installation attention, without which it will not be usable.
1618This involves using the following command:
1619
1620    $ openssl fipsinstall
1621
1622See the openssl-fipsinstall(1) manual for details and examples.
1623
1624Advanced Build Options
1625======================
1626
1627Environment Variables
1628---------------------
1629
1630A number of environment variables can be used to provide additional control
1631over the build process.  Typically these should be defined prior to running
1632`Configure`.  Not all environment variables are relevant to all platforms.
1633
1634    AR
1635                   The name of the ar executable to use.
1636
1637    BUILDFILE
1638                   Use a different build file name than the platform default
1639                   ("Makefile" on Unix-like platforms, "makefile" on native Windows,
1640                   "descrip.mms" on OpenVMS).  This requires that there is a
1641                   corresponding build file template.
1642                   See [Configurations/README.md](Configurations/README.md)
1643                   for further information.
1644
1645    CC
1646                   The compiler to use. Configure will attempt to pick a default
1647                   compiler for your platform but this choice can be overridden
1648                   using this variable. Set it to the compiler executable you wish
1649                   to use, e.g. gcc or clang.
1650
1651    CROSS_COMPILE
1652                   This environment variable has the same meaning as for the
1653                   "--cross-compile-prefix" Configure flag described above. If both
1654                   are set then the Configure flag takes precedence.
1655
1656    HASHBANGPERL
1657                   The command string for the Perl executable to insert in the
1658                   #! line of perl scripts that will be publicly installed.
1659                   Default: /usr/bin/env perl
1660                   Note: the value of this variable is added to the same scripts
1661                   on all platforms, but it's only relevant on Unix-like platforms.
1662
1663    KERNEL_BITS
1664                   This can be the value `32` or `64` to specify the architecture
1665                   when it is not "obvious" to the configuration. It should generally
1666                   not be necessary to specify this environment variable.
1667
1668    NM
1669                   The name of the nm executable to use.
1670
1671    OPENSSL_LOCAL_CONFIG_DIR
1672                   OpenSSL comes with a database of information about how it
1673                   should be built on different platforms as well as build file
1674                   templates for those platforms. The database is comprised of
1675                   ".conf" files in the Configurations directory.  The build
1676                   file templates reside there as well as ".tmpl" files. See the
1677                   file [Configurations/README.md](Configurations/README.md)
1678                   for further information about the format of ".conf" files
1679                   as well as information on the ".tmpl" files.
1680                   In addition to the standard ".conf" and ".tmpl" files, it is
1681                   possible to create your own ".conf" and ".tmpl" files and
1682                   store them locally, outside the OpenSSL source tree.
1683                   This environment variable can be set to the directory where
1684                   these files are held and will be considered by Configure
1685                   before it looks in the standard directories.
1686
1687    PERL
1688                   The name of the Perl executable to use when building OpenSSL.
1689                   Only needed if building should use a different Perl executable
1690                   than what is used to run the Configure script.
1691
1692    RANLIB
1693                   The name of the ranlib executable to use.
1694
1695    RC
1696                   The name of the rc executable to use. The default will be as
1697                   defined for the target platform in the ".conf" file. If not
1698                   defined then "windres" will be used. The WINDRES environment
1699                   variable is synonymous to this. If both are defined then RC
1700                   takes precedence.
1701
1702    WINDRES
1703                   See RC.
1704
1705Makefile Targets
1706----------------
1707
1708The `Configure` script generates a Makefile in a format relevant to the specific
1709platform.  The Makefiles provide a number of targets that can be used.  Not all
1710targets may be available on all platforms.  Only the most common targets are
1711described here.  Examine the Makefiles themselves for the full list.
1712
1713    all
1714                   The target to build all the software components and
1715                   documentation.
1716
1717    build_sw
1718                   Build all the software components.
1719                   THIS IS THE DEFAULT TARGET.
1720
1721    build_docs
1722                   Build all documentation components.
1723
1724    debuginfo
1725                    On unix platforms, this target can be used to create .debug
1726                    libraries, which separate the DWARF information in the
1727                    shared library ELF files into a separate file for use
1728                    in post-mortem (core dump) debugging
1729
1730    clean
1731                   Remove all build artefacts and return the directory to a "clean"
1732                   state.
1733
1734    depend
1735                   Rebuild the dependencies in the Makefiles. This is a legacy
1736                   option that no longer needs to be used since OpenSSL 1.1.0.
1737
1738    install
1739                   Install all OpenSSL components.
1740
1741    install_sw
1742                   Only install the OpenSSL software components.
1743
1744    install_docs
1745                   Only install the OpenSSL documentation components.
1746
1747    install_man_docs
1748                   Only install the OpenSSL man pages (Unix only).
1749
1750    install_html_docs
1751                   Only install the OpenSSL HTML documentation.
1752
1753    install_fips
1754                   Install the FIPS provider module configuration file.
1755
1756    list-tests
1757                   Prints a list of all the self test names.
1758
1759    test
1760                   Build and run the OpenSSL self tests.
1761
1762    uninstall
1763                   Uninstall all OpenSSL components.
1764
1765    reconfigure
1766    reconf
1767                   Re-run the configuration process, as exactly as the last time
1768                   as possible.
1769
1770    update
1771                   This is a developer option. If you are developing a patch for
1772                   OpenSSL you may need to use this if you want to update
1773                   automatically generated files; add new error codes or add new
1774                   (or change the visibility of) public API functions. (Unix only).
1775
1776Running Selected Tests
1777----------------------
1778
1779You can specify a set of tests to be performed
1780using the `make` variable `TESTS`.
1781
1782See the section [Running Selected Tests of
1783test/README.md](test/README.md#running-selected-tests).
1784
1785Troubleshooting
1786===============
1787
1788Configuration Problems
1789----------------------
1790
1791### Selecting the correct target
1792
1793The `./Configure` script tries hard to guess your operating system, but in some
1794cases it does not succeed. You will see a message like the following:
1795
1796    $ ./Configure
1797    Operating system: x86-whatever-minix
1798    This system (minix) is not supported. See file INSTALL.md for details.
1799
1800Even if the automatic target selection by the `./Configure` script fails,
1801chances are that you still might find a suitable target in the `Configurations`
1802directory, which you can supply to the `./Configure` command,
1803possibly after some adjustment.
1804
1805The `Configurations/` directory contains a lot of examples of such targets.
1806The main configuration file is [10-main.conf], which contains all targets that
1807are officially supported by the OpenSSL team. Other configuration files contain
1808targets contributed by other OpenSSL users. The list of targets can be found in
1809a Perl list `my %targets = ( ... )`.
1810
1811    my %targets = (
1812    ...
1813    "target-name" => {
1814        inherit_from     => [ "base-target" ],
1815        CC               => "...",
1816        cflags           => add("..."),
1817        asm_arch         => '...',
1818        perlasm_scheme   => "...",
1819    },
1820    ...
1821    )
1822
1823If you call `./Configure` without arguments, it will give you a list of all
1824known targets. Using `grep`, you can lookup the target definition in the
1825`Configurations/` directory. For example the `android-x86_64` can be found in
1826[Configurations/15-android.conf](Configurations/15-android.conf).
1827
1828The directory contains two README files, which explain the general syntax and
1829design of the configuration files.
1830
1831 - [Configurations/README.md](Configurations/README.md)
1832 - [Configurations/README-design.md](Configurations/README-design.md)
1833
1834If you need further help, try to search the [openssl-users] mailing list
1835or the [GitHub Issues] for existing solutions. If you don't find anything,
1836you can [raise an issue] to ask a question yourself.
1837
1838More about our support resources can be found in the [SUPPORT] file.
1839
1840### Configuration Errors
1841
1842If the `./config` or `./Configure` command fails with an error message,
1843read the error message carefully and try to figure out whether you made
1844a mistake (e.g., by providing a wrong option), or whether the script is
1845working incorrectly. If you think you encountered a bug, please
1846[raise an issue] on GitHub to file a bug report.
1847
1848Along with a short description of the bug, please provide the complete
1849configure command line and the relevant output including the error message.
1850
1851Note: To make the output readable, please add a 'code fence' (three backquotes
1852` ``` ` on a separate line) before and after your output:
1853
1854     ```
1855     ./Configure [your arguments...]
1856
1857     [output...]
1858
1859     ```
1860
1861Build Failures
1862--------------
1863
1864If the build fails, look carefully at the output. Try to locate and understand
1865the error message. It might be that the compiler is already telling you
1866exactly what you need to do to fix your problem.
1867
1868There may be reasons for the failure that aren't problems in OpenSSL itself,
1869for example if the compiler reports missing standard or third party headers.
1870
1871If the build succeeded previously, but fails after a source or configuration
1872change, it might be helpful to clean the build tree before attempting another
1873build.  Use this command:
1874
1875    $ make clean                                     # Unix
1876    $ mms clean                                      ! (or mmk) OpenVMS
1877    $ nmake clean                                    # Windows
1878
1879Assembler error messages can sometimes be sidestepped by using the `no-asm`
1880configuration option. See also [notes](#notes-on-assembler-modules-compilation).
1881
1882Compiling parts of OpenSSL with gcc and others with the system compiler will
1883result in unresolved symbols on some systems.
1884
1885If you are still having problems, try to search the [openssl-users] mailing
1886list or the [GitHub Issues] for existing solutions. If you think you
1887encountered an OpenSSL bug, please [raise an issue] to file a bug report.
1888Please take the time to review the existing issues first; maybe the bug was
1889already reported or has already been fixed.
1890
1891Test Failures
1892-------------
1893
1894If some tests fail, look at the output.  There may be reasons for the failure
1895that isn't a problem in OpenSSL itself (like an OS malfunction or a Perl issue).
1896
1897You may want increased verbosity, that can be accomplished as described in
1898section [Test Failures of test/README.md](test/README.md#test-failures).
1899
1900You may also want to selectively specify which test(s) to perform. This can be
1901done using the `make` variable `TESTS` as described in section [Running
1902Selected Tests of test/README.md](test/README.md#running-selected-tests).
1903
1904If you find a problem with OpenSSL itself, try removing any
1905compiler optimization flags from the `CFLAGS` line in the Makefile and
1906run `make clean; make` or corresponding.
1907
1908To report a bug please open an issue on GitHub, at
1909<https://github.com/openssl/openssl/issues>.
1910
1911Notes
1912=====
1913
1914Notes on multi-threading
1915------------------------
1916
1917For some systems, the OpenSSL `Configure` script knows what compiler options
1918are needed to generate a library that is suitable for multi-threaded
1919applications.  On these systems, support for multi-threading is enabled
1920by default; use the `no-threads` option to disable (this should never be
1921necessary).
1922
1923On other systems, to enable support for multi-threading, you will have
1924to specify at least two options: `threads`, and a system-dependent option.
1925(The latter is `-D_REENTRANT` on various systems.)  The default in this
1926case, obviously, is not to include support for multi-threading (but
1927you can still use `no-threads` to suppress an annoying warning message
1928from the `Configure` script.)
1929
1930OpenSSL provides built-in support for two threading models: pthreads (found on
1931most UNIX/Linux systems), and Windows threads.  No other threading models are
1932supported.  If your platform does not provide pthreads or Windows threads then
1933you should use `Configure` with the `no-threads` option.
1934
1935For pthreads, all locks are non-recursive. In addition, in a debug build,
1936the mutex attribute `PTHREAD_MUTEX_ERRORCHECK` is used. If this is not
1937available on your platform, you might have to add
1938`-DOPENSSL_NO_MUTEX_ERRORCHECK` to your `Configure` invocation.
1939(On Linux `PTHREAD_MUTEX_ERRORCHECK` is an enum value, so a built-in
1940ifdef test cannot be used.)
1941
1942Notes on shared libraries
1943-------------------------
1944
1945For most systems the OpenSSL `Configure` script knows what is needed to
1946build shared libraries for libcrypto and libssl.  On these systems
1947the shared libraries will be created by default.  This can be suppressed and
1948only static libraries created by using the `no-shared` option.  On systems
1949where OpenSSL does not know how to build shared libraries the `no-shared`
1950option will be forced and only static libraries will be created.
1951
1952Shared libraries are named a little differently on different platforms.
1953One way or another, they all have the major OpenSSL version number as
1954part of the file name, i.e.  for OpenSSL 1.1.x, `1.1` is somehow part of
1955the name.
1956
1957On most POSIX platforms, shared libraries are named `libcrypto.so.1.1`
1958and `libssl.so.1.1`.
1959
1960on Cygwin, shared libraries are named `cygcrypto-1.1.dll` and `cygssl-1.1.dll`
1961with import libraries `libcrypto.dll.a` and `libssl.dll.a`.
1962
1963On Windows build with MSVC or using MingW, shared libraries are named
1964`libcrypto-1_1.dll` and `libssl-1_1.dll` for 32-bit Windows,
1965`libcrypto-1_1-x64.dll` and `libssl-1_1-x64.dll` for 64-bit x86_64 Windows,
1966and `libcrypto-1_1-ia64.dll` and `libssl-1_1-ia64.dll` for IA64 Windows.
1967With MSVC, the import libraries are named `libcrypto.lib` and `libssl.lib`,
1968while with MingW, they are named `libcrypto.dll.a` and `libssl.dll.a`.
1969
1970On VMS, shareable images (VMS speak for shared libraries) are named
1971`ossl$libcrypto0101_shr.exe` and `ossl$libssl0101_shr.exe`.  However, when
1972OpenSSL is specifically built for 32-bit pointers, the shareable images
1973are named `ossl$libcrypto0101_shr32.exe` and `ossl$libssl0101_shr32.exe`
1974instead, and when built for 64-bit pointers, they are named
1975`ossl$libcrypto0101_shr64.exe` and `ossl$libssl0101_shr64.exe`.
1976
1977Notes on random number generation
1978---------------------------------
1979
1980Availability of cryptographically secure random numbers is required for
1981secret key generation.  OpenSSL provides several options to seed the
1982internal CSPRNG.  If not properly seeded, the internal CSPRNG will refuse
1983to deliver random bytes and a "PRNG not seeded error" will occur.
1984
1985The seeding method can be configured using the `--with-rand-seed` option,
1986which can be used to specify a comma separated list of seed methods.
1987However, in most cases OpenSSL will choose a suitable default method,
1988so it is not necessary to explicitly provide this option.  Note also
1989that not all methods are available on all platforms.  The FIPS provider will
1990silently ignore seed sources that were not validated.
1991
1992I) On operating systems which provide a suitable randomness source (in
1993form  of a system call or system device), OpenSSL will use the optimal
1994available  method to seed the CSPRNG from the operating system's
1995randomness sources.  This corresponds to the option `--with-rand-seed=os`.
1996
1997II) On systems without such a suitable randomness source, automatic seeding
1998and reseeding is disabled (`--with-rand-seed=none`) and it may be necessary
1999to install additional support software to obtain a random seed and reseed
2000the CSPRNG manually.  Please check out the manual pages for `RAND_add()`,
2001`RAND_bytes()`, `RAND_egd()`, and the FAQ for more information.
2002
2003Notes on assembler modules compilation
2004--------------------------------------
2005
2006Compilation of some code paths in assembler modules might depend on whether the
2007current assembler version supports certain ISA extensions or not. Code paths
2008that use the AES-NI, PCLMULQDQ, SSSE3, and SHA extensions are always assembled.
2009Apart from that, the minimum requirements for the assembler versions are shown
2010in the table below:
2011
2012| ISA extension | GNU as | nasm   | llvm    |
2013|---------------|--------|--------|---------|
2014| AVX           | 2.19   | 2.09   | 3.0     |
2015| AVX2          | 2.22   | 2.10   | 3.1     |
2016| ADCX/ADOX     | 2.23   | 2.10   | 3.3     |
2017| AVX512        | 2.25   | 2.11.8 | 3.6 (*) |
2018| AVX512IFMA    | 2.26   | 2.11.8 | 6.0 (*) |
2019| VAES          | 2.30   | 2.13.3 | 6.0 (*) |
2020
2021---
2022
2023(*) Even though AVX512 support was implemented in llvm 3.6, prior to version 7.0
2024an explicit -march flag was apparently required to compile assembly modules. But
2025then the compiler generates processor-specific code, which in turn contradicts
2026the idea of performing dispatch at run-time, which is facilitated by the special
2027variable `OPENSSL_ia32cap`. For versions older than 7.0, it is possible to work
2028around the problem by forcing the build procedure to use the following script:
2029
2030    #!/bin/sh
2031    exec clang -no-integrated-as "$@"
2032
2033instead of the real clang. In which case it doesn't matter what clang version
2034is used, as it is the version of the GNU assembler that will be checked.
2035
2036---
2037
2038<!-- Links  -->
2039
2040[openssl-users]:
2041    <https://mta.openssl.org/mailman/listinfo/openssl-users>
2042
2043[SUPPORT]:
2044    ./SUPPORT.md
2045
2046[GitHub Issues]:
2047    <https://github.com/openssl/openssl/issues>
2048
2049[raise an issue]:
2050    <https://github.com/openssl/openssl/issues/new/choose>
2051
2052[10-main.conf]:
2053    Configurations/10-main.conf
2054
2055[CMVP]:
2056    <https://csrc.nist.gov/projects/cryptographic-module-validation-program>
2057
2058[ESV]:
2059    <https://csrc.nist.gov/Projects/cryptographic-module-validation-program/entropy-validations>
2060
2061[FIPS 203]:
2062    <https://csrc.nist.gov/pubs/fips/203/final>
2063
2064[FIPS 204]:
2065    <https://csrc.nist.gov/pubs/fips/204/final>
2066
2067[SP 800-90B]:
2068    <https://csrc.nist.gov/pubs/sp/800/90/b/final>
2069
2070[jitterentropy-library]:
2071    <https://github.com/smuellerDD/jitterentropy-library>
2072
2073[FIPS 205]:
2074    <https://csrc.nist.gov/pubs/fips/205/final>
2075