Avoid an underflow in ecp_nistp521.c
[openssl.git] / INSTALL
1  OPENSSL INSTALLATION
2  --------------------
3
4  This document describes installation on all supported operating
5  systems (the Unix/Linux family (which includes Mac OS/X), OpenVMS,
6  and Windows).
7
8  To install OpenSSL, you will need:
9
10   * A make implementation
11   * Perl 5 with core modules (please read NOTES.PERL)
12   * The perl module Text::Template (please read NOTES.PERL)
13   * an ANSI C compiler
14   * a development environment in the form of development libraries and C
15     header files
16   * a supported operating system
17
18  For additional platform specific requirements, solutions to specific
19  issues and other details, please read one of these:
20
21   * NOTES.UNIX (any supported Unix like system)
22   * NOTES.VMS (OpenVMS)
23   * NOTES.WIN (any supported Windows)
24   * NOTES.DJGPP (DOS platform with DJGPP)
25   * NOTES.ANDROID (obviously Android [NDK])
26
27  Notational conventions in this document
28  ---------------------------------------
29
30  Throughout this document, we use the following conventions in command
31  examples:
32
33  $ command                      Any line starting with a dollar sign
34                                 ($) is a command line.
35
36  { word1 | word2 | word3 }      This denotes a mandatory choice, to be
37                                 replaced with one of the given words.
38                                 A simple example would be this:
39
40                                 $ echo { FOO | BAR | COOKIE }
41
42                                 which is to be understood as one of
43                                 these:
44
45                                 $ echo FOO
46                                 - or -
47                                 $ echo BAR
48                                 - or -
49                                 $ echo COOKIE
50
51  [ word1 | word2 | word3 ]      Similar to { word1 | word2 | word3 }
52                                 except it's optional to give any of
53                                 those.  In addition to the examples
54                                 above, this would also be valid:
55
56                                 $ echo
57
58  {{ target }}                   This denotes a mandatory word or
59                                 sequence of words of some sort.  A
60                                 simple example would be this:
61
62                                 $ type {{ filename }}
63
64                                 which is to be understood to use the
65                                 command 'type' on some file name
66                                 determined by the user.
67
68  [[ options ]]                  Similar to {{ target }}, but is
69                                 optional.
70
71  Note that the notation assumes spaces around {, }, [, ], {{, }} and
72  [[, ]].  This is to differentiate from OpenVMS directory
73  specifications, which also use [ and ], but without spaces.
74
75  Quick Start
76  -----------
77
78  If you want to just get on with it, do:
79
80   on Unix (again, this includes Mac OS/X):
81
82     $ ./config
83     $ make
84     $ make test
85     $ make install
86
87   on OpenVMS:
88
89     $ @config
90     $ mms
91     $ mms test
92     $ mms install
93
94   on Windows (only pick one of the targets for configuration):
95
96     $ perl Configure { VC-WIN32 | VC-WIN64A | VC-WIN64I | VC-CE }
97     $ nmake
98     $ nmake test
99     $ nmake install
100
101  If any of these steps fails, see section Installation in Detail below.
102
103  This will build and install OpenSSL in the default location, which is:
104
105   Unix:    normal installation directories under /usr/local
106   OpenVMS: SYS$COMMON:[OPENSSL-'version'...], where 'version' is the
107            OpenSSL version number with underscores instead of periods.
108   Windows: C:\Program Files\OpenSSL or C:\Program Files (x86)\OpenSSL
109
110  If you want to install it anywhere else, run config like this:
111
112   On Unix:
113
114     $ ./config --prefix=/opt/openssl --openssldir=/usr/local/ssl
115
116   On OpenVMS:
117
118     $ @config --prefix=PROGRAM:[INSTALLS] --openssldir=SYS$MANAGER:[OPENSSL]
119
120  (Note: if you do add options to the configuration command, please make sure
121  you've read more than just this Quick Start, such as relevant NOTES.* files,
122  the options outline below, as configuration options may change the outcome
123  in otherwise unexpected ways)
124
125
126  Configuration Options
127  ---------------------
128
129  There are several options to ./config (or ./Configure) to customize
130  the build (note that for Windows, the defaults for --prefix and
131  --openssldir depend in what configuration is used and what Windows
132  implementation OpenSSL is built on.  More notes on this in NOTES.WIN):
133
134   --api=x.y.z
135                    Don't build with support for deprecated APIs below the
136                    specified version number. For example "--api=1.1.0" will
137                    remove support for all APIS that were deprecated in OpenSSL
138                    version 1.1.0 or below.
139
140   --cross-compile-prefix=PREFIX
141                    The PREFIX to include in front of commands for your
142                    toolchain. It's likely to have to end with dash, e.g.
143                    a-b-c- would invoke GNU compiler as a-b-c-gcc, etc.
144                    Unfortunately cross-compiling is too case-specific to
145                    put together one-size-fits-all instructions. You might
146                    have to pass more flags or set up environment variables
147                    to actually make it work. Android and iOS cases are
148                    discussed in corresponding Configurations/15-*.conf
149                    files. But there are cases when this option alone is
150                    sufficient. For example to build the mingw64 target on
151                    Linux "--cross-compile-prefix=x86_64-w64-mingw32-"
152                    works. Naturally provided that mingw packages are
153                    installed. Today Debian and Ubuntu users have option to
154                    install a number of prepackaged cross-compilers along
155                    with corresponding run-time and development packages for
156                    "alien" hardware. To give another example
157                    "--cross-compile-prefix=mipsel-linux-gnu-" suffices
158                    in such case. Needless to mention that you have to
159                    invoke ./Configure, not ./config, and pass your target
160                    name explicitly. Also, note that --openssldir refers
161                    to target's file system, not one you are building on.
162
163   --debug
164                    Build OpenSSL with debugging symbols and zero optimization
165                    level.
166
167   --libdir=DIR
168                    The name of the directory under the top of the installation
169                    directory tree (see the --prefix option) where libraries will
170                    be installed. By default this is "lib". Note that on Windows
171                    only ".lib" files will be stored in this location. dll files
172                    will always be installed to the "bin" directory.
173
174   --openssldir=DIR
175                    Directory for OpenSSL configuration files, and also the
176                    default certificate and key store.  Defaults are:
177
178                    Unix:           /usr/local/ssl
179                    Windows:        C:\Program Files\Common Files\SSL
180                                 or C:\Program Files (x86)\Common Files\SSL
181                    OpenVMS:        SYS$COMMON:[OPENSSL-COMMON]
182
183   --prefix=DIR
184                    The top of the installation directory tree.  Defaults are:
185
186                    Unix:           /usr/local
187                    Windows:        C:\Program Files\OpenSSL
188                                 or C:\Program Files (x86)\OpenSSL
189                    OpenVMS:        SYS$COMMON:[OPENSSL-'version']
190
191   --release
192                    Build OpenSSL without debugging symbols. This is the default.
193
194   --strict-warnings
195                    This is a developer flag that switches on various compiler
196                    options recommended for OpenSSL development. It only works
197                    when using gcc or clang as the compiler. If you are
198                    developing a patch for OpenSSL then it is recommended that
199                    you use this option where possible.
200
201   --with-zlib-include=DIR
202                    The directory for the location of the zlib include file. This
203                    option is only necessary if enable-zlib (see below) is used
204                    and the include file is not already on the system include
205                    path.
206
207   --with-zlib-lib=LIB
208                    On Unix: this is the directory containing the zlib library.
209                    If not provided the system library path will be used.
210                    On Windows: this is the filename of the zlib library (with or
211                    without a path). This flag must be provided if the
212                    zlib-dynamic option is not also used. If zlib-dynamic is used
213                    then this flag is optional and a default value ("ZLIB1") is
214                    used if not provided.
215                    On VMS: this is the filename of the zlib library (with or
216                    without a path). This flag is optional and if not provided
217                    then "GNV$LIBZSHR", "GNV$LIBZSHR32" or "GNV$LIBZSHR64" is
218                    used by default depending on the pointer size chosen.
219
220
221   --with-rand-seed=seed1[,seed2,...]
222                    A comma separated list of seeding methods which will be tried
223                    by OpenSSL in order to obtain random input (a.k.a "entropy")
224                    for seeding its cryptographically secure random number
225                    generator (CSPRNG). The current seeding methods are:
226
227                    os:         Use a trusted operating system entropy source.
228                                This is the default method if such an entropy
229                                source exists.
230                    getrandom:  Use the L<getrandom(2)> or equivalent system
231                                call.
232                    devrandom:  Use the the first device from the DEVRANDOM list
233                                which can be opened to read random bytes. The
234                                DEVRANDOM preprocessor constant expands to
235                                "/dev/urandom","/dev/random","/dev/srandom" on
236                                most unix-ish operating systems.
237                    egd:        Check for an entropy generating daemon.
238                    rdcpu:      Use the RDSEED or RDRAND command if provided by
239                                the CPU.
240                    librandom:  Use librandom (not implemented yet).
241                    none:       Disable automatic seeding. This is the default
242                                on some operating systems where no suitable
243                                entropy source exists, or no support for it is
244                                implemented yet.
245
246                    For more information, see the section 'Note on random number
247                    generation' at the end of this document.
248
249   no-afalgeng
250                    Don't build the AFALG engine. This option will be forced if
251                    on a platform that does not support AFALG.
252
253   enable-ktls
254                    Build with Kernel TLS support. This option will enable the
255                    use of the Kernel TLS data-path, which can improve
256                    performance and allow for the use of sendfile and splice
257                    system calls on TLS sockets. The Kernel may use TLS
258                    accelerators if any are available on the system.
259                    This option will be forced off on systems that do not support
260                    the Kernel TLS data-path.
261
262   enable-asan
263                    Build with the Address sanitiser. This is a developer option
264                    only. It may not work on all platforms and should never be
265                    used in production environments. It will only work when used
266                    with gcc or clang and should be used in conjunction with the
267                    no-shared option.
268
269   no-asm
270                    Do not use assembler code. This should be viewed as
271                    debugging/trouble-shooting option rather than production.
272                    On some platforms a small amount of assembler code may
273                    still be used even with this option.
274
275   no-async
276                    Do not build support for async operations.
277
278   no-autoalginit
279                    Don't automatically load all supported ciphers and digests.
280                    Typically OpenSSL will make available all of its supported
281                    ciphers and digests. For a statically linked application this
282                    may be undesirable if small executable size is an objective.
283                    This only affects libcrypto. Ciphers and digests will have to
284                    be loaded manually using EVP_add_cipher() and
285                    EVP_add_digest() if this option is used. This option will
286                    force a non-shared build.
287
288   no-autoerrinit
289                    Don't automatically load all libcrypto/libssl error strings.
290                    Typically OpenSSL will automatically load human readable
291                    error strings. For a statically linked application this may
292                    be undesirable if small executable size is an objective.
293
294   no-autoload-config
295                    Don't automatically load the default openssl.cnf file.
296                    Typically OpenSSL will automatically load a system config
297                    file which configures default ssl options.
298
299   enable-buildtest-c++
300                    While testing, generate C++ buildtest files that
301                    simply check that the public OpenSSL header files
302                    are usable standalone with C++.
303
304                    Enabling this option demands extra care.  For any
305                    compiler flag given directly as configuration
306                    option, you must ensure that it's valid for both
307                    the C and the C++ compiler.  If not, the C++ build
308                    test will most likely break.  As an alternative,
309                    you can use the language specific variables, CFLAGS
310                    and CXXFLAGS.
311
312   no-capieng
313                    Don't build the CAPI engine. This option will be forced if
314                    on a platform that does not support CAPI.
315
316   no-cms
317                    Don't build support for CMS features
318
319   no-comp
320                    Don't build support for SSL/TLS compression. If this option
321                    is left enabled (the default), then compression will only
322                    work if the zlib or zlib-dynamic options are also chosen.
323
324   enable-crypto-mdebug
325                    Build support for debugging memory allocated via
326                    OPENSSL_malloc() or OPENSSL_zalloc().
327
328   enable-crypto-mdebug-backtrace
329                    As for crypto-mdebug, but additionally provide backtrace
330                    information for allocated memory.
331                    TO BE USED WITH CARE: this uses GNU C functionality, and
332                    is therefore not usable for non-GNU config targets.  If
333                    your build complains about the use of '-rdynamic' or the
334                    lack of header file execinfo.h, this option is not for you.
335                    ALSO NOTE that even though execinfo.h is available on your
336                    system (through Gnulib), the functions might just be stubs
337                    that do nothing.
338
339   no-ct
340                    Don't build support for Certificate Transparency.
341
342   no-deprecated
343                    Don't build with support for any deprecated APIs. This is the
344                    same as using "--api" and supplying the latest version
345                    number.
346
347   no-dgram
348                    Don't build support for datagram based BIOs. Selecting this
349                    option will also force the disabling of DTLS.
350
351   enable-devcryptoeng
352                    Build the /dev/crypto engine.  It is automatically selected
353                    on BSD implementations, in which case it can be disabled with
354                    no-devcryptoeng.
355
356   no-dso
357                    Don't build support for loading Dynamic Shared Objects.
358
359   no-dynamic-engine
360                    Don't build the dynamically loaded engines. This only has an
361                    effect in a "shared" build
362
363   no-ec
364                    Don't build support for Elliptic Curves.
365
366   no-ec2m
367                    Don't build support for binary Elliptic Curves
368
369   enable-ec_nistp_64_gcc_128
370                    Enable support for optimised implementations of some commonly
371                    used NIST elliptic curves.
372                    This is only supported on platforms:
373                    - with little-endian storage of non-byte types
374                    - that tolerate misaligned memory references
375                    - where the compiler:
376                      - supports the non-standard type __uint128_t
377                      - defines the built-in macro __SIZEOF_INT128__
378
379   enable-egd
380                    Build support for gathering entropy from EGD (Entropy
381                    Gathering Daemon).
382
383   no-engine
384                    Don't build support for loading engines.
385
386   no-err
387                    Don't compile in any error strings.
388
389   enable-external-tests
390                    Enable building of integration with external test suites.
391                    This is a developer option and may not work on all platforms.
392                    The only supported external test suite at the current time is
393                    the BoringSSL test suite. See the file test/README.external
394                    for further details.
395
396   no-filenames
397                    Don't compile in filename and line number information (e.g.
398                    for errors and memory allocation).
399
400   enable-fuzz-libfuzzer, enable-fuzz-afl
401                    Build with support for fuzzing using either libfuzzer or AFL.
402                    These are developer options only. They may not work on all
403                    platforms and should never be used in production environments.
404                    See the file fuzz/README.md for further details.
405
406   no-gost
407                    Don't build support for GOST based ciphersuites. Note that
408                    if this feature is enabled then GOST ciphersuites are only
409                    available if the GOST algorithms are also available through
410                    loading an externally supplied engine.
411
412   no-makedepend
413                    Don't generate dependencies.
414
415   no-multiblock
416                    Don't build support for writing multiple records in one
417                    go in libssl (Note: this is a different capability to the
418                    pipelining functionality).
419
420   no-nextprotoneg
421                    Don't build support for the NPN TLS extension.
422
423   no-ocsp
424                    Don't build support for OCSP.
425
426   no-padlockeng
427   no-hw-padlock
428                    Don't build the padlock engine.
429                    ('no-hw-padlock' is deprecated and should not be used)
430
431   no-pic
432                    Don't build with support for Position Independent Code.
433
434   no-pinshared     By default OpenSSL will attempt to stay in memory until the
435                    process exits. This is so that libcrypto and libssl can be
436                    properly cleaned up automatically via an "atexit()" handler.
437                    The handler is registered by libcrypto and cleans up both
438                    libraries. On some platforms the atexit() handler will run on
439                    unload of libcrypto (if it has been dynamically loaded)
440                    rather than at process exit. This option can be used to stop
441                    OpenSSL from attempting to stay in memory until the process
442                    exits. This could lead to crashes if either libcrypto or
443                    libssl have already been unloaded at the point
444                    that the atexit handler is invoked, e.g. on a platform which
445                    calls atexit() on unload of the library, and libssl is
446                    unloaded before libcrypto then a crash is likely to happen.
447                    Applications can suppress running of the atexit() handler at
448                    run time by using the OPENSSL_INIT_NO_ATEXIT option to
449                    OPENSSL_init_crypto(). See the man page for it for further
450                    details.
451
452   no-posix-io
453                    Don't use POSIX IO capabilities.
454
455   no-psk
456                    Don't build support for Pre-Shared Key based ciphersuites.
457
458   no-rdrand
459                    Don't use hardware RDRAND capabilities.
460
461   no-rfc3779
462                    Don't build support for RFC3779 ("X.509 Extensions for IP
463                    Addresses and AS Identifiers")
464
465   sctp
466                    Build support for SCTP
467
468   no-shared
469                    Do not create shared libraries, only static ones.  See "Note
470                    on shared libraries" below.
471
472   no-sock
473                    Don't build support for socket BIOs
474
475   no-srp
476                    Don't build support for SRP or SRP based ciphersuites.
477
478   no-srtp
479                    Don't build SRTP support
480
481   no-sse2
482                    Exclude SSE2 code paths from 32-bit x86 assembly modules.
483                    Normally SSE2 extension is detected at run-time, but the
484                    decision whether or not the machine code will be executed
485                    is taken solely on CPU capability vector. This means that
486                    if you happen to run OS kernel which does not support SSE2
487                    extension on Intel P4 processor, then your application
488                    might be exposed to "illegal instruction" exception.
489                    There might be a way to enable support in kernel, e.g.
490                    FreeBSD kernel can  be compiled with CPU_ENABLE_SSE, and
491                    there is a way to disengage SSE2 code paths upon application
492                    start-up, but if you aim for wider "audience" running
493                    such kernel, consider no-sse2. Both the 386 and
494                    no-asm options imply no-sse2.
495
496   enable-ssl-trace
497                    Build with the SSL Trace capabilities (adds the "-trace"
498                    option to s_client and s_server).
499
500   no-static-engine
501                    Don't build the statically linked engines. This only
502                    has an impact when not built "shared".
503
504   no-stdio
505                    Don't use anything from the C header file "stdio.h" that
506                    makes use of the "FILE" type. Only libcrypto and libssl can
507                    be built in this way. Using this option will suppress
508                    building the command line applications. Additionally since
509                    the OpenSSL tests also use the command line applications the
510                    tests will also be skipped.
511
512   no-tests
513                    Don't build test programs or run any test.
514
515   no-threads
516                    Don't try to build with support for multi-threaded
517                    applications.
518
519   threads
520                    Build with support for multi-threaded applications. Most
521                    platforms will enable this by default. However if on a
522                    platform where this is not the case then this will usually
523                    require additional system-dependent options! See "Note on
524                    multi-threading" below.
525
526   no-ts
527                    Don't build Time Stamping Authority support.
528
529   enable-ubsan
530                    Build with the Undefined Behaviour sanitiser. This is a
531                    developer option only. It may not work on all platforms and
532                    should never be used in production environments. It will only
533                    work when used with gcc or clang and should be used in
534                    conjunction with the "-DPEDANTIC" option (or the
535                    --strict-warnings option).
536
537   no-ui
538                    Don't build with the "UI" capability (i.e. the set of
539                    features enabling text based prompts).
540
541   enable-unit-test
542                    Enable additional unit test APIs. This should not typically
543                    be used in production deployments.
544
545   enable-weak-ssl-ciphers
546                    Build support for SSL/TLS ciphers that are considered "weak"
547                    (e.g. RC4 based ciphersuites).
548
549   zlib
550                    Build with support for zlib compression/decompression.
551
552   zlib-dynamic
553                    Like "zlib", but has OpenSSL load the zlib library
554                    dynamically when needed.  This is only supported on systems
555                    where loading of shared libraries is supported.
556
557   386
558                    In 32-bit x86 builds, when generating assembly modules,
559                    use the 80386 instruction set only (the default x86 code
560                    is more efficient, but requires at least a 486). Note:
561                    This doesn't affect code generated by compiler, you're
562                    likely to complement configuration command line with
563                    suitable compiler-specific option.
564
565   no-<prot>
566                    Don't build support for negotiating the specified SSL/TLS
567                    protocol (one of ssl, ssl3, tls, tls1, tls1_1, tls1_2,
568                    tls1_3, dtls, dtls1 or dtls1_2). If "no-tls" is selected then
569                    all of tls1, tls1_1, tls1_2 and tls1_3 are disabled.
570                    Similarly "no-dtls" will disable dtls1 and dtls1_2. The
571                    "no-ssl" option is synonymous with "no-ssl3". Note this only
572                    affects version negotiation. OpenSSL will still provide the
573                    methods for applications to explicitly select the individual
574                    protocol versions.
575
576   no-<prot>-method
577                    As for no-<prot> but in addition do not build the methods for
578                    applications to explicitly select individual protocol
579                    versions. Note that there is no "no-tls1_3-method" option
580                    because there is no application method for TLSv1.3. Using
581                    individual protocol methods directly is deprecated.
582                    Applications should use TLS_method() instead.
583
584   enable-<alg>
585                    Build with support for the specified algorithm, where <alg>
586                    is one of: md2 or rc5.
587
588   no-<alg>
589                    Build without support for the specified algorithm, where
590                    <alg> is one of: aria, bf, blake2, camellia, cast, chacha,
591                    cmac, des, dh, dsa, ecdh, ecdsa, idea, md4, mdc2, ocb,
592                    poly1305, rc2, rc4, rmd160, scrypt, seed, siphash, siv, sm2,
593                    sm3, sm4 or whirlpool.  The "ripemd" algorithm is deprecated
594                    and if used is synonymous with rmd160.
595
596   -Dxxx, -Ixxx, -Wp, -lxxx, -Lxxx, -Wl, -rpath, -R, -framework, -static
597                    These system specific options will be recognised and
598                    passed through to the compiler to allow you to define
599                    preprocessor symbols, specify additional libraries, library
600                    directories or other compiler options. It might be worth
601                    noting that some compilers generate code specifically for
602                    processor the compiler currently executes on. This is not
603                    necessarily what you might have in mind, since it might be
604                    unsuitable for execution on other, typically older,
605                    processor. Consult your compiler documentation.
606
607                    Take note of the VAR=value documentation below and how
608                    these flags interact with those variables.
609
610   -xxx, +xxx
611                    Additional options that are not otherwise recognised are
612                    passed through as they are to the compiler as well.  Again,
613                    consult your compiler documentation.
614
615                    Take note of the VAR=value documentation below and how
616                    these flags interact with those variables.
617
618   VAR=value
619                    Assignment of environment variable for Configure.  These
620                    work just like normal environment variable assignments,
621                    but are supported on all platforms and are confined to
622                    the configuration scripts only.  These assignments override
623                    the corresponding value in the inherited environment, if
624                    there is one.
625
626                    The following variables are used as "make variables" and
627                    can be used as an alternative to giving preprocessor,
628                    compiler and linker options directly as configuration.
629                    The following variables are supported:
630
631                    AR              The static library archiver.
632                    ARFLAGS         Flags for the static library archiver.
633                    AS              The assembler compiler.
634                    ASFLAGS         Flags for the assembler compiler.
635                    CC              The C compiler.
636                    CFLAGS          Flags for the C compiler.
637                    CXX             The C++ compiler.
638                    CXXFLAGS        Flags for the C++ compiler.
639                    CPP             The C/C++ preprocessor.
640                    CPPFLAGS        Flags for the C/C++ preprocessor.
641                    CPPDEFINES      List of CPP macro definitions, separated
642                                    by a platform specific character (':' or
643                                    space for Unix, ';' for Windows, ',' for
644                                    VMS).  This can be used instead of using
645                                    -D (or what corresponds to that on your
646                                    compiler) in CPPFLAGS.
647                    CPPINCLUDES     List of CPP inclusion directories, separated
648                                    the same way as for CPPDEFINES.  This can
649                                    be used instead of -I (or what corresponds
650                                    to that on your compiler) in CPPFLAGS.
651                    HASHBANGPERL    Perl invocation to be inserted after '#!'
652                                    in public perl scripts (only relevant on
653                                    Unix).
654                    LD              The program linker (not used on Unix, $(CC)
655                                    is used there).
656                    LDFLAGS         Flags for the shared library, DSO and
657                                    program linker.
658                    LDLIBS          Extra libraries to use when linking.
659                                    Takes the form of a space separated list
660                                    of library specifications on Unix and
661                                    Windows, and as a comma separated list of
662                                    libraries on VMS.
663                    RANLIB          The library archive indexer.
664                    RC              The Windows resource compiler.
665                    RCFLAGS         Flags for the Windows resource compiler.
666                    RM              The command to remove files and directories.
667
668                    These cannot be mixed with compiling / linking flags given
669                    on the command line.  In other words, something like this
670                    isn't permitted.
671
672                        ./config -DFOO CPPFLAGS=-DBAR -DCOOKIE
673
674                    Backward compatibility note:
675
676                    To be compatible with older configuration scripts, the
677                    environment variables are ignored if compiling / linking
678                    flags are given on the command line, except for these:
679
680                    AR, CC, CXX, CROSS_COMPILE, HASHBANGPERL, PERL, RANLIB, RC
681                    and WINDRES
682
683                    For example, the following command will not see -DBAR:
684
685                         CPPFLAGS=-DBAR ./config -DCOOKIE
686
687                    However, the following will see both set variables:
688
689                         CC=gcc CROSS_COMPILE=x86_64-w64-mingw32- \
690                         ./config -DCOOKIE
691
692                    If CC is set, it is advisable to also set CXX to ensure
693                    both C and C++ compilers are in the same "family".  This
694                    becomes relevant with 'enable-external-tests' and
695                    'enable-buildtest-c++'.
696
697   reconf
698   reconfigure
699                    Reconfigure from earlier data.  This fetches the previous
700                    command line options and environment from data saved in
701                    "configdata.pm", and runs the configuration process again,
702                    using these options and environment.
703                    Note: NO other option is permitted together with "reconf".
704                    This means that you also MUST use "./Configure" (or
705                    what corresponds to that on non-Unix platforms) directly
706                    to invoke this option.
707                    Note: The original configuration saves away values for ALL
708                    environment variables that were used, and if they weren't
709                    defined, they are still saved away with information that
710                    they weren't originally defined.  This information takes
711                    precedence over environment variables that are defined
712                    when reconfiguring.
713
714  Displaying configuration data
715  -----------------------------
716
717  The configuration script itself will say very little, and finishes by
718  creating "configdata.pm".  This perl module can be loaded by other scripts
719  to find all the configuration data, and it can also be used as a script to
720  display all sorts of configuration data in a human readable form.
721
722  For more information, please do:
723
724        $ ./configdata.pm --help                         # Unix
725
726        or
727
728        $ perl configdata.pm --help                      # Windows and VMS
729
730  Installation in Detail
731  ----------------------
732
733  1a. Configure OpenSSL for your operation system automatically:
734
735      NOTE: This is not available on Windows.
736
737        $ ./config [[ options ]]                         # Unix
738
739        or
740
741        $ @config [[ options ]]                          ! OpenVMS
742
743      For the remainder of this text, the Unix form will be used in all
744      examples, please use the appropriate form for your platform.
745
746      This guesses at your operating system (and compiler, if necessary) and
747      configures OpenSSL based on this guess. Run ./config -t to see
748      if it guessed correctly. If you want to use a different compiler, you
749      are cross-compiling for another platform, or the ./config guess was
750      wrong for other reasons, go to step 1b. Otherwise go to step 2.
751
752      On some systems, you can include debugging information as follows:
753
754        $ ./config -d [[ options ]]
755
756  1b. Configure OpenSSL for your operating system manually
757
758      OpenSSL knows about a range of different operating system, hardware and
759      compiler combinations. To see the ones it knows about, run
760
761        $ ./Configure                                    # Unix
762
763        or
764
765        $ perl Configure                                 # All other platforms
766
767      For the remainder of this text, the Unix form will be used in all
768      examples, please use the appropriate form for your platform.
769
770      Pick a suitable name from the list that matches your system. For most
771      operating systems there is a choice between using "cc" or "gcc".  When
772      you have identified your system (and if necessary compiler) use this name
773      as the argument to Configure. For example, a "linux-elf" user would
774      run:
775
776        $ ./Configure linux-elf [[ options ]]
777
778      If your system isn't listed, you will have to create a configuration
779      file named Configurations/{{ something }}.conf and add the correct
780      configuration for your system. See the available configs as examples
781      and read Configurations/README and Configurations/README.design for
782      more information.
783
784      The generic configurations "cc" or "gcc" should usually work on 32 bit
785      Unix-like systems.
786
787      Configure creates a build file ("Makefile" on Unix, "makefile" on Windows
788      and "descrip.mms" on OpenVMS) from a suitable template in Configurations,
789      and defines various macros in include/openssl/opensslconf.h (generated from
790      include/openssl/opensslconf.h.in).
791
792  1c. Configure OpenSSL for building outside of the source tree.
793
794      OpenSSL can be configured to build in a build directory separate from
795      the directory with the source code.  It's done by placing yourself in
796      some other directory and invoking the configuration commands from
797      there.
798
799      Unix example:
800
801        $ mkdir /var/tmp/openssl-build
802        $ cd /var/tmp/openssl-build
803        $ /PATH/TO/OPENSSL/SOURCE/config [[ options ]]
804
805        or
806
807        $ /PATH/TO/OPENSSL/SOURCE/Configure {{ target }} [[ options ]]
808
809      OpenVMS example:
810
811        $ set default sys$login:
812        $ create/dir [.tmp.openssl-build]
813        $ set default [.tmp.openssl-build]
814        $ @[PATH.TO.OPENSSL.SOURCE]config [[ options ]]
815
816        or
817
818        $ @[PATH.TO.OPENSSL.SOURCE]Configure {{ target }} [[ options ]]
819
820      Windows example:
821
822        $ C:
823        $ mkdir \temp-openssl
824        $ cd \temp-openssl
825        $ perl d:\PATH\TO\OPENSSL\SOURCE\Configure {{ target }} [[ options ]]
826
827      Paths can be relative just as well as absolute.  Configure will
828      do its best to translate them to relative paths whenever possible.
829
830   2. Build OpenSSL by running:
831
832        $ make                                           # Unix
833        $ mms                                            ! (or mmk) OpenVMS
834        $ nmake                                          # Windows
835
836      This will build the OpenSSL libraries (libcrypto.a and libssl.a on
837      Unix, corresponding on other platforms) and the OpenSSL binary
838      ("openssl"). The libraries will be built in the top-level directory,
839      and the binary will be in the "apps" subdirectory.
840
841      Troubleshooting:
842
843      If the build fails, look at the output.  There may be reasons
844      for the failure that aren't problems in OpenSSL itself (like
845      missing standard headers).
846
847      If the build succeeded previously, but fails after a source or
848      configuration change, it might be helpful to clean the build tree
849      before attempting another build. Use this command:
850
851        $ make clean                                     # Unix
852        $ mms clean                                      ! (or mmk) OpenVMS
853        $ nmake clean                                    # Windows
854
855      Assembler error messages can sometimes be sidestepped by using the
856      "no-asm" configuration option.
857
858      Compiling parts of OpenSSL with gcc and others with the system
859      compiler will result in unresolved symbols on some systems.
860
861      If you are still having problems you can get help by sending an email
862      to the openssl-users email list (see
863      https://www.openssl.org/community/mailinglists.html for details). If
864      it is a bug with OpenSSL itself, please open an issue on GitHub, at
865      https://github.com/openssl/openssl/issues. Please review the existing
866      ones first; maybe the bug was already reported or has already been
867      fixed.
868
869   3. After a successful build, the libraries should be tested. Run:
870
871        $ make test                                      # Unix
872        $ mms test                                       ! OpenVMS
873        $ nmake test                                     # Windows
874
875      NOTE: you MUST run the tests from an unprivileged account (or
876      disable your privileges temporarily if your platform allows it).
877
878      If some tests fail, look at the output.  There may be reasons for
879      the failure that isn't a problem in OpenSSL itself (like a
880      malfunction with Perl).  You may want increased verbosity, that
881      can be accomplished like this:
882
883        $ make VERBOSE=1 test                            # Unix
884
885        $ mms /macro=(VERBOSE=1) test                    ! OpenVMS
886
887        $ nmake VERBOSE=1 test                           # Windows
888
889      If you want to run just one or a few specific tests, you can use
890      the make variable TESTS to specify them, like this:
891
892        $ make TESTS='test_rsa test_dsa' test            # Unix
893        $ mms/macro="TESTS=test_rsa test_dsa" test       ! OpenVMS
894        $ nmake TESTS='test_rsa test_dsa' test           # Windows
895
896      And of course, you can combine (Unix example shown):
897
898        $ make VERBOSE=1 TESTS='test_rsa test_dsa' test
899
900      You can find the list of available tests like this:
901
902        $ make list-tests                                # Unix
903        $ mms list-tests                                 ! OpenVMS
904        $ nmake list-tests                               # Windows
905
906      Have a look at the manual for the perl module Test::Harness to
907      see what other HARNESS_* variables there are.
908
909      If you find a problem with OpenSSL itself, try removing any
910      compiler optimization flags from the CFLAGS line in Makefile and
911      run "make clean; make" or corresponding.
912
913      To report a bug please open an issue on GitHub, at
914      https://github.com/openssl/openssl/issues.
915
916      For more details on how the make variables TESTS can be used,
917      see section TESTS in Detail below.
918
919   4. If everything tests ok, install OpenSSL with
920
921        $ make install                                   # Unix
922        $ mms install                                    ! OpenVMS
923        $ nmake install                                  # Windows
924
925      This will install all the software components in this directory
926      tree under PREFIX (the directory given with --prefix or its
927      default):
928
929        Unix:
930
931          bin/           Contains the openssl binary and a few other
932                         utility scripts.
933          include/openssl
934                         Contains the header files needed if you want
935                         to build your own programs that use libcrypto
936                         or libssl.
937          lib            Contains the OpenSSL library files.
938          lib/engines    Contains the OpenSSL dynamically loadable engines.
939
940          share/man/man1 Contains the OpenSSL command line man-pages.
941          share/man/man3 Contains the OpenSSL library calls man-pages.
942          share/man/man5 Contains the OpenSSL configuration format man-pages.
943          share/man/man7 Contains the OpenSSL other misc man-pages.
944
945          share/doc/openssl/html/man1
946          share/doc/openssl/html/man3
947          share/doc/openssl/html/man5
948          share/doc/openssl/html/man7
949                         Contains the HTML rendition of the man-pages.
950
951        OpenVMS ('arch' is replaced with the architecture name, "Alpha"
952        or "ia64", 'sover' is replaced with the shared library version
953        (0101 for 1.1), and 'pz' is replaced with the pointer size
954        OpenSSL was built with):
955
956          [.EXE.'arch']  Contains the openssl binary.
957          [.EXE]         Contains a few utility scripts.
958          [.include.openssl]
959                         Contains the header files needed if you want
960                         to build your own programs that use libcrypto
961                         or libssl.
962          [.LIB.'arch']  Contains the OpenSSL library files.
963          [.ENGINES'sover''pz'.'arch']
964                         Contains the OpenSSL dynamically loadable engines.
965          [.SYS$STARTUP] Contains startup, login and shutdown scripts.
966                         These define appropriate logical names and
967                         command symbols.
968          [.SYSTEST]     Contains the installation verification procedure.
969          [.HTML]        Contains the HTML rendition of the manual pages.
970
971
972      Additionally, install will add the following directories under
973      OPENSSLDIR (the directory given with --openssldir or its default)
974      for you convenience:
975
976          certs          Initially empty, this is the default location
977                         for certificate files.
978          private        Initially empty, this is the default location
979                         for private key files.
980          misc           Various scripts.
981
982      Package builders who want to configure the library for standard
983      locations, but have the package installed somewhere else so that
984      it can easily be packaged, can use
985
986        $ make DESTDIR=/tmp/package-root install         # Unix
987        $ mms/macro="DESTDIR=TMP:[PACKAGE-ROOT]" install ! OpenVMS
988
989      The specified destination directory will be prepended to all
990      installation target paths.
991
992   Compatibility issues with previous OpenSSL versions:
993
994   *  COMPILING existing applications
995
996      Starting with version 1.1.0, OpenSSL hides a number of structures
997      that were previously open.  This includes all internal libssl
998      structures and a number of EVP types.  Accessor functions have
999      been added to allow controlled access to the structures' data.
1000
1001      This means that some software needs to be rewritten to adapt to
1002      the new ways of doing things.  This often amounts to allocating
1003      an instance of a structure explicitly where you could previously
1004      allocate them on the stack as automatic variables, and using the
1005      provided accessor functions where you would previously access a
1006      structure's field directly.
1007
1008      Some APIs have changed as well.  However, older APIs have been
1009      preserved when possible.
1010
1011  Environment Variables
1012  ---------------------
1013
1014  A number of environment variables can be used to provide additional control
1015  over the build process. Typically these should be defined prior to running
1016  config or Configure. Not all environment variables are relevant to all
1017  platforms.
1018
1019  AR
1020                 The name of the ar executable to use.
1021
1022  BUILDFILE
1023                 Use a different build file name than the platform default
1024                 ("Makefile" on Unix-like platforms, "makefile" on native Windows,
1025                 "descrip.mms" on OpenVMS).  This requires that there is a
1026                 corresponding build file template.  See Configurations/README
1027                 for further information.
1028
1029  CC
1030                 The compiler to use. Configure will attempt to pick a default
1031                 compiler for your platform but this choice can be overridden
1032                 using this variable. Set it to the compiler executable you wish
1033                 to use, e.g. "gcc" or "clang".
1034
1035  CROSS_COMPILE
1036                 This environment variable has the same meaning as for the
1037                 "--cross-compile-prefix" Configure flag described above. If both
1038                 are set then the Configure flag takes precedence.
1039
1040  NM
1041                 The name of the nm executable to use.
1042
1043  OPENSSL_LOCAL_CONFIG_DIR
1044                 OpenSSL comes with a database of information about how it
1045                 should be built on different platforms as well as build file
1046                 templates for those platforms. The database is comprised of
1047                 ".conf" files in the Configurations directory.  The build
1048                 file templates reside there as well as ".tmpl" files. See the
1049                 file Configurations/README for further information about the
1050                 format of ".conf" files as well as information on the ".tmpl"
1051                 files.
1052                 In addition to the standard ".conf" and ".tmpl" files, it is
1053                 possible to create your own ".conf" and ".tmpl" files and store
1054                 them locally, outside the OpenSSL source tree. This environment
1055                 variable can be set to the directory where these files are held
1056                 and will be considered by Configure before it looks in the
1057                 standard directories.
1058
1059  PERL
1060                 The name of the Perl executable to use when building OpenSSL.
1061                 This variable is used in config script only. Configure on the
1062                 other hand imposes the interpreter by which it itself was
1063                 executed on the whole build procedure.
1064
1065  HASHBANGPERL
1066                 The command string for the Perl executable to insert in the
1067                 #! line of perl scripts that will be publically installed.
1068                 Default: /usr/bin/env perl
1069                 Note: the value of this variable is added to the same scripts
1070                 on all platforms, but it's only relevant on Unix-like platforms.
1071
1072  RC
1073                 The name of the rc executable to use. The default will be as
1074                 defined for the target platform in the ".conf" file. If not
1075                 defined then "windres" will be used. The WINDRES environment
1076                 variable is synonymous to this. If both are defined then RC
1077                 takes precedence.
1078
1079  RANLIB
1080                 The name of the ranlib executable to use.
1081
1082  WINDRES
1083                 See RC.
1084
1085  Makefile targets
1086  ----------------
1087
1088  The Configure script generates a Makefile in a format relevant to the specific
1089  platform. The Makefiles provide a number of targets that can be used. Not all
1090  targets may be available on all platforms. Only the most common targets are
1091  described here. Examine the Makefiles themselves for the full list.
1092
1093  all
1094                 The default target to build all the software components.
1095
1096  clean
1097                 Remove all build artefacts and return the directory to a "clean"
1098                 state.
1099
1100  depend
1101                 Rebuild the dependencies in the Makefiles. This is a legacy
1102                 option that no longer needs to be used since OpenSSL 1.1.0.
1103
1104  install
1105                 Install all OpenSSL components.
1106
1107  install_sw
1108                 Only install the OpenSSL software components.
1109
1110  install_docs
1111                 Only install the OpenSSL documentation components.
1112
1113  install_man_docs
1114                 Only install the OpenSSL man pages (Unix only).
1115
1116  install_html_docs
1117                 Only install the OpenSSL html documentation.
1118
1119  list-tests
1120                 Prints a list of all the self test names.
1121
1122  test
1123                 Build and run the OpenSSL self tests.
1124
1125  uninstall
1126                 Uninstall all OpenSSL components.
1127
1128  reconfigure
1129  reconf
1130                 Re-run the configuration process, as exactly as the last time
1131                 as possible.
1132
1133  update
1134                 This is a developer option. If you are developing a patch for
1135                 OpenSSL you may need to use this if you want to update
1136                 automatically generated files; add new error codes or add new
1137                 (or change the visibility of) public API functions. (Unix only).
1138
1139  TESTS in Detail
1140  ---------------
1141
1142  The make variable TESTS supports a versatile set of space separated tokens
1143  with which you can specify a set of tests to be performed.  With a "current
1144  set of tests" in mind, initially being empty, here are the possible tokens:
1145
1146  alltests       The current set of tests becomes the whole set of available
1147                 tests (as listed when you do 'make list-tests' or similar).
1148  xxx            Adds the test 'xxx' to the current set of tests.
1149  -xxx           Removes 'xxx' from the current set of tests.  If this is the
1150                 first token in the list, the current set of tests is first
1151                 assigned the whole set of available tests, effectively making
1152                 this token equivalent to TESTS="alltests -xxx".
1153  nn             Adds the test group 'nn' (which is a number) to the current
1154                 set of tests.
1155  -nn            Removes the test group 'nn' from the current set of tests.
1156                 If this is the first token in the list, the current set of
1157                 tests is first assigned the whole set of available tests,
1158                 effectively making this token equivalent to
1159                 TESTS="alltests -xxx".
1160
1161  Also, all tokens except for "alltests" may have wildcards, such as *.
1162  (on Unix and Windows, BSD style wildcards are supported, while on VMS,
1163  it's VMS style wildcards)
1164
1165  Example: All tests except for the fuzz tests:
1166
1167  $ make TESTS=-test_fuzz test
1168
1169  or (if you want to be explicit)
1170
1171  $ make TESTS='alltests -test_fuzz' test
1172
1173  Example: All tests that have a name starting with "test_ssl" but not those
1174  starting with "test_ssl_":
1175
1176  $ make TESTS='test_ssl* -test_ssl_*' test
1177
1178  Example: Only test group 10:
1179
1180  $ make TESTS='10'
1181
1182  Example: All tests except the slow group (group 99):
1183
1184  $ make TESTS='-99'
1185
1186  Example: All tests in test groups 80 to 99 except for tests in group 90:
1187
1188  $ make TESTS='[89]? -90'
1189
1190  Note on multi-threading
1191  -----------------------
1192
1193  For some systems, the OpenSSL Configure script knows what compiler options
1194  are needed to generate a library that is suitable for multi-threaded
1195  applications.  On these systems, support for multi-threading is enabled
1196  by default; use the "no-threads" option to disable (this should never be
1197  necessary).
1198
1199  On other systems, to enable support for multi-threading, you will have
1200  to specify at least two options: "threads", and a system-dependent option.
1201  (The latter is "-D_REENTRANT" on various systems.)  The default in this
1202  case, obviously, is not to include support for multi-threading (but
1203  you can still use "no-threads" to suppress an annoying warning message
1204  from the Configure script.)
1205
1206  OpenSSL provides built-in support for two threading models: pthreads (found on
1207  most UNIX/Linux systems), and Windows threads. No other threading models are
1208  supported. If your platform does not provide pthreads or Windows threads then
1209  you should Configure with the "no-threads" option.
1210
1211  Notes on shared libraries
1212  -------------------------
1213
1214  For most systems the OpenSSL Configure script knows what is needed to
1215  build shared libraries for libcrypto and libssl. On these systems
1216  the shared libraries will be created by default. This can be suppressed and
1217  only static libraries created by using the "no-shared" option. On systems
1218  where OpenSSL does not know how to build shared libraries the "no-shared"
1219  option will be forced and only static libraries will be created.
1220
1221  Shared libraries are named a little differently on different platforms.
1222  One way or another, they all have the major OpenSSL version number as
1223  part of the file name, i.e. for OpenSSL 1.1.x, 1.1 is somehow part of
1224  the name.
1225
1226  On most POSIX platforms, shared libraries are named libcrypto.so.1.1
1227  and libssl.so.1.1.
1228
1229  on Cygwin, shared libraries are named cygcrypto-1.1.dll and cygssl-1.1.dll
1230  with import libraries libcrypto.dll.a and libssl.dll.a.
1231
1232  On Windows build with MSVC or using MingW, shared libraries are named
1233  libcrypto-1_1.dll and libssl-1_1.dll for 32-bit Windows, libcrypto-1_1-x64.dll
1234  and libssl-1_1-x64.dll for 64-bit x86_64 Windows, and libcrypto-1_1-ia64.dll
1235  and libssl-1_1-ia64.dll for IA64 Windows.  With MSVC, the import libraries
1236  are named libcrypto.lib and libssl.lib, while with MingW, they are named
1237  libcrypto.dll.a and libssl.dll.a.
1238
1239  On VMS, shareable images (VMS speak for shared libraries) are named
1240  ossl$libcrypto0101_shr.exe and ossl$libssl0101_shr.exe.  However, when
1241  OpenSSL is specifically built for 32-bit pointers, the shareable images
1242  are named ossl$libcrypto0101_shr32.exe and ossl$libssl0101_shr32.exe
1243  instead, and when built for 64-bit pointers, they are named
1244  ossl$libcrypto0101_shr64.exe and ossl$libssl0101_shr64.exe.
1245
1246  Note on random number generation
1247  --------------------------------
1248
1249  Availability of cryptographically secure random numbers is required for
1250  secret key generation. OpenSSL provides several options to seed the
1251  internal CSPRNG. If not properly seeded, the internal CSPRNG will refuse
1252  to deliver random bytes and a "PRNG not seeded error" will occur.
1253
1254  The seeding method can be configured using the --with-rand-seed option,
1255  which can be used to specify a comma separated list of seed methods.
1256  However in most cases OpenSSL will choose a suitable default method,
1257  so it is not necessary to explicitly provide this option. Note also
1258  that not all methods are available on all platforms.
1259
1260  I) On operating systems which provide a suitable randomness source (in
1261  form  of a system call or system device), OpenSSL will use the optimal
1262  available  method to seed the CSPRNG from the operating system's
1263  randomness sources. This corresponds to the option --with-rand-seed=os.
1264
1265  II) On systems without such a suitable randomness source, automatic seeding
1266  and reseeding is disabled (--with-rand-seed=none) and it may be necessary
1267  to install additional support software to obtain a random seed and reseed
1268  the CSPRNG manually.  Please check out the manual pages for RAND_add(),
1269  RAND_bytes(), RAND_egd(), and the FAQ for more information.