OpenSSL: Build on Windows

Hi,

these steps compile openssl on Windows.

Install the Visual Studio Community Edition , git and Strawberry Perl.

nasm is needed for builing openssl. To get it, open Visual Studio and create a New Project “Console App Tags: C++, Windows, Console”. Simply store it to D:\temp and name it TempNASM. When finshed, right click the project and select Manage NuGet Packages. Search for nasm and install the latest version. You can find the executable at “D:\Temp\TempNASM\packages\nasm.2.10.07\tools”.

To install Strawberry Perl download the latest 64Bit zip edition an extract it, for example, to D:\perl. Then execute the two batch files relocation.pl.bat and update_env.pl.bat. These batches adjust the internal path references and add perl to the search path.

Depending on the Architecture for which you want to build openssl, x64 or x86, open the “x64 Native Tools Command Prompt for VS 2019” or “x86 Native Tools Command Prompt for VS 2019” shell from start menu.

Get the sources from github

D:\> cd /d D:\
D:\> mkdir temp
D:\> cd temp
D:\temp> git clone https://github.com/openssl/openssl
D:\temp> cd openssl

This would build the latest development version. If you want to build the latest 1.1.1 stable release

D:\temp\openssl> git checkout OpenSSL_1_1_1-stable

Add nasm to the search path

D:\temp\openssl> set PATH=%PATH%;D:\Temp\TempNASM\packages\nasm.2.10.07\tools;

Configure openssl with it default settings(Ciphers,…) for x64 architecture

D:\temp\openssl> nmake clean
D:\temp\openssl> perl Configure VC-WIN64A

The default version string is like “OpenSSL 1.1.1d-dev xx XXX xxxx”. xx XXX xxxx is a placeholder for the Build date. If you want to adjust the version text edit the macro OPENSSL_VERSION_TEXT in “include\openssl\opensslv.h“. For example

# define OPENSSL_VERSION_TEXT    "OpenSSL 1.1.1d-dev  05 Jun 2019"

And compile

D:\temp\openssl> nmake all

You can find openssl.exe in the apps folder

D:\temp\openssl> apps\openssl.exe version
OpenSSL 3.0.0-dev xx XXX xxxx (Library: OpenSSL 3.0.0-dev xx XXX xxxx)

Clean up your temporary Visual Studio Project

D:> rmdir /S /Q D:\Temp\TempNASM

Michael

Leave a Reply