Sort cipher-list at runtime.
[openssl.git] / NOTES.WIN
1
2  NOTES FOR THE WINDOWS PLATFORMS
3  ===============================
4
5  [Notes for Windows CE can be found in INSTALL.WCE]
6
7  Requirement details for native (Visual C++) builds
8  --------------------------------------------------
9
10  - You need Perl.  We recommend ActiveState Perl, available from
11    http://www.activestate.com/ActivePerl.
12    You also need the perl module Text::Template, available on CPAN.
13    Please read README.PERL for more information.
14
15  - You need a C compiler.  OpenSSL has been tested to build with these:
16
17    * Visual C++
18
19  - Netwide Assembler, a.k.a. NASM, available from http://www.nasm.us,
20    is required if you intend to utilize assembler modules. Note that NASM
21    is the only supported assembler. The Microsoft provided assembler is NOT
22    supported.
23
24
25  GNU C (Cygwin)
26  --------------
27
28  Cygwin implements a Posix/Unix runtime system (cygwin1.dll) on top of the
29  Windows subsystem and provides a bash shell and GNU tools environment.
30  Consequently, a make of OpenSSL with Cygwin is virtually identical to the
31  Unix procedure.
32
33  To build OpenSSL using Cygwin, you need to:
34
35  * Install Cygwin (see http://cygwin.com/)
36
37  * Install Cygwin Perl and ensure it is in the path. Recall that
38    as least 5.10.0 is required.
39
40  * Run the Cygwin bash shell
41
42  Apart from that, follow the Unix instructions in INSTALL.
43
44  NOTE: "make test" and normal file operations may fail in directories
45  mounted as text (i.e. mount -t c:\somewhere /home) due to Cygwin
46  stripping of carriage returns. To avoid this ensure that a binary
47  mount is used, e.g. mount -b c:\somewhere /home.
48
49  It is also possible to create "conventional" Windows binaries that use
50  the Microsoft C runtime system (msvcrt.dll or crtdll.dll) using MinGW
51  development add-on for Cygwin. MinGW is supported even as a standalone
52  setup as described in the following section. In the context you should
53  recognize that binaries targeting Cygwin itself are not interchangeable
54  with "conventional" Windows binaries you generate with/for MinGW.
55
56  GNU C (MinGW/MSYS)
57  -------------
58
59  * Compiler and shell environment installation:
60
61    MinGW and MSYS are available from http://www.mingw.org/, both are
62    required. Run the installers and do whatever magic they say it takes
63    to start MSYS bash shell with GNU tools and matching Perl on its PATH.
64    "Matching Perl" refers to chosen "shell environment", i.e. if built
65    under MSYS, then Perl compiled for MSYS is highly recommended.
66
67    Alternativelly, one can use MSYS2 from http://msys2.github.io/,
68    which includes MingW (32-bit and 64-bit).
69
70  * It is also possible to cross-compile it on Linux by configuring
71    with './Configure --cross-compile-prefix=i386-mingw32- mingw ...'.
72    Other possible cross compile prefixes include x86_64-w64-mingw32-
73    and i686-w64-mingw32-.
74
75
76  "Classic" builds (Visual C++)
77  ----------------
78
79  [OpenSSL was classically built using a script called mk1mf.  This is
80   still available by configuring with --classic.  The notes below are
81   using this flag, and are tentative.  Use with care.
82
83   NOTE: this won't be available for long.]
84
85  If you want to compile in the assembly language routines with Visual
86  C++, then you will need the Netwide Assembler binary, nasmw.exe or nasm.exe, to
87  be available on your %PATH%.
88
89  Firstly you should run Configure and generate the Makefiles. If you don't want
90  the assembly language files then add the "no-asm" option (without quotes) to
91  the Configure lines below.
92
93  For Win32:
94
95  > perl Configure VC-WIN32 --classic --prefix=c:\some\openssl\dir
96  > ms\do_nasm
97
98  Note: replace the last line above with the following if not using the assembly
99  language files:
100
101  > ms\do_ms
102
103  For Win64/x64:
104
105  > perl Configure VC-WIN64A --classic --prefix=c:\some\openssl\dir
106  > ms\do_win64a
107
108  For Win64/IA64:
109
110  > perl Configure VC-WIN64I --classic --prefix=c:\some\openssl\dir
111  > ms\do_win64i
112
113  Where the prefix argument specifies where OpenSSL will be installed to.
114
115  Then from the VC++ environment at a prompt do the following. Note, your %PATH%
116  and other environment variables should be set up for 32-bit or 64-bit
117  development as appropriate.
118
119  > nmake -f ms\ntdll.mak
120
121  If all is well it should compile and you will have some DLLs and
122  executables in out32dll. If you want to try the tests then do:
123
124  > nmake -f ms\ntdll.mak test
125
126  To install OpenSSL to the specified location do:
127
128  > nmake -f ms\ntdll.mak install
129
130  Tweaks:
131
132  There are various changes you can make to the Windows compile
133  environment. By default the library is not compiled with debugging
134  symbols. If you add --debug to the Configure lines above then debugging symbols
135  will be compiled in.
136
137  By default in 1.1.0 OpenSSL will compile builtin ENGINES into separate shared
138  libraries. If you specify the "enable-static-engine" option on the command line
139  to Configure the shared library build (ms\ntdll.mak) will compile the engines
140  into libcrypto32.dll instead.
141
142  You can also build a static version of the library using the Makefile
143  ms\nt.mak
144
145  Linking your application
146  ------------------------
147
148  This section applies to non-Cygwin builds.
149
150  If you link with static OpenSSL libraries then you're expected to
151  additionally link your application with WS2_32.LIB, ADVAPI32.LIB,
152  GDI32.LIB and USER32.LIB. Those developing non-interactive service
153  applications might feel concerned about linking with the latter two,
154  as they are justly associated with interactive desktop, which is not
155  available to service processes. The toolkit is designed to detect in
156  which context it's currently executed, GUI, console app or service,
157  and act accordingly, namely whether or not to actually make GUI calls.
158  Additionally those who wish to /DELAYLOAD:GDI32.DLL and /DELAYLOAD:USER32.DLL
159  and actually keep them off service process should consider
160  implementing and exporting from .exe image in question own
161  _OPENSSL_isservice not relying on USER32.DLL.
162  E.g., on Windows Vista and later you could:
163
164         __declspec(dllexport) __cdecl BOOL _OPENSSL_isservice(void)
165         {   DWORD sess;
166             if (ProcessIdToSessionId(GetCurrentProcessId(),&sess))
167                 return sess==0;
168             return FALSE;
169         }
170
171  If you link with OpenSSL .DLLs, then you're expected to include into
172  your application code small "shim" snippet, which provides glue between
173  OpenSSL BIO layer and your compiler run-time. See the OPENSSL_Applink
174  manual page for further details.