Skip to main content

Using OpenSSL on windows

OpenSSL provides the core functionality required for many security protocols in use within and between computer networks, and can be obtained from http://www.openssl.org/.

Its power has meant that it has become embedded into, and is therefore a prerequisite of many other libraries, such as the PyOpenSSL, the openSSL libraries for Python.

Prebuilt binaries have been built for many platforms. The OpenSSL webpageindicates that binaries for Windows can be obtained fromShining Light Productions.

When building with Visual C++ 2005, I have found that these enable software to be built using the dlls provided, but build errors occur when trying to use the static libraries.

However, it is relatively easy to build the necessary libraries from scratch. The source should be downloaded from theOpenSSL website, and unpacked into a suitable directory.

Prerequisites

The file INSTALL.W32 provides the details about installing on windows. The minimum prerequisites are:

  • Visual C++ Express. I have built using the 2005 release, but there should be no problem with later releases
  • Windows Platform SDK. I have built using the Windows Server 2003 release, but again there should be no problems with later releases.
  • A windows Perl installation, such as Active Perl

Configuring

Once the OpenSSH software has been unpacked it can be configured for a Windows build with

perl Configure VC-WIN32 --prefix=c:/local

I have adopted the convention that all my open-source unix like code is installed under C:/local, whose sub directories (bin, lib, include etc) mirror a classic Unix top level directory.

Next, the makefiles have to be built. The simplest option is to do this without the assembly language build components (which requires an assembler to be installed). This is done with

ms\do_ms

Building

The build itself requires various environment variables to be set up. These may or may not have been setup when the Platform SDK and Visual C++ was installed. If not then they can be setup by creating and running a small batch file containing:

call "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.Cmd"
call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"

The instructions show how the classic dll/lib build can then be done using:

nmake -f ms\ntdll.mak

To build static libraries that can be linked into the final executable so that dlls are not required use:

nmake -f ms\nt.mak

In both cases, the results are transferred to their final location using:

nmake -f ms\nt.mak install