| 
									
										
										
										
											2003-04-11 03:11:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  |  NOTES FOR THE WINDOWS PLATFORMS | 
					
						
							|  |  |  |  =============================== | 
					
						
							| 
									
										
										
										
											2003-04-11 03:11:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  |  Requirement details for native (Visual C++) builds | 
					
						
							|  |  |  |  -------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2003-04-11 03:11:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-23 21:11:04 +08:00
										 |  |  |  In addition to the requirements and instructions listed in INSTALL, | 
					
						
							|  |  |  |  this are required as well: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  |  - You need Perl.  We recommend ActiveState Perl, available from | 
					
						
							| 
									
										
										
										
											2017-03-15 04:29:24 +08:00
										 |  |  |    https://www.activestate.com/ActivePerl. Another viable alternative | 
					
						
							|  |  |  |    appears to be Strawberry Perl, http://strawberryperl.com. | 
					
						
							| 
									
										
										
										
											2016-01-21 21:43:51 +08:00
										 |  |  |    You also need the perl module Text::Template, available on CPAN. | 
					
						
							| 
									
										
										
										
											2016-05-23 21:11:04 +08:00
										 |  |  |    Please read NOTES.PERL for more information. | 
					
						
							| 
									
										
										
										
											2006-10-23 15:38:30 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  |  - You need a C compiler.  OpenSSL has been tested to build with these: | 
					
						
							| 
									
										
										
										
											2003-04-11 03:11:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  |    * Visual C++ | 
					
						
							| 
									
										
										
										
											2003-04-11 03:11:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  |  - Netwide Assembler, a.k.a. NASM, available from http://www.nasm.us, | 
					
						
							|  |  |  |    is required if you intend to utilize assembler modules. Note that NASM | 
					
						
							|  |  |  |    is the only supported assembler. The Microsoft provided assembler is NOT | 
					
						
							|  |  |  |    supported. | 
					
						
							| 
									
										
										
										
											2003-04-11 03:11:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-17 17:08:25 +08:00
										 |  |  |  Visual C++ (native Windows) | 
					
						
							|  |  |  |  --------------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  Installation directories | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  The default installation directories are derived from environment | 
					
						
							|  |  |  |  variables. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  For VC-WIN32, the following defaults are use: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      PREFIX:      %ProgramFiles(86)%\OpenSSL | 
					
						
							|  |  |  |      OPENSSLDIR:  %CommonProgramFiles(86)%\SSL | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-26 09:28:02 +08:00
										 |  |  |  For VC-WIN64, the following defaults are use: | 
					
						
							| 
									
										
										
										
											2016-03-17 17:08:25 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |      PREFIX:      %ProgramW6432%\OpenSSL | 
					
						
							|  |  |  |      OPENSSLDIR:  %CommonProgramW6432%\SSL | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  Should those environment variables not exist (on a pure Win32 | 
					
						
							|  |  |  |  installation for examples), these fallbacks are used: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      PREFIX:      %ProgramFiles%\OpenSSL | 
					
						
							|  |  |  |      OPENSSLDIR:  %CommonProgramFiles%\SSL | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 04:24:13 +08:00
										 |  |  |  ALSO NOTE that those directories are usually write protected, even if | 
					
						
							|  |  |  |  your account is in the Administrators group.  To work around that, | 
					
						
							|  |  |  |  start the command prompt by right-clicking on it and choosing "Run as | 
					
						
							|  |  |  |  Administrator" before running 'nmake install'.  The other solution | 
					
						
							|  |  |  |  is, of course, to choose a different set of directories by using | 
					
						
							|  |  |  |  --prefix and --openssldir when configuring. | 
					
						
							| 
									
										
										
										
											2016-03-17 17:08:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  |  GNU C (Cygwin) | 
					
						
							|  |  |  |  -------------- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  Cygwin implements a Posix/Unix runtime system (cygwin1.dll) on top of the | 
					
						
							|  |  |  |  Windows subsystem and provides a bash shell and GNU tools environment. | 
					
						
							|  |  |  |  Consequently, a make of OpenSSL with Cygwin is virtually identical to the | 
					
						
							| 
									
										
										
										
											2016-03-15 01:04:21 +08:00
										 |  |  |  Unix procedure. | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |  To build OpenSSL using Cygwin, you need to: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-06 05:43:16 +08:00
										 |  |  |  * Install Cygwin (see https://cygwin.com/) | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-15 01:04:21 +08:00
										 |  |  |  * Install Cygwin Perl and ensure it is in the path. Recall that | 
					
						
							|  |  |  |    as least 5.10.0 is required. | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |  * Run the Cygwin bash shell | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  Apart from that, follow the Unix instructions in INSTALL. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  NOTE: "make test" and normal file operations may fail in directories | 
					
						
							|  |  |  |  mounted as text (i.e. mount -t c:\somewhere /home) due to Cygwin | 
					
						
							|  |  |  |  stripping of carriage returns. To avoid this ensure that a binary | 
					
						
							|  |  |  |  mount is used, e.g. mount -b c:\somewhere /home. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-15 01:04:21 +08:00
										 |  |  |  It is also possible to create "conventional" Windows binaries that use | 
					
						
							|  |  |  |  the Microsoft C runtime system (msvcrt.dll or crtdll.dll) using MinGW | 
					
						
							|  |  |  |  development add-on for Cygwin. MinGW is supported even as a standalone | 
					
						
							|  |  |  |  setup as described in the following section. In the context you should | 
					
						
							|  |  |  |  recognize that binaries targeting Cygwin itself are not interchangeable | 
					
						
							|  |  |  |  with "conventional" Windows binaries you generate with/for MinGW. | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-18 06:15:12 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  |  GNU C (MinGW/MSYS) | 
					
						
							| 
									
										
										
										
											2016-03-17 17:08:25 +08:00
										 |  |  |  ------------------ | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |  * Compiler and shell environment installation: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    MinGW and MSYS are available from http://www.mingw.org/, both are | 
					
						
							|  |  |  |    required. Run the installers and do whatever magic they say it takes | 
					
						
							| 
									
										
										
										
											2016-03-15 01:04:21 +08:00
										 |  |  |    to start MSYS bash shell with GNU tools and matching Perl on its PATH. | 
					
						
							|  |  |  |    "Matching Perl" refers to chosen "shell environment", i.e. if built | 
					
						
							| 
									
										
										
										
											2016-06-02 18:03:45 +08:00
										 |  |  |    under MSYS, then Perl compiled for MSYS must be used. | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-20 01:39:01 +08:00
										 |  |  |    Alternatively, one can use MSYS2 from https://msys2.github.io/, | 
					
						
							| 
									
										
										
										
											2016-03-08 21:44:46 +08:00
										 |  |  |    which includes MingW (32-bit and 64-bit). | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * It is also possible to cross-compile it on Linux by configuring | 
					
						
							|  |  |  |    with './Configure --cross-compile-prefix=i386-mingw32- mingw ...'. | 
					
						
							|  |  |  |    Other possible cross compile prefixes include x86_64-w64-mingw32- | 
					
						
							|  |  |  |    and i686-w64-mingw32-. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-15 01:04:21 +08:00
										 |  |  |  Linking your application | 
					
						
							|  |  |  |  ------------------------ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  This section applies to non-Cygwin builds. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  If you link with static OpenSSL libraries then you're expected to | 
					
						
							| 
									
										
										
										
											2016-05-13 04:32:12 +08:00
										 |  |  |  additionally link your application with WS2_32.LIB, GDI32.LIB, | 
					
						
							|  |  |  |  ADVAPI32.LIB, CRYPT32.LIB and USER32.LIB. Those developing | 
					
						
							|  |  |  |  non-interactive service applications might feel concerned about | 
					
						
							|  |  |  |  linking with GDI32.LIB and USER32.LIB, as they are justly associated | 
					
						
							|  |  |  |  with interactive desktop, which is not available to service | 
					
						
							|  |  |  |  processes. The toolkit is designed to detect in which context it's | 
					
						
							|  |  |  |  currently executed, GUI, console app or service, and act accordingly, | 
					
						
							|  |  |  |  namely whether or not to actually make GUI calls. Additionally those | 
					
						
							|  |  |  |  who wish to /DELAYLOAD:GDI32.DLL and /DELAYLOAD:USER32.DLL and | 
					
						
							|  |  |  |  actually keep them off service process should consider implementing | 
					
						
							|  |  |  |  and exporting from .exe image in question own _OPENSSL_isservice not | 
					
						
							|  |  |  |  relying on USER32.DLL. E.g., on Windows Vista and later you could: | 
					
						
							| 
									
										
										
										
											2016-03-15 01:04:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	__declspec(dllexport) __cdecl BOOL _OPENSSL_isservice(void) | 
					
						
							|  |  |  | 	{   DWORD sess; | 
					
						
							|  |  |  | 	    if (ProcessIdToSessionId(GetCurrentProcessId(),&sess)) | 
					
						
							|  |  |  | 	        return sess==0; | 
					
						
							|  |  |  | 	    return FALSE; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  If you link with OpenSSL .DLLs, then you're expected to include into | 
					
						
							|  |  |  |  your application code small "shim" snippet, which provides glue between | 
					
						
							|  |  |  |  OpenSSL BIO layer and your compiler run-time. See the OPENSSL_Applink | 
					
						
							|  |  |  |  manual page for further details. |